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,521,001 | 3,521,002 | Facebook like count is not changing instantly | <p>I am trying to develop a facebook app,in that I have developed the news feed data as we see in android facebook app. It contains all posts with like,comment,comment number and likes number.</p>
<p>when I press like, it should change to unlike and the count of likes should increases as quickly as we find in android facebook app.</p>
<p>I have used this code for doing this</p>
<pre><code> likes.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
// TODO Auto-generated method stub
if(like_or_ulike.get(position).equals("Like"))
{
likes.setText("Unlike");
Log.e("inlike","like");
UrltoValue.getValuefromUrl("https://graph.facebook.com/"+objectid.get(position)+"/likes?access_token="+accesstoken+"&method="+"post");
like_or_ulike.set(position, "Unlike");
}
else
{
Log.e("unlike","unlike");
likes.setText("Like");
UrltoValue.getValuefromUrl("https://graph.facebook.com/"+objectid.get(position)+"/likes?access_token="+accesstoken+"&method="+"DELETE");
like_or_ulike.set(position, "Like");
}
}
});
</code></pre>
<p>But it is not changing quickly,eventhough I set the text before itself,I really can't understand how can they able to change that much quickly.</p>
<p>I also don't know how they can able to change the count within fraction of seconds.I got that count from this url
<a href="https://graph.facebook.com/me/home?access_token=" rel="nofollow">https://graph.facebook.com/me/home?access_token=</a>"+accesstoken</p>
<p>I need to call this to get the count of particular post.I think if I call this it definitely takes much time.</p>
<p>And I also have many more doubts,because I am developing the exactly same app as android facebook app.</p>
<p>please help me in doing this</p>
<p>Thanks in advance.</p>
| android | [4] |
4,628,783 | 4,628,784 | C++ Constructor call | <p>I have written this small code snippet in C++, the output is also attached.
I fail to understand why the constructor is being called only once, while i can see two calls being made for destructor.</p>
<p>From what i understand, default constructor and overloaded assignment operator should be called at line 28.</p>
<p>Can someone please throw some light on this:</p>
<pre><code> 1 #include <iostream>
2 using namespace std;
3
4 class ABC {
5 char c;
6 public:
7 ABC() {
8 cout << "default" << endl;
9 }
10 ABC(char c) {
11 this->c = c;
12 cout << c << endl;
13 }
14 ~ABC() {
15 cout << hex << this << " destructor " << c << endl;
16 }
17 void method() {
18 cout << "method" << endl;
19 }
20 void operator= (const ABC& a) {
21 cout << "operator" << endl;
22 }
23
24 };
25
26 int main() {
27 ABC b('b');
28 ABC a = b;
29 }
</code></pre>
<p><hr /></p>
<pre><code>Output in g++ version 4.0.1:
~/src$ g++ test.cpp
~/src$ ./a.out
b
0xbffff0ee destructor b
0xbffff0ef destructor b
</code></pre>
| c++ | [6] |
3,134,434 | 3,134,435 | Warning: DOMDocument::loadHTML() [domdocument.loadhtml] | <p>After installing a plug in on my site I now have the error </p>
<blockquote>
<p>Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: ID tribe-events-s already defined in Entity, line: 5 in /home/flatoute/public_html/wp-content/themes/yoo_revista_wp/warp/helpers/dom.php on line 44</p>
</blockquote>
<p>Well to me it looks like the problem is in the dom.php file, When I open the dom.php file there is nothing inside of it except this %s a percentage sign with a lower case s</p>
<p>As I've bought the plug in and the theme does anyone know what %s actually is or how to get rid of the warning message on my site?</p>
<p>I've sent emails to the developers of the theme and plug in, the developers of the plug in say it's nothing to do with them it's theme based, the developers of the theme/ well I doubt I'll hear anything back from them as their customer support is non existant!</p>
| php | [2] |
3,210,096 | 3,210,097 | Finding a common way to slide 'div's by clicking on the buttons for each of them | <p>My HTML consists of lines of text(questions) and a button beside each to show/hide answers.
It is something like this.</p>
<pre><code><div id="test">
<ul>
<li>ques 1 <button>view/hide answer</button> </li>
<div id="ans1">
Answer 1
</div>
<li>ques 2 <button>view/hide answer</button></li>
<div id="ans2">
Answer 2
</div>
.
.
.
</ul>
</div>
</code></pre>
<p>What I'm trying to achieve is a single function which can take the id of the clicked button or say the class of button and show/hide the div after it.
Using jQuery I can provide different ids to each and write code for the same but that'll be a foolish thing to do as I have a lot of questions to show. I hope I'm able to explain myself well.
There may be a very easy way to do it but unfortunately I just can't get to it.
Hope someone out there will help me out.</p>
| jquery | [5] |
868,581 | 868,582 | jQuery: grabbing form values | <p>If form is submitted to a function using onsubmit(), how can I get an array of the values of all checkboxes with name='values[]' ? </p>
<p>EDIT: originally I mentioned radio buttons, this is wrong - checkboxes is correct.</p>
<p>EDIT: line below only gets the value of the first one, obviously</p>
<pre><code>$("input[name='values[]']:checked").val()
</code></pre>
<p>Also, how can I get the number of checkboxes that were checked when the form was submitted?</p>
| jquery | [5] |
4,587,163 | 4,587,164 | Java ArrayList problem (involves valueOf()) | <p>So I have this function, combinations, which adds to an arraylist all permutations of a string.</p>
<pre><code> public static void combinations(String prefix, String s, ArrayList PermAttr) {
if (s.length() > 0) {
PermAttr.add(prefix + s.valueOf(s.charAt(0)));
combinations(prefix + s.valueOf(s.charAt(0)), s.substring(1), PermAttr);
combinations(prefix, s.substring(1), PermAttr);
}
}
</code></pre>
<p>Now, I have this arrayList tryCK which let us say is {"A","B"}.</p>
<p>I have another arrayList CK which is also {"A","B"}, but it was derived from the combinations function above.</p>
<p>When I do tryCK.equals(CK) it returns true.</p>
<p>But when I put it through a another function I have on both tryCK and CK, for tryCK it returns true and CK it returns false, even though they are exactly the same lists.</p>
<p>So, my question is, does using .valueOf(s.charAt()) change some inner type?</p>
<p>This is super hard to explain but I do not want to post the full code.</p>
| java | [1] |
2,152,996 | 2,152,997 | When will one need to create a separate process in a Application? | <p>I was reading a article in Android developer blog <a href="http://developer.android.com/guide/topics/fundamentals/processes-and-threads.html" rel="nofollow">Process and Threads</a> which talks about creating new process for specific component of Application. But I failed to understand when will creating a new process in my application becomes a absolute need. Could you please help me understand following doubts I have in this regard.</p>
<ol>
<li>When as a developer I should feel I need to have a separate process for a Android component/s?</li>
<li>Does introducing a new process has any side effect on application's overall performance?</li>
</ol>
<p>Any other info is greatly appreciated.</p>
<p>Thanks,
SKU</p>
| android | [4] |
1,483,184 | 1,483,185 | How to visualize text in message field in android? | <p>I would like show my text messages like this in picture that i have attached. Please give me some hints on that...</p>
<p><img src="http://i.stack.imgur.com/FxZRV.png" alt="enter image description here"></p>
<p>Sample text that i like to have:</p>
| android | [4] |
2,264,176 | 2,264,177 | Android: Is it is possible to override the default dialog title and set our own xml | <p>I want to override default setTitle method of Dialog class.
We can have only text there. But i want to have text and image as a part of title.</p>
<p>I have one text and image in one xml. Which i want to set it as title.
How can i do this. Please guide me. If any sample code is provided it will be great help.
Any help is appreciated.</p>
<p>Thanks in advance.</p>
| android | [4] |
5,177,027 | 5,177,028 | Jquery function calling sequence | <p>I'm newbie to Jquery and saw this piece of code in a book.
I'm trying to understand how hideCode() is being executed.</p>
<p>This is my understanding of the sequence of evets thats going to happen:</p>
<ol>
<li>Document gets loaded and its ready to perform the jquery function.</li>
<li>When the guess_box is clicked run checkForCode() function.</li>
<li>hideCode() function runs.</li>
</ol>
<p>Is this correct?</p>
<pre><code>$(document).ready(function() {
$(".guess_box").click(checkForCode);
function getRandom(num) {
var my_num = Math.floor(Math.random() * num);
return my_num;
}
var hideCode = function() {
var numRand = getRandom(4);
$(".guess_box").each(function(index, value) {
if(numRand == index){
$(this).append("<span id='has_discount'></span>");
return false;
}
});
}
hideCode();
function checkForCode() {
var discount;
if($.contains(this, document.getElementById("has_discount"))) {
var my_num = getRandom(5);
discount = "<p>Your Discount is " + my_num + "%</p>";
} else {
discount = "<p>Sorry, no discount this time!</p>" ;
}
$(this).append(discount);
$(".guess_box").each(function() {
$(this).unbind('click');
});
</code></pre>
| jquery | [5] |
3,440,880 | 3,440,881 | RSS error in pubDate? | <p>I m getting RSS from a site. Especially, i m getting the title of the news and the pubDate.My problem is that the site is giving me date PDT,and if the device language is e.x. English US ,i m getting my catch exception...how could i fix it in order to work on every time zone?</p>
| android | [4] |
5,621,359 | 5,621,360 | Python puzzle sets | <p>I found this table in How to Think Like a Computer Scientist: Learning with Python.</p>
<pre><code>1
2 4
3 6 9
4 8 12 16
5 10 15 20 25
6 12 18 24 30 36
7 14 21 28 35 42 49
</code></pre>
<p>The exercise was to create a program which produces that output. I must have spent at least an hour on it, and I came up with this:</p>
<pre><code>def printMultiples(n):
g = n*n
m = n
while m < g:
if m%n == 0:
print m, '\t',
m = m+1
elif m%n != 0:
m = m+1
print g
def uniqueTable(n, y):
while n < y:
printMultiples(n)
n = n+1
printMultiples(y)
uniqueTable(1, 7)
</code></pre>
<p>And it worked! I was so happy, I almost cried. Anyways, I've become addicted to these sorts of Python problems; currently I'm working on a program that prints the Fibonacci sequence. I go looking for problems, but they always go way over my head for some reason, for example the Facebook puzzles which use ASCII which I haven't studied yet. Does anyone know of any good Python problem sets?</p>
| python | [7] |
1,896,942 | 1,896,943 | Add timestamps in python month wise | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6775811/add-timestamps-in-python">Add timestamps in python</a> </p>
</blockquote>
<pre><code>dates = {}
dates.update({'2011-03-07':'16:03:01'})
dates.update({'2011-03-06':'16:03:01'})
dates.update({'2011-03-08':'16:03:01'})
dates.update({'2011-03-04':'16:03:01'})
dates.update({'2011-05-16':'16:03:01'})
dates.update({'2011-05-18':'16:03:01'})
dates.update({'2011-07-16':'16:03:01'})
dates.update({'2011-07-17':'16:03:01'})
</code></pre>
<p>From the above dictionary how to how to add the all the timestamps for a particular month in <code>python2.4</code></p>
| python | [7] |
3,357,929 | 3,357,930 | increment and decrement between 2 buttons | <p>I have 2 buttons and these 2 buttons will increase the total number of clicks. (The total is count separately)
An user only allow to select 1 of them which means if user has previously clicked on buttonA and click buttonB again. ButtonA will - 1 and ButtonB will + 1. </p>
<p>I have following codes and there is a problem. If no clicked before the buttons would be </p>
<pre><code>buttonA (0) - buttonB (0).
</code></pre>
<p>If an user click buttonA suppose to be <code>buttonA (1) - buttonB (0)</code>
but the following codes show</p>
<pre><code>buttonA (1) - buttonB (-1)
</code></pre>
<p>What I want is, the button ONLY decrease the button which user clicked it before.
And how can I improve my code? It seems messy.</p>
<pre><code>$this.addClass('active').siblings().removeClass('active');
if ($this.is('span[name="ans_yes"]')) {
yes_no = 1;
currentVal = parseInt($this.find('.badge').html());
$this.find('.badge').html(currentVal + 1);
currentVal2 = parseInt($id.find('.ans-no').html());
$id.find('.ans-no').html(currentVal2 - 1);
} else {
yes_no = 0;
currentVal = parseInt($this.find('.badge').html());
$this.find('.badge').html(currentVal + 1);
currentVal2 = parseInt($id.find('.ans-yes').html());
console.log(currentVal2);
$id.find('.ans-yes').html(currentVal2 - 1);
}
</code></pre>
<p>Updated - <a href="http://jsfiddle.net/vzhen/TtkDG/" rel="nofollow">demo</a></p>
| jquery | [5] |
387,394 | 387,395 | Detect on which browser current web application is running | <p>I wanted to know in PHP, how to detect on which browser my web application is running. </p>
<p>e.g. </p>
<p>If current browser is chrome then alert("Chrome browser processing") otherwise alert("rest browser processing");</p>
<pre><code>echo $_SERVER['HTTP_USER_AGENT'];
</code></pre>
<p>Below output I am getting If i execute above code :</p>
<pre><code>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.21 Safari/532.0
</code></pre>
<p>Please suggest your pointers to detect exact browser name.</p>
<p>Thanks,</p>
<p>-Pravin</p>
| php | [2] |
998,786 | 998,787 | Why does TextAppearance and TextAppearance.Small has the same text size? | <p>I am developing a android app and i believe using the official text style can give user the best experience across all kinds of platforms and devices. But i found that <code>TextAppearance.Large</code> has the bigger text size but <code>TextAppearance</code> and <code>TextAppearance.Small</code> has the same size but only different in color, i don't know why.</p>
| android | [4] |
4,611,126 | 4,611,127 | PHP - Get values from Array | <p>I am trying to get a record from a database using an sql lookup (sql1). This then returns as an array which is fine, but I need to use part of the array for my next stage.</p>
<p>$opt=get_records_sql($sql1);</p>
<pre><code> //Diags for SQL content
print_object($opt);
$n = count($opt);
if (empty($opt))
{
echo 'No options selected';
}
else
{
$optno = $opt["subjectid"];
// Diags of $optno
echo '<br>$optno = '.$optno;
</code></pre>
<p>As you can see, I tried to use this: $opt["subjectid"] as subjectid is the fieldname that I am trying to access and I was under the impression that this was correct for accessing an array, but I get the following error:</p>
<pre><code>Notice: Undefined index: subjectid
</code></pre>
<p>Array contents:</p>
<pre><code>Array
(
[1] => stdClass Object
(
[uname] => JHollands06
[tutor] => M LSt
[subjectid] => 1
[year] => 2010
[optid] => 1
)
)
</code></pre>
| php | [2] |
1,607,112 | 1,607,113 | Override line in file while writing | <p>I am reading a file using streamreader opened in ReadWrite mode. The requirement I have is to check for a file for specific text, and if it is found, replace that line with a new line. </p>
<p>Currently I have initialized a <code>StreamWriter</code> for writing.</p>
<p>It is writing text to a file but it's appending that to a new line.</p>
<p>So what should I do to replace the particular line text?</p>
<pre><code>System.IO.FileStream oStream = new System.IO.FileStream(sFilePath, System.IO.FileMode.Append, System.IO.FileAccess.Write, System.IO.FileShare.Read);
System.IO.FileStream iStream = new System.IO.FileStream(sFilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite);
System.IO.StreamWriter sw = new System.IO.StreamWriter(oStream);
System.IO.StreamReader sr = new System.IO.StreamReader(iStream);
string line;
int counter = 0;
while ((line = sr.ReadLine()) != null)
{
if (line.Contains("line_found"))
{
sw.WriteLine("line_found false");
break;
}
counter++;
}
sw.Close();
sr.Close();
</code></pre>
| c# | [0] |
1,684,982 | 1,684,983 | What are your Java 'rules'? | <p>I'm learning Java and I'm wondering what everyone's Java rules are. The rules that you know intrinsically and if you see someone breaking them you try to correct them. Things to keep you out of trouble or help improve things. Things you should never do. Things you should always do. The rules that a beginner would not know.</p>
| java | [1] |
962,843 | 962,844 | IE8 gets caught in an infinite loop with array push | <p>I am confused the following loop causing an infinite loop in IE8</p>
<pre><code>for (var i in theArray) {
this.theArray.push(theArray[i]);
}
</code></pre>
<p>IE8 get caught in an infinite loop which I don't understand why because <code>this.theArray</code> is a global array while <code>theArray</code> is a local variable.</p>
<p>If I had something like the following I would understand that an infinite loop would occurs:</p>
<pre><code>for (var i in theArray) {
theArray.push(theArray[i]);
}
</code></pre>
<p>This only happens in IE8. Does IE8 treat variables and scoping differently?</p>
<p>EDIT</p>
<p>Here is what I have within an object</p>
<pre><code>this.theArray = new Array();
this.selection = function(theArray) {
for (var i in theArray) {
this.theArray.push(theArray[i]);
}
}
</code></pre>
<p>EDIT</p>
<p>I found out that I am pass the global variable into the function as an argument. Duh! Why does this not work in IE8?</p>
| javascript | [3] |
1,753,951 | 1,753,952 | how to pass value of checked checkbox in php | <p>Hi i am generating checkbox list by using a for each loop, I want to pass the <code>value</code> of checked checkbox into database.</p>
<pre><code>foreach($this->lis as $lst)
{?>
<tr>
<td>
<input type="checkbox" name="list" value="1" />
<label for="list_32"><?php echo $list->nList ?></label>
</td>
</tr>
<?php } ?>
</code></pre>
<p>when i checked the checkbox i want to pass the label name into the database can someone help.</p>
| php | [2] |
4,435,230 | 4,435,231 | What is difference between the xpath and xpathselect in asp.net datalist? | <p>I got this question from programming asp.net and web-site called quickstart.asp.net.
In this it is mentioned that xpath and xpathselect is how used and syntex but it is not mentioned how it differs in work, i ckecked but both are giving same result.</p>
| asp.net | [9] |
937,779 | 937,780 | Creating a ListView and setting the background color of a view in each row | <p>I am trying to implement a ListView that is composed of rows that contain a View on the left followed by a TextView to the right of that. I want to be able to change the background color of the first View based on it's position in the ListView. Below is what I have at this point but it doesn't seem to due anything. </p>
<pre><code>public class Routes extends ListActivity {
String[] ROUTES;
TextView selection;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ROUTES = getResources().getStringArray(R.array.routes);
setContentView(R.layout.routes);
setListAdapter(new IconicAdapter());
selection=(TextView)findViewById(R.id.selection);
}
public void onListItemClick(ListView parent, View v, int position, long id) {
selection.setText(ROUTES[position]);
}
class IconicAdapter extends ArrayAdapter<String> {
IconicAdapter() {
super(Routes.this, R.layout.row, R.id.label, ROUTES);
}
}
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = getLayoutInflater();
View row = inflater.inflate(R.layout.row, parent, false);
TextView label = (TextView) row.findViewById(R.id.label);
label.setText(ROUTES[position]);
View icon = (View) row.findViewById(R.id.icon);
switch(position){
case 0:
icon.setBackgroundColor(R.color.Red);
break;
case 1:
icon.setBackgroundColor(R.color.Red);
break;
case 2:
icon.setBackgroundColor(R.color.Green);
break;
case 3:
icon.setBackgroundColor(R.color.Green);
break;
case 4:
icon.setBackgroundColor(R.color.Blue);
break;
case 5:
icon.setBackgroundColor(R.color.Blue);
break;
}
return(row);
}
}
</code></pre>
<p>Any input is appreciated and if you have any questions don't hesitate to ask! </p>
<p>Thanks,
Rob</p>
| android | [4] |
3,222,642 | 3,222,643 | Android App - disappearance of app GUI | <p>I'm trying to create a simple app, whose main task is to open the browser on defined URL.
I've created first Activity:</p>
<pre><code>public class MyActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
Intent myIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://my.url.tld"));
startActivity(myIntent);
}
</code></pre>
<p>Here's my AndroidManifest.xml:</p>
<pre><code><manifest ...>
<application ...>
<activity android:name=".MyActivity" ...>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</code></pre>
<p>This code is fully functional, but before it opens the browser, it displays a black background - blank app GUI. I didn't figured out, how to go directly do the browser (without displaying the GUI).</p>
<p>Anyone knows?</p>
| android | [4] |
3,470,813 | 3,470,814 | How to compile and run a Class.java file from another java program | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1064259/how-can-i-compile-and-deploy-a-java-class-at-runtime">How can I compile and deploy a java class at runtime?</a> </p>
</blockquote>
<p>I am creating a swing gui application within this i want to compile and run a Class.java file located at C:\Users\SK\Desktop by writing java code on click event of button.</p>
| java | [1] |
5,700,802 | 5,700,803 | How can I check for existence of element in std::vector, in one sentence? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/571394/how-to-find-an-item-in-a-stdvector">How to find an item in a std::vector?</a> </p>
</blockquote>
<p>This is what I'm looking for:</p>
<pre><code>#include <vector>
std::vector<int> foo() {
// to create and return a vector
return std::vector<int>();
}
void bar() {
if (foo().has(123)) { // it's not possible now, but how?
// do something
}
}
</code></pre>
<p>In other words, I'm looking for a short and simple syntax to validate the existence of an element in a vector. And I don't want to introduce another temporary variable for this vector. Thanks!</p>
| c++ | [6] |
2,908,095 | 2,908,096 | Problem with my method in C++ | <p>I have a class like so:</p>
<pre><code>class Qtree
{
public:
Qtree();
Qtree(BMP img, int d);
private:
class QtreeNode
{
public:
QtreeNode* nwChild; // pointer to northwest child
QtreeNode* neChild; // pointer to northeast child
QtreeNode* swChild; // pointer to southwest child
QtreeNode* seChild; // pointer to southeast child
RGBApixel element; // the pixel stored as this node's "data"
QtreeNode();
QuadtreeNode copy(QuadtreeNode & n);
};
</code></pre>
<p>And so the question is on the copy method. It makes a copy of a given node and returns it. </p>
<pre><code>QtreeNode Qtree::QtreeNode::copy(QtreeNode & n) {
QtreeNode *newNode;
//....
return newNode;
}
</code></pre>
<p>And then I call copy from my Qtree copy constructor:</p>
<pre><code>root=QtreeNode::copy(*tree.root); //each tree has a root pointer
//have also tried many different things here, but dont really know what to put
</code></pre>
<p>I get the following errors:</p>
<pre><code>error: cannot call member function ‘Qtree::QtreeNode* Qtree::QtreeNode::copy(Qtree::QtreeNode&)’ without object
and
error: no matching function for call to ‘copy(Qtree::QtreeNode&)’
</code></pre>
| c++ | [6] |
2,520,868 | 2,520,869 | ContactsContract.Contacts does not return ASC order by ContactsContract.Contacts.DISPLAY_NAME | <p>I've written code to access Contacts order byContactsContract.Contacts.DISPLAY_NAME ASC , but it does not return in order . My code is below </p>
<pre><code>contactCursor = requestActivity.managedQuery(
ContactsContract.Contacts.CONTENT_URI, new String[] {
ContactsContract.Contacts._ID,
ContactsContract.Contacts.HAS_PHONE_NUMBER,
ContactsContract.Contacts.DISPLAY_NAME },
ContactsContract.Contacts.HAS_PHONE_NUMBER + "=?",
new String[] { "1" },
ContactsContract.Contacts.DISPLAY_NAME
+ " COLLATE LOCALIZED ASC LIMIT " + start
+ ", " + upto);
</code></pre>
<p>I'm unable to understand the reason tried in different way including below </p>
<pre><code>contactCursor = requestActivity.managedQuery(
ContactsContract.Contacts.CONTENT_URI, new String[] {
ContactsContract.Contacts._ID,
ContactsContract.Contacts.HAS_PHONE_NUMBER,
ContactsContract.Contacts.DISPLAY_NAME },
ContactsContract.Contacts.HAS_PHONE_NUMBER + "=?",
new String[] { "1" },
ContactsContract.Contacts.DISPLAY_NAME
+ " ASC LIMIT " + start
+ ", " + upto);
</code></pre>
<p>Why It does not work ? any idea ? is it because of LIMIT or I'm doing something wrong ? please help it's urgent . </p>
| android | [4] |
1,382,550 | 1,382,551 | Designing a C++ library | <p>I am in the process of designing a C++ static library.
I want to make the classes generic/configuarable so that they can support a number of data types(and I don't want to write any data type specific code in my library).
So I have templatized the classes.</p>
<p>But since the C++ "export" template feature is not supported by the compiler I am currently using, I am forced to provide the implementation of the classes in the header file.
I dont want to expose the implementation details of my Classes to the client code which is going to use my library.</p>
<p>Can you please provide me with some design alternatives to the above problem??</p>
| c++ | [6] |
3,675,531 | 3,675,532 | Javascript summation calculator | <p>I would like to make a calculator for summation.</p>
<p>I write number, then i click on button + , and then i enter second number, and then i click on Submit button and get value in input.</p>
<p>I am getting values from input with this:</p>
<pre><code>var something = document.getElementById('inputid');
var newvalue = something.year.value;
</code></pre>
<p>Can anyone help me with this? </p>
| javascript | [3] |
2,716,469 | 2,716,470 | onload function issue | <p>I use this javascript on the home page, and that page contain h2 tags within an element magazine-brief, the alert is working well. If I go to any other page which does not have an element magazine-brief the alert box does not work. How can i solve this problem. my code is :</p>
<pre><code>window.onload = function(){
var yellows = document.getElementById('magazine-brief').getElementsByTagName('h2');
alert('hi');
}
</code></pre>
| javascript | [3] |
700,661 | 700,662 | Jquery mask for number and letter | <p>I'd like check via jquery a string, thi string can begin by "P" or "M" and after that some number, sample P1456598, M124, P47, M798664645</p>
<p>Any idea ?</p>
<p>Thanks,</p>
| jquery | [5] |
2,763,641 | 2,763,642 | JavaScript client-side search engine | <p>I am developing a local web application with jQuery/JavaScript.</p>
<p>My goal is to create search engine for searching content from a JSON file. I already made it with regex, but it works slowly.</p>
<p>What is the best way? Is there a JavaScript search engine?</p>
| javascript | [3] |
3,544,323 | 3,544,324 | Editing one List<> edits it's clone | <p>I have this list of custom class objects:</p>
<pre><code>List<URL> URLs = new List<URL>();
</code></pre>
<p>and I'm trying to push a copy on to a Stack:</p>
<pre><code>Stack<List<URL>> undo = new Stack<List<URL>>();
List<URL> temp = new List<URL>();
temp.AddRange(new List<URL>(URLs));
undo.Push(temp);
</code></pre>
<p>Now whenever I delete an object from the original (URLs) list everything is OK with the one on the stack (temp). But when I delete a list element from a list inside the object in the original (URLs) the same element dissapears in the copy of that object's list that is on the stack.</p>
<p>I delete objects from URLs the same way I delete list elements inside that object.
Does anyone know why this is happening?</p>
| c# | [0] |
1,925,940 | 1,925,941 | Socket Send/receive simultaneously | <p>can any one point out the reason why u cant send and receive on a socket at the same time ?</p>
<p>to my understanding there are 2 streams one to push and one to pull </p>
<p>if you attempt to send/receive simultaneously you will get wasealready error </p>
<p>what is the reason that the socket throws wasealready error (10035)
does it have any thing to do with the ack window the receiving side sends back ?
as if to keep the line open for the window ?</p>
| c# | [0] |
2,235,631 | 2,235,632 | How can I deploy a service provider and activity package together within eclipse | <p>In Eclipse I want to deploy both a Service Provider package and a standard Activity-based package (which uses the Service Provider). Can I bundle these together in Eclipse to make a single apk which gets deployed to the device?</p>
<p>thanks</p>
<p>anton</p>
| android | [4] |
3,362,248 | 3,362,249 | is it possible to have a virtual class declaration in a class? | <p>I'm setting a up an interface for various components of a framework in a personal project, and i've suddenly thought of something that i figured might be useful with an interface. My question is whether this is possible or not:</p>
<pre><code>class a
{
public:
virtual class test = 0;
};
class b : public a
{
public:
class test
{
public:
int imember;
};
};
class c : public a
{
public:
class test
{
public:
char cmember; // just a different version of the class. within this class
};
};
</code></pre>
<p>sort of declaring a virtual class or pure virtual class, that is required to be defined within the derived object, so that you might be able to do something like this:</p>
<pre><code>int main()
{
a * meh = new b();
a * teh = new c();
/* these would be two different objects, but have the same name, and still be able
to be referred to by an interface pointer in the same way.*/
meh::test object1;
teh::test object2;
delete meh;
delete teh;
return 0;
}
</code></pre>
<p>msvc++ throws me a bunch of syntax errors, so is there a way to do this, and i'm just not writing it right?</p>
| c++ | [6] |
1,709,650 | 1,709,651 | Refresh UIView for drawRect? | <p>Is there a way to refresh a UIView which will subsequently call drawRect?</p>
<p>EDIT:</p>
<p>I am doing <code>[view setNeedsDisplay]</code> however it doesn't appear to be working! Or at least my NSLog in drawRect isn't displaying.</p>
<p>EDIT2:</p>
<p>Please see comments of selected answer for the gory details! Number one tip: Make sure it's <em>property</em> linked!</p>
| iphone | [8] |
5,677,063 | 5,677,064 | Updating a datatable in c# | <p>I have a datatable storing info about a student classroom. My table looks like this:</p>
<pre><code>Student ID Grade Absence Count
00001 85 0
00002 95 7
00002 70 5
00003 35 1
</code></pre>
<p>Dont ask me why there are two id's that are the same... its just the way it is. Now i want to update the absence count for the 00002 id that has absence count of 7. At the same time, i want to delete the 00002 entry that doesnt have the absence count of 7 (in this case the one with count 5). Now i know how to query the table with a select statement and update the 00002 id student with count 7. How can i, at the same time, delete the other entry for the 00002 student? This is my code:</p>
<pre><code>foreach(oldCount in absenceCount)
{
DataRow[] dr = dt.Select("Student ID='" + ID + "' AND Absence Count='" + oldCount);
dr[0]["Absence Count"] = newCount;
}
</code></pre>
<p>So here how can i tell the program that if there is another student id whose absence count isnt in the absenceCount list, delete it from the table?</p>
<p>Thanks</p>
| c# | [0] |
5,983,613 | 5,983,614 | Android UI Implementation | <p>I was having a look at the footprints application found on the Android Market Place. I have rather intrigued with the Tab Bar that they used. Does anyone have an idea how to do that ? </p>
| android | [4] |
181,689 | 181,690 | Converting string to c-style string and detecting null terminating character | <p>I am trying to convert a C++ string object to C-Style NULL terminated string using c_str() and then trying to access individual character as it can be done for c-style string.</p>
<pre><code>#include <iostream>
#include <string>
using namespace std;
int main()
{
string str1("Alpha");
cout << str1 << endl;
const char * st = new char [str1.length()+1];
st = str1.c_str(); // Converts to null terminated string
const char* ptr=st;
// Manually Showing each character
// correctly shows each character
cout << *ptr << endl;
ptr++;
cout << *ptr << endl;
ptr++;
cout << *ptr << endl;
ptr++;
cout << *ptr << endl;
ptr++;
cout << *ptr << endl;
ptr++;
cout << "# Null Character :" << *ptr << endl;
// But below loop does not terminate
// It does not find '\0' i.e. null
while( ptr != '\0')
{
cout << "*ptr : "<< *ptr << endl;
ptr++;
}
return 0;
}
</code></pre>
<p>But seems like it does not add '\0' at the end and the loop does not terminate.
Where I am going wrong ?</p>
<p>C-style string (e.g. char* st="Alpha";) can be accessed with the loop shown in the code but when the conversion from string object to c-style string happens, it can not.How do I do it?</p>
| c++ | [6] |
2,876,294 | 2,876,295 | read an string line by line using c++ | <p>I have a <code>string</code> with multiple line and I need to read it line by line.
Please show me how to do it with a small example.</p>
<p>Ex: I have a string <code>string h;</code></p>
<p>h will be:</p>
<pre><code>Hello there.
How are you today?
I am fine, thank you.
</code></pre>
<p>I need to extract <code>Hello there.</code>, <code>How are you today?</code>, and <code>I am fine, thank you.</code> somehow.</p>
| c++ | [6] |
3,987,958 | 3,987,959 | xml for multiple screen in android | <p>i am working on 2.2 version of android and xml is designed according to this version
Specification of emulator : version 2.2, Built-in : HVGA , Memory : 1024</p>
<p>and now i need this application to be transformed into 4.0 version of Samsung galaxy s3 but the screen are very streched and does not look good </p>
<p>thanks in advance if any help.</p>
| android | [4] |
1,246,744 | 1,246,745 | Two new lines instead of one | <p>I banged my head as to why this code is inserting two new lines instead of one. Can someone help?</p>
<pre><code>file=open('16052013')
for line in file:
line=line.strip()
splitLine=line.split("\t")
strSentence=splitLine[2]
caseId=splitLine[0]
for word in strSentence.split():
word=word.strip()
print caseId,'\t',word
print '\n'
</code></pre>
| python | [7] |
2,989,573 | 2,989,574 | Comparing mysql record with current time | <p>I have a query that shows appointments that a user has made in a format year-month-day start time(00:00:00) end time(00:00:00),now i want to compare this whole format with the current time and if it is equal or higher to not show do appointment because user has the option to cancel the appointment and if the time for the appointment has passed i want to hide the cancel appointment option from him...here is my query and html echo...</p>
<pre><code>$result = mysql_query("SELECT id,date,start,end FROM jos_jxtc_appbook_appointments WHERE userident='$idusera'");
while($row = mysql_fetch_assoc($result))
{
echo '<div class="record" id="record-',$row['id'],'">
<a href="?delete=',$row['id'],'" class="delete">Delete</a>
<strong>',$row['date'], $row['start'], $row['end'],'</strong>
</div>';
}
</code></pre>
| php | [2] |
1,732,005 | 1,732,006 | Set defaults at runtime | <p>I manage a fairly large python-based quantum chemistry suite, <a href="http://pyquante.sf.net" rel="nofollow">PyQuante</a>. I'm currently struggling with how to set various defaults so that users can choose among different options at runtime.</p>
<p>For example, I have three different methods for computing electron repulsion integrals. Let's call them a,b,c. I used to simply pick the one I liked best (say, c), and have that hard-wired into the module that computes these integrals. </p>
<p>I have now modified this to use a module, Defaults.py, that contains all such hard-wires. But this is set at compile/install time. I would now like users to be able to override these options at runtime, say, using a .pyquanterc.py file.</p>
<p>In my integral routines, I currently have something like</p>
<pre><code>from Defaults import integral_method
</code></pre>
<p>I know about dictionaries, and the .update() method. But I don't know how I would use this in real life. My defaults module looks like</p>
<pre><code>integral_method = c
</code></pre>
<p>should I modify the end of Defaults.py to look for a .pythonrc.py file and override these values? E.g.</p>
<pre><code>if os.path.exists('$HOME/.pythonrc.py'): do_something
</code></pre>
<p>If so, what should do_something look like?</p>
| python | [7] |
3,218,849 | 3,218,850 | C++ Proper way of deleting a new struct array that contains new struct array? | <p>What is the proper way of deleting a new struct array that contains new struct array?</p>
<pre><code>typedef struct CALF_STRUCTURE
{
char* Name;
bool IsBullCalf;
} CALF;
typedef struct COW_STRUCTURE
{
CALF* Calves;
} COW;
int main( void )
{
COW* Cows;
Cows = new COW[ 3 ]; // There are 3 cows.
Cows[ 0 ].Calves = new CALF[ 2 ]; // The 1st cow has 2 calves.
Cows[ 1 ].Calves = new CALF[ 1 ]; // The 2nd cow has only 1 calf.
Cows[ 2 ].Calves = new CALF[ 25 ]; // The 3rd cow has 25 calves. Holy cow!
Cows[ 2 ].Calves[ 0 ].Name = "Bob"; // The 3rd cow's 1st calf name is Bob.
// Do more stuff...
</code></pre>
<p>Now, its time do clean-up! But...what is the proper way of deleting the cows and calves array or any type of struct array?</p>
<p>Should I delete all of the cows's calves array in a for-loop first? Like this:</p>
<pre><code>// First, delete all calf struct array (cows[x].calves)
for( ::UINT CowIndex = 0; CowIndex != 3; CowIndex ++ )
delete [ ] Cows[ CowIndex ].Calves;
// Lastly, delete the cow struct array (cows)
delete [ ] Cows;
return 0;
};
</code></pre>
<p>Or should I just simply delete the cows array and hope that it will also delete all calves array? Like this:</p>
<pre><code>// Done, lets clean-up
delete [ ] Cows;
return 0;
};
</code></pre>
<p>Or?</p>
| c++ | [6] |
3,335,394 | 3,335,395 | javascript: how to check a property is undefined | <p>I have codes below.</p>
<pre><code>elem.onkeypress=function(e){
if( (e.which===undefined?e.keyCode:e.which)==13 ){
//dosomething
}
}
</code></pre>
<p>at IE8, it occus erros: <code>'which' is null or not an object</code></p>
<p>how to fix this problem.</p>
| javascript | [3] |
4,983,535 | 4,983,536 | manipulating a stream via FILE* | <p>I've just run across some C++ code which uses a FILE* to manipulate a file stream using the "f" functions (fopen, fseek, fread, etc). I believe that these are provided by standard header cstdio.</p>
<p>Is this considered a dated or bad practice in modern C++ code? I ask because I also see that you can get/set the position of the stream of an ifstream object using setg and tellg and I'd like to know what the advantage is to doing it this way. Is this an "old habits die hard" C programmer way of manipulating the stream or is there still a valid reason to use FILE* and the "f" functions in modern C++ code?</p>
| c++ | [6] |
2,394,899 | 2,394,900 | Remove View from LinearLayout in Android issue | <p>I created a LinearLayout that has ImageViews added dynamically to it. I can have a list of 50 ImageViews but only 3 will be shown in it at the same time. </p>
<p>I need to reference the 3 items in it so I have private variables setup at the top of my activity called ImageView item1, item2, item3. </p>
<p>When a button is pressed, the next ImageView in the list is added to the layout and the first item is removed. I then reset the references for item1, item2, and item3.</p>
<p>My problem is that while it works good, there seems to be a painting issue. item3 (the last ImageView) will show the new item added on top of the previous ImageView. It seems to be a painting issue because if I flip my phone into landscape mode and then go back to portrait, the issue is resolved.</p>
<p>Edit: I have tried adding .invalidate() to the layout and to the imageViews themselves with no luck.</p>
| android | [4] |
5,964,359 | 5,964,360 | looking for a c++ function to load a specified Line from a file (txt) | <p>I have to load data from a file which contains hundreds of lines.
in each line, we have the input and its output.</p>
<p>I am trying to implement a C++ function that takes the line number as argument, and go to the specified line in order to load existed data.</p>
| c++ | [6] |
39,593 | 39,594 | Development of Browser ToolBar | <p>I want to make a browser toolbar for Windows that should work for existing browsers like Firefox (2.x, 3.x) and Chrome as well in c#.net. I have read some articles on accomplishing this task and found some good stuff.</p>
<p>Does anyone have any ideas about how to do this?</p>
| c# | [0] |
1,554,440 | 1,554,441 | Is there a jquery plugin to refresh certain areas of page | <p>I want to find out a plugin which can refresh certain areas of a page, without refreshing the entire page itself. I have a custom control kept inside a div that changes its contents only on refresh, so I am thinking to use something that can refresh only the div</p>
| jquery | [5] |
4,097,349 | 4,097,350 | Res folder in a library project | <p>I have a couple of projects that use one common library project for shared code. I'd like to be able to put layouts, strings, etc into the common project, but the compiler is not recognizing the res folders, so I can't use R. Is it possible to put layouts, etc into a library project, or am I going to have to copy them to both concrete projects?</p>
| android | [4] |
5,663,363 | 5,663,364 | ASIHTTP Request & Classes | <p>I am new to iPhone application development and working on a web service based application.</p>
<p>I am using NSXML parser in this application and all is working finr, I am able to get the data from server.</p>
<p>But my friend told me that I should include ASIHTTP Classes in this project that is mandatory, but I wonder as I have not used any usch classes as of now and still i am able to fetch the data successfully.</p>
<p>Can any body please explain me what is the purpose of ASIHTTP classes and if i don't use it then would that be a right approach?</p>
<p>I will also need to do Lazy loading in my project so will that be possible without ASIHTTP Classes? </p>
<p>Please help me to clear my doubts.</p>
<p>Thanks in advance.
iPhone Developer</p>
| iphone | [8] |
2,970,487 | 2,970,488 | Starting debugger on errors in threads | <p>I'm using following trick to get debugger started on error
<a href="http://stackoverflow.com/questions/242485/starting-python-debugger-automatically-on-error">Starting python debugger automatically on error</a></p>
<p>Any idea how to make this also work for errors that happen in newly created threads? I'm using thread pool, something like <a href="http://code.activestate.com/recipes/577187-python-thread-pool/" rel="nofollow">http://code.activestate.com/recipes/577187-python-thread-pool/</a></p>
| python | [7] |
1,026,305 | 1,026,306 | Android emulator crash on Mac osx 10.7 lion, causing kernel panic | <p>I am using Android emulator with an intel x86 based image for version 2.3 and developing on a Mac 10.7 lion system.
I have also installed intel hardware execution manager due to which the emulator runs at faster speed than normal. However while using the emulator it crashes randomly causing a kernel panic.
This happens quite frequently. Any clues to how I may get over this !</p>
| android | [4] |
2,130,963 | 2,130,964 | Datastructure to map Class objects to values while considering superclasses? | <p>Is there a map like data structure that uses Java Class objects as keys but uses fallback to superclasses if no mapping is found? Let me give a short example:</p>
<pre><code>ClassMap<Integer> map = new ClassMap<Integer>();
map.put(Object.class, 1);
map.put(Number.class, 2);
assertEquals(1, map.get(String.class));
assertEquals(2, map.get(Number.class));
assertEquals(2, map.get(Double.class));
</code></pre>
<p>I know that I could do the fallback manually, e.g.</p>
<pre><code>WeakHashMap<Class<?>, Integer> map = // snip
Class<?> cls = Double.class;
Integer i;
do {
i = map.get(cls);
cls = cls.getSuperclass();
} while (i == null && cls != null);
</code></pre>
<p>Still I'm interested in existing or alternative solutions.</p>
| java | [1] |
5,568,263 | 5,568,264 | Logging recursively | <p>I am trying to use my logger to dump variables to my logfile.
I need it to write down arrays within arrays.
Could you explain please how to do this ? (I am not sure of how to pass the sub-array of the rest of the array but here's what I came up with, which obviously is missing something)</p>
<p>Thanks</p>
<pre><code>function logRec($param)
{
if(!isset($param))
return;
foreach($param as $key=>$value)
{
if(is_array($value))
{
echo "<b>nested array</b><br />";
logRec(next($param));
}
else
{
echo $param;
return;
}
}
}
$par = array("ABC","DEF",array("Apple","Peach","Melon",array("Cube","Sphere","Pyramid")));
logRec($par);
</code></pre>
| php | [2] |
4,449,057 | 4,449,058 | ListView Listener not Working | <p>I've seen a few examples on here to this problem, but none have solved this issue, observe the code below:</p>
<pre><code>mProductList = hotdealhelper.getCatalog(getResources());
ListView myListView = (ListView) findViewById(R.id.listViewoffers);
myListView.setAdapter(new hotdealadapter(mProductList, getLayoutInflater()));
myListView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
System.out.println("Newbie");
}});
</code></pre>
<p>I have it in my oncreate lethod, and when I click on a particular position in the list, it is not printing the system.out. I am wondering why this is, I have used this exact code in another class and it works fine. I have the list in a activity class also. Below is the xml if it helps.</p>
<blockquote>
<p>
<pre><code><ImageView android:id="@+id/imageView1" android:src="@drawable/dealheader" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true"></ImageView>
<ListView android:layout_height="wrap_content" android:id="@+id/listViewoffers" android:layout_width="match_parent" android:layout_marginTop="35px"></ListView>
<Button android:text="Button" android:id="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="0px" android:layout_alignParentBottom="true"></Button>
</code></pre>
<p></p>
</blockquote>
| android | [4] |
338,463 | 338,464 | what does 'objects being subclassable' mean? | <p><a href="http://diveintopython.net/getting_to_know_python/everything_is_an_object.html" rel="nofollow">Dive into Python</a> - </p>
<blockquote>
<p>Different programming languages define “object” in different ways. In some, it means that all objects must have attributes and methods; in others, it means that all objects are subclassable. In Python, the definition is looser; some objects have neither attributes nor methods (more on this in Chapter 3), and not all objects are subclassable (more on this in Chapter 5). </p>
</blockquote>
<p>I am coming from <code>C++/Java</code> background. </p>
| python | [7] |
4,370,781 | 4,370,782 | Using appropriate layout markup according to screen resolution | <p>I've got a design list for 480x800, 1024x600, 1280x800. How do I ask android to use exact markup based on user screen's resolution ?
As far as I know there're only abstract means(hdpi,xdpi) for solving resolution difference.</p>
| android | [4] |
3,978,890 | 3,978,891 | Remote OS detection with PHP | <p>I run a Apache/php server on Mac, and I want to show different info based on the OS that accesses it. </p>
<p>How can I do that with PHP?</p>
| php | [2] |
781,514 | 781,515 | Removing an element permanently in jQuery | <p>when I append an element and afterwards remove it the object still exists?</p>
<pre><code>bg = $('<div class="dialog_bg"></div>');
$('#'+elm).append(bg);
bg.remove();
</code></pre>
<p>how is that? isn't it possible to remove the element permanently?</p>
| jquery | [5] |
705,903 | 705,904 | Is it possible to save the voice data recorded from an iPhone? | <p>What would be a good way to transport the voice data recorded on the iPhone? I am building some sort of online cloud system where the user is able to record a clip and save it online to be retrieved later on from our server. What format should I save the voice data and how should it best be stored (as a file etc)?</p>
| iphone | [8] |
2,243,012 | 2,243,013 | how to edit the text of a button which is in the list item of android | <p>how to edit the text of a button which is in the list item of android</p>
| android | [4] |
4,807,894 | 4,807,895 | Sinatra inspired PHP Framework any ones that stand out? | <p>I know this has been asked before but there all in 2008 - 2010. Is there any ones that seem to stand out that you can recommend that are being updated/maintained?</p>
| php | [2] |
578,359 | 578,360 | Creating variable from the url string and using the last one to set an image path | <p>I've got a site where I'd like to have a specific header image displayed for each individual page. The way the layout is done, it's not easily achievable with the current templating system. What I'd like to do is grab the last piece of the url string, create a variable and use that variable to complete an image path. That way I can upload images with the same name and get my desired affect.</p>
<p>I can create the array:</p>
<pre><code>var pathArray = window.location.pathname.split( '/' );
</code></pre>
<p>Not sure how to grab the last item. The number of items in the array will vary.
Also, not sure exactly how to append the image path. What I need is something like this:</p>
<pre><code><img src="/headerImages/[variable here].jpg"/>
</code></pre>
<p>All the urls on the site do not have .html or .htm so we shouldn't need to filter those out.</p>
<p>Thanks in advance for any help!</p>
| jquery | [5] |
1,782,122 | 1,782,123 | Android: "Path for project must have only one segment" | <p>I just setup the NotePad sample project as described here, but when I try to launch it (Ctrl+F11) I received the following error message box:</p>
<blockquote>
<p>Path for project must have only one
segment.</p>
</blockquote>
<p><img src="http://i.stack.imgur.com/iBurr.png" alt="enter image description here"></p>
<p>What does this error mean and why is it happening?</p>
<p>(I tried to consult <a href="http://dushi.co.uk/09/07/2009/error-path-for-project-must-have-only-one-segment/">this article</a>, but it seems irrelevant to my problem because I have no getProject anywhere in this copied-verbatim sample project)</p>
| android | [4] |
4,377,230 | 4,377,231 | Best mock framework for android | <p>Can anybody suggest a good framework for mocking in Android. I have found robotium <a href="http://code.google.com/p/robotium/" rel="nofollow">http://code.google.com/p/robotium/</a> . I also read that EasyMock is also available. Can you suggest sth else or share your experiance using the latter two?</p>
| android | [4] |
1,111,847 | 1,111,848 | Please any one give me simple or First Example of SNMP in JAVA | <p>I am new in Networking Filed and I want and Require a use of SNMP so please give a best and simple and First Example of SNMP that i use to my learn.... Please ...Please</p>
<p>Thanks </p>
| java | [1] |
37,694 | 37,695 | whats a good way of always having the correct doc root string? | <p>if i have a menu such as</p>
<pre><code><a href="index.php">home</a>
<a href="aboutus.php">about us</a>
<a href="contact.php">contact us</a>
</code></pre>
<p>inside a file called menu.php</p>
<p>and this menu.php file gets include into pages all across the application. but what if i create a new folder and call it portfolio and in this folder there is a file named example1.php and the menu.php gets included in this file. the home,about us, and contact us links wont work anymore since their pointing to the root. so i created this function</p>
<pre><code>function getRoot() {
$self = $_SERVER['PHP_SELF'];
$protocol = $_SERVER['https'] == 'on' ? 'https:/' : 'http:/';
$docroot_before = explode("/", $self);
array_pop($docroot_before);
$docroot_after = implode("/", $docroot_before);
$host = $_SERVER['HTTP_HOST'];
return $protocol.$host.$docroot_after."/";
}
</code></pre>
<p>and the menu now looks like this</p>
<pre><code><a href="<?=getRoot();?>index.php">home</a>
<a href="<?=getRoot();?>aboutus.php">about us</a>
<a href="<?=getRoot();?>contact.php">contact us</a>
the link should come out as http://localhost/domain/aboutus.php (for example)
but it comes out as http://localhost:/domain/portfolio/aboutus.php (and this is wrong).
</code></pre>
<p>what is the best way to always get the correct doc root no matter where the menu.php gets include.?</p>
| php | [2] |
2,953,934 | 2,953,935 | How do I move a pointer in C++? | <p>This is a stupid question but I just have no idea how to accomplish this.</p>
<p>I have an object and a vector. At a set time during execution, I need to put this object in the vector and overwrite this object with a new one. I currently have this, </p>
<pre><code>std::vector<Cube*> cubes;
Cube* workingCube = new Cube();
...
cubes.insert(cubes.begin(), workingCube);
workingCube = new Cube();
</code></pre>
<p>which I assume is wrong because of some pointer-related reason. I can't figure out how to do this properly though.</p>
| c++ | [6] |
1,121,302 | 1,121,303 | unbelievably simple "if" failing in PHP | <p>I have been banging my head against this one for a while now and have tried many versions of this code. I must be doing something <em>very</em> basic wrong ...</p>
<pre><code>$pop = FALSE;
$pop = ($visits > 4);
if ($pop){
drupal_add_js(drupal_get_path('module', 'spester') .'/light.js');
}
</code></pre>
<p><code>var_dump($visits, $pop)</code> gives me </p>
<pre><code>int(3) bool(false)
</code></pre>
<p>... and yet the expression inside my if evaluates.</p>
<p>Of course, if I instead do <code>if{FASLE}{...}</code>, then my code behaves as expected ...</p>
| php | [2] |
2,848,485 | 2,848,486 | jquery if have html tag | <p>I have some code, the <code>p.words</code> is hidden, I tried to make a judge, if next <code>div</code> has <code>span</code> tag, then show the <code>p.words</code>, else keep the css rule.</p>
<p>I use <code>jquery.next</code> and <code>jquery.find</code> to make a judge <code>$(this).parent().next('.col').find('span')</code>, but it will show all the <code>p.words</code> even the next <code>div</code> has no <code>span</code> tag</p>
<pre><code><style>
.words{display:none;}
</style>
<script src="jquery.js"></script>
<script>
$(document).ready(function(){
$('.words').each(function(){
if($(this).parent().next('.col').find('span')){
$(this).css('display','block');
}
});
});
</script>
<a>Voodoo
<p class="words"> 1</p><!-- do not show -->
</a>
<div class="col">
<ul>
<li>ATI Rage128 Pro</li><!-- no span tag -->
</ul>
</div>
<a>NVIDIA
<p class="words"> GeForce2 MX</p><!-- show -->
</a>
<div class="col">
<ul>
<li>
<span>NVIDIA GeForce2 MX 400</span><!-- have span tag -->
</li>
<li>
<span>ATI 9200SE</span>
</li>
</ul>
</div>
</code></pre>
| jquery | [5] |
1,977,266 | 1,977,267 | list of android market to publish app | <p><strong>hello friends</strong>,</p>
<p>I need a publish my app in <code>different-different</code> market but not in <code>https://market.android.com/</code>. so simply I need a list of that can any one help me? </p>
<p><strong>Thanks<br>
nik</strong></p>
| android | [4] |
2,471,520 | 2,471,521 | click event for the button inside listview in android | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1709166/android-listview-elements-with-multiple-clickable-buttons">Android: ListView elements with multiple clickable buttons</a> </p>
</blockquote>
<p>how to do click event for the button inside listview in android.plz help me.if anybody know plz provide the example code</p>
| android | [4] |
5,843,777 | 5,843,778 | jQuery hover - mouseout not working | <p>I have the following script here... It works when I mouseover the item... but when the mouse leaves, it doesn't hide anything. In fact, it just seems like an endless loop. Help please! :-)</p>
<pre><code><script type="text/javascript">
$(document).ready(function() {
// Handler for .ready() called.
$(".hover").hover(
function () {
$('.hide').hide();
var clss = $(this).attr('id');
$('.pop_'+clss+'').show('slow');
},
function () {
$('.hide').hide('slow');
}
);
});
</script>
</code></pre>
| jquery | [5] |
1,468,547 | 1,468,548 | Animation causes AsyncTask HttpClient task to be super slow | <p>I have a network task defined inside of an AsyncTask that takes approximately 2-3 seconds to complete.</p>
<p>When I add the animation code below:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:duration="60"
android:interpolator="@android:anim/linear_interpolator" />
</code></pre>
<p>and then in my activity execute it as follows:</p>
<pre><code>progressImageView = (ImageView) getWindow().findViewById(
R.id.progressImageView);
progressAnimation = AnimationUtils.loadAnimation(this, R.anim.progress);
progressImageView.startAnimation(progressAnimation);
</code></pre>
<p>The network call takes approximately 12-13 seconds to complete. Am I doing something incredibly wrong here?</p>
| android | [4] |
3,386,544 | 3,386,545 | Can javascript be enabled only when the user is on a mobile devices? | <p>I'm trying to figure out how to make a javascript line work only when the user is using a mobile device.</p>
| javascript | [3] |
1,957,472 | 1,957,473 | Input a data file .txt and output specific data to a new .txt file using Python | <p>I would like to input or read the following data of a .txt file:</p>
<pre><code>VIBRATION/SHOCK CALIBRATION DATA
DATE: 2/26/2012
TIME: 0800
Time (ms) Channel 1 Channel 2 Channel 3
0.0 -0.9 9.0 12.9
50.0 5.0 12 343
100.0 56.7 120 0.8
150.0 90.0 0.9 12.0
200.0 32.9 12.4 34.0
</code></pre>
<p>Then output to a new .txt file such that only the numbers are written for Time and Channel 3 columns:</p>
<pre><code>0.0 12.9
50.0 343
100.0 0.8
150.0 12.0
200.0 34.0
</code></pre>
| python | [7] |
4,474,567 | 4,474,568 | Way to exit from the method | <p>Is there any way to exit from the method? I hear that there are two way to exit.</p>
<p><strong>One :</strong> throw Exception. </p>
<pre><code>public void dosomething() {
if(...) {
throw new MyException();
}
// there might be another process.
}
</code></pre>
<p><strong>Two :</strong> return somevalue. Even void method, we can return the value.</p>
<pre><code>public void dosomething() {
if(...) {
return;
}
// there might be another process.
}
</code></pre>
<p>Question is, Is there any better way?</p>
| java | [1] |
364,188 | 364,189 | Why isn't this referring to window when called in setTimeout | <p>If there is no binding of functions to instances in javascript how does <code>getName()</code> return <code>john</code></p>
<pre><code>function Person() {
this.name = "john";
this.getName = function() {
return this.name;
};
}
var me = new Person();
setTimeout(function(){alert(me.getName())}, 3000);
</code></pre>
<p>I though <code>this</code> would refer to the window at the point of call from <code>setTimeout</code>.</p>
<p>See jsFiddle: <a href="http://jsfiddle.net/qZeXG/" rel="nofollow">http://jsfiddle.net/qZeXG/</a> </p>
| javascript | [3] |
3,837,441 | 3,837,442 | Visual Stduio, ASP.NET, C# | <p>How can I send pictures to database and then how can take it?</p>
| asp.net | [9] |
4,622,636 | 4,622,637 | Storing just 2 variables in ASP.NET in most easy way | <p>How to store 2 integers between all users in most easiest way, should I use global session variable or cache somehow?</p>
<p>Are these safe methods - is assume lost only if server needs to be rebooted?</p>
| asp.net | [9] |
1,148,517 | 1,148,518 | Check version of Python library that doesn't define __version__ | <p>I'm dealing with a Python library that does not define the __version__ variable (<a href="http://code.google.com/p/sqlalchemy-migrate/" rel="nofollow">sqlalchemy-migrate</a>), and I want to have different behavior in my code based on what version of the library I have installed. </p>
<p>Is there a way to check at runtime what version of the library is installed (other than, say, checking the output of <code>pip freeze</code>)?</p>
| python | [7] |
1,558,172 | 1,558,173 | Check if line affected when writing a file with php | <p>how can i check if a line was written to a file?
I am trying something like this:</p>
<pre><code> if (fwrite($handle, $data) == FALSE) {
echo "<script>
alert('Not written');
</script>";
include ('index.html');
}
else{
echo "<script>
alert('Written');
</script>";
include ('index2.html');}
fclose($handle);
</code></pre>
<p>but it still notifies me as written even if nothing was put in the file.</p>
| php | [2] |
763,026 | 763,027 | Best method for dividing list into equal parts | <blockquote>
<p><strong>Possible Duplicate:</strong><br />
<a href="http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python">How do you split a list into evenly sized chunks in Python?</a> </p>
</blockquote>
<p>I have a list more than 500 elements long.</p>
<p>I want to divide it into 5 lists, each of 100 elements.</p>
<pre><code>mylist = [1......................700]
if len(mylist) > 100:
newlist1 = mylist[0:100]
someothelist = mylist[100:]
if len(someotherlist) > 100:
newlist2 = someotherlist[0:100]
someotherlist2 = mylist[100:]
</code></pre>
<p>What's the best way to implement it using iteration?</p>
| python | [7] |
4,349,407 | 4,349,408 | Timetable generation algorithm | <p>C#.Net timetable generation.</p>
<p>I'm trying to make the program for timetable generations using C#.net. So i'm looking for the algorithm,hints or links regarding this . So it would great if any one help in this. </p>
| c# | [0] |
3,606,966 | 3,606,967 | python: Dictionaries of dictionaries merge | <p>I need to merge multiple dictionaries, here's what I have for instance:</p>
<pre><code>dict1 = {1:{"a":{A}},2:{"b":{B}}}
dict2 = {2:{"c":{C}}, 3:{"d":{D}}
</code></pre>
<p>with <code>A</code> <code>B</code> <code>C</code> and <code>D</code> being leaves of the tree, like <code>{"info1":"value", "info2":"value2"}</code></p>
<p>There is an unknown level(depth) of dictionaries, it could be <code>{2:{"c":{"z":{"y":{C}}}}}</code></p>
<p>In my case it represents a directory/files structure with nodes being docs and leaves being files.</p>
<p>I want to merge them to obtain <code>dict3={1:{"a":{A}},2:{"b":{B},"c":{C}},3:{"d":{D}}}</code></p>
<p>I'm not sure how I could do that easily with Python, if anyone could help, thanks!</p>
<p>Regards,</p>
| python | [7] |
3,541,078 | 3,541,079 | Deselecting rows in table using jquery | <p>In <a href="http://jsfiddle.net/hKZqS/51/" rel="nofollow">this code</a>, if I press shift+down key it selects multiple rows and if I press the up key, it is deselecting. But if I press shift+uparrow only deselection should happen.</p>
<p>Normally using the up and down keys, I can navigate up and down.</p>
<p>eg:If table has 10 rows and using shift+downarrow, I select 3 rows, and after this I press the down arrow to row 6. From this I should be able to select rows again with deselection the previous selected rows.</p>
<p>In my code you can see </p>
<pre><code>if(code == 13) { //Enter keycode
alert(did);
if(did != undefined){
window.open('keyboard.php?q=' + did);
}
}
</code></pre>
<p>Here, if I press the enter key, it should take me to another page but for some reason I am getting an undefined error. What am I doing wrong?</p>
| jquery | [5] |
2,701,017 | 2,701,018 | Populate select box depending on choice of different select box (php / ajax) | <p>Basically I have two forms
The first form Is a simple select box which submits it's value to be processed and inserted into a database (mysql)
However on the same page I have a second form with a select box which will be auto populated with the results from the database(ajax / php), depending on which option was chosen from the first forms select box</p>
<p>So anyway I need some way to store the first select box's chosen value in a variable without submitting the form</p>
| php | [2] |
2,391,444 | 2,391,445 | Getting UIImageView to Change its Image IPhone App | <p>Still a newbie here, forgive me. I'm trying to make a button that will change an Image thats located in the same view.</p>
<pre><code>- (IBAction)myButton:(id)sender {
myUIImageView.image = [UIImage imageNamed:@"image.jpg"];
}
</code></pre>
<p>And I synthesize myUIImageView above this. I have also created it in the .h file:</p>
<pre><code>- (IBAction)myButton;
@property(retain, nonatomic) IBOutlet UIImageView* myUIImageView;
</code></pre>
<p>I have created a button called myButton in IB. Connected it's Touch Up Inside event to File's Owner. I've connected to the UIImageView with File's Owner. Also, I have image.jpg inside my resources folder, however the image stays the same when I push the button. Nothing happens! The app loads fine with no errors, any advice would help,</p>
<p>Thanks!</p>
| iphone | [8] |
1,928,493 | 1,928,494 | What is the best tips to improve the Application Performance in Asp.Net? | <p>Can any help regarding the performance improvement in Asp.Net?The best practise tips for asp.net performance improvement?</p>
| asp.net | [9] |
2,878,632 | 2,878,633 | Load HTML data into WebView, referencing local images? | <p>If I'm loading a WebView with an HTML document directly (no web server) using WebView.loadData() is there a way for that document to reference local images? If so where do I place them, and how do I reference them?</p>
<p>Or alternatively is there a way to easily encode and embed bitmaps into the HTML document?</p>
<p>I need to display local HTML documents that include images and I'd like to avoid setting up a remote server to serve the resources.</p>
| android | [4] |
5,033,434 | 5,033,435 | The Difference Between a DataGrid and a GridView in ASP.NET? | <p>I've been doing ASP.NET development for a little while now, and I've used both the GridView and the DataGrid controls before for various things, but I never could find a really good reason to use one or the other. I'd like to know:</p>
<p>What is the difference between these 2 ASP.NET controls? What are the advantages or disadvantages of both? Is one any faster? Newer? Easier to maintain?</p>
<p>The intellisense summary for the controls doesn't seem to describe any difference between the two. They both can view, edit, and sort data and automatically generate columns at runtime.</p>
<p><strong>Edit:</strong> Visual Studio 2008 no longer lists DataGrid as an available control in the toolbox. It is still available (for legacy support I assume) if you type it in by hand though.</p> | asp.net | [9] |
2,359,282 | 2,359,283 | How to retrun match element ID using jquery | <p>I want to return matched element ID using jquery filter method but it is returning 'object object' <a href="http://jsfiddle.net/xTF8f/10/" rel="nofollow">fiddle</a></p>
<p>//css</p>
<pre><code>.none{display:none}
</code></pre>
<p>//html</p>
<pre><code><div class="none">
<span style="display:none">first</span>
<span style="display:block">second</span>
</div>
</code></pre>
<p>//script</p>
<pre><code>visibles = $('.none').find('span').filter(function(){
if($(this).css('display') == 'block')
return $(this).attr('id');
});
alert(visibles);
</code></pre>
| jquery | [5] |
691,540 | 691,541 | java: default number-formatting | <p>I have a program that does algorithmic calculations with some number-output. I want this output to look nice and the program still being fast. I used the DecumalFormat but this makes it so slow, but works.
Is there a way to set the default number output so I wouldnt need DecimalFormat???</p>
<pre><code>Locale deLocale = new Locale("de_DE");
// should be format: ###,###.### 123.456,789 de_DE
Locale.setDefault (deLocale);
double f=-123456.123458998;
System.out.println (""+f+""); // I wourld expect -123.456,123
// but the output is -123456.123458998
</code></pre>
<p>any ideas?? thanks!
chris</p>
| java | [1] |
5,780,868 | 5,780,869 | Copy input from one place and use it as a variable or in another area using onclick | <p>I'm trying to figure out how to take values from one of these input boxes and duplicate them in another input box. This action would be very useful in another project I'm working on but, I can seem to get it to work.
What am I doing wrong?</p>
<p><a href="http://jsfiddle.net/qBFAe/" rel="nofollow">http://jsfiddle.net/qBFAe/</a></p>
<p>HTML</p>
<pre><code>Field1: <input type="text" id="field1" />
<br />
Field2: <input type="text" id="field2" />
<br /><br />
Click the button to copy the content of Field1 to Field2.
<br />
<button id="convert">Copy Text</button>
</code></pre>
<p>JS</p>
<pre><code>var converter = document.getElementById("convert");
var ff2 = document.getElementById('field2');
var ff1 = document.getElementById('field1');
convert.onclick = fillFun();
function fillFun(){
ff2.value=ff1.value;
}
</code></pre>
| javascript | [3] |
4,226,827 | 4,226,828 | int24 - 24 bit integral datatype | <p><br>
is there a 24Bit primitive integral datatype in C++?</p>
<p>If there is none, would it be possible to create a class int24 (, uint24 ) ?</p>
<p>it's purpose could be:<br>
* manipulating soundfiles in 24 bit format<br>
* manipulating bitmapdata without alphachannel </p>
<p>many thanks in advance</p>
<p>Oops</p>
| c++ | [6] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.