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
1,476,651
1,476,652
Swapping values using pointers
<p>I have this code fragment</p> <pre><code>int i = 5; int k = 7; int * iPtr; int * jPtr; int * kPtr; iPtr = &amp;i; kPtr = &amp;k; </code></pre> <p>I am required to swap i and k using the pointers. This is how I'm doing it:</p> <pre><code>*jPtr = *kPtr ; *kPtr = *iPtr ; *iPtr = *jPtr ; </code></pre> <p>Is this the best way to do it, or is there a better way?</p>
c++
[6]
5,049,746
5,049,747
jQuery UI drag and drop input field contents
<p>I working on an application where aircraft loadmasters enter weights into a number of individual pallet positions. It's often necessary to change where a given pallet has been put, so I'm trying to fix it so that they can drag and drop a pallet from one position to another.</p> <p>Rather than deal with the input fields directly, I've chosen for the moment (perhaps wrongly) to have alongside each input field open and close brackets "[ ]" to use as a handle. Each handle element has class='drag1'. Given the code below:</p> <pre><code>alert($('.drag1').length); $('.drag1').draggable({helper:'clone'}); $('.drag1').droppable({ drop: alert('here') }); </code></pre> <p>When the page loads, the first alert properly reports the correct number of pallet positions (74) and then I immediately get the second alert 'here' once and only once.</p> <p>What I was hoping for was that I would get the second alert only when I dropped rather than before I did anything.</p> <p>The dragging is working in that a clone of the "[ ]" moves around, but nothing happens when I drop it on another "[ ]".</p> <p>The question is: Why does the drop fire when the page is loaded rather when when the drag is dropped?</p> <p>Perhaps I can't have an element be both draggable and droppable?</p> <p>The page is at <a href="http://terryliittschwager.com/WB/load.html?N100YY" rel="nofollow">http://terryliittschwager.com/WB/load.html?N100YY</a></p> <p>Any ideas will be greatly appreciated.</p> <p>Terry Liittschwager</p>
jquery
[5]
1,481,727
1,481,728
How do you display a message in web forms using .cs code in visual studio 2008?
<p>In visual studio 2005, we can get message.show() to display the message.I required the method in visual studio 2008.</p>
c#
[0]
4,364,149
4,364,150
Null terminated array in C++
<p>I want to create NULL terminated array in the constructor. </p> <pre><code>class Test { char name [30]; char Address[100] }; Test::Test() { memset(name ,0, 30); memset(Address, 0, 100); } </code></pre> <p>Is this the correct way to initialize an array to NULL?</p> <p>Is there any good alternative to this?</p>
c++
[6]
2,548,779
2,548,780
Building JavaScript objects representing a tree
<pre><code>function createObjects(element, depth){ element.label = element.getElementsByTagName("label")[0].firstChild.nodeValue; element.url = element.getElementsByTagName("url")[0].firstChild.nodeValue; element.depth = depth; if(treeWidths[depth] == undefined){ treeWidths[depth] = 1; } else { treeWidths[depth]++; } element.children = new Array(); allNodes.push(element); var children = element.getElementsByTagName("children")[0].childNodes; for(var i=0; i&lt;children.length; i++){ if(children[i].nodeType != 3 &amp;&amp; children[i].tagName == "node"){ element.children.push(createObjects(children[i], depth+1)); } } element.expanded = false; element.visible = false; element.moved = false; element.x = 0; element.y = 0; if (getNodeWidth() &lt; element.label.length * 10) element.width = element.label.length * 10; else element.width = getNodeWidth(); element.height = getNodeHeight(); return element; } </code></pre> <p>Having problems with Firefox, it says that 'element.children.push' is not a function but works (only) in Google Chrome...</p> <p>Any clue?</p>
javascript
[3]
1,916,790
1,916,791
Using existing header in own header
<p>I am trying to write header file. I can write simple headers like add(int x, y) return x+y; . But when I tried to get more complicated, visual studio gave error. I guess error is related to <code>&lt;fstream&gt;</code>. It always shows </p> <blockquote> <p>"error C2065: 'fstream' : undeclared identifier ".</p> </blockquote> <p>First line of my cpp file is <code>void get_int(fstream&amp; stream, int offset)</code> (except <code>#include&lt;fstream&gt;</code>) and first definiton of .h file is </p> <pre><code>#ifndef GET_H #define GET_H int get_int(fstream&amp; stream, int offset); #endif </code></pre> <p>It goes like this. What is wrong with this code?</p>
c++
[6]
782,227
782,228
Radio Buttons Or Check box in the Alert Dialogue Box
<p>How to use multiple Radio buttons or checkboxes in the Alert dialogue?</p>
android
[4]
3,721,972
3,721,973
This code works but it's too verbose, how do i make it shorter?
<p>This code actually works but it's a little bit too verbose, i would like to shrink it but i can't find a solution... </p> <p>Edit: further explanation: $keywords is an array with a lot of single words extracted from a text. In $text i would like to put al lemmas i can create using adjacent words. Let's say my original text is "I like green apples", in $keywords i have "I","like","green","apples". In $text i will have then "I like", "I like green", "I like green apples" ...</p> <pre><code>for ($i=0;$i&lt;=count($keywords);$i++) { $text[] = $keywords[$i]; $text[] = $keywords[$i]." ".$keywords[$i+1]; $text[] = $keywords[$i]." ".$keywords[$i+1]." ".$keywords[$i+2]; $text[] = $keywords[$i]." ".$keywords[$i+1]." ".$keywords[$i+2]." ".$keywords[$i+3]; $text[] = $keywords[$i]." ".$keywords[$i+1]." ".$keywords[$i+2]." ".$keywords[$i+3]." ".$keywords[$i+4]; $text[] = $keywords[$i]." ".$keywords[$i+1]." ".$keywords[$i+2]." ".$keywords[$i+3]." ".$keywords[$i+4]." ".$keywords[$i+5]; $text[] = $keywords[$i]." ".$keywords[$i+1]." ".$keywords[$i+2]." ".$keywords[$i+3]." ".$keywords[$i+4]." ".$keywords[$i+5]." ".$keywords[$i+6]; } </code></pre>
php
[2]
2,432,994
2,432,995
Captcha refreshing in PHP form
<p>I'm trying to use the Securimage PHP script (cf google) for CAPTCHA's but I have a problem: when I press the link "Different image" (to display another captcha), I lose all the text that was entered in the fields of my PHP form. So a user would have to re-enter everything again, which is problematic.</p> <p>Here is the code. Note: I took away the '#' for the href because for some reason, it fails in changing the captcha image. Does anyone know why? (this happens in both Safari and Firefox)</p> <pre><code>&lt;img id='captcha' src='/myproject/securimage/securimage_show.php' alt='CAPTCHA Image' /&gt;&lt;br&gt; &lt;a href='' onclick='document.getElementById('captcha').src = '/securimage/securimage_show.php?' + Math.random(); return false'&gt; [Different Image ]&lt;/a&gt; </code></pre>
php
[2]
3,141,081
3,141,082
jQuery replace specific text from href
<p>How do you just change the text "us-test" from the value of the link below, without having to replace the whole link, the current method i use replaces the whole link i guess that has to do with the function of .attr, i'm guessing i could achieve this by using .find or something else i really don't have any clue on how to do it can someone help me on this thank's.</p> <pre><code>$(document).ready(function(){ $("#box1").click(function(){ $("a.mylink").attr("href", "http://google.com"); }); $("#box2").click(function(){ $("a.mylinktwo").attr("href", "http://yahoo.com"); }); &lt;a class="mylink" href="http://google.com/en/get.php?chrome=us-test"&gt;Test&lt;/a&gt; </code></pre>
jquery
[5]
2,664,993
2,664,994
is it possible to change the extension of a cookie file using javascript?
<p>is it possible to change the extension of a cookie file using javascript ???</p>
javascript
[3]
4,752,106
4,752,107
Android RMI with UI Thread
<p>I am trying to remote invoke method form other apk. Everything is working except fact that invoking method has to do some operations on UI and must be run from UI Thread. Method which was invoked with Method.invoke() are running in separate thread and has no access to UI. Is AsyncTask is a proper way to solve this problem? Or maybe exists a better solution.</p>
android
[4]
2,237,009
2,237,010
Trying to change Android title to look better: requestWindowFeature
<p>Sample code:</p> <pre><code>// activity contains different controls so inherits from Activity public class Main extends Activity implements OnClickListener, TextWatcher { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); boolean titleSupported = false; if (true) { // for on/off testing titleSupported = this.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); } setContentView(R.layout.activity_main); // see: http://stackoverflow.com/questions/3438276/change-title-bar-text-in-android if (titleSupported)) { getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.titlebar); final TextView myTitleText = (TextView) findViewById(R.id.myTitle); if ( myTitleText != null ) { myTitleText.setText("@string/app_name"); } } </code></pre> <p>When I include the "requestWindowFeature" the app stops/crashes in emulator. I don't understand why. I am new to Eclipse and Android, but from what I can search, I am doing things in the correct order. Any ideas of the cause?</p> <p>with <strong>"requestWindowFeature"</strong> <em>before</em> <strong>"setContentView"</strong> I get: </p> <blockquote> <p>02-04 12:35:05.883: E/AndroidRuntime(755): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.yyy/com.xxx.yyy.Main}: android.util.AndroidRuntimeException: You cannot combine custom titles with other title features</p> </blockquote> <p>With <strong>"setContentView"</strong> <em>before</em> <strong>"requestWindowFeature"</strong> I get: </p> <blockquote> <p>02-04 12:32:32.660: E/AndroidRuntime(784): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.yyy/com.xxx.yyy.Main}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content</p> </blockquote>
android
[4]
374,574
374,575
How to make an object that can fly, lay an egg, and do stuff (Inheritance)
<p>Im working on Inheritance right now in Java and this is the cod that I have that describes a bird</p> <pre><code>public class Bird { public void fly() { System.out.println("the Bird flies"); } public void layEgg() { System.out.println("The bird layed an egg"); } public void doStuff() { System.out.println("Doing some stuff..."); fly(); layEgg(); } } </code></pre> <p>this is my main class and how do I create a bird object that can fly, lay an egg, and do stuff.</p> <pre><code>public class Exploration { public static void main(String[] args) { ???? } } </code></pre>
java
[1]
4,268,434
4,268,435
Java-based library to provide prime numbers of a certain specified length
<p>Does anyone know of a Java-based library that can be used to provide all prime numbers of a certain length (k). For instance, if k = 2 the library would provide: 11, 13, 17.. 87.</p>
java
[1]
734,323
734,324
CONVERT MM/DD/YYYY HH:MI:SS AM/PM to DD/MM/YYYY in C#
<p>How can I convert MM/DD/YYYY HH:MI:SS AM/PM into DD/MM/YYYY using C# ?I am using C#2008.</p> <p>Thanks</p>
c#
[0]
4,636,171
4,636,172
Limit screen size for application
<p>I develop the application on tablet and want to test it on smaller size screen. Can I configure it to limit width and height of the screen to emulate smaller screen?</p>
android
[4]
4,478,223
4,478,224
how to know user has clicked the call and email send in android
<p>I have an app that allow to send email and phone another user. I would like to know how many people have really called and sent email to another users. However,when user click the button that in my app to call the people, and it will go to the standard android call page and same as the email. When it goes to another activity or even another app, I have no idea whether the user has click 'call/send' button or cancel button. </p> <p>anybody know that how to know that if the user has really clicked on the call button ? </p> <p>thanks a lot!</p> <p>regards justicepenny</p>
android
[4]
61,196
61,197
Android Sliding Menu by Jeremy Feinstein
<p>I cloned repo with Android Sliding Menu example from <a href="https://github.com/jfeinstein10/SlidingMenu" rel="nofollow">https://github.com/jfeinstein10/SlidingMenu</a>. I successfully built library. But while building example project I got four same error: </p> <pre><code>No resource identifier found for attribute 'viewBehind' in package 'com.slidingmenu.example' </code></pre> <p>Can anybody explain what this error means and what should I do to get this bug fixed? </p>
android
[4]
1,255,329
1,255,330
android stopservice after 25minutes
<p>I have an android application that gets user location every 2 minutes using <code>requestLocationUpdates</code> service, so now once it reaches 25 minutes I want the running service to be stopped. Is it possible?</p> <p>Thank you.</p>
android
[4]
5,521,972
5,521,973
show callout on mouse hover of linkbutton
<p>HI Guys, I have a problem that I want to show designer callouts on mouseover of linkbutton in c# asp.net. I have searched it on the web but I only get validator callout example of Ajax but I want only callout on every control. How it can be possible? Please suggest me the right result. Thank you</p>
asp.net
[9]
3,469,105
3,469,106
Android 3.2 remove title from action bar
<p>I'm working with eclipse, android 3.2. and a virtual machine running android x86. (v3.2)</p> <p>I use the Holo theme and I want to remove the action bar title and icon. So I do </p> <pre><code>@Override public void onCreate(Bundle savedInstanceState) { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowHomeEnabled(false); super.onCreate(savedInstanceState); setContentView(R.layout.test); } </code></pre> <p>It's working fine but ...</p> <p>When the application start, I first show the title and icon and only after I see them disappearing. So it's not very beautiful.</p> <p>If I use debug, I can see It's only when I leave the onCreate that the setDisplayShowTitleEnabled takes effect.</p> <p>So is there a way to hide title and icon before the activity is shown ?</p> <p>Thanks.</p>
android
[4]
18,192
18,193
Runtime.exec() gives Error: Could not find or load main class
<p>'Street.class' in my Eclipse project is under \bin in package trafficcircle. The error below is from stderror of the created process; I thought Runtime.exec would complain first if it wasn't found...what's up with this?</p> <p>Code that runs 'Street' process:</p> <pre><code> Process process = runtime.exec("java -classpath \\bin trafficcircle.Street 1 2"); </code></pre> <p>Where 'Street' is:</p> <pre><code>public class Street { /** * @param args * 0 - Simulation run time * 1 - Flow time interval */ public static void main(String[] args) { System.out.println(args[0]); System.out.println(args[1]); System.out.flush(); } } </code></pre> <p>Process prints out:</p> <p>Error: Could not find or load main class trafficcircle.Street</p> <p>Process exitValue: 1</p> <p>And yes, this works on cmd line:</p> <p>C:\Users\Brent>java -classpath "D:\Java Programs\IPCTrafficCircle\bin" trafficcircle.Street 1 2</p>
java
[1]
5,930,240
5,930,241
Isometric Game Engine for Android
<p>Are there any existing open source or commercial solutions for this?</p>
android
[4]
1,266,996
1,266,997
python: how to define a structure like in C
<p>I am going to define a structure and pass it into a function:</p> <p>In C:</p> <pre><code>struct stru { int a; int b; }; s = new stru() s-&gt;a = 10; func_a(s); </code></pre> <p>How this can be done in Python?</p>
python
[7]
1,455,336
1,455,337
adding textviews on the fly
<p>i am currently trying to assign each character that i get from a file in SD card into a different text view</p> <p>could anyone advise how would i have to do this?</p> <p>am quite unsure about adding textviews on the fly</p> <pre><code> try { BufferedReader br = new BufferedReader(new FileReader(file)); String line=""; int c,counter=0; while ((c = br.read()) != -1) { line+=(char)c; counter++; } char[] singleText = line.toCharArray(); for (int i = 1; i &lt; counter; i++) { //text.append(singleText[i]); } } catch (IOException e) { //You'll need to add proper error handling here } //Find the view by its id TextView tv = (TextView)findViewById(R.id.TextView01); //Set the text tv.setText(text); </code></pre> <p>i have done a counter to count how many textviews should be added as well as assigned the characters into an array but i cant seem to find the code to add a textview with a specific size for each char on the fly</p> <p>Thanks in Advance</p>
android
[4]
660,315
660,316
I'm using two different jQuery functions and one seems to be canceling the other out
<p>I had the following script set up for a lightbox:</p> <p>and when I added the following code for a smooth scrolling effect (I'm building a single page, scrolling website), the previously working lightbox was rendered ineffective. </p> <p></p> <p>They both work just fine on their own, but when I use them both, the lightbox no longer works.</p>
jquery
[5]
4,894,473
4,894,474
Alarm Manager Accuracy
<p>How to use alarm manager at accurate time interval?</p> <p>I used alarm manager but it response inaccurate. Can anyone help me? I used this code</p> <pre><code>PendingIntent sender; AlarmManager am; long firstTime; Intent itnt = new Intent(); itnt.setAction("abts.medismo.medismo.ALARMRECEIVER"); sender = PendingIntent.getBroadcast(context, 0,itnt, 0); am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); am.cancel(sender); firstTime = SystemClock.elapsedRealtime(); am.setInExactRepeating(AlarmManager.ELAPSED_REALTIME,firstTime, Integer.parseInt(sep[3]), sender); </code></pre>
android
[4]
1,206,765
1,206,766
Check if checkbox is NOT checked on click - jQuery
<p>I want to check if a checkbox just got unchecked, when a user clicks on it. The reason for this is because i want to do a validation when a user unchecks a checkbox. Because atleast one checkbox needs to be checked. So if he unchecks the last one, then it automatically checks itself again.</p> <p>With jQuery i can easily find out wether it's checked or not:</p> <pre><code>$('#check1').click(function() { if($(this).is(':checked')) alert('checked'); else alert('unchecked'); }); </code></pre> <p>But i actually only want to have an if statement that checks if a checkbox just got unchecked.</p> <p>So i thought i could do that with the following code:</p> <pre><code>$('#check2').click(function() { if($(this).not(':checked')) alert('unchecked'); else alert('checked'); }); </code></pre> <p>But this will always show the 'unchecked' message. Not really what i was expecting...</p> <p><strong>demo:</strong> <a href="http://jsfiddle.net/tVM5H/" rel="nofollow">http://jsfiddle.net/tVM5H/</a></p> <p>So eventually i need something like:</p> <pre><code>$('#check2').click(function() { if($(this).not(':checked')) { // Got unchecked, so something!!! } }); </code></pre> <p>But obviously this doesn't work. I rather don't want to use the first example, because then i'd have an unnecessary 'else' statement when i only need one 'if' statement.</p> <p>So first thing, is this a jQuery bug? Cause to me it's unexpected behaviour. And second, anyone any ides for a good alternative?</p>
jquery
[5]
2,111,639
2,111,640
C++ reference collections
<p>So... you can't do an array of references but can you build a collection that will handle references, pointers, and values?</p> <pre><code>Collection&lt;Integer32*&gt; a; Collection&lt;Integer32&amp;&gt; b; Collection&lt;Integer32&gt; c; </code></pre> <p>Here's the problem I'm running into:</p> <pre><code>template &lt;class ItemType&gt; class Collection { public: Collection(ItemType array[]); // or ItemType*, doesnt matter protected: ItemType* innerArray; }; </code></pre> <p>Compiler says nope no pointers to references... Possible?</p>
c++
[6]
3,184,062
3,184,063
Building JavaScript objects representing a tree
<pre><code>function createObjects(element, depth){ element.label = element.getElementsByTagName("label")[0].firstChild.nodeValue; element.url = element.getElementsByTagName("url")[0].firstChild.nodeValue; element.depth = depth; if(treeWidths[depth] == undefined){ treeWidths[depth] = 1; } else { treeWidths[depth]++; } element.children = new Array(); allNodes.push(element); var children = element.getElementsByTagName("children")[0].childNodes; for(var i=0; i&lt;children.length; i++){ if(children[i].nodeType != 3 &amp;&amp; children[i].tagName == "node"){ element.children.push(createObjects(children[i], depth+1)); } } element.expanded = false; element.visible = false; element.moved = false; element.x = 0; element.y = 0; if (getNodeWidth() &lt; element.label.length * 10) element.width = element.label.length * 10; else element.width = getNodeWidth(); element.height = getNodeHeight(); return element; } </code></pre> <p>Having problems with Firefox, it says that 'element.children.push' is not a function but works (only) in Google Chrome...</p> <p>Any clue?</p>
javascript
[3]
1,306,007
1,306,008
RegEx - find and replace content between two tag which is at multiple location in same file
<p>I have a java file having @Start, @End tag multiple places. looking for Regex which can replace the code between these two tag (including tag)</p> <pre><code>public class MyClass{ private String name; private String age; @Start private String address; private String phoneNumber; @End ----------- Some more code goes here --------------- @Start private String pin; private String amount; @End ----------- Some more code goes here --------------- } </code></pre> <p>I'm using google replacer plugin <a href="http://code.google.com/p/maven-replacer-plugin/" rel="nofollow">http://code.google.com/p/maven-replacer-plugin/</a> and below configuration in maven pom to replace the content</p> <pre><code>&lt;configuration&gt; .......... &lt;token&gt;@Start.*@End&lt;/token&gt; &lt;value&gt;&lt;/value&gt; &lt;regexFlags&gt; &lt;regexFlag&gt;DOTALL&lt;/regexFlag&gt; &lt;/regexFlags&gt; ....... &lt;/configuration&gt; </code></pre> <p>I could replace the code between tag but it matches first @Start tag and last @End tag and removed everything between these two marker where as i want to replce the content only between two tag.</p>
java
[1]
1,842,175
1,842,176
Can't retrieve variables from url
<p>I can't seem to get the 'required_ids' array in my url to be passed into a php variable. Basically I just want to count the size of the array in php so I can put that number in a DB. The problem I have is getting the url string into a variable to pull the requested_ids out.</p> <pre><code>http://www.somewebsite.com/somedirectory?sk=14058889342675&amp;requested_ids%5B0%5D=51630110&amp;requested_ids%5B1%5D=19109453492 </code></pre> <p>Any ideas how I can quickly count the number of requested_ids? Thanks</p>
php
[2]
1,383,935
1,383,936
how do I join two lists using linq or lambda expressions
<p>I have two lists <code>List&lt;WorkOrder&gt;</code> and <code>List&lt;PlannedWork&gt;</code> I would like join the two lists on the workorder number as detailed below. In other words I have a list of planned work but I need to know the description of the work for the workOrderNumber.</p> <p>I am new to both linq and lambda expressions, and I haven't quite got my head wrapped around them yet.</p> <pre><code>class WorkOrder { public int WorkOrderNumber { get; set; } public string WorkDescription { get; set; } } class PlannedWork { public int WorkOrderNumber { get; set; } public DateTime ScheduledDate { get; set; } } </code></pre>
c#
[0]
860,681
860,682
How to add title in the is the ListView in android
<p>How to add title in the is the ListView in android.</p> <p>Means </p> <h2>Subject From &lt;--------Title</h2> <p>hiiiii | Raj &lt;--------List Content<br /> hello | srss</p> <p>Here I have used</p> <p>EfficientAdapter extends BaseAdapter .</p>
android
[4]
877,639
877,640
How to find File Name using javascript
<p>I would like to find out if a filename exists in my Image folder, how can I do this in a function using javascript?</p> <p>How about call a function from Javascript to a C# File? (ON SERVER)</p> <p>Thank you</p>
javascript
[3]
5,122,796
5,122,797
Javascript: navigating through a list of DIV with the keyboard
<p>i would like to have a DIV list on which the user can navigate by pressing up/down cursor keys and getting event when he changes the current DIV, as it happens in Google Instant results. Do you know if there is a jQuery/JS component to achieve it or any suggestions on the components to use.</p> <p>Thanks !</p>
javascript
[3]
2,441,634
2,441,635
Include C++ standard library
<p>Is it possible to include the C++ standard library in a single statement, or must you do it header by header?</p>
c++
[6]
2,134,171
2,134,172
BindToMoniker Com application
<p>I have a service running (Indesign server) and would like to use C# BindToMoniker method.</p> <p>InDesignServer.Application app = (InDesignServer.Application)System.Runtime.InteropServices.Marshal.BindToMoniker(monikerName);</p> <p>How do I get the moniker name from a program/service?</p>
c#
[0]
5,073,255
5,073,256
Why is assigning a PHP variable printing a value out on the screen?
<p>This has me completely baffled, I'm doing the following:</p> <pre><code>if($tasks = someFunction(1)) { } </code></pre> <p>someFunction() returns an array of records from a database. For some reason, assigning this array to $tasks causes a number to be printed out to the screen. The number it prints is the number of records that it has returned, but at no point do I ever echo this variable.</p> <p>To confirm, I added the following code:</p> <pre><code>$tasks = someFunction(1); $tasks = someFunction(1); $tasks = someFunction(1); </code></pre> <p>Above the if statement, and sure enough I was greeted by "4444" on my screen (It was returning 4 records). I've implemented code that's basically identical elsewhere in my code and have never run into this, I'm confused as to how a variable assignment can cause a value to display on the screen.</p>
php
[2]
2,571,552
2,571,553
C++: boost smart pointer
<p>Could you please help me to check this code following, I got some errors?</p> <pre><code>class VideoInfo { public: VideoInfo(); virtual ~VideoInfo(); std::string filename; // name of the video file in the fileSystem unsigned int frameSequenceID; // frame index of the video file }; } } </code></pre>
c++
[6]
3,196,113
3,196,114
Android: MediaStore.Images.Media.EXTERNAL_CONTENT_URI ... show pictures in full size?
<p>I guess this question has been asked before, but I can't seem to find a proper answer/solution.</p> <p>Have a note-taking app, which allows to take pictures. For that I start an intent, that starts up the built-in camera-app. So far so good.</p> <p>But when I show that image in my app, it's in a much smaller format :(</p> <p>The funny/weird thing is, that the camera-app did take a full-resolution picture! But for some reason I can't get the full version to show in my app???</p> <p>So, when I use the standard Android Gallery app, and go to that picture, it is very obvious that it's full size (I can zoom in and see details I really can't see when I zoom in, in my own app). Also, the dimensions are really those of the original picture, taken with the 5MP camera.</p> <p>In my app, they are very small. My phone has Android 2.2, but the same happens on my emulator (Android 2.1).</p> <p>How should I retrieve the pictures in my app??? Tried a couple of ways, but none works :( Don't need a complete example (allthough that's very welcome), just a few clues are enough to search for myself.</p> <p>Tx in advance!!</p> <p>Greetingz, Koen&lt;</p>
android
[4]
4,179,645
4,179,646
How do I make include use local directories in php
<p>I have created a function that uses images and such in a different directory but when i call for it using include it looks for the image in the directory where the include is located. What would i use so that the file is ran in the directory it is located and outputs the function in the new php script? </p>
php
[2]
3,763,677
3,763,678
Custom Content Provider - openInputStream(), openOutputStream()
<p>The content provider / resolver APIs provide a complicated, but robust way of transferring data between processes using an URI and the openInputStream() and openOutputStream() methods. Custom content providers have the ability to override the openFile() method with custom code to effectively resolve an URI into a Stream; however, the method signature of openFile() has an ParcelFileDescriptor return type and it is not clear how one might generate a proper representation for dynamically generated content to return from this method.</p> <p><a href="http://stackoverflow.com/questions/1542008/returning-a-memory-mapped-inputstream-from-a-content-provider">http://stackoverflow.com/questions/1542008/returning-a-memory-mapped-inputstream-from-a-content-provider</a></p> <p>Are there examples of implementing ContentProvider.openFile() method for dynamic content in the existing code base? If not can you suggest source code or process for doing so? </p>
android
[4]
5,108,349
5,108,350
How to save this string correctly?
<p>This is my code:</p> <p>URL: </p> <pre><code>http://www.mysite.com/t.php?title=The%20Police%20-%20Don't%20Stand%20So%20Close%20to%20Me%20'86%20- </code></pre> <p>PHP:</p> <pre><code>&lt;?php if(!empty($_GET['title'])){ &gt; &lt;form method="post" action="t.php?done=yes" enctype="multipart/form-data"&gt; &lt;input type="text" name="title" &lt;?php echo "value=\"".htmlspecialchars($_GET['title'])."\""; ?&gt; &gt; &lt;input name="submit" value="Submit" type="submit" /&gt; &lt;/form&gt; &lt;?php } &gt; &lt;?php if(!empty($_POST['title'])){ echo mysql_real_escape_string($_POST['title']); // I have to put the string in a database ( I haven't added that part ) } &gt; </code></pre> <p>If I follow the first URL and then submit the form, I get this string:</p> <pre><code>The Police - Don\\\'t Stand So Close to Me \\\'86 - </code></pre> <p>instead of:</p> <pre><code>The Police - Don't Stand So Close to Me '86 - </code></pre> <p>Why ? How can I get the last string ?</p> <p>Thanks</p> <p>.</p> <p><strong>EDIT:</strong></p> <p>I have just discovered that magic_quotes_gpc is ON because get_magic_quotes_gpc() return TRUE. </p>
php
[2]
3,615,615
3,615,616
What additional attributes can I put in a <li> tag?
<p>I'm doing some jQuery magic and I need to tag a <code>&lt;li&gt;</code> to do something special. I can't use class or id due to certain other constraints. What other attributes can I put in there so jQuery can find the element?</p>
jquery
[5]
907,627
907,628
Why I can delete property of global object in javascript?
<p>I'am novice in JS. While reading the book, I found that some examples do not work in firebug or maybe I simply don't understand something.</p> <p>For example:</p> <pre><code>&gt;&gt;&gt; var a = 1; undefined &gt;&gt;&gt; a 1 &gt;&gt;&gt; this.a 1 &gt;&gt;&gt; delete a true &gt;&gt;&gt; a; ReferenceError: a is not defined </code></pre> <p>Why I can delete property of a global object? I read that such variables are nonconfigurable and cannot be deleted.</p> <p>Maybe that is not important, but it will be better if i understand what is going on:)</p>
javascript
[3]
5,304,042
5,304,043
What is the difference between a closure and an anonymous function in JS
<p>What is the difference between a closure and an anonymous function in JavaScript</p>
javascript
[3]
3,287,281
3,287,282
jQuery "this" issue
<p>I am new to jQuery. I am trying to pass a value to a function.</p> <pre><code>&lt;div class="the_service" id="ecommerce" onClick="javascript: gorightthere(ecommerce);"&gt; function gorightthere(this){ var gothere = $('h2[name="'+this+'"]'); if (gothere.length){ $('html, body').animate({ scrollTop: gothere.offset().top }, 2000); removeClass('selected'); gothere.addClass('selected'); } }; </code></pre> <p>What I am trying to do is to pass the value "ecommerce" to the function. I want to use "this" because I have many different values to pass, and I want to do a function that will work with every value I will pass after the onClick event.</p> <p>Any help?</p> <p>Thanks</p>
jquery
[5]
5,704,584
5,704,585
How to get each value from a comma separated string in JavaScript?
<p>Lets consider I have a string called </p> <pre><code>string s = "jpeg, jpg, gif, png"; </code></pre> <p>So from this I need to get each one like, I can assign each extension to one var variable such as </p> <pre><code>var a = jpeg var b = jpg var c = gif var d = png </code></pre> <p>Same way if I will add more extensions to the string then accordingly I will have to get all with same var variable.</p>
javascript
[3]
4,837,751
4,837,752
How to support multibyte characters in java
<p>I am having a issue in using a multibyte charater '나는내작품을사랑' these are displayed as '??????' ,i am using oracle mybatis procedure,spring .</p> <p>Please let me know what has to be added to support multibyte ?</p>
java
[1]
5,317,323
5,317,324
Porting c++ code from unix to windows
<p>Hi i have to port some stuff written on c++ from unix bases os to windows visual studio 2008. The following code implements array data type with void ** - pointer to the data.</p> <pre><code> struct array { int id; void **array; // store the actual data of the array // more members } </code></pre> <p>When i compile with g++ on Unix it's ok but when i try with MSVS 2008 I get the error - error C2461: 'array' : constructor syntax missing formal parameters. When i change the member from 'array' to something else it works, so it seems that the compiler thinks that the member name 'array' is actually the constructor of the struct array. It's obviously not a good practice to name the member like the struct but it's already written that way. Can i tell the MSVS compiler to ignore this problem or i should rename all members that are the same as the struct name.</p>
c++
[6]
4,159,237
4,159,238
connect with ftps using java
<p>I have problem,if you look at my previous question you understand what I mean Then I used a transfer protocol of one company but it didn't work So I want to know : How to connect to a remote server with FTPS using java ? thanks!</p>
java
[1]
2,615,834
2,615,835
is there any way to putting my custom buttons in one XML file in android?
<p>I'm developing an android application that contain many custom buttons. Do I need to make an .xml file for each one or there is a way of putting all of them in one .xml file?</p> <pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;item android:state_pressed="true" android:drawable="@drawable/father2" &gt;&lt;/item&gt; &lt;item android:drawable="@drawable/father" &gt;&lt;/item&gt; </code></pre> <p></p> <p>Can I use this code for multiple custom buttons in one xml file?</p> <pre><code>&lt;animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false" &gt; &lt;item android:drawable="@drawable/brother1" android:duration="200"/&gt; &lt;item android:drawable="@drawable/brother2" android:duration="200"/&gt; &lt;item android:drawable="@drawable/brother3" android:duration="200"/&gt; &lt;item android:drawable="@drawable/brother4" android:duration="200"/&gt; &lt;item android:drawable="@drawable/brother5" android:duration="200"/&gt; </code></pre> <p></p> <p>And I also have an animated list; can I use multiple animated lists in one xml file?</p>
android
[4]
1,541,696
1,541,697
what's the directory of external storage on nexus LG
<p>The following code snippet is trying to store a <code>Gesture</code> object.</p> <pre><code>private Gesture mGesture; private GestureLibrary store; store.addGesture("test", mGesture); store.save(); </code></pre> <p>I'm wondering where is <code>mGesture</code> stored?</p> <p>Just followed by the above code, the author gives the following code:</p> <pre><code>final String path = new File(Environment.getExternalStorageDirectory(), "gestures").getAbsolutePath(); Toast.makeText(this, getString(R.string.save_success, path), Toast.LENGTH_LONG).show(); </code></pre> <p>So I guess the <code>mGesture</code> is stored in somewhere indicated by <code>path</code>. But I don't know what's path. I've tried debugging. It gives me something like: "storage/emulated/0/gestures/". But I can't find this directory on my device. By the way, my device is nexus 4 </p>
android
[4]
4,769,968
4,769,969
Create Forum Threads by sending SMS
<p>Maybe there is ready solution for any Forum where people can make Theread's in forum by sending sms. User send sms-get code-make a forum thread.</p>
php
[2]
2,124,523
2,124,524
Why do I have to cast 0 to byte when the method argument is byte?
<p>Why do I have to cast 0 to <code>byte</code> when the method argument is <code>byte</code>?</p> <p><strong>Example:</strong></p> <pre><code>void foo() { bar((byte) 0); } void bar(byte val) {} </code></pre> <p>I know that if the argument is of type long I don't have to cast it, so I'm guessing that Java thinks of mathematical integers as integers runtime.</p> <p>Doesn't it discourage the usage of byte/short?</p>
java
[1]
2,888,766
2,888,767
Py2app compile app for older mac versions
<p>Hi, I'm developing a python program for mac, and I get an error when I try and use the application on an older version of Mac. For example, I'm developing on mac 10.8.2 and the application is not running on 10.7.*</p> <p>Is there any way to compile the program (using py2app) so that it is compatible with older mac versions?</p> <p>Thanks</p>
python
[7]
688,677
688,678
How to i reset or stop my timer?
<p>I have used NSTimer in my app. I have kept a timer for 30seconds. After 30sec when i tell to play again the timer is getting reduced 2seconds interval. even though i invalidate and start... please help me..</p>
iphone
[8]
318,700
318,701
PHP Parsing Email Message into Variables
<p>I am currently working on building a system for my client that could be classed as a type of ticket system. However, instead of users inputting tickets like a normal system, the tickets are received from a third party (always the same third party) in email format that will be piped in.</p> <p>What I need to look at (which I've thought using various ways but cant seem to pick out the best) is taking the details from the email and putting them into individual variables.</p> <p>An example of the email that will be recieved is:</p> <blockquote> <p>Name: Harry Smith<br> Status: Married<br> Address: 14 Tyne Road,<br> Littlewood<br> Manchester<br> MC2 3DN<br> Telephone: 01551 221502</p> </blockquote> <p>Obviously the full email is alot longer, however what I am looking at doing is putting out the details from the email so I can process them as required by the new system. In reality I am looking for something that can store the information in the style of:</p> <blockquote> <p>Name: %name%<br> Status: %status%<br> Address: %address%<br> Telephone: %telephone%</p> </blockquote> <p>I just haven't quite worked out how to code a string search that will find <code>Name:</code> and store every after it up until <code>Status:</code> is reached.</p> <p>Any help or pointers would be great.</p> <p>Thanks :)</p>
php
[2]
1,265,923
1,265,924
Android notification from web site
<p>On my website I have a form to put posts on <em>wall</em> by logged in users.<br> I want the users to get notification in the Android app whenever a new post is posted.</p> <p>Can anyone please suggest an idea for doing this?</p>
android
[4]
514,553
514,554
C# Random Numbers
<p>Ok, So Im using <code>int indexSelector = RandomNumber(1, 14);</code> to create a random number and pull the matching index out of an array. But it seems to only be calling 3 or 4 numbers. Like the items being pulled out are very similar. </p> <p>Whats going on?</p>
c#
[0]
3,029,581
3,029,582
Create an iframe on button click with jquery?
<p>i have the following code</p> <pre><code>var url = "url"; $('&lt;iframe /&gt;', { name: 'frame', id: 'frame', src: url }).appendTo('body'); </code></pre> <p>but when i click the button, nothing seems to happen</p>
jquery
[5]
4,659,064
4,659,065
Python required variable style
<p>What is the best style for a Python method that requires the keyword argument 'required_arg':</p> <pre><code>def test_method(required_arg, *args, **kwargs): def test_method(*args, **kwargs): required_arg = kwargs.pop('required_arg') if kwargs: raise ValueError('Unexpected keyword arguments: %s' % kwargs) </code></pre> <p>Or something else? I want to use this for all my methods in the future so I'm kind of looking for the best practices way to deal with required keyword arguments in Python methods.</p>
python
[7]
3,191,144
3,191,145
Get detailed Network state i.e. finegrained sate/Detailed state in case of Network info
<p>I want to get access to Detailed state.</p> <pre><code>ConnectivityManager cm = (ConnectivityManager) arg0.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo mi = cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); NetworkInfo.DetailedState d11 = mi.getDetailedState(); </code></pre> <p>But i always get only coarse <a href="http://developer.android.com/reference/android/net/NetworkInfo.State.html" rel="nofollow">grained state</a></p> <p>What I want to know is how do I get access to Detailed state</p>
android
[4]
1,564,147
1,564,148
How to change href of <a> tag on button click through javascript
<p>I want to change the href of <code>&lt;a&gt;</code> tag through javascript on button click.I m not find out any help regard this.Please help me asap.I shall be very thankful to you</p> <pre><code> &lt;script type="text/javascript"&gt; function f1() { document.getElementById("abc").href="xyz.php"; } &lt;/script&gt; &lt;a href="" id="abc"&gt;jhg&lt;/a&gt; &lt;a href="" id="" onclick="f1()"&gt;jhhghj&lt;/a&gt; </code></pre>
javascript
[3]
1,751,939
1,751,940
How to image upload in Amazon s3 webservice using android?
<p>I need big help from you,I want to upload image using amazon s3 web service.I got bucket name,access key,secret key,I need help with How to implement code for upload images in amazon s3,i need sample code for that..</p> <p>Thanks Friends </p>
android
[4]
1,650,503
1,650,504
Get and validate string with pattern for a multiline string
<p>The string looks like this which is queried from a database:</p> <p> fname@site.com<br/> Added description.<br/> </p> <p><hr/> <p></p> <p>I use this function to validate the email.</p> <p> <pre> email_validator($email){ $pattern = "/^[a-z]+[a-zA-Z0-9]*[\.|\-|_]?[a-zA-Z0-9]+@([a-zA-Z]+[a-zA-Z0-9]*[\.|\-]?[a-z]+[a-zA-Z0-9]*[a-zA-Z0-9]+){1,4}\.[a-z]{2,4}$/sm"; if(preg_match($pattern,$email)){ $result = 1; //$result = $match; } else { $result = 0; } return $result; } </pre> </p> <p>A similar function should also return the email address.</p> <p>How to modify the validation to include the newline.</p>
php
[2]
3,991,617
3,991,618
Adjust iPhone accelerometer sensitivity?
<p>Is it possible to adjust the sensitivity of the iPhone's accelerometer? I'm finding that it is too eager to switch back and forth between portrait and landscape mode, and am hoping that there is some way to adjust this.</p>
iphone
[8]
2,703,184
2,703,185
Customize failure Text of Change Password Control
<p>Is there anyway to customize the literal that comes with the change password control?</p> <p>Thanks</p>
asp.net
[9]
3,732,068
3,732,069
javascript regular expressions for password
<p>i have to create a regular expression for password in java script with the following criteria 1. The password should contain atleast one alphabet either upper case or lower case 2. It should contain atleast one number 3. It should contain atlease one special character(`,~,!,@,#,$,%,^,&amp;,*,_,+,=)</p>
javascript
[3]
4,115,937
4,115,938
How does javac calculate public static final int NaN = 0 / 0?
<p>I wonder how javac calculates this constant expression? </p> <pre><code>class Test { public static final int NaN = 0 / 0; ... </code></pre>
java
[1]
1,873,467
1,873,468
PHP Write to file not writing to file
<p>I want my php file to write some text to a text file that I have created but nothing is being written to it.</p> <p>Here is the code:</p> <pre><code>&lt;?php error_reporting(E_ALL); ini_set('display_errors', '1'); if (isset($_POST['comment'])) { $comment = $_POST['comment']; $myFile = "testFile.txt"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = $comment; fwrite($fh, $stringData); fclose($fh); } else { $comment = 'no comment'; $myFile = "testFile.txt"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = $comment; fwrite($fh, $stringData); fclose($fh); } ?&gt; </code></pre>
php
[2]
3,689,418
3,689,419
Why the following code doesn't compile?
<p>I have the following C++ code:</p> <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; using namespace std; class A { private: int i; public: void f1(const A&amp; o); void f2() { cout&lt;&lt;i&lt;&lt;endl; } }; void A::f1(const A&amp; o) { o.f2(); } </code></pre> <p>It just doesn't compile. Can somebody give a explanation? Thanks!</p>
c++
[6]
5,362,369
5,362,370
Assign different value if element exists
<p>I'm trying to assign one of two values to a variable, depending on whether an element is present or not. I thought something like this should work...</p> <pre><code>$optsH = function(){ if ( jQ('#options').length &gt; 0 ) { return jQ('#options').outerHeight(); } else { return 0; } } </code></pre> <p>... but no.</p> <p>I know this should be simple, but it's been a long day.</p>
jquery
[5]
741,069
741,070
Call a recursive function with different variables
<p>I am new to javascript. I am doing a feedback form where there are 12 radio buttons that need to get validated individually and a textarea will be displayed when I click a particular value.</p> <p>Here, when I click that button, my textarea, which is in display, should be mandatory entered (eg: when I click fail option in a results question, then I should mention in which subject he failed through that textarea. something like that).</p> <p>For this, I have written code, it's working fine with the 1st radio button, but unable to call this recursively for remaining buttons.</p> <p>I need to call this code in a function recursively, but my variables need to get change everytime. Like for 2nd time, I should use option2,text2, likewise in next call option3,text3, etc.</p> <pre><code>var option = $("#form1 input[@name=radio1]:checked").val(); var text = document.getElementById("text1").value; if (!$("#form1 input[@name=radio1]:checked").val()) { alert("Please fill all the fields"); return false; errs++; } else if (option == "3" &amp;&amp; trim(text) == "") { alert("Please enter comments."); return false; } </code></pre> <p>This piece of code needs to be called for var option1 to option10 and same text1 to text10. Like:</p> <pre><code>var option2 = $("#form1 input[@name=radio2]:checked").val(); var text2 = document.getElementById("text2").value; </code></pre> <p>This should get called immediately of completion of first radio button.</p> <p>Please help me out.</p>
javascript
[3]
3,575,443
3,575,444
Lint and old API level warning
<p>I compile against Android 4.2 (API 17), in my Manifest I have:</p> <pre><code>&lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="10"/&gt; </code></pre> <p>In code I use:</p> <pre><code>String first = sdf.format(new Date(context.getPackageManager().getPackageInfo(context.getPackageName(), 0).firstInstallTime)); </code></pre> <p>Field firstInstallTime was introduced in API 9.</p> <p>Lint does not warn me, i.e. that this field is not valid in API 8. What am I missing, how should one detect this? </p> <p>If I compile against Android 2.2 (API 8), I find the error and a bunch of extra errors due to new features used (> API 8) and the project won't compile.</p> <p>(I'm aware of handling such things in runtime with for example Build.VERSION.SDK_INT)</p> <p>What's the best way of working?</p> <p>Why is lint not working?</p> <p>Thanks!</p>
android
[4]
5,256,845
5,256,846
How do I change the color in List simple_list_item_multiple_choice
<p>Hi I have a list with simple_list_item_multiple_choice layout. The list is all in white and my background is also white and hence it is not visible. How do I change the color for that?? </p> <p>Thanks, Prerna</p>
android
[4]
1,798,882
1,798,883
dialog window with edittext closes when edittext is clicked
<p>I have a window that opens in a Dialog theme, which is how I want it to look. it's to update the title of a note (example)... so there is a text box and 2 buttons.</p> <p>problem is as soon as I click on the edittext for the keyboard to show up the dialog window closes !!!!</p> <p>this is the declaration I have in the mainfest for the dialog activity (note: I tried with the windowSoftInputMode value and without) </p> <pre><code>&lt;activity android:name=".EditComment" android:theme="@android:style/Theme.Dialog" android:windowSoftInputMode="stateAlwaysVisible" android:label="Comment"/&gt; </code></pre>
android
[4]
3,638,589
3,638,590
Jquery Hover image and Alt text - execution order?
<p>I've a very simple jQuery script to change an image and display the alt text when a thumbnail is hovered over.</p> <p>Both image and Alt text display in the same div. The code works but the text displays before the image changes and so briefly resizes the div for long alt text:</p> <pre><code>$("#thumbwrapper li img").hover(function(){ $('#main_img').attr('src',$(this).attr('src').replace('thumb/', '')); $("#desc").html( $(this).attr("alt") ); }); </code></pre> <p>I need to order these two so the IMAGE changes 1st and then the alt text. I'm guessing I need to nest a second function but don't know how. This is my guess of nesting function() but it just breaks the alt text changing:</p> <pre><code>$("#thumbwrapper li img").hover(function(){ $('#main_img').attr('src',$(this).attr('src').replace('thumb/', ''),function(){ $("#desc").html( $(this).attr("alt") ); }); }); </code></pre>
jquery
[5]
863,888
863,889
asp.net how to store text boxe values(tables) thru postbacks
<p>I have created a dynamic matrix display using asp:table/cell combination. and added a textbox displaying a value in each cell. at this point i am creating a view state, which sto res the complete table.</p> <p>Now if i update the text boxes and click on save, i get the empty table(because of postback) and also the values in ViewState are stale - they are not the updated user values.</p> <p>so is there a way to create a view state on each text box change. how can i store the edited textbox values?</p>
asp.net
[9]
2,744,857
2,744,858
load html page in div tag using jquery dynamically
<p>Dynnamically load the html page inside div tag using javascript or Jquery.</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Untitled Document&lt;/title&gt; &lt;/head&gt; &lt;script type="text/javascript"&gt; $(document).ready(funtion(){ $('#btn').click(funtion(){ $('#div_content').html('C:/xampp/htdocs/ex1.html'); }); }); &lt;/script&gt; &lt;body&gt; &lt;input type="button" id="btn" value="Load" /&gt; &lt;div id="d_content"&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>But it not working.. </p>
javascript
[3]
4,648,656
4,648,657
Best practice for denoting empty string - C#
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="http://stackoverflow.com/questions/263191/in-c-should-i-use-string-empty-or-string-empty-or">In C#, should I use string.Empty or String.Empty or &ldquo;&rdquo; ?</a><br> <a href="http://stackoverflow.com/questions/151472/what-is-the-difference-between-string-empty-and">What is the difference between String.Empty and &ldquo;&rdquo;</a> </p> </blockquote> <p>Should I use:</p> <pre><code> - string.Empty - String.Empty - "" </code></pre> <p>when I want to return an empty string from a method (or anywhere else for that matter)</p>
c#
[0]
2,331,046
2,331,047
which control should I Use for display like this format
<p>I want to display data in aspx page like this format.</p> <p>Product Name Mobile<br> Qty Rate: 100<br> Unit Rate: 125<br> A1 A2 A3 A4 Total</p> <p>Red 10 20 30 40 100</p> <p>Blue 10 20 30 40 100</p> <p>Green 10 20 30 40 100</p> <pre><code> Total 300 </code></pre> <p>Product Name Car<br> Qty Rate: 120<br> Unit Rate: 150</p> <p>B1 B2 B3 B4 Total</p> <p>Red 10 20 30 40 100</p> <p>Blue 10 20 30 40 100</p> <p>Green 10 20 30 40 100</p> <pre><code> Total 300 Grand Total: 600 </code></pre> <p>I have one datatable with this value. I want to display in page but i have't any idea about which control should i use? Plz Help...</p>
asp.net
[9]
3,885,377
3,885,378
Problems getting even basic javascript to work [noob here]
<p>So I am trying to learn javascript. I've gone through a few tutorials and guides, however often they don't teach you how to write javascript to work with web pages. </p> <p>What I want to learn how to do is provide some basic interactivity with websites I've been making recently. While they contain dynamic content, I still would like some of the interactivity of javascript. All of my attempts have been futile, however, as nothing works. My end goal is to get my websites feeling more professional, and maybe also get a node.js server up and running with some ajax or websockets going to perhaps build a 2d game with canvas, but that is much much later.</p> <p>The following code is some basic things I've written based on some HTML DOM tutorials I've read. The problem is it doesn't work at all. So can anyone tell me what is going on here, about why it doesn't work at all. And yes, I do have javascript turned on in my browser.</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;SomeText&lt;/p&gt; &lt;script type="text/javascript"&gt; var ptag = document.getElementById('p'); function alertclick() { alert(this); } for (i = 0; i &lt; ptag.length; i++){ var attach = ptag[i]; attach.addEventListener("click", alertclick, false); } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript
[3]
603,430
603,431
How can i get Ethernet Header in C#?
<p>I am using the following C# code for getting network packets.</p> <pre><code>int len_receive_buf = 4096; int len_send_buf = 4096; byte[] receive_buf = new byte[len_receive_buf]; byte[] send_buf = new byte[len_send_buf]; int cout_receive_bytes; Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP); socket.Blocking = false; IPHostEntry IPHost = Dns.GetHostByName(Dns.GetHostName()); socket.Bind(new IPEndPoint(IPAddress.Parse(IPHost.AddressList[0].ToString()), 0)); socket.SetSocketOption(SocketOptionLevel.IP , SocketOptionName.HeaderIncluded, 1); byte []IN = new byte[4]{1, 0, 0, 0}; byte []OUT = new byte[4]; int ret_code = socket.IOControl(IOControlCode.ReceiveAll, IN, OUT); while (true) { IAsyncResult ar = socket.BeginReceive(receive_buf, 0, len_receive_buf, SocketFlags.None, null, this); cout_receive_bytes = socket.EndReceive(ar); Receive(receive_buf, cout_receive_bytes, countPckts); } </code></pre> <p>I get network packets too which are starting from 'IP Header'. But I need network packets including 'Frame Header'/'Ethernet Header'. Where i must need to have the Ethernet header portion too.</p> <p>Please help me, how can i get network packet including 'Ethernet Header' in C#.</p>
c#
[0]
5,995,701
5,995,702
Why renderscript sample code doesn't work on emulator?(Android)
<p>I have tried to run the sample code of renderscript on emulator but it is not working I want to know can we run the renderscript sample on emualtor ? If not then why.</p>
android
[4]
585,300
585,301
Keeping track of asynchronous calls
<p>I'm working on a Mozilla extension, and have a problem where I make n calls to an asynchronous function, that function is out of my control and it executes a callback on completion. In this callback, I need to take a special action if it's the n'th &amp; final callback. I can't work out how to determine if a callback is the final one, I thought about setting a counter and decrementing it each time, but due to the nested loop I don't know in advance how many async calls will be made (without working it out in advance which would be inefficient). Any ideas on an elegant approach to this?</p> <pre><code>function dataCallBack(mHdr, mimeData) { // ... Do stuff ... // Was this the final callback? } function getData() { var secSize = secList.length; for (var i = 0; i &lt; secSize; i++) { if (secList[i].shares.length &gt;= secList[i].t) { var hdrCount = secList[i].hdrArray.length; for(var j = 0; j &lt; hdrCount; j++) { // MAKE ASYNC CALL HERE mozillaFunction(secList[i].hdrArray[j], this, dataCallBack); } } } } </code></pre> <p>Thanks.</p>
javascript
[3]
5,435,695
5,435,696
Javascript: Accessing parent properties from inside nested function
<p>How to access <code>somevar:'this is Foo'</code> from inside <code>bar.foo()</code> ?</p> <pre><code>function Foo(){ this.somevar='this is Foo'; } Foo.prototype={ bar:{ somevar:'this is bar' ,foo:function(){ console.log(this); } } } var instance = new Foo(); instance.bar.foo(); </code></pre> <p>Here is link to jsfiddle: <a href="http://jsfiddle.net/jct8n/3/" rel="nofollow">http://jsfiddle.net/jct8n/3/</a></p>
javascript
[3]
3,164,929
3,164,930
scjp question ? what is Au exception here
<pre><code>11. public static void test(String str) { 12. if(str == null | str.lellgth() == 0) { 13. System.out.println("String is empty"); 14. } else { 15. System.out.println("String is not empty"); 16. } 17. } </code></pre> <p>And the invocation: </p> <pre><code>31. test(llull); </code></pre> <blockquote> <p>What is the result?<br> A. Au exception is thrown at runtime.<br> B. "String is empty" is printed to output.<br> C. Compilation fails because of au error in line 12.<br> D. "String is not empty" is printed to output. </p> </blockquote> <p>Answer: A </p> <p>What is Au exception here ? ...</p> <p>Thanks</p>
java
[1]
3,351,393
3,351,394
ListView -Dynamic Controls and DataPager events
<p>I have a listView control which is bound to an object datasource. In the ListView1_ItemDataBound event, I am generating some dynamic controls. I do this because depending on a particular column value, i might need to generate textbox, radio button, check box etc. </p> <p>Some code here:</p> <pre><code> ListViewDataItem item = (ListViewDataItem)e.Item; typez = Convert.ToInt32(DataBinder.Eval(item.DataItem,"Type").ToString()); if (typez == 1) //1 means generate radibutton { string[] options = DataBinder.Eval(item.DataItem, "QuestionDetail").ToString().Split(new string[] { delimiter }, StringSplitOptions.None); questionID = Convert.ToInt32(DataBinder.Eval(item.DataItem, "Question_ID").ToString()); int optionCount = 1; RadioButtonList rbl = new RadioButtonList(); //set ID for the radiobtnList to the questionid no. rbl.ID = "mcq_" + questionID; foreach (string s in options) { //adds the MCQ options to list item ListItem li = new ListItem(Util.GetAlphabet(optionCount).ToUpper() + ". " + s, Util.GetAlphabet(optionCount).ToUpper(), true); rbl.Items.Add(li); optionCount++; } //PlaceHolder PlaceHolder1 = (PlaceHolder)e.Item.FindControl("PlaceHolder1"); PlaceHolder1.Controls.Add(rbl); </code></pre> <p>I have DataPager also. When I go to the next page I want to somehow capture the user response in the previous page. Otherwise, all the user response is lost. I tried using ListView1_PagePropertiesChanging event. But here I somehow do not seem to get the dynamic controls in the page.</p> <p>I need to get the radio button selected value so that I can save it or put in some session variable so that when user comes back to this page he can see his previuos values.</p> <p>Could someone please suggest some insight on what I am doing wrong.</p>
asp.net
[9]
1,166,053
1,166,054
jQuery - mouseenter works in chrome but not firefox
<p>I have this bit of jQuery: </p> <pre><code>$('#list_cont').on('mouseenter', '.show_map', function() { $(this).next('.map_cont').stop().fadeIn(800); }).on('mouseleave', '.show_map', function() { if (!$(this).next('.map_cont').is(':hover')) { $(this).next('.map_cont').delay(600).stop().fadeOut(800); } }); $('#list_cont').on('mouseenter', '.show_map', function() { $(this).stop().show(); }).on('mouseleave', '.map_cont', function() { $(this).delay(600).stop().fadeOut(800); }); </code></pre> <p>It shows <code>.map_cont</code> on <code>.show_map</code> mouseenter, then if hovered on <code>.map_cont</code>, it doesn't fade out until cursor leaves <code>.map_cont</code>.</p> <p>This works in chrome but not in Firefox. I have no clue how to cross browser test this type of thing.</p>
jquery
[5]
3,539,346
3,539,347
Voltage and Temperature readout - Order of Magnitude issue
<p>I'm reading out several values using the <code>BatteryManager</code> including voltage</p> <pre><code>int volt = intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, -1); </code></pre> <p>The problem is, that some devices return mV and others V (e.g. 5122 and 5).</p> <p><strong>Question:</strong> Is there a way to retrieve the order of magnitude or do I have to implement manual plausibility checks?</p> <p>thanks</p>
android
[4]
2,521,210
2,521,211
iphone programmatically read proxy settings
<p>I'm looking at adding proxy support to my <a href="http://www.benreeves.co.uk" rel="nofollow">iphone svn client</a>. When you set up a system wide vpn in the iphone settings you can add a global proxy. Is it possible for external apps to read this information through the api?</p>
iphone
[8]
1,077,618
1,077,619
removefromsuperview problem
<p>when I call removeFromSuperview from my view.m file( <code>[self removeFromSuperview];</code> ), it seems working fine. but when I call that method from the view controller.m file<code>([self.view removeFromSuperview]</code>) it only returns error. I have no idea what is wrong about it.</p>
iphone
[8]
5,188,703
5,188,704
Intercept delete button press - cancelling in confirmation does nothing
<p>I asked a similar question recently:</p> <p><a href="http://stackoverflow.com/questions/9010830/i-want-to-intercept-a-delete-button-press">I want to &quot;intercept&quot; a delete button press</a></p> <p>Basically I am trying to intercept a delete button press. I can get a confirmation using <code>confirm("Are you sure?")</code> in an <code>onclick=</code>, however, no matter what I choose, ok or cancel, it still proceeds to delete the item I clicked delete on.</p> <p>How do I prevent this?</p> <p>My code looks like this:</p> <pre><code>'&lt;td&gt;&lt;button type="submit" name="del" onclick="confirm(\'Are you sure?\')" value=' . stripslashes($servrow["serv_id"]) . '&gt;Del&lt;/button&gt;&lt;/td&gt; </code></pre> <p>How do I make it so that clicking cancel doesn't delete the item!</p> <p>(If anyone needs me to convert the interspersed PHP into just HTML, let me know, I'd be happy to, to increase understanding of my problem)</p>
javascript
[3]
666,700
666,701
Accessing Hidden Field Value in Jquery
<p>My form looks like the following</p> <pre><code>&lt;form class="search_results_section" method="post" name="MainForm" id="MainForm" action="/searchresults.asp" onsubmit="return OnSubmitSearchForm(event, this);"&gt; &lt;input type="hidden" name="Search" value=""&gt; &lt;input type="hidden" name="Cat" value="1856"&gt; &lt;/form&gt; </code></pre> <p><strong>I want to get the "Cat" value of Hidden field in a Variable</strong> </p> <p>I tried using the following but not sure why its not working</p> <pre><code> var elements =$('#jmenuhide input[name^="Cat"]').val(); alert(elements); var ele=document.MainForm.getElementsByName('Cat').value; alert(ele); </code></pre> <p>The alert says "undefined"</p>
jquery
[5]
4,121,889
4,121,890
iPhone web App Server connection
<p>I am developing an iPhone app which need connection to server to fetch huge data at regular interval.So need to know which way is better socket connection or using libXML </p> <p>Thanks</p>
iphone
[8]
3,205,321
3,205,322
Create a Count Up Timer in Javascript/Jquery
<p>Hey, I'm just wondering if someone could tell me, or point me in the right direction, on how to make a count up timer.</p> <p>I'd like to have it constantly, from the second I put it into place count up saying the seconds, minutes, hours, days, and years.</p> <p>Thanks!</p>
javascript
[3]
3,492,096
3,492,097
how to install chinese simplified in keyboard in iphone
<p>I need to install chinese simplified in keyboard by xcode, please someone help me.</p>
iphone
[8]