Unnamed: 0
int64 65
6.03M
| Id
int64 66
6.03M
| Title
stringlengths 10
191
| input
stringlengths 23
4.18k
| output
stringclasses 10
values | Tag_Number
stringclasses 10
values |
---|---|---|---|---|---|
3,236,994 | 3,236,995 | GridView - sometimes rows are top-aligned, sometimes they're bottom-aligned! | <p>I am using a GridView. Four items in a column. Each element is composed of the following layout:</p>
<pre><code><LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="32dip"
android:layout_height="32dip"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="11dip"
android:paddingTop="2dip" />
</LinearLayout>
</code></pre>
<p>So each element is a small image with a bit of text below it. The layout works great on the first pass. However, if an item's text is long, it wraps to two lines. This works ok, until you scroll it in and out of view. By default, all the images in a row are top-aligned. When you scroll a row off-screen, then back on screen, you'll see that the row somehow gets bottom-aligned. It looks like:</p>
<p>First layout:</p>
<pre><code>[image] [image] [image]
[text] [text] [text
wrap]
</code></pre>
<p>so even though the third element has 2 lines of text, the tops are aligned which is perfect. If I scroll this row off screen, then back on, it looks like this:</p>
<pre><code> [image]
[image] [image] [text
[text] [text] wrap]
</code></pre>
<p>so the row gets bottom-aligned here. I'm not sure if this is a bug in GridView, or if there's some way to control the layout to always top-align rows. I've tried setting the gravity of the element layout to "top", no good. There also doesn't appear to be any setting unique to GridView to control this. Any ideas?</p>
<p>Thanks</p>
| android | [4] |
714,689 | 714,690 | STOP UIWebView bounces vertically in device | <p>I am using this code to stop uiwebview bounces vertically and its work fine in simulator 4.0.But when i installed my app in my first generation ipod it wont work.</p>
<pre><code>for (id subview in webView.subviews)
if ([[subview class] isSubclassOfClass: [UIScrollView class]])
((UIScrollView *)subview).bounces = NO;
</code></pre>
<p>Can anyone help me? Is there any reason beyond this ?</p>
<p>Thanks in advance......</p>
| iphone | [8] |
3,826,251 | 3,826,252 | Java different Calculator basic functions problem? | <p>The code below is a chunk from actual code of Calculator.What it does is that user presses a number on the calculator then as he presses "+" the number on the text field gets stored and then he presses the next number and it gets stored when he presses "=".Then in "=" if condition the addition function is performed.Now i want both addition and subtraction running at one time that is after doing addition user wants to do subtraction then HOW will i do it???? </p>
<pre><code>if(a.getActionCommand().equals("+"))
{
q=tf.getText();
x=Integer.parseInt(q);
}
if(a.getActionCommand().equals("-"))
{
b=tf.getText();
t=Integer.parseInt(b);
}
if(a.getActionCommand().equals("="))
{
p=tf.getText();
y=Integer.parseInt(p);
z=x+y;
//z=t-y;
w=Integer.toString(z);
tf.setText(w);
}
</code></pre>
| java | [1] |
1,229,225 | 1,229,226 | working on how to display a map view in Iphone | <p>I can display the map view for specific location. However, I dont know how to zoom in or out in simulator. Please any one how to do it, advice me. Thanks</p>
| iphone | [8] |
706,168 | 706,169 | in C++ what does this code means? | <p>I was working on linked lists and found a sample. In that sample it says </p>
<p><code>while (currNode && index > currIndex)</code></p>
<p>so here, whats the boolean value of currNode?</p>
| c++ | [6] |
3,182,482 | 3,182,483 | check for valid date issue | <p>I would like to check for a valid date in 'mm/dd/yyyy' format. When I call the function below with <code>isValidDateTime('12/10/2012')</code>, it returns false. Could you please let me know what could be wrong?</p>
<pre><code>function isValidDateTime($dateTime)
{
if (preg_match("/^(\d{2})/(\d{2})/(\d{4}) ([0-5][0-9]):([0-5][0-9]):([01][0-9]|2[0-3])$/", $dateTime, $matches)) {
if (checkdate($matches[1], $matches[3], $matches[2])) {
return true;
}
}
return false;
}
</code></pre>
| php | [2] |
4,699,482 | 4,699,483 | Strict Standard erro in file upload | <p>I have written a PHP script to upload files. But when I press the submit button it gives an error message:</p>
<pre><code>Strict Standards: Only variables should be passed by reference in H:\xampp\htdocs\phpTest\upload_file.php on line 4.
</code></pre>
<p>line 4 is $extension = end(explode(".", $_FILES["file"]["name"]));</p>
<p>upload_file.php:</p>
<pre><code><?php
$allowedExts = array("jpg", "jpeg", "gif", "png");
$extension = end(explode(".", $_FILES["file"]["name"]));
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 20000)
&& in_array($extension, $allowedExts))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
$target_Path = "images/";
$target_Path = $target_Path.basename( $_FILES['file']['name'] );
move_uploaded_file( $_FILES['file']['tmp_name'], $target_Path );
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
echo $target_Path;
}
}
else
{
echo "Invalid file";
}
?>
</code></pre>
| php | [2] |
3,492,119 | 3,492,120 | I discovered a bug in javascript function parseInt(). Report this? | <p>I have some zeros prior to a positive integer. I want to remove the zeros so only the positive integer remains. Like '001' will only be '1'. I thought the easiest way was to use parseInt('001'). But what I discovered is that it don't works for the number 8 and 9. Example parseInt('008') will result in '0' instead of '8'.</p>
<p>Here are the whole html code:</p>
<pre><code><html> <body>
<script>
var integer = parseInt('002');
document.write(integer);
</script>
</body> </html>
</code></pre>
<p>Pls give a try!</p>
<p>But can I somehow report this problem? Do anyone know an another easy workaround this problem?</p>
<p>UPDATE:</p>
<p>There was no bug sorry! See answers below</p>
| javascript | [3] |
465,606 | 465,607 | delete image from folder PHP | <p>hello i have a folder where i keep my images! <code>"img/filename.jpg"</code> </p>
<p>And i have a table with all of my images:</p>
<pre><code><table border="3">
<tr >
<td>
<?php
$files = glob("img/*");
foreach($files as $file)
{
echo "<div class='divimages'>";
echo '<img src="'.$file.'"/>';
echo "<input type='submit' value='Delete image'/><br>";
echo "</div>";
}
?>
</td>
</tr>
</table>
</code></pre>
<p>The question is: </p>
<p>How can i delete the image associated to the button with the value:<code>"Delete image"</code>. </p>
| php | [2] |
3,679,387 | 3,679,388 | how to disable the browser to give warning in php? | <p>When some thing is divided by 0, the webpage will appear a line of waring like this" Warning: Division by zero in C:\xampp\htdocs\XXXX.php on line 109". How can I solve this problem.</p>
<p>Thanks</p>
| php | [2] |
568,661 | 568,662 | C++ strtok return error | <pre><code>string result="CCY 1.2597 Down 0.0021(0.16%) 14:32 SGT [44]";
char* token;
char* buffer[result.length() + 1]; //Space for '\0'
strcpy(buffer, result.c_str());
buffer[result.length()] = '\0'; //insert '\0'
token = strtok(buffer, " ");
while (token != NULL) {
/* work with token */
token = strtok(NULL, " ");
}
</code></pre>
<p>I not sure why the above code got error, what is wrong with my code</p>
<pre><code>main.cpp:51:30: error: cannot convert ‘char**’ to ‘char*’ for argument ‘1’ to ‘char* strcpy(char*, const char*)’
main.cpp:53:27: error: cannot convert ‘char**’ to ‘char*’ for argument ‘1’ to ‘char* strtok(char*, const char*)’
make: *** [main.o] Error 1
BUILD FAILED (exit value 2, total time: 893ms)
</code></pre>
| c++ | [6] |
5,524,120 | 5,524,121 | Writing JavaScript from a Custom Control | <p>I'm new to writing custom controls. I have MyCustomControl.cs and in my Render method I want to render out about 50 lines of JavaScript. What's the best way to do this, use the writer?</p>
<pre><code>protected override void Render(HtmlTextWriter writer)
{
writer.write(@"<script type....rest of opening tag here");
writer.Write(@"
function decode(s)
{
return s.replace(/&amp;/g, ""&"")
.replace(/&quot;/g, '""')
.replace(/&#039;/g, ""'"")
.replace(/&lt;/g, ""<"")
.replace(/&gt;/g, "">"");
};"
);
</code></pre>
<p>I plan on having around 6 more writer.Write to write out some more sections here. Is that the best approach to actually perform the writing of JavaScript in this manor?</p>
<p>or should I use ClientScript.RegisterClientScriptBlock? So what's the best practice or common way people are writing javascript from a custom control? (I'm not talking about a user control here!!, custom control/Class!)</p>
<p>I also want to keep any indentation for readability once it's spit out/rendered on the client when viewing source.</p>
| asp.net | [9] |
5,937,341 | 5,937,342 | Why should avoid using Runtime.exec() in java? | <pre><code> Process p = Runtime.getRuntime().exec(command);
is = p.getInputStream();
byte[] userbytes = new byte[1024];
is.read(userbytes);
</code></pre>
<p>I want to execute a shell command in linux os from java . But pmd reports says don't use java Runtime.exec(). Why? What is the reason ? Is there any alternative for Runtime.exec()?</p>
| java | [1] |
5,407,132 | 5,407,133 | Detecting an arbittrary button press on a USB joystick WITHOUT pygame | <p>Is there anyway I could register button pushes on a joystick without using any function from pygame? </p>
| python | [7] |
220,787 | 220,788 | How to choose current theme on android | <p>I'm quite new to android dev and would like to know, how can I choose the current theme of the phone. I'm developing on the Galaxy Tab and the current theme is a nice white one (if I go into the settings menu for example). But the default theme in the sdk seems to be Android.Black.</p>
<p>I would prefer not to hardcode any choice and let the app use whichever one is chosen on the phone/tab...</p>
| android | [4] |
1,434,106 | 1,434,107 | Are elements of Javascript arrays processed in a defined order? | <p>For example:</p>
<pre><code>var a = [];
function p(x) { a.push(x); }
[[p(1),p(2)],p(3),[p(4),[p(5)]],p(6)]
a == [1,2,3,4,5,6] // Always true?
</code></pre>
<p>Is 'a == [1,2,3,4,5,6]' defined behavior? Can it be relied upon?</p>
| javascript | [3] |
1,128,247 | 1,128,248 | how to copy array to array | <pre><code>var ce_info=[
{location:"inchannel",name:"Jae Jung",volume:"50",url:"img/jae.jpeg",group:1},
{location:"inchannel",name:"Houston",volume:"50",url:"img/houston.jpeg",group:1},
{location:"inchannel",name:"Jun kuriha..",volume:"50",url:"img/jun.jpeg",group:1},
{location:"inchannel",name:"Andrea Melle",volume:"50",url:"img/andrea.jpeg",group:0},
{location:"inchannel",name:"Tomoaki Ohi..",volume:"50",url:"img/ohira.jpeg",group:0},
{location:"inchannel",name:"Woosuk Cha..",volume:"50",url:"img/woosuk.jpeg",group:0},
{location:"inchannel",name:"Luca Rigaz..",volume:"50",url:"img/luca.jpeg",group:0},
{location:"inchannel",name:"SooIn Nam",volume:"50",url:"img/sooin.jpeg",group:0}
];
var inch_info=[{location:"ichat",name:"",volume:"50",url:""}];
for(i=0;i<ce_info.length;i++)
{
if(ce_info[i].location=="inchat")
{
inch_info[inchat_count].name=ce_info[i].name;
inch_info[inchat_count].url=ce_info[i].url;
inchat_count++;
}
}
</code></pre>
<p>I am trying to copy ce_info to inch_info.
It seems like it does not work.It occurs an error when I try to copy ce_info to inch_info
Any thought?</p>
| javascript | [3] |
1,269,611 | 1,269,612 | How to place the selected Li in h4 using jquery | <p><a href="http://jsfiddle.net/soul/EamPb/" rel="nofollow">complete code JSFIDDLE</a></p>
<p>as shown in the code the selected state comes below the h4 , how to display the selected state in h4 and after selecting a state it just shows that particular state and not able to select other states</p>
| jquery | [5] |
3,631,341 | 3,631,342 | append data to url in android | <p>Hello
In my android application i am trying to append data to url.But the data is not getting appended.Below is my code.Please correct me.</p>
<p>URL url=new URL("http://220.226.22.57:8780/WEB-3/client/requests/sgduTimeStampRequest.action");</p>
<pre><code> HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("aContentType","text/plain");
conn.setRequestProperty("aBody","modified_since=3491039964");
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setDoInput(true);
SGDUParser parser=new SGDUParser(context);
parser.parseUpdateBinaryFile(conn.getInputStream())
</code></pre>
<p>Please share your valuable suggestions.</p>
<p>Thanks in advance :)</p>
| android | [4] |
1,512,066 | 1,512,067 | Autofill feature with Listbox in asp.net | <p>i have a Listbox with items being 'first name' loaded from a table of a database, </p>
<ol>
<li>now i want an autofill feature where if a user types like 'a' all the names starting with 'a' first name should be show in the listbox</li>
<li>and after some button click the original data should be repopulated in the listbox</li>
</ol>
<p>for 2nd one i.e.. repopulating hope i can do with below code</p>
<p><code>protected void btnRePopulate_Click(object sender, EventArgs e)
{
DataSet oDs = ReadDataSet();
Listbox1.DataTextField = "Name";
Listbox1.DataValueField = "ID";
Listbox1.DataSource = oDs;
Listbox1.DataBind();
}</code></p>
<p>but for the 1st i have some things on which iam working (i am using textbox keyup event to fire when the user types 'a' or whatever)</p>
<ol>
<li>clear the listbox and add the names which starts with 'a', but not sure is it possible from client side</li>
<li>or set another listbox visible with names filtered from the original and hide the original listbox, for which i am not able to set visible property either from js or codebehind</li>
<li>no i dont want to use ajax autofill</li>
</ol>
<p>is there a better option apart from the above two...</p>
| asp.net | [9] |
4,124,540 | 4,124,541 | Enable/disable button based on condition shows alert two times | <p>I have two input fields and two buttons in a row. Like that having 3 or more rows in a page. For each row i need to enable the two buttons only when the two input fields have any value. I gave id for two buttons like this.</p>
<pre><code><a href="#" style="margin: auto;" id="first_link"></a>
<a href="#" style="margin: auto;" id="second_link"></a>
</code></pre>
<p>In jquery i gave as follows:</p>
<pre><code>$('#first_link').click(function() {alert("Some info will come soon")});
$('#second_link').click(function() {alert("new info will come soon")});
</code></pre>
<p>But this alerts coming for all rows (for three rows 3 alerts showing). How can i show alert only one time for entire table in that page.</p>
| jquery | [5] |
978,215 | 978,216 | Adding video files in iPhone | <p>I am new to iPhone. I need sample code for how to add video files in iPhone.</p>
| iphone | [8] |
3,921,563 | 3,921,564 | Using getGeneratedKeys() Java | <p>Can anyone see how I'm missuing this ResultSet? I'm getting the below errors from "customerID = rs.getInt(1)"</p>
<p><a href="http://pastebin.com/YJvQjy3L" rel="nofollow">http://pastebin.com/YJvQjy3L</a></p>
| java | [1] |
2,700,307 | 2,700,308 | how to solve this type of compilation error? | <pre><code>import java.net.*;
import java.io.*;
public class DjPageDownloader {
public URL url;
public InputStream is = null;
public DataInputStream dis;
public String line;
public static void main(String []args){
try {
url = new URL("http://stackoverflow.com/");
is = url.openStream(); // throws an IOException
dis = new DataInputStream(new BufferedInputStream(is));
while ((line = dis.readLine()) != null) {
System.out.println(line);
}
} catch (MalformedURLException mue) {
mue.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
is.close();
} catch (IOException ioe) {
// nothing to see here
}
}
}
</code></pre>
<p>this on compilation shows error as:-</p>
<pre><code>Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Cannot make a static reference to the non-static field url
Cannot make a static reference to the non-static field is
Cannot make a static reference to the non-static field url
Cannot make a static reference to the non-static field dis
Cannot make a static reference to the non-static field is
Cannot make a static reference to the non-static field line
Cannot make a static reference to the non-static field dis
Cannot make a static reference to the non-static field line
Cannot make a static reference to the non-static field is
at djPageDownloader.DjPageDownloader.main(DjPageDownloader.java:16)
</code></pre>
| java | [1] |
4,254,123 | 4,254,124 | How to include my application as a dialing option when calling from the addressbook? | <p>I need to include additional dialing options in the menu appearing after pressing "Call" over a contact (<a href="http://i.stack.imgur.com/JpOis.png" rel="nofollow">Screenshot</a>). </p>
<p>I'm trying to do it with action-filters for the DIAL and CALL intents without any success.</p>
<p>I know this is possible because Skype does it (<a href="http://i.stack.imgur.com/JpOis.png" rel="nofollow">Screenshot</a>). Anybody knows how to implement it?</p>
| android | [4] |
3,438,919 | 3,438,920 | On Nexus ONE, getting RESULT_ERROR_GENERIC_FAILURE when trying to use SmsManager.sendTextMessage() | <p>I've been successfully testing my app which sends a text message to another phone number. The problem came when I sent this to a buddy that has the Nexus One. I added a pending intent to sendTextMessage() and saw I'm hitting: <code>RESULT_ERROR_GENERIC_FAILURE</code>.</p>
| android | [4] |
427,409 | 427,410 | Change color of hover element? | <p>I want to change the background color on an element when I hover on it, but i won't work!?</p>
<pre><code>$(document).ready(function(){
$(".walkingRoute-container").hover(function(){
$("walkingRoute-container").css("background","#02baff");
});
});
</code></pre>
<p>Preciate som help. Thanks!</p>
| jquery | [5] |
5,555,439 | 5,555,440 | Obtain the first id from a sorted Array through Comparator | <p>I use the following method to sort an array from an sqlite database:</p>
<pre><code>public void sortNearby(final double lat, final double lng) {
Arrays.sort(videoLocationsDB, new Comparator<VideoLocationDB>() {
@Override
public int compare(VideoLocationDB lhs, VideoLocationDB rhs) {
double lat1 = lhs.latitude;
double lng1 = lhs.longitude;
double lat2 = rhs.latitude;
double lng2 = rhs.longitude;
double lhsDistance = countDistance(lat, lng, lat1, lng1);
double rhsDistance = countDistance(lat, lng, lat2, lng2);
if (lhsDistance < rhsDistance)
return -1;
else if (lhsDistance > rhsDistance)
return 1;
else
return 0;
}
});
videoLocationAdapter.notifyDataSetChanged();
}
</code></pre>
<p>How can I obtain the Id of the first object from the sorted array? for example I need to get <code>VideoLocationDB.id</code> of the first object</p>
| android | [4] |
1,161,551 | 1,161,552 | Check boxes in a listView | <p>I have a listView each item of which consists of a chechbox, an imageView and a textView. The android application gets some data from the server(which takes the data from a database) and puts these data as items in the list and the user can also add some new data in this list. I have set the visibility of the checkboxes to "gone" so that the checkboxes being invisible when I run the application, but in the meantime, when i push a button I would like to make the checkboxes of each item in the list visible. Is it possible? I can make this only for one of the items in the list. Is there any way to make all the checkboxes visible? </p>
| android | [4] |
300,035 | 300,036 | C++ creating object based on condition | <p>I create an object based on a command line option.</p>
<p>In C++</p>
<pre><code>Capture *cc = NULL;
if ( argv[2] == "capture" )
cc = new Capture(<some args>);
</code></pre>
<p>Now to use this at different parts of the code, should i create a CaptureStub that contains dummy functions so that null pointer is never accessed. Or is there an easier way?</p>
<p>Thanks</p>
| c++ | [6] |
3,604,496 | 3,604,497 | Dynamic database record in iphone | <p>I am making an iphone application in which there is use of database. But this database records must be dynamic means record get stored in database when user make entry in iphone application. It need dynamic record.</p>
<p>Anyone know about it? Please help me.</p>
<p>Thanks alot. </p>
| iphone | [8] |
2,999,608 | 2,999,609 | Can i change the value of local variable sitting inside the function in PHP? | <p>I was reading an article about Data Encapsulation in PHP, and the author explained in such a way that it made me to wonder if this is really possible? here is what he said. </p>
<blockquote>
<p>The primary purpose of encapsulation
(scope) is to ensure that you write
code that can't be broken. This
applies to scope in general, so let me
use a simpler example of a local
variable inside a function:</p>
</blockquote>
<pre><code>function xyz ($x) {
$y = 1;
while ($y <= 10) {
$array[] = $y * $x;
$y++;
}
return $array;
}
</code></pre>
<blockquote>
<p>The purpose of this function is to
pass a number and return an array. The
example code is pretty basic. In order
for function xyz() to be dependable,
you need to be guaranteed that it does
the exact same thing every time. So
what if someone had the ability to
from the outside change that initial
value of $y or $array? Or even $x? If
you were able to do that from outside
of the function, you could no longer
guarantee what that function is
returning.</p>
</blockquote>
<p>Now this made me wonder can i really change the value of local variable sitting inside the function without using any argument as demonstrated above ?? if it is possible how do i do it?</p>
<p>thank you..</p>
| php | [2] |
4,066,705 | 4,066,706 | Android VM heap - heapsize. Is this normal? | <pre><code>ID Heap Size Allocated Free % Used #Objects
1 7.383 MB 3.551 MB 3.832 MB 48.10% 65,709
</code></pre>
<p>That's what I see in DDMS. I have no sense of what's reasonable, but seems like a lot to me. I guess % used refers to percentage of heap size that allocated is using?</p>
| android | [4] |
4,535,291 | 4,535,292 | SQLite Android Project and Android Library | <p>I have the following ones:</p>
<ul>
<li>One main Android application.</li>
<li>One Android library project.</li>
</ul>
<p>The main project adds the library project.
The problem is, I need same Database and same data model for both apps. I need access same tables of the database and I also need the same data model cause there is data I need to share between each other.</p>
<p>Can anyone explain me how can I do it??</p>
<p>Thanks a lot!!</p>
| android | [4] |
391,695 | 391,696 | How big data can we transfer between iPhone applications | <p>Hello guys
I want to use "Custom URL Scheme" to transfer data from application to other application in iPhone.
Can I ask: How big data can we transfer from app to app?</p>
<p>Thank you!</p>
| iphone | [8] |
4,300,734 | 4,300,735 | Getting music artist(bands) from allmusic.com api | <p>Is there any api for allmusic.com means to getting all music artist in a Json file or Xml file like getting cover art from api <a href="http://infolife.mobi/api/cover_hunt.php?keyword=Janis" rel="nofollow">http://infolife.mobi/api/cover_hunt.php?keyword=Janis</a> Joplin please any one provide api url to get all the data of artists in allmusic database</p>
| android | [4] |
27,636 | 27,637 | set DateTime to start of month | <p>How to get the DateTime to start of month in c#?</p>
| c# | [0] |
2,991,559 | 2,991,560 | resolveUri failed on bad bitmap | <p>i want to display image on button click ..i have url for image in an array and my code is allright but problem is when i click on button it gives information on log cat that: resolveUri failed on bad bitmap what to do now ???pls help me....thanks in advanse</p>
<pre><code>private String[] imageList = {"http://www.artealdiaonline.com/var/artealdia_com/storage/images/argentina/directorio/galerias/ruth_benzacar/artistas/martin_di_girolamo._diosas/198915-1-esl-AR/MARTIN_DI_GIROLAMO._Diosas.jpg","http://www.artealdiaonline.com/var/artealdia_com/storage/images/argentina/directorio/galerias/ruth_benzacar/artistas/martin_sastre._fiebre/198922-1-esl-AR/MARTIN_SASTRE._Fiebre.jpg"};
</code></pre>
<p>piece of code is:</p>
<pre><code> imageLoader = (ImageView) findViewById(R.id.imageLoader);
//imageLoader.setImageResource(image1);
this.loadImage(imageList[imageCounter]);
}
</code></pre>
<p>@Override
public void onClick(View v) {
String imagePath = null;
// TODO Auto-generated method stub
switch (v.getId())
{
case R.id.next:
Log.i("Tag","tag");
if(imageCounter < imageList.length)
{
imageCounter++;
imagePath = imageList[imageCounter];
if (imageCounter==(imageList.length)-1)
{
{
Button next=(Button)findViewById(R.id.next);
next.setEnabled(false);
}
}
else
{
Button back=(Button)findViewById(R.id.back);
back.setEnabled(true);
}
}
break;</p>
<pre><code>}
this.loadImage(imagePath);
</code></pre>
<p>}</p>
<p><strong>private void loadImage(final String imagePath)
{
imageLoader.setImageURI(Uri.parse(imagePath));
}</strong></p>
| android | [4] |
1,443,282 | 1,443,283 | Android notification on web site content updation | <p>I am creating a website application. The website is actually coded in php. In the website there is an option to post comments by users who are logged in to the site. Actually I wanted to show notification on the android device even when the application is not running . Can anyone please suggest an idea for doing this. Should I need to make any permission settings in the website for this.
Thanks in advance.</p>
| android | [4] |
1,108,217 | 1,108,218 | Querying a database from a remote service | <p>I have been working on this little music player for a while and I have been stuck for quite a couple of days in creating a now-playing list. I was thinking about storing it inside the database back end. Well, I have a remote interface and what I would like to do is that I would like to query and retrieve data from the database, from that remote interface. Any one would care to shed some lights?</p>
| android | [4] |
4,987,626 | 4,987,627 | how do I center a label i android? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5347341/how-to-align-center-the-title-or-label-in-activity">How to align center the title or label in activity?</a> </p>
</blockquote>
<p>Simple question, I have made a dialogbox with a label at the top. The label has for some reason gravity left as default, and I want to change it to center. The label is defined in my AndroidManifest.xml file as : </p>
<pre><code><b>activity</B>
android:name=".WelcomeDialog"
android:theme="@android:style/Theme.Dialog"
android:label="@string/welcome_dialog_title"
>
<b>/activity></B>
</code></pre>
<p>I have tried to put android:gravity="center" but it is not working, any tips how to solve this issue?</p>
<p>Thx in advance!</p>
| android | [4] |
3,896,002 | 3,896,003 | brackets in php templates | <p>I have a script, and now it's the perfect time to have an option to change <code>theme</code> templates. </p>
<p>I was looking forward to store these files in <code>php</code> files, or html files. with <code>CSS</code> file. I looked over some codes and I found that they use brackets to refer to the variable.</p>
<p>Here's an example of a template block: </p>
<pre><code><div class='block_div'>
<center>{title}</center>
{content}
</div>
</code></pre>
<p>I know that I can use <code>PHP</code> vars usering <code><?=$var;?></code>. However, I think the one above is better, and I looked over the web to find anything about it but I couldn't. </p>
<p>My Question is how I can use these brackets in my php or html code. to let the user changing the template only not the code!</p>
| php | [2] |
4,396,822 | 4,396,823 | Unexpected Indent error in Python | <p>I have a simple piece of code that I'm not understanding where my error is coming from. The parser is barking at me with an Unexpected Indent on line 5 (the if statement). Does anyone see the problem here? I don't.</p>
<pre>
def gen_fibs():
a, b = 0, 1
while True:
a, b = b, a + b
if len(str(a)) == 1000:
return a
</pre>
<p>Thanks,<br>
T.J.</p>
| python | [7] |
2,025,114 | 2,025,115 | Implementing Undo Redo on CALayer | <p>How to Implement Undo and Redo Functionality on CALayer.
Please help.</p>
<p>Thank you.</p>
| iphone | [8] |
1,114,944 | 1,114,945 | How to build a last login script using PHP? | <p>I was wondering how can I create a last login script using php.</p>
| php | [2] |
3,907,309 | 3,907,310 | Android Menu alignment | <p>Hi
in my application i have menu that contain 4 option , i need to align the menu in the following format, 2X2 </p>
| android | [4] |
2,091,524 | 2,091,525 | Streaming music to android with .pls files | <p>I've read several places that I cannot stream .pls files with the <code>MediaPlayer</code> class in the android SDK. When I open the the .pls files, which contains several URLS like this one:</p>
<pre><code>[playlist]
numberofentries=7
File1=http://88.190.24.47:80
Title1=(#1 - 174/900) French Kiss FM
Length1=-1
File2=http://88.190.234.233:80
Title2=(#2 - 479/900) French Kiss FM
Length1=-1
File3=http://88.190.234.232:80
Title3=(#3 - 620/900) French Kiss FM
Length1=-1
File4=http://88.190.234.231:80
Title4=(#4 - 698/900) French Kiss FM
Length1=-1
File5=http://88.190.234.237:80
Title5=(#5 - 702/900) French Kiss FM
Length1=-1
File6=http://88.190.234.239:80
Title6=(#6 - 744/900) French Kiss FM
Length1=-1
File7=http://88.190.234.235:80
Title7=(#7 - 766/900) French Kiss FM
Length1=-1
Version=2
</code></pre>
<p>I'am able to get the ip-adresses to the stream server, as you might see. But is it possible for me to use this ip-address as a parameter to the <code>MediaPlayer</code> class? And how can I manage to do so? </p>
<p>Thanks in advance!</p>
<p><strong>UPDATE</strong></p>
<p>I managed to get the ip-adresse from a .pls file. But how can I stream the content of the ip adresse in android? </p>
| android | [4] |
5,490,772 | 5,490,773 | Exclamation mark doesn't work in trigger() when using event namespace in jQuery 1.9 | <p>Here is the code:</p>
<pre><code>$("div").on("click",function(){
console.log("click");
});
$("div").on("click.plugin", function(){
console.log("click.plugin");
});
$("button").click(function() {
$("div").trigger("click!");
});
</code></pre>
<p>and the HTML: </p>
<pre><code><div>test.</div>
<button >Trigger event according to namespace</button>
</code></pre>
<p>When I <a href="http://jsfiddle.net/un9aP/" rel="nofollow">run the code under jQuery 1.8.3</a>, it works. When I click button, it logs <code>click</code> in the console. </p>
<p>But when I <a href="http://jsfiddle.net/un9aP/1/" rel="nofollow">change to jQuery 1.9.1</a>, nothing happens when I press the button. It seems like the exclamation mark doesn't work anymore in 1.9.1. </p>
<p>I can't find this change in the 1.9 upgrade guide. Does anybody know why?</p>
| jquery | [5] |
1,054,986 | 1,054,987 | How to pass a c structure from native c library to java and access its elements | <p>I have a structure defined in my native c library and i want to pass it to the java. In java then i want to access this structure elements. How to do this. Can anybody explain me with one example showing both c and java code. I will definitely appreciate for the help. Please help me as soon as possible.</p>
| android | [4] |
3,359,247 | 3,359,248 | Circular SIngly LInked LIst , ADDing a new node and displaing it | <p>Neither of the compilers I've used are able to debug it. I am trying to add a new node at the end of the list and then displaying it,,, they are not showing any sort of errors , both give a send dont send error by windows , I think this may be a memory leak..Please help me</p>
<pre><code>#include <iostream>
#include <conio.h>
using namespace std;
struct Node
{
int data;
Node *nextptr;
};
class CLLIST{
private:
Node*firstptr;
Node*lastptr;
public:
CLLIST(){
cout << "Constructor Called !";
firstptr=lastptr=NULL;
}
void insert_at_back(int val){
cout << " \n \n I am in the insert at back function: ";
Node*newptr;
newptr = new Node;
newptr->data=val;
if(firstptr=NULL)//means list is empty
{
firstptr=newptr;
}else{
lastptr->nextptr=newptr;
}
lastptr=newptr;
lastptr->nextptr=firstptr;
}
void display(){
Node *temptr,*endptr;
temptr = new Node;
endptr = new Node;
temptr=firstptr;
endptr = NULL;
while(temptr!=endptr){
cout << "I am in the display Function: ";
cout << firstptr->data << " ";
firstptr=firstptr->nextptr;
endptr=firstptr;}
delete temptr;
delete endptr;
}
};
int main()
{
CLLIST obj1;
obj1.insert_at_back(26);
obj1.display();
cout << " \n \n Done !";
getch();
}
</code></pre>
| c++ | [6] |
5,514,551 | 5,514,552 | Pulling class elements into an array and then summing them up | <p>I'm extremely new to Javascript and I need some help to do this. The classes will be pulling from different tables (like below). I just need a way to pull all the cell values out of each class and sum them up. So classone = 1234 + 1234. I'm confused as to whether document.getElementByClassName works? Any help would be appreciated. </p>
<pre><code><table>
<tbody>
<tr><td class="classone">1234</td></tr>
<tr><td class="classtwo">1234</td></tr>
<tr><td class="classthree">1234</td></tr>
</tbody>
</table>
<table>
<tbody>
<tr><td class="classone">1234</td></tr>
<tr><td class="classtwo">1234</td></tr>
<tr><td class="classthree">1234</td></tr>
</tbody>
</table>
</code></pre>
| javascript | [3] |
5,325,568 | 5,325,569 | What am I gonna do with that AppID? | <p>I had to make a new AppID in order to get my provisioning profiles working. But I completely forgot: If I make an AppID with no wildcard, I can only run those apps on my test device that have this AppID?</p>
| iphone | [8] |
4,220,394 | 4,220,395 | Android: Edittext with hint | <p>Hi i have a edittext with hint ..what iam trying to implement is whenever i am getting the info into the Edittext or when the user types into the edittext..the hint should stay and text user types should start below or beside hint...<strong>can we make the hint permanent?</strong>.or is there any way we can implement ..any suggestion is appreciated </p>
<pre><code>EditText address = new EditText(activity);
if (data.getAddress() != null
&& !data.getAddress().trim().equals("")) {
address.setText(data.getAddress());
} else {
address.setHint(R.string.address);
}
</code></pre>
| android | [4] |
65,829 | 65,830 | Empty input field before deleting w/jQuery | <p>I have a page where I append a delete icon to certain form text fields:</p>
<pre><code>$(this).parent().append(\'<span class="remove" onclick="$(this).parent().remove(); return false"><span class="delete"></span></span>\');
</code></pre>
<p>and I get</p>
<pre><code><div>
<input type="text"><span class="remove" onclick="$(this).parent().remove(); return false"><span class="delete"></span></span>
</div>
</code></pre>
<p>It works fine, but when I submit the form the fields that I "delete" still post information. I think they are still in DOM, just don't show. However, if I manually clear input field and then submit -- data is not posted, obviously. How do i empty text field before remove()? </p>
| jquery | [5] |
3,697,090 | 3,697,091 | PHP rating system | <p>I have a table (review) which stores the values (1-5) for ratings. I will use the sum of these ratings for the overall score.</p>
<p>I have 5 stars on the page which will show on or off depending on the overall value.</p>
<p>I have the overall score by counting the total value of all the ratings divided by the number of reviews in the table. This give a value below 5 every time...great.</p>
<p>However I now have a problem where the value could either be 1.5 or 1.75 for instance. If the value is 1.5 I will show 1 and a half stars on and 3 and a half stars off. How should I determine if the value is 1.75 to show only the 1.5 value star.</p>
<p>Hope that makes sense.</p>
| php | [2] |
3,551,480 | 3,551,481 | ASP.Net rebuilds on each request | <p>I have an asp.net application, installed on a 2003 server.</p>
<p>I have a main installation on a dir called X, and a test installation installed on a dir called X_test.</p>
<p>When I installed a new version of my code to X_TEST - that web site (the one on the test) rebuilds the dlls on each request, resulting in a very slow response time.</p>
<p>When i copied the bin from X to X_test - it worked ok, but when I used the new bin, I get the build on every request.</p>
<p>Any ideas?</p>
| asp.net | [9] |
44,572 | 44,573 | Accessing Global Vars & Functions in custom php page | <p>I have created a php page called "test.php" and uploaded this file to the root
folder of my wordpress installation.</p>
<p>This file contains only this:</p>
<pre><code><?php if ( is_user_logged_in() ) { blah..... } ?>
</code></pre>
<p>I need to check if user is logged in and if so, get some details.</p>
<p>So what I need to know is what wp file(s) I need to include in my php file to be able to get the results of this function and also I prob need to check on an id, username.</p>
| php | [2] |
4,422,121 | 4,422,122 | Nested IF's with jQuery's help | <p>I'm brand new to JQuery - thought it might be good to pick it up for a project I'm taking part on. Basically I want to create a form of sorts, and each time a question on the form is answered, a new question appears depending on the answer. I've got a bit of pseudo code written for it and could probably write it in PHP. The problem is the current version has multiple pages containing every single possibility.</p>
<p>I need an efficient and easily maintainable and modifiable way of creating this.</p>
<p>To give a bit more background, here's how it works..</p>
<p>Each question has a yes/no answer. Depending on the answer, another question is asked, and so on before reaching a certain conclusion. There are about 25 different possible outcomes.</p>
<p>Does anyone know of any references I could use to do something like this, or if there is currently anything out there similar? </p>
<p>Thanks,
Sean</p>
| jquery | [5] |
760,631 | 760,632 | ASP.NET File uplading:Show Progress to User | <p>I have an ASP.NET page where i want to use a file uploading facility for the user.in ASP.NET ,we have an ASP.NET File upload control.I want the site to show some upload progress back to the user when he uploads the file to the site.IF i use ASP.NET file upload control,It will use the post back and it will not give the user the impression as youtube/orkut gives while uploading files. Can any one tell me a solution for this ? I am using VS 2008</p>
| asp.net | [9] |
5,691,842 | 5,691,843 | How do I remove part of a filename using listIndexOf()? | <p>I have these files :</p>
<pre><code> Hingga Akhir Nanti - Allycats_part001
, Hingga Akhir Nanti - Allycats_part002
, Hingga Akhir Nanti - Allycats_part003
</code></pre>
<p>I would like to remove the <code>"_part001"</code> onwards and replace it with extension <code>.mp3</code> for all files in the folder ..</p>
<p>Any ideas on how to do that in Java?</p>
| java | [1] |
1,498,799 | 1,498,800 | Preview aspect ratio is different on different devices | <p>in my app I have a preview screen. On one device (LG, with Android 2.2, 320x480 screen) and another one (HTC, with Android 2.3, 480x800 screen) everything is OK. In both cases the list of supported preview sizes include one that fits the screen size exactly, I choose it and the image is perfect.
The problem comes with yet another device, having a screen similar to the first one (Samsung, Android 2.3, 320x480 screen). Regardless of the fact that I select a preview size that fits the screen size, as in previous cases, the image doe not preserve its aspect ratio; circles appear oval; the image is squeezed along the short axis of the screen. It seems the hardware itself, in order to obtain a 320x480 preview, squeezes the image (the camera has a form factor 4:3, while the screen has a form factor 3:2).
So I have altered the layout params of the view where the preview appears, in order to fit the form factor of the camera (size: 360x480. This PARTIALLY solves the problem; actually, to solve it completely I had to set 380x480 (!!!).
The fact is that I can't possibly find any API that tells me about this different behavior, so that I can automatically compensate for it. Not even the <a href="http://developer.android.com/reference/android/hardware/Camera.Parameters.html#getHorizontalViewAngle%28%29" rel="nofollow">Camera.Parameters.getHorizontalViewAngle</a> and <a href="http://developer.android.com/reference/android/hardware/Camera.Parameters.html#getVerticalViewAngle%28%29" rel="nofollow">Camera.Parameters.getHorizontalViewAngle</a> seem to be helpful; they give the same values on all of the three devices!
Can anyone help me?</p>
| android | [4] |
4,427,054 | 4,427,055 | constructor error , cannot find | <p>it says cannot find Constructor Person() in class person, but i have class person. heres my code</p>
<pre><code>public class Person{
private String name;
private int age;
public String details;
public Person(final String name, final int age){
this.name = name;
this.age = age;
}
}
</code></pre>
<p>and the test person class</p>
<pre><code>public class TestPerson{
public static void main(String args[]){
int q;
System.out.println(args.length + "objects created");
for(q = 1; q < args.length; q++){
final Person p1 = new Person();
for(int x = 0; x < args[q].length(); x++){
args[q].split(",");
p1.setDetails(name, age);
System.out.println(p1);
}
}
}
}
</code></pre>
| java | [1] |
1,344,010 | 1,344,011 | How to navigate the user from floor to floor using android application | <p>I have the requirment to navigate the user from floor to floor using wifi and gps. If user have have android tablet with wifi connection and walking to get lattitude and longitude .I have to draw or voice recognition to go left or right to tell to the user.Is it possible? if it is can anybody tell how to dO?</p>
<p>Thanks </p>
| android | [4] |
1,373,144 | 1,373,145 | Is there a way to change multiple items? [Hard to describe, example inside] | <p>I'm struggling a bit in how to put this into words coherently, so I'll just use an example and hope it gets the message across.</p>
<p>Take the game Othello (Reversi) for example. I can program the logic behind the game, that is to say I can determine which pieces are to have their colors changed after each turn.</p>
<p>Let's say I've got 64 panels on a JFrame, each one representing a position on the Othello board. After a turn ends, I determine that panels 5 and 6 need to have their colors changed.</p>
<p>What I would like to be able to do is pass 5 and 6 via an array, let's say, and have a for-loop that runs through the array.</p>
<pre><code>for(int i=0; i < array.length; i++){
change the image at array[i]
}
</code></pre>
<p>And, thus, only check for and make changes at the 2, in this example, places I need changed. Saving quite a bit of time writing code.</p>
<p>What I currently have to do is have a for-loop and inside the for-loop I have 64 if-else statements, saying</p>
<pre><code>if(panel == 5){
change the image at 5
}
etc.
</code></pre>
<p>I hope this successfully got across what I was trying to ask. If not, I'd be more than happy to clarify.</p>
| java | [1] |
4,549,968 | 4,549,969 | How to read and send resource? | <p>I need to generate and send log data to the mail in <code>csv</code> format. Here is my code:</p>
<pre><code>public function sendMail(){
$csv = $this->createCSV();
$subject = $this->getMessage('subject');
$message = $this->getMessage('message');
$headers = $this->generateHeaders($csv, $message);
mail('[email protected]', $subject, $message, $headers);
}
private function createCSV(){
$data = $this->getAVG();
$csv = fopen('php://temp', 'w+');
// long statistics generation
fclose($csv);
return $csv;
}
private function generateHeaders($file, $message){
$boundary = md5(uniqid(time()));
$headers = 'MIME-Version: 1.0'."\r\n";
$headers .= 'Content-Type: multipart/mixed; boundary="'.$boundary."\"\r\n";
$headers .= 'From: noreplay@'.$_SERVER['SERVER_NAME']."\r\n";
$headers .= '--'.$boundary."\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
$headers .= "Content-Transfer-Encoding: base64\r\n";
$headers .= "\r\n";
$headers .= chunk_split(base64_encode($message));
$headers .= '--'.$boundary."\r\n";
$headers .= "Content-Type: text/csv; name=\"ServersLogs.csv\"\r\n";
$headers .= "Content-Transfer-Encoding: base64\r\n";
$headers .= "Content-Disposition: attachment; filename=\"ServersLogs.csv\"\r\n";
$headers .= "\r\n";
$headers .= chunk_split(base64_encode(readfile($file)));
$headers .= "\r\n--".$boundary."--\r\n";
return $headers;
}
</code></pre>
<p>The problem is that i cant save file on the server, so i use <a href="http://www.php.net/manual/en/wrappers.php.php" rel="nofollow">php://</a>, but after it can't read a file...</p>
| php | [2] |
1,009,811 | 1,009,812 | Is this a dialog or activity? | <p>When you long press on an email in Gmail application the dialog box is shown. I'm wondering is it just a dialog or an activity represented as dialog? Thank you.
<img src="http://i.stack.imgur.com/dWg6E.png" alt="enter image description here"></p>
| android | [4] |
5,985,435 | 5,985,436 | Scoring in Android | <p>I have a quick android mini game and I was wondering, when a monster exits the screen (I already have that function ready) I need it to somehow -1 from the current lives alue.</p>
<p>I want to make it the player has 5 lives.</p>
<p>I understand how to declare variables and minus from it but i also have a label, the label should update when the value updates.</p>
<p>How can i accomplish this?</p>
<p>My code : <a href="http://pastebin.com/LDha0rAG" rel="nofollow">http://pastebin.com/LDha0rAG</a></p>
<p>updateLives is the function accesses, but even with test it does not update.</p>
<p>Main Activity</p>
<p><a href="http://pastebin.com/SUz7Rz7s" rel="nofollow">http://pastebin.com/SUz7Rz7s</a></p>
| android | [4] |
3,629,079 | 3,629,080 | Passing List<T> as query string | <p>I have a List having country names in the list. And this list needs to be sent as one of the parameters in Response.Redirect(page). </p>
<p>Is there a straight forward way to do this, so that in the recieving page, I can type cast the query string to List and use it.</p>
<p>Thanks,
Sriram</p>
| asp.net | [9] |
5,645,175 | 5,645,176 | Convert Window desktop application into Window service | <p>I have a window desktop application, developed in C#.NET (.NET framework 4.0), but now I want to convert it into window services. There is one Window Form in desktop application. How is it possible? Any code or helping link is welcomed.</p>
<p>Thanks</p>
| c# | [0] |
1,487,794 | 1,487,795 | How to display current date and time as toast message in Android | <p>How to display current date and time as toast message</p>
| android | [4] |
3,518,495 | 3,518,496 | how to identify whether X and y coordinates of touch lie with in range of bitmap image or not | <p>here is the code snippet to get bitmap and i am using Touch Event to get the coordinates</p>
<pre><code>`BitmapDrawable drawable = (BitmapDrawable) view.getDrawable();
Bitmap bitmap = drawable.getBitmap();
float x=event.getX();
float y=event.getY();`
</code></pre>
<p>Now i want to know whether these x and y lie in the bitmap region or not
i found a condition but its in pseudo code Kindly guide me that how can i find this xOfBitmap and yOfBitmap </p>
<pre><code> if (x >= xOfYourBitmap && x < (xOfYourBitmap + yourBitmap.getWidth())
&& y >= yOfYourBitmap && y < (yOfYourBitmap + yourBitmap.getHeight()))
{
// if this is true, you've started your click inside your bitmap
}
</code></pre>
<p>thanks in advance</p>
| android | [4] |
4,945,135 | 4,945,136 | Launching a modal UINavigationController | <p>I'd like to launch a modal view controller the way one does with 'ABPeoplePickerNavigationController' and that is without having to creating a navigation controller containing the view controller.</p>
<p>Doing something similar yields a blank screen with no title for the navigation bar and there's no associated nib file loaded for the view even though I am invoking the initWithNibName when the 'init' is called.</p>
<p>My controller looks like:</p>
<pre><code>@interface MyViewController : UINavigationController
@implementation MyViewController
- (id)init {
NSLog(@"MyViewController init invoked");
if (self = [super initWithNibName:@"DetailView" bundle:nil]) {
self.title = @"All Things";
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"All Things - 2";
}
@end
</code></pre>
<p>When using the AB controller, all you do is:</p>
<pre><code>ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
[self presentModalViewController:picker animated:YES];
[picker release];
</code></pre>
<p>ABPeoplePickerNavigationController is declared as:</p>
<pre><code>@interface ABPeoplePickerNavigationController : UINavigationController
</code></pre>
<p>The other way to create a modal view as suggested in Apple's 'View Controller Programming Guide for
iPhone OS':</p>
<pre><code>// Create a regular view controller.
MyViewController *modalViewController = [[[MyViewController alloc] initWithNibName:nil bundle:nil] autorelease];
// Create a navigation controller containing the view controller.
UINavigationController *secondNavigationController = [[UINavigationController alloc] initWithRootViewController:modalViewController];
// Present the navigation controller as a modal view controller on top of an existing navigation controller
[self presentModalViewController:secondNavigationController animated:YES];
</code></pre>
<p>I can create it this way fine (as long as I change the MyViewController to inherit from UIViewController instead of UINavigationController). What else should I be doing to MyViewController to launch the same way as ABPeoplePickerNavigationController? </p>
| iphone | [8] |
3,992,242 | 3,992,243 | Whitespace name of variables | <p>I want to set variables in javascript with a blank name (to obfuscate). It will render something like this :</p>
<pre><code>var ='hi';
</code></pre>
<p>Here is a link that could help : <a href="http://mathiasbynens.be/notes/javascript-identifiers" rel="nofollow">http://mathiasbynens.be/notes/javascript-identifiers</a><br>
My problem is that firefox says illegal character but <a href="http://mothereff.in/js-variables#%EF%BE%A0%E1%85%A0%E1%85%9F" rel="nofollow">http://mothereff.in/js-variables#%EF%BE%A0%E1%85%A0%E1%85%9F</a><br>
How can I make this work ?</p>
| javascript | [3] |
5,790,036 | 5,790,037 | In java can an abstract method be anything other than public? | <p>In java can an abstract method be anything other than public? Are abstract methods implicitly public or are they package if you don't specify? (regular methods are implicitly package right?) are there any visibility modifiers that an abstract method can't have? (private strikes me as problematic)</p>
| java | [1] |
4,562,229 | 4,562,230 | How can I erase a printed output line? | <p>What code would I have to add, replacing the comment, to print 1 & 3 only?</p>
<pre><code>main()
{
cout<<" 1 "<<endl;
cout<<" 2 "<<endl;
/* Code here to remove above " 2" line on output screen */
cout<<" 3 "<<endl;
}
expected output:
1
3
</code></pre>
<p>If you know the answer, please let me know.</p>
| c++ | [6] |
5,242,928 | 5,242,929 | What is platform useragent of the windows platfom? | <p>I am posting the requesting request uisng "POST" method, In mac platform uaser agent is
10.6.2. But the in windows waht is platform user agent.</p>
| c++ | [6] |
2,778,072 | 2,778,073 | Memory leakage check of C++ program report in malloc/free? | <p>I suspect my C++ program has a memory leakage problem. If I run it with some high load configuration, it finally get killed by the system (linux). I used top command to monitor the program, it consumes high percentage of memory. Then I get valgrind to help.</p>
<p>It reports that </p>
<pre><code>malloc/free: 18,550,137 allocs, 18,550,137 frees, 1,043,554,226 bytes allocated
</code></pre>
<p>and </p>
<pre><code> all heap blocks were freed -- no leaks are possible".
</code></pre>
<p>In my program I never used malloc/free nor new/delete. All dynamic created objects were created by its constructor. I wonder does program written in c++ always use malloc/free as its lower level memory allocation and deallocation methods? I assume all dynamic memory are allocated from heap. Because linux OS is not aware of which language the program was invented. </p>
<p>It load every executable with the same virtual memory layout -- "TEXT" + "DATA" + "HEAP" + "STACK". Therefore if we let c++/c library function to dynamic allocate memory, it must be from "HEAP" right?</p>
| c++ | [6] |
5,710,362 | 5,710,363 | logged in function for both logged in and logged out | <p>okay this is tricky, i need this to work or be shown for both of those logged in and logged out. But with this code, if set to "true" and "false" either only those logged in or only those logged out can see the corresponding information. How can i get it to work for both situations? here is the code:</p>
<pre><code><?php if(isset($this->loggedin) && $this->loggedin == false){ ?>
</code></pre>
<p>Right now it only work for those logged out because it is set to false.</p>
| php | [2] |
5,364,117 | 5,364,118 | Downloading a variable | <p>Is it possible, in Javascript, to prompt user for downloading a file that isn't actually on the server, but has contents of a script variable, instead?</p>
<p>Something in spirit with:</p>
<pre><code>var contents = "Foo bar";
invoke_download_dialog(contents, "text/plain");
</code></pre>
<p>Cheers,</p>
<p>MH</p>
| javascript | [3] |
240,616 | 240,617 | preg_replace() help | <p>i need to replace combobox like this.
eg:- </p>
<pre><code><select sistem="" name="answer5" >
<option>math</option>
<option>science</option>
<option selected="selected">engineering</option>
<option>English</option></select>
</code></pre>
<p>result shuld be(AFTER REPLACED) :- {answer5}</p>
<p>i have tried this but failed:</p>
<pre><code>preg_replace('|<SELECT(.*)name="'.$name.'"(.*)>(.*)</SELECT>|U', '{'.$name.'}',$string);
</code></pre>
| php | [2] |
2,078,373 | 2,078,374 | problem with import qt in python | <p>I want to use qt with python.
"import qt" return me :"ImportError: No module named qt". I already instaled pyqt.</p>
<p>what I hve to install in order to activate "import qt"</p>
<p>Thank You </p>
| python | [7] |
4,159,262 | 4,159,263 | Problem with implementing iAd into iPhone application | <p>okay so i have completely followed multiple tutorials step by step including this one <a href="http://bees4honey.com/blog/tutorial/how-to-add-iad-banner-in-iphoneipad-app/" rel="nofollow">iAd Tutorial</a></p>
<p>and using apples official sample code.. everytime i get the errors: "_CGRectOffset" Referenced from: and _CGRectZero Referenced from: any help guys?</p>
| iphone | [8] |
3,797,260 | 3,797,261 | How to call an activity inside a fragment | <p>I have created a fragment inside an Activity, and now I want to open another application/Activity inside this fragment, Result that I want is, both the activities should be seen on the display (it should not open in another window). Please let me know how can I achieve this.?</p>
| android | [4] |
2,605,810 | 2,605,811 | UITableView on scroll doesn't call didSelectRowAtIndexPath | <p>I have a UITableView with one section. If I click on a cell, the didSelectRowAtIndexPath is triggered as expected. but if the tableview has more rows than that can be shown in a single screen, and if I vertically scroll the tableview and click on a row, the didSelectRowAtIndexPath is not called. It is only triggered if i click on the same row one more time. Is this how the tableviews are supposed to function when you scroll? If not, is there something that I'm missing?
thanks for any help.</p>
| iphone | [8] |
4,086,323 | 4,086,324 | Is it possible to place a viewflipper and sliding drawer in the same screen | <p>Is it possible to place a viewflipper and sliding drawer in the same screen</p>
| android | [4] |
5,752,735 | 5,752,736 | Images are not fitting in the Motorola Razr 4.7 screen | <p>I am testing my app on different devices and on the Motorola Razr the images are smaller and the layout is not fitting correctly.</p>
<ol>
<li>This device's screen size is categorized as normal. Just like the different devices I am testing on.</li>
<li>I put all my images in 5 different drawable folders(drawable-hdpi,drawable-ldpi,drawable-mdpi,drawable-tvdpi,drawable-xhdpi). Still the images are smaller...</li>
</ol>
<p>Is there any way I can get the layout to fit just like the other devices? (HTC, Samsung etc)</p>
<p>EDIT:</p>
<p>I have an image 480X556 and I put it in the drawable-hdpi folder. In the XML I put the Image background width to--android:layout_width="320dp" . All is working fine on all "Normal" screens except for the 4.7 screen. I dont want to change the xml but add another image to a diffrent folder.
1) What folder should I move the new image too?
2) What width in the pixel should I give it in order for it to fit the screen without me touching the XML and leaving it on android:layout_width="320dp" ?</p>
| android | [4] |
925,944 | 925,945 | How to use blender on Android | <p>I want to develop a small game in Android. But for this I need to get animation into my Android project. Can I use blender to create animations and then port it into Android. If not then what other software can I use to create animation on Android. Are there any tutorials for this on the net.</p>
| android | [4] |
5,543,927 | 5,543,928 | Unexpected mathematical output | <p>I am trying to count my eggs in an exercise in Learning Python the Hard Way. The formula for counting the eggs is:</p>
<pre><code>print (3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6)
</code></pre>
<p>and the suggested answer is <code>7</code>.
I am getting <code>6.75</code> and have no idea why, I think I am putting it in correctly but I could be wrong. The way it is shown above is exactly how I have put it into the program. </p>
<p>Note: The book I am using uses the 2.6 version of Python where I am using the 3.1 version. This might be part of the confusion. Please help.</p>
<p>The URL for reference <a href="http://learnpythonthehardway.org/book/ex3.html" rel="nofollow">here</a>.</p>
| python | [7] |
2,882,268 | 2,882,269 | Java milli second precision | <p>Is there a Java API/suggestion to use instead of System.currentTimeMillis() to get current time in milli second precision on windows - requirement is two subsequent calls with a sleep time of 1ms in between should give two different time - currently i need to explicitly sleep for 15 ms to get different times</p>
| java | [1] |
1,335,054 | 1,335,055 | why can't write the number to it? | <pre><code><ul class="newsct">
<li><span class="listnum"></span><a href="#">test</a></li>
<li><span class="listnum"></span><a href="#">test</a></li>
<li><span class="listnum"></span><a href="#">test</a></li>
<li><span class="listnum"></span><a href="#">test</a></li>
<li><span class="listnum"></span><a href="#">test</a></li>
<li><span class="listnum"></span><a href="#">test</a></li>
<li><span class="listnum"></span><a href="#">test</a></li>
</ul>
</code></pre>
<p>i want to write 3,4,5,6,7 to <strong></strong> like this <code><span class="listnum">3</span></code></p>
<p>i using the following code,but it doesn't work.</p>
<pre><code>var len = $('.newsct li').length;
for(var i=0;i<len;i++){
if(i>=3){
$('.newsct li .listnum').text()==i;
}
}
</code></pre>
<p>thank you</p>
| jquery | [5] |
2,088,071 | 2,088,072 | which is simple way to create layout android | <p>I want to display For each and every tab different layout so what a easy way to display </p>
<ol>
<li>Create different layout and add or merge in.</li>
<li>Create only one layout for different tab and set visiblity to gone and visible.</li>
</ol>
<p>Which one is easy way or other way please tell me.<br>
Here attached screen: <a href="http://screencast.com/t/pEhf8g0b" rel="nofollow">http://screencast.com/t/pEhf8g0b</a></p>
| android | [4] |
3,793,167 | 3,793,168 | conditional based on month | <p>I'm looking to create an if/else statement that first checks to see if the current month is >= January and <= July (basically any month from Jan-July. If it is, display code snippet a. If not, than show code snippet b. I'm just learning PHP, and I haven't had any luck on google. Thanks!</p>
| php | [2] |
1,302,129 | 1,302,130 | Chained Python class invocations | <p>I am trying to build a set of classes to define hierarchical properties for protocols in the OSI stack... in an abstract sense, I just need to inherit properties from parent python classes, but I need to be able to invoke the entire class chain at once... so, I'm looking for something like this...</p>
<pre><code>#!/usr/bin/env python
class Foo(object):
def __init__(self,fooprop1=None):
return None
class Bar(Foo):
def __init__(self,barprop1=None):
return None
if __name__=='__main__':
tryit = Foo(fooprop1="someMacAddress").Bar(barprop1="someIpAddress")
</code></pre>
<p>However, invoking that script complains that <code>AttributeError: 'Foo' object has no attribute 'Bar'</code></p>
<p>Can someone show me a way to get this done in python? Thanks in advance...</p>
| python | [7] |
5,793,819 | 5,793,820 | Display information in Java GUI | <p>The code below is my attempt at creating a simple GUI to ask a user to input information relating to a book and display it. the problem is i'd like to display the questions i.e. enter title, enter author etc. in one go rather than each one displaying one at a time as in the code i've written so far, also i want to display the cost as Double but not sure how to go about it. any pointers please? i'd like to do it without completely changing the code i've written below as i'm a beginner and want to see how to build on what i've done so far. thanks, Simon</p>
<pre><code>import javax.swing.JOptionPane;
public class GUI
{
public static void main (String args[])
{
String title = "";
String author = "";
String year = "";
String publisher = "";
String cost = "";
title = JOptionPane.showInputDialog("Enter Title");
author = JOptionPane.showInputDialog("Enter Author");
year = JOptionPane.showInputDialog("Enter Year");
publisher = JOptionPane.showInputDialog("Enter Publisher");
cost = JOptionPane.showInputDialog("Enter Cost");
String message = "The title of the book is :" + title +", " +
"and the Author of the Book is :" + author +". It was published in" + year + "by " + publisher +
"and retails at" + cost;
;
JOptionPane.showMessageDialog(null, message, "Book Details", JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}
</code></pre>
| java | [1] |
2,445,119 | 2,445,120 | How handler classes work in Android | <p>I am new to android and was reading the demo applications on official android website. And I came across a method of Handler class named as <code>postDelayed(Runnable r, long milliseconds)</code>.</p>
<p>Can anybody please explain what this method does ?</p>
<p>Thanks.</p>
| android | [4] |
268,270 | 268,271 | How to access the content of a map and process it in java? | <p>I’m reading access logs files and grouping by IP and storing it in a map. At the end I get each IP as the key and the values are the date and urls. I’m storing the values as a list.</p>
<pre><code>HashMap<String,List<String>> map = new HashMap<String,List<String>>();
</code></pre>
<p>The result:</p>
<pre>
IP: 46.33.8.38 ==> [[16/Jul/2011:12:25:23, /TestWebPages/index.html], [16/Jul/2011:12:25:46, /TestWebPages/MScAIS-SEWN-Search-Optimisation.html], [16/Jul/2011:12:25:46, /TestWebPages/valid-rss-rogers.png]]
…
</pre>
<p>Now I would like to further group the content of the map depending on the day and time. But I don’t know how can I access the list of each key in the map and process it!</p>
<p>So I would like to have those webpages accessed on the same day associated with IP address in a new map.</p>
| java | [1] |
4,356,747 | 4,356,748 | using aspx controls in base class | <p>I've got two aspx pages which are very similar and have various identical functions in the code behind. I'd like to create a base class which both the code behind classes derive from. Is it possible for the base class to access the controls on the aspx page. For instance:</p>
<pre><code>class base
inherits System.Web.UI.Page
Sub prepareScreen()
'txtName is a text box on the aspx page
Me.txtName.text = "George"
end sub
end class
class codeBehind
inherits base
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
prepareScreen()
end sub
end class
</code></pre>
<p>Somewhat understandably the code fails to compile with:</p>
<pre><code>'txtName' is not a member of 'clsbase'
</code></pre>
<p>Is it possible to link the two together?</p>
| asp.net | [9] |
5,335,866 | 5,335,867 | Changing time into timestrings in PHP | <p>On my website we store all time & date in the following format:</p>
<p>Table Column: Date - 16.01.2012
Table Column: Time - 06:36:50pm</p>
<p>This has been causing problems with those who live in different timezones, therefore we are looking at changing this to simple time() strings, however because theres a lot of content on our site that already has such time(old, not time() strings) in the database, we want to keep that data and therefore are wondering how we can go about changing those strings into time().</p>
<p>I understand how to update databases and all, I am lost on actually converting 16.01.201206:36:50pm into its respective time() string, as strtotime likes things to be perfect.</p>
<p>Thank you for your time, and I look forward to your suggestions.</p>
| php | [2] |
2,584,863 | 2,584,864 | how to get only the displayed part of text from richtext box | <p>I want only displayed text from richtext box in string form</p>
<p>I have found the initial linenumber and last linenumber through</p>
<pre><code>Point pos = new Point(0, 0);
int firstIndex = this.GetCharIndexFromPosition(pos);
int firstLine = this.GetLineFromCharIndex(firstIndex);
//now we get index of last visible char and number of last visible line
pos.X = ClientRectangle.Width;
pos.Y = ClientRectangle.Height;
int lastIndex = this.GetCharIndexFromPosition(pos);
int lastLine = this.GetLineFromCharIndex(lastIndex);
//this is point position of last visible char,
//we'll use its Y value for calculating numberLabel size
pos = this.GetPositionFromCharIndex(lastIndex);
</code></pre>
<p>how can I get filter rtb text and get only the displayed part of text?</p>
| c# | [0] |
401,390 | 401,391 | How can i display swf file in asp.net flash control? | <p>I have used asp.net flash control to display flash file in asp.net, but it doesnt work for me.</p>
<p>Here is the code I used:</p>
<pre><code><ASPNetFlash:Flash ID="Flash1" runat="server" PlayerVersionAutoDetect="true"
MovieURL="flash/cube.swf">
<HTMLAlternativeTemplate>
<asp:ImageButton ID="ImageButtonGetFlashPlayer" runat="server" PostBackUrl="http://www.adobe.com/go/getflashplayer" ImageUrl="http://www.aspnetflash.com/images/get_flash_player.gif" />
</HTMLAlternativeTemplate>
</ASPNetFlash:Flash>
</code></pre>
<p>The flash file I'm using is version 9, but flash control tries to display version 10. Is there any problem? Otherwise, can you suggest the best way to do this?</p>
| asp.net | [9] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.