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
5,942,544
5,942,545
Why does this JSON.parse return error: "unexpected token illegal"?
<p>I'm using an AJAX request. This is the first time I'm using JSON or any of it's methods. The ajax utility returns an argument to the onreadystatechange callback as the responseText or responseXML of the file I'm requesting. Using a simple <code>info.txt</code> and <code>request.responseText</code> will work fine but when I try <code>info.js</code> and <code>JSON.parse</code> it returns "Unexpected token ILLEGAL" when I've checked multiple times that my syntax is correct. Here is the JSON:</p> <p>JSON:</p> <pre><code>{ first: 1, second: 2 } </code></pre>
javascript
[3]
2,232,946
2,232,947
Purpose & Tutorial for how we make customized usage of `std::iterator`
<pre><code>class MainClass { class EmbeddedClass {...}; class const_iterator : public std::iterator&lt;std::random_access_iterator_tag, EmbeddedClass&gt; {...} class iterator: public const_iterator {...}; }; </code></pre> <p>I have seen the above design in a legacy project.</p> <p>Question 1> What is the main purpose to design an embedded <code>class const_iterator</code> and <code>class iterator</code>?</p> <p>Question 2> Is there a good design tutorial that illustrates how we can implement the customized <code>const_iterator</code> or <code>iterator</code> class in a professional way?</p> <p>Thank you</p>
c++
[6]
3,475,016
3,475,017
callback causing memory leak
<pre><code>Model.GetData(function (args,jsonData) { RenderData(jsonData); }); </code></pre> <p>I am passing a callback to my model class, </p> <pre><code>var Model = (function () { function GetData(args,callback) { // do all math works. var HTTPClient; HTTPClient.onload = function () { callback(this.responseText); }; } })(); </code></pre> <p>Will my callback cause memory leak in my view page.</p>
javascript
[3]
2,030,799
2,030,800
DIV width immediately after append is calculating wrong?
<p>In the script I'm working on, I'm appending markup for a feedback form to the body and then centering that element (a DIV) on screen with jQuery. In the code sample below, form_code holds my form markup. The defined CSS styles for #feedback_form explicitly define a width. However, the calculation for width() called immediately after appending is calculating wrong, returning a dimension almost equal to the entire width of the page. </p> <p>If I alert the width with console, even seconds later, it calculates correctly. Never run into this before, can somebody shed some light on this?</p> <pre><code>jQuery('body').append(form_code); alert(jQuery("#feedback_form").css("width")); </code></pre>
jquery
[5]
3,109,116
3,109,117
Programming voicemail in Android
<p>Is it possible to program my voicemail box in Android using Android SDK or NDK.</p> <p>What I want to know is that if someone calls me and I am busy on another line. Can I direct their call to some app that gives them some sort of IVR menu to choose from ?</p> <p>Thanks in advance.</p>
android
[4]
1,078,754
1,078,755
How to make code compatible for both IOS 5 and IOS 4 [iphone]
<p>I am on a new project. I want my code compatible to be for both IOS4 and IOS5 SDKs. I need all my functionalities work both in IOS4 and IOS5. That said, i am not planning to use new features in IOS5 (feature wise) and disable that feature for IOS4.</p> <p>I have 2 options. Let me know which is best ?</p> <ol> <li>Target and code for IOS4. and that will work fine in IOS5 also, i think.</li> <li>BaseSDK IOS5 and target IOS4 .(I am not planning to use ARC or storyboard for now anyway ).</li> </ol> <p>I think with method #2, i have to be extra careful while using each usages at the same time as i am not using story board and ARC , there are no benefits. So hope #1 is better.</p> <p>Let me know expert opinion. </p> <p>Note: in future if need to switch to IOS5 new features , hope only this ARC will be the blocking and that is also an optional thing and i can easily switch rt?</p>
iphone
[8]
3,487,247
3,487,248
Not getting exact result in python with the values leading zero. Please tell me what is going on there
<blockquote> <blockquote> <blockquote> <p>zipcode = 02132</p> <p>print zipcode</p> </blockquote> </blockquote> </blockquote> <p>result = 1114</p>
python
[7]
5,761,443
5,761,444
Uncaught SyntaxError: Unexpected end of input - Javascript error
<p>I get this error when i try to call this function in Chrome 16.0.912.77 m:</p> <pre><code>function fade(e){ if(op &gt; 0){ op -= 0.01; document.getElementById(e).style.opacity = op; window.setTimeout("fade(\""+e+")\"", 10); } } </code></pre> <p>It's a simple function which fade a element on my page out. I read that the error appears when i forgett a }-bracket, but i closed all..</p> <p>Any ideas?</p>
javascript
[3]
1,131,574
1,131,575
Initialization list on different subclasses
<p>I've got a large, abstract, class <code>InfoBase</code> with lots of properties. Then there are a few subclasses, which have a handful of properties. I will recieve an object with information to instansiate a subclass object of <code>InfoBase</code> which will then be returned, something like this:</p> <pre><code>private static InfoBase CreateInfo(Dictionary&lt;string, string&gt; userInput) { InfoBase info; if(userInput["InfoType"] == "SomeInfo") { info = new SomeInfo { sharedData1 = Process(userInput["data1"]), sharedData2 = ProcessDifferently(userInput["data2"] + userInput["AuxData"]), // ... specialData1 = Something(userInput["blah"]) }; } else if(userInput["InfoType"] == "OtherInfo") { // ... And so on } return info; } </code></pre> <p>Almost all the fields of the <code>info</code> object will be initialized in the same way, so I'd like to share that initialization instead of copy/pasting it, and just change the specifics. I'd like to do the shared initialization with an initialization list, instead of having twenty rows of <code>info.data1 = ...;</code>. Is this possible? Ideally, something like this:</p> <pre><code>InfoBase info = WhateverMagicStuff { sharedData1 = // ... }; SomeInfo specificInfo = SomeInfo(info); specificInfo.specialData1 = // ... </code></pre>
c#
[0]
2,814,940
2,814,941
2D Arrays: Retreiving Row/Column And Not Value
<p>Simply as my title states, I'm wishing to compare an array with itself, so it doesn't process a certain body of code unless the coordinates are different. For example:</p> <pre><code>if (one [a][b] == two [c][d]) { //Do Nothing } else { System.out.println(one [a][b]); } </code></pre> <p>What I want to do is to compare the coordinates used ([a][b] and [c][d]), and not the value of what the element of one or two is. Is there a way to do this?</p>
java
[1]
2,250,131
2,250,132
Download apk and start install prompt inside android application
<p>I'm building a private enterprise Android application. My goal is to detect when there is update available and offer user to download it. If user choose to download update file is downloaded and android app install prompt is showed.</p> <p>I successfully check for update, the problem is that apk file is not downloaded (empty file is created) therefore "There is a problem parsing the package." error is showed in android app install prompt.</p> <p>Code:</p> <pre><code>public void downloadfileto(String fileurl, String filename) { String myString; try { FileOutputStream f = new FileOutputStream(filename); try { URL url = new URL(fileurl); URLConnection urlConn = url.openConnection(); InputStream is = urlConn.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is, 8000); int current = 0; while ((current = bis.read()) != -1) { f.write((byte) current); } } catch (Exception e) { myString = e.getMessage(); } f.flush(); f.close(); install(filename); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } protected void install(String fileName) { Intent install = new Intent(Intent.ACTION_VIEW); install.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive"); startActivity(install); } </code></pre> <p>Function downloadfileto is called with:</p> <pre><code>downloadfileto("http://some-url/ind.apk", "data/data/my.package.name/app.apk"); </code></pre>
android
[4]
3,376,929
3,376,930
spatial index for lines
<p>I have lots of line segments (that represent various surfaces such as walls, ceilings and floors). I want to efficiently determine which lines are within the player's bounding box.</p> <p>(Right now I'm cycling through all lines, and whilst correct, it is proving much too slow).</p> <p>There are several kd-tree and other spatial indices in Javascript but they all store points rather than lines.</p> <p>I actually only need to query by the x axis; it would suffice with a 1D range tree of some sort.</p> <p>How can you efficiently store and retrieve shapes such as lines?</p> <p>Once built, the index would not be added to.</p>
javascript
[3]
4,504,415
4,504,416
dotx (Word Template) file manipulation using ASP.Net
<p>I have a <strong>dotx</strong> file which contains placeholders to be replaced with DB values including Image place-holders.</p> <p>Should I convert <strong>dotx</strong> file to <strong>docx</strong> first and then replace the placeholders in my .net application?</p> <p>Or there is some other way to do same.</p> <p>Please guide.</p> <p>Thank you!</p>
asp.net
[9]
4,677,787
4,677,788
How to create chart with the crystal reports in ASP.Net?
<p>How to create chart with the crystal report in asp.net.</p> <p>Please reply.........</p> <p>Regards, Hrishi</p>
asp.net
[9]
4,380,943
4,380,944
C++ assignment operator associativity
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4176328/undefined-behavior-and-sequence-points">Undefined Behavior and Sequence Points</a> </p> </blockquote> <p>after the following c++ code, the array a contains: 0, 1, 2, 3, 4</p> <pre><code>int a[5] = {0,1,2,3,4}; int i = 2; a[i++] = a[i++]; </code></pre> <p>i expected it to be: 0, 1, 3, 3, 4</p> <p>could anyone explain me why?</p>
c++
[6]
5,656,346
5,656,347
Binary utilities for Android
<p><code>busybox</code> provides some, but not all, useful binary utilities for Android. For example, there are no <code>pstree</code> or <code>file</code>. To use these utilities, one must cross-compile them with ARM as target. </p> <p>Question:</p> <ol> <li><p>Are there any other sources of Android binary utilities?</p></li> <li><p>Is there any toolchain for cross-compiling binary utilities on Android (possibly with a guide)? And how to deal with the library issues?</p></li> </ol> <p>Thanks.</p>
android
[4]
4,758,130
4,758,131
Difference between pass-by-reference & and *?
<p>What is the difference between passing-by-reference and using the C pointer notation?</p> <p><code>void some_function(some_type&amp; param)</code></p> <p>and</p> <p><code>void some_function(some_type *param)</code></p> <p>Thanks</p>
c++
[6]
4,127,705
4,127,706
jQuery: How do you pass $(this) as function parameter?
<p>All jQuery examples I see has in-line functions.</p> <p>If the function is pretty long, or if the function is reusable, I may want to separate the function.</p> <p>For example, how can I turn this</p> <pre><code>$('#myElement').click(function(){ $(this).addCss('clicked'); }) </code></pre> <p>into something like this</p> <pre><code>$('#myElement').click(ElementClicked($(this)) function ElementClicked(???){ ???.addCss('clicked'); } </code></pre> <p>Thanks!</p>
jquery
[5]
1,755,525
1,755,526
i have java code and i wont to find the defect in it & this is the code
<pre><code>package com.foobar; import java.lang.String; import java.util.*; /** * An example program for an application suitte. * * @since 1.1.1 * @author Richard Torkar * @author * @throws NullPointerExceptions These are of course thrown throughout the code. */ public class Example extends Object { static final transient public int ZERO = 0; /** * The constructor. * * @return quits if the value is set. */ public Example() { super(); } /** * &lt;description&gt; * * @param * @author * @since * @version */ public void skeletal() { int hashCode = super.hashCode(); int a = -1; switch (hashCode) { case 0: a = 14; case 1: a = 23; break; } if (a &gt; 4); System.out.println("a is greater than 4"); } /** * A confusional function; between types and names. * * @param Object The first value. * @param String The second value. * @return int The returned thingy. */ public int mixed(Object one, String str) { return 0; } /** * A test function that takes 4 arguments and sums them. * * @param first The first value. * @param third The third value. * @param secodn The second value. * @param fourth The fourth value. * @returns the sum of the values. */ public int sum(int first, int second, int third) throws Exception { return first + second + third; } /** * The main thingy. * * @author Richard Torkar * @param argv List of arguments. */ public static void main(String[] args) { } } </code></pre>
java
[1]
818,914
818,915
error with mainactivity.java
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/8498869/r-cannot-be-resolved-to-a-variable-hello-world">R cannot be resolved to a variable - Hello World</a> </p> </blockquote> <p>I was developing my first app but get stuck on <code>mainactivity.java</code>.</p> <p>Here is my code: </p> <pre><code>package com.nterface; import android.app.Activity; import android.os.Bundle; import android.view.View; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } /** Called when the user clicks the Send button */ public void sendMessage(View view) { // Do something in response to button } } </code></pre> <p>An error occurs on line <code>setContentView(R.layout.activity_main);</code></p> <p>Multiple markers at this line:</p> <ul> <li>R cannot be resolved to a variable</li> <li>Line breakpoint:MainActivity [line: 12]- onCreate(Bundle)</li> </ul>
android
[4]
5,151,048
5,151,049
What is the fastest way to copy a double[] in Java?
<p>Simple question, what's the fastest way of copying an array of doubles in Java. I currently do this...</p> <pre><code>public static double[] clone_doubles(double[] from) { double[] to = new double[from.length]; for (int i = 0; i &lt; from.length; i++) to[i] = from[i]; return to; } </code></pre> <p>which also does the allocation to avoid overflows, but if there is a quicker way I will separate the allocation from the copy.</p> <p>I have looked at <code>Arrays.copyOf()</code> and <code>System.arraycopy()</code> but I'm wondering if anyone has any neat tricks.</p> <p><strong>Edit:</strong> How about copying a <code>double[][]</code>?</p>
java
[1]
480,669
480,670
Why reading Floating point number from file gives rounded output?
<p>i have a file and two inputs are shown below:</p> <blockquote> <p>34.800287000 0.077352000</p> </blockquote> <p>i'm reading from a file(by getline then define stringstream) and saving it in my class variables which are both defined <strong>double</strong>. However when i check my variables i see that:</p> <blockquote> <p>34.8003 0.077352</p> </blockquote> <p><strong>EDIT:</strong> i'm using cout to check my variables.</p> <p>why is that ?</p> <p>thanks.</p>
c++
[6]
395,186
395,187
when we will use user control?
<p>when and where we will use user control ? actually i want to ask it's best practices.</p> <p>i have read on msdn about user control there it was written .</p> <p>At times, you might need functionality in a control that is not provided by the built-in ASP.NET Web server controls. In those cases, you can create your own controls. You have two options. You can create: "User controls= User controls are containers into which you can put markup and Web server controls. You can then treat the user control as a unit and define properties and methods for it."</p> <p>i confused from first statement ? what he want to say ?</p>
asp.net
[9]
1,852,602
1,852,603
How To Validate X Days Before D-Day?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/676824/how-to-calculate-the-difference-between-two-dates-using-php">How to calculate the difference between two dates using PHP?</a> </p> </blockquote> <p>Let's say I have given date like this :</p> <pre><code>$Christmas = '2012-12-25'; $Today = date('Y-m-d'); </code></pre> <p>I want to create an <code>if</code> statement like this :</p> <pre><code>if ($Today != 7 days before $Christmas) { echo 'Christmas still to far away'; }else ($Today == 7 days before $Christmas) { echo 'Christmas will be here within less than a week!'; } </code></pre> <p>How to create validation date such like that? thanks.</p>
php
[2]
4,296,478
4,296,479
Using OnClick Listener in Listview
<p>I want to be notified when an item in a listview has been clicked , I have a main activity that has a ListView , I want to be notified when an Item in a this list has been Clicked , I did not override main activity to ListActivity .</p>
android
[4]
2,408,066
2,408,067
Control scrolling DIV with keyboard
<p>I have a div that contains a table that has many rows in it. The scrollbar displays correctly and works correctly when using the mouse. However, in an effort to make it keyboard driven I have made the div have focus and then being able to use the arrow keys (via a onKeyPress event I am able to move up and down the div. </p> <p>This works except for a little quirk... When the div gains focus and I press the down arrow key, the scrollbar also moves down (effectively hiding the row I'm now currently focused on). So my question is, is there any way to avoid this from happening?</p> <p>I was looking at the following commands: doScroll(), or scrollTo(), or scroll()</p> <p>Would any of those work or is there something else I could do to correct the behavior of the scroll bar?</p>
javascript
[3]
2,210,072
2,210,073
Invalid Postback occurring?
<p>I keep getting this error:</p> <blockquote> <p>Invalid postback or callback argument. Event validation is enabled using in configuration or &lt;%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.</p> </blockquote> <p>I have registered the ClientScriptMagner.Regis.... but still nothing.</p> <p>I have dropdownlist's in a control and when my form is submitted, this happens.</p> <p>How do I fix this?</p>
asp.net
[9]
2,380,368
2,380,369
Identical Javascript code works in separate file
<p>So I was beating my head against a wall, again and again, trying to find the error in my complex code. Finally, with nothing else to do, I copied and pasted the code into another file and called it code2.js and linked my hmtl file to this code. Suddenly, it works. Any ideas? It wasn't even the entire code went from broken to fixed, it was the new edit I was making went from broken to fixed. I know I was continuously saving the file, this was not the issue.</p> <p>For background I use cpanel content managing system. Perhaps it's a bug in this?</p> <p>Anyone seen anything like this?</p>
javascript
[3]
774,353
774,354
Python: How can I run python functions in parallel?
<p>I researched first and couldn't find an answer to my question. I am trying to run multiple functions in parallel in Python.</p> <p>I have something like this:</p> <pre><code>files.py import common #common is a util class that handles all the IO stuff dir1 = 'C:\folder1' dir2 = 'C:\folder2' filename = 'test.txt' addFiles = [25, 5, 15, 35, 45, 25, 5, 15, 35, 45] def func1(): c = common.Common() for i in range(len(addFiles)): c.createFiles(addFiles[i], filename, dir1) c.getFiles(dir1) time.sleep(10) c.removeFiles(addFiles[i], dir1) c.getFiles(dir1) def func2(): c = common.Common() for i in range(len(addFiles)): c.createFiles(addFiles[i], filename, dir2) c.getFiles(dir2) time.sleep(10) c.removeFiles(addFiles[i], dir2) c.getFiles(dir2) </code></pre> <p>I want to call func1 and func2 and have them run at the same time. The functions do not interact with each other or on the same object. Right now I have to wait for func1 to finish before func2 to start. How do I do something like below:</p> <pre><code>process.py from files import func1, func2 runBothFunc(func1(), func2()) </code></pre> <p>I want to be able to create both directories pretty close to the same time because every min I am counting how many files are being created. If the directory isn't there it will throw off my timing. </p>
python
[7]
5,670,086
5,670,087
Getting information from the battery usage indicator
<p>What I would like to do is get the data from the built in battery usage indicator screen in Android. This is the screen that displays what has been using battery life in percentages, such as display, cell standby, wifi etc.</p> <p>I've searched through the Android developer site and can't seem to find any information on this. I assume this data isn't accessible through an API. Has anyone been successful in getting this data?</p>
android
[4]
2,284,611
2,284,612
what will be the result of atoi (argv[1])?
<p>I just want to know that what will these line actually do.</p> <pre><code> int main(int argc, char *argv[]) </code></pre> <p>And especially this one.</p> <pre><code> int n = atoi (argv[1]); </code></pre> <p>I read this from a book but i cannot understand these line.</p>
c++
[6]
1,787,978
1,787,979
using python 2.7 : sh: -c: line 0: syntax error near unexpected token `('
<p>Python 2.7</p> <p>I am getting the following error message. Not clear as to why this is. I have searched and no luck. Fairly basic script. Has worked across all our windows environments</p> <pre><code>#!/usr/bin/env python import os import time import subprocess import platform #Log Files source = ['"/home/datatec/ds/datos"' ] #Backup target_dir = "/home/datatec/Backup" #Zip file + date and time target = "target_dir + os.sep + time.strftime('%Y%m%d') + platform.node() + '.zip'" zip_command = zip_command = "zip -r {0} {1}".format(target, ' '.join(source)) err = open('error.txt' , 'w') #Run the backup + verify if os.system(zip_command) == 0: print('Successful backup to', target) else: print('Backup FAILED') #create server directory, all folders are moved at end of the week mkdir = 'ssh logcp@ushsdata01p "cd ../proddata;sleep 3;hn=$ushsdtec01p;mkdir ushsdtec01p;"' os.system(mkdir) dz = "rm /home/datatec/Backup/*.zip" psfiles = "scp *.zip logcp@ushsdata01p:/proddata/ushsdtec01p/" print 'TRANSFERRING ZIP FILES!!' if os.system(psfiles) == 0: os.system(dz) print ('Files transferred') else: print('TRANSFER FAILED') err.write("job failed") err.close() </code></pre> <p>this is the output:</p> <pre><code>sh: -c: line 0: syntax error near unexpected token `(' sh: -c: line 0: `zip -r target_dir + os.sep + time.strftime('%Y%m%d') + platform.node() + '.zip' "/home/datatec/ds/datos"' Backup FAILED </code></pre>
python
[7]
3,302,302
3,302,303
Python within python
<p>I have two python scripts. First python script calls second. But seconds python script should use one variable from first script to give desired result. I know I can just writes those few codes in second script to first one simply. But I am curious how to do this on this way. Tnx.</p>
python
[7]
1,848,680
1,848,681
How to get the most recent National Weather Service radar images?
<p>I am trying to get the most recent NWS radar images using c#. There are <a href="http://radar.weather.gov/ridge/RadarImg/NCR/OKX/?C=M;O=D" rel="nofollow">directories</a> on the NWS website that contain a list of the most recent images. However, the files are named by the date uploaded, not in numerical order. They are generally uploaded every few minutes, but the exact amount of minutes can vary by as much as 5 minutes. To get the URLs of the images, I could write an XML parser to extract the URLs from the index page, however this seems over complicated for such a simple task. In addition, this index page is not an API, and if they might change something with the format that would screw up the XML parser. Is there some other way to get the URLs of the most recent images?</p>
c#
[0]
3,591,181
3,591,182
Android non-root lock replacement
<p>Let me begin by saying that, yes, I know that the stock Android lock screen can not be programatically replaced without rooting. </p> <p>Now that that's over with, I want to make an app that contains a custom 'lock' mechanism. There are apps out there that emulate this functionality, namely LockGo. This allows a user to view information from widgets on a 'lock screen' and emulates the slide-to-unlock functionality (or whack-a-mole if the user wants to install that plugin). </p> <p>Does anyone know what mechanism or Android API functionality they may have used to do this? Is it as simple as hooking into the power button to launch an activity, such as in the link below?</p> <p><a href="http://stackoverflow.com/questions/3703071/how-to-hook-into-the-power-button-in-android">How to hook into the Power button in Android?</a></p> <p>Any insight to this would be appreciated.</p>
android
[4]
3,241,859
3,241,860
Is Android Context thread safe?
<p>When I use the Android Context within an AsyncTask#doInBackground, is it thread safe? The context is provided via constructor or via getApplicationContext() from a surrounding Activity. This simple questions is asked a lot at stackoverflow and else where but I found not a clear answer?</p> <p>E.g. in the doInBackground() I use the context in order to Instantiate an DAO class.</p> <pre><code> @Override protected Void doInBackground(Void... params) { ExampleDao dao = new ExampleDao(context); ... } </code></pre> <p>I saw several examples doing that in this way, but I cannot image that this is thread-safe, because the context is now accessed by the main tread (UI Thread) and the worker thread. </p>
android
[4]
1,750,866
1,750,867
removeData causing the value to revert to the value of
<p>According to the <a href="http://api.jquery.com/removeData/" rel="nofollow">documentation</a>, .removeData() will cause the value of the property being removed to revert to the value of the data attribute of the same name in the DOM.</p> <p>Q: What does that mean?</p>
jquery
[5]
2,961,593
2,961,594
line breaks (enter pressed) inside tags?
<p>I have a div editablecontent, which has the following code</p> <pre><code>&lt;span id="id1"&gt;Hello &lt;/span&gt; &lt;span id="id2"&gt;there &lt;/span&gt; &lt;span id="id3"&gt;how &lt;/span&gt; &lt;span id="id4"&gt;are &lt;/span&gt; &lt;span id="id5"&gt;you? &lt;/span&gt; </code></pre> <p>Now the thing is when cursor is inside one of these spans and I press enter, I want it to be</p> <pre><code>&lt;span id="id1"&gt;Hel[enter pressed here]&lt;/span&gt; &lt;span id="xx"&gt;lo &lt;/span&gt; &lt;span id="id2"&gt;there &lt;/span&gt; &lt;span id="id3"&gt;how &lt;/span&gt; &lt;span id="id4"&gt;are &lt;/span&gt; &lt;span id="id5"&gt;you? &lt;/span&gt; </code></pre> <p>so it detects if you're in a span an splits the span into a new one?</p>
jquery
[5]
1,054,547
1,054,548
What's a good online source for learning java
<p>I always wanted to be able to program. But I never knew where to began, so any book's, videos or lessons I can start with.</p>
java
[1]
3,255,068
3,255,069
Extracting the a value from a tuple when the other values are unused
<p>I have a tuple <code>foo</code> which contains something I don't care about and something I do.</p> <pre><code>foo = (something_i_dont_need, something_i_need) </code></pre> <p>Is it more correct to use</p> <pre><code>_, x = foo </code></pre> <p>or </p> <pre><code>x = foo[1] </code></pre> <p>The only things I can think of are different behaviour if <code>foo</code> isn't of length two. I suppose this is fairly case-specific, but is one of these the de-facto pythonic way of doing things?</p>
python
[7]
2,161,775
2,161,776
Order a variable to display from the highest to lowest value
<p>my code below will echo the position of the user if the number($nm) fall between the range so let say i have $nm = (10,4,3,3,1) respectively the position will be (staff,staff,staff,marketer,staff) instead of (marketer,staff,staff,staff,staff) how can i arrange so that marketer come first (marketer,staff,staff,staff,staff).</p> <pre><code>$query = "SELECT DISTINCT username,num FROM user ORDER BY num DESC LIMIT 5"; $result = mysql_query ($query) or die('query error'); while( $line = mysql_fetch_assoc($result)){ $um = $line[username]; $nm = $line[num]; echo "name:$um"; if($nm &lt;= 50){ echo "Position: president"; }else if($nm &lt;= 40){ echo "Position: vice"; }else if($nm &lt;= 30){ echo "Position: manager"; }else if($nm &lt;= 20){ echo "Position: marketer"; }else if($nm &lt;= 10){ echo "Position: staff"; } </code></pre>
php
[2]
2,028,308
2,028,309
Remove html table rows after 2nd row
<p>how remove html table rows after 2nd row? if in table have 5 row, 1 and 2 are safe, 3,4,5 must be remove </p>
jquery
[5]
1,729,868
1,729,869
Swipe Pages in Android
<p>I have a question that I want to Swipe Screens with touch in Horizontal Manner with Many Pages. Means the background of all these pages are same but Pages over that are different. Same as the WallPaper Screen of any Android Phone which is horizontal Scrollable and Pages are different. How to implement this in our project? PLease suggest me for right result.</p>
android
[4]
4,194,888
4,194,889
iPhone - increase UIImageView size and keep the image size fixed
<p>I have a custom UIImageView class which I use to handle multi-touch events on the UIImageView. When the user touch begins, I want to increase the UIImageView's frame but keep the UIImage size fixed.</p> <p>I tried changing the UIImageView's frame and then calling the drawInRect: method of UIImage to keep the UIImage's size fixed. But this is not working.</p> <p>The contentMode for the UIImageView is set as ScaleAspectFit and as soon as I increase the frame size of the UIImageView, the UIImage size also increases (and is not affected by the drawInRect:)</p> <p>Can someone please tell me how I can achieve this?</p> <p>Thanks.</p> <p><strong>Adding more details</strong></p> <p>What I am trying to do is this</p> <ol> <li><p>Place a UIImageView on the screen with the size same as the size of the image</p></li> <li><p>When the user selects the image, anywhere he touches, the image edits as if the user is doing multi-touch with the image</p></li> </ol> <p>If I increase the size of the imageview to detect touches any where, the image size also increases... Hope that makes things clearer!</p> <p>Thanks</p>
iphone
[8]
2,425,626
2,425,627
not able to change name after copying a form
<p>I'm trying to copy and past a form within a project using Visual Studio. </p> <p>I've managed to copy and past the form (right clicking in the Solution explorer > Copy; Right click again paste) I can change the name of the new form in the Solution explorer. But when I select the form [Design] I can't change the name property without changing the name property in the original form. Somehow the two are linked. What am I doing wrong? </p> <p>I hope this all makes sense. </p>
c#
[0]
2,297,230
2,297,231
iPhone trying to phrase a php file return from my web service
<p>I have made up a simple set of web services (trying to make a super simple chat server) that return a string. I cannot figure out a easy way to phrase the string using the NSString class. the string looks something like</p> <p>start user tedpottel fred Oreo<br> end user start comments hello today how are you say whats up end comments</p> <p>I would like to 1. extract a separate nsstring from start user to end user and start comment to end comment 2. then extract each line by using /n as the start and begging.</p> <p>I can only find methods to get all the text from the end to a index, or from the begging to a index. I did not see anything for extrcating a string between to strings, or something like mid in php (ahhhh I wish i was using php now).</p> <p>Since there is code to phrase xml files, there must be a way to do this am I missing something?????? Ted</p>
iphone
[8]
163,749
163,750
Why do we use Object as a synchonized lock?
<p>Does it provide any benefit over using lock on String etc?</p> <pre><code>private Object lock = new Object(); private String lock = new String(); </code></pre>
java
[1]
5,066,121
5,066,122
How can Data will show dynamically on the pages
<p>In my database there is a table where every time multiple records will come.I have a screen where I have to show all the data,means first row display in first page second row data will display on second page,so how can I do this.how can I show page dynamically.In my page there is are so many images and I am taking text view on my images and data will show on these text view.</p> <p>How can I do this please help me..</p>
android
[4]
1,625,460
1,625,461
About NSPredicate in Core Data Fetch
<p>I have two entities, User &amp; Message.</p> <ul> <li>Message has a created_at timestamp;</li> <li>Message has a sender[to one relationship with User];</li> <li>User has a sentMessages[to many relationship with Message];</li> </ul> <p>However I want to fetch all users who have sent any messages and with their latest sent message fetched together.</p> <p>I've try fetch message and set predicate </p> <pre><code>created_at = sender.sentMessages.@max.created_at </code></pre> <p>but the compiler told me unable to parse sql statement? How can I do that?</p>
iphone
[8]
5,299,553
5,299,554
Javascript Regexp for Amount
<p>Strugling with trying to do the following without having to write a complex regexp:</p> <p>I want the following inputs only: Numbers, commas (,) and Period (.)</p> <p>Example</p> <ul> <li><strong>123.123.101.45,00</strong> </li> <li><strong>1.0</strong> </li> <li><strong>1,00</strong> </li> <li><strong>5</strong> </li> <li><strong>50</strong> </li> </ul> <p>As you can see from the examples above all 3 types of input (number,comma and Period) dont have to be all present at the same time but these are the only 3 types of input I want to allow. Anything else should not be allowed.</p> <p>Can someone help please, thanks in advance.</p>
javascript
[3]
1,800,329
1,800,330
Unexpected Results When Comparing getString() Return Values
<p>I am facing a problem is that the if statement which I am coding is producing wrong results and can't compare two results:</p> <p>My code is:</p> <p><code>temp_code</code> has value <code>130</code> and <code>rs.getString(employee_id)</code> has value <code>130</code> also</p> <pre><code>String temp_code = rs.getString(employee_id); if ((rs.getString(employee_id)).equals(temp_code)) { out.println("employee IDs equal"); } else { out.println("employee IDs not equal"); } </code></pre> <p>But it is giving me that the employee IDs not equal</p> <p>when I am printing the values both of them are 130 and when I am printing the value of the:</p> <pre><code>out.println((rs.getString(employee_id)).equals(temp_code)); </code></pre> <p>It is producing false value</p>
java
[1]
1,448,223
1,448,224
How to set the UIBarButtonItem color
<p>I want to Change the UIBarButtonItem Color, which is the sub view of UIToolBar,</p> <p>My problem is if i change the toolber tint color , the barbuttonitems color are changing automatically ,how can i differ them...</p>
iphone
[8]
1,951,453
1,951,454
read android dmesg with code
<p>How can I read dmesg output in my program?</p> <p>Thanks..</p>
android
[4]
983,387
983,388
Web-view full-screen mode
<p>i have set swf file in <code>webview</code> i got everything is successfully but when i long press it give me option of full-screen so i need to avoid it how can i do that ?? </p> <p><strong>here i have attach image :</strong> </p> <p><img src="http://i.stack.imgur.com/g8sYC.png" alt="enter image description here"></p> <p>Here is my <strong>webview</strong> : </p> <pre><code>wv_introduction = (WebView) findViewById(R.id.ady_solwv); wv_introduction.getSettings().setJavaScriptEnabled(true); wv_introduction.getSettings().setPluginState(PluginState.ON); wv_introduction.getSettings().setAllowFileAccess(true); wv_introduction.loadUrl(str_url); </code></pre>
android
[4]
2,208,922
2,208,923
Detect when a fragment is drawn?
<p>Basically I need the functionality of OnWindowFocusChanged but on a fragment. The onWindowFocusChanged listener isn't actually available to fragments unfortunately, so I'm not sure what to do.</p> <p>Any way to do this?</p>
android
[4]
2,442,556
2,442,557
C# NullReferenceException unhandled (with string array)
<p>I have the following code:</p> <pre><code>string[] buttons = new buttons[5]; int j = 0; while (j&lt;5) { buttons[j] = pullString(node); j++; } </code></pre> <p>However I get a NullReferenceException unhandled error pointing to the first line of the code inside the while block. Please explain! </p>
c#
[0]
4,858,802
4,858,803
How to require non-blank text on an Alert Input Dialog
<p>I would like to retrieve user input via an Alert Dialog... is there any way to make it so that the user cannot press Ok if the EditText is blank? I mean require that he type something in?</p>
android
[4]
3,980,246
3,980,247
Removing redundancy when adding items to Python dictionaries
<p>Suppose you have a dictionary like:</p> <pre><code>my_dict = {'foo' : {'bar' : {}}} </code></pre> <p>And you want to make the following sequence of assignments:</p> <pre><code>my_dict['foo']['bar']['first'] = 1 my_dict['foo']['bar']['second'] = 2 </code></pre> <p>Clearly there is some redundancy in the fact that <code>my_dict['foo']['bar']</code> is repeated. Is there any way to prevent this redundancy?</p> <p>Thanks!</p>
python
[7]
1,356,308
1,356,309
Use jQuery to add scripts to the Head of a document
<p>I am looking for a way (using jQuery) that I can add other scripts into the head of a document.</p> <p>The reason I need to do this is because when building a "template" for a certain web design application I am only allowed to insert 1 js file into the head of the document.</p> <p>Some features that I would like to add to the design require more than 1 js file so I think I would like to have other js files added to the head of the document as the page loads. This would allow me to add the features to the design that I want.</p> <p>I have looked at jQuery's "getScript" call but am not sure if there is a better way to approach this.</p>
jquery
[5]
7,822
7,823
Casting size_t to allow more elements in a std::vector
<p>I need to store a huge number of elements in a <code>std::vector</code> (more that the 2^32-1 allowed by unsigned int) in 32 bits. As far as I know this quantity is limited by the <code>std::size_t</code> unsigned int type. May I change this <code>std::size_t</code> by casting to an <code>unsigned long</code>? Would it resolve the problem?</p> <p>If that's not possible, suppose I compile in 64 bits. Would that solve the problem without any modification?</p>
c++
[6]
1,250,886
1,250,887
Object Literals In Java?
<p>I am learning GWT for web development and came across a piece of code I can't really understand.</p> <pre><code>helloBtn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Window.alert("Hello!"); } }); </code></pre> <p>If someone could explain to me what it is doing that would be great.</p> <p>Thanks, John</p>
java
[1]
4,656,316
4,656,317
Launching activity from the status bar creates new activity even when one already exists
<p>I have an activity that starts a long-running service which in turn adds an icon to the status bar. When the activity gets invisible, e.g. by pressing the Home button, and the pressing the icon in the status bar a new activity is created instead of showing the already created activity. If you now press the back button the new activity is destroyed and the activity created in the first place gets visible. How do I make the invisible activity brought to front when pressing the icon in the status bar instead of creating a new activity? Thanks, Christian</p>
android
[4]
5,120,953
5,120,954
C++ - Why static member function can't be created with 'const' qualifier
<p>Today I got a problem. I am in the need of a static member function, const is not a must but a better. But, I didn't succeed in my efforts. Can anybody say why or how?</p>
c++
[6]
462,697
462,698
Add Pdf file to Resource using Code C#
<p>Is there any way to add a file to an application's resources using code (not the visual designer)? I've tried the <code>ResourceWriter</code> class but it doesn't do what I want.</p>
c#
[0]
4,244,016
4,244,017
how to create sqlite database or table from text file saved in sd card in android?
<p>I have text file in sd card, In that First line contain column name for tables and rest of the lines contains values for the columns. Each line separated by /n, and each item separated by |. By using this i have to create a table in my database.</p>
android
[4]
1,724,202
1,724,203
Android: Adding Activity to the menu on the homescreen
<p>I'm trying to add my Android activity to the menu on the homescreen (the one with: add, wallpaper, settings, search, notifications).</p> <p>I suspect this is done from the AndroidManifest.xml, but I can't figure out how.</p> <p>Am I looking at the right place? And if so, what am I missing?</p>
android
[4]
2,592,121
2,592,122
Monitor class in Java
<p>I want to know about <code>Monitor</code> class in Java.</p> <p>What is it used for, where is it used?</p>
java
[1]
1,924,810
1,924,811
Parentheses around data type?
<p>I am a beginning programmer and came across this in my textbook:</p> <pre><code>public boolean equals(DataElement otherElement) { IntElement temp = (IntElement) otherElement; return (num == temp.num); } </code></pre> <p><code>IntElement</code> is a subclass of <code>DataElement</code>. <code>num</code> is an int storing a value for a linked list.</p> <p>What is the purpose of <code>(IntElement)</code> after <code>temp =?</code> What would be wrong with <code>IntElement temp = otherElement</code>? And, in general, what does putting a data type in parentheses like that do?</p>
java
[1]
4,596,791
4,596,792
functionname.arguments not working in Mozilla
<p>I have function works perfect in IE but not in mozilla.</p> <pre><code>function showhide() { alert("test"); var args=showhide.arguments; alert("1"+args); for (i=0; i&lt;(args.length); i=i+2) { alert("2"+args); eval(args[i]+".style.display='"+args[i+1]+"'"); } alert("3"+args); } </code></pre> <p>I get alert <code>test</code> in mozilla but rest of alert does not display.</p>
javascript
[3]
3,417,340
3,417,341
How to check if an object is an instance of a NodeList in IE?
<p>Why is NodeList undefined in IE6/7?</p> <pre><code>&lt;form action="/" method="post" id="testform"&gt; &lt;input type="checkbox" name="foobar[]" value="1" id="" /&gt; &lt;input type="checkbox" name="foobar[]" value="2" id="" /&gt; &lt;input type="checkbox" name="foobar[]" value="3" id="" /&gt; &lt;/form&gt; &lt;script type="text/javascript" charset="utf-8"&gt; (function () { var el = document.getElementById('testform')['foobar[]'] if (el instanceof NodeList) { alert("I'm a NodeList"); } })(); &lt;/script&gt; </code></pre> <p>This works in FF3/Safari 3.1 but doesn't work in IE6/7. Anyone have any ideas how to check if el is an instance of NodeList across all browsers?</p>
javascript
[3]
1,482,258
1,482,259
how to increase the progress bar value based on validations
<p>Hello i have the code like following.. In this i have validations... i used progress bar also.. for every validation if it is true then the progress bar value should increase by 10..if validation not performed well then the progress bar value should be at the same state..how to achieve this.. plz help me</p> <p>Thank you</p> <pre><code>$('form').validate({ rules: { name:{ required:true, minlength:5 }, psd:{ required:true, minlength:6 }, repsd:{ required:true, equalTo:'#pwd' }, dob:{ required:true }, email:{ required:true, email:true }, address: { required:true } }, success:function(label){ label.text('ok').addClass('valid'); } }) </code></pre> <p>for progress bar i wrote like this.. ofcourse it is not work as per my desired condition</p> <pre><code>$('#progressdiv').progressbar(); $('.same').blur(function(){ $('#progressdiv').progressbar('value', i); i=i+10; }) </code></pre>
jquery
[5]
605,664
605,665
How can I accept multiple classes for one function argument?
<p>Say I have two classes, ClassA and ClassB.</p> <p>ClassB inherits ClassA, and has some additional functions and variables.</p> <p>Is it possible for me to make a function that can accept either ClassA or ClassB as the same argument, and let me determine which one was used?</p>
c++
[6]
2,274,595
2,274,596
iPhone app - Review guidelines - Contest rules
<p>i've just had my iPhone app rejected on the 20.2 statement of the Review Guidelines:</p> <p>Official rules for sweepstakes and contests, must be presented in the app and make it clear that Apple is not a sponsor or involved in the activity in any manner</p> <p>Now, I have a problem. In my app I will have more than one contest, even if all based on the same ground rules. Can I put these rules in the app (like in a UITextField) taking them dynamically form a server? In this manner I could specify, for exemple, the specific period of time each contest would last without having to chose them right now... Do you think that this would be accepted or I have to put those rules directly in the bundle?</p> <p>Thank you</p>
iphone
[8]
3,562,064
3,562,065
Exporting File from Google results to local machine
<p>I am a java developer. I want to know that if there is anyway in JAVA by which I can export files from google results to my local machine. What I tend to do is that Search something in google and if the page searched contains a file, I want to store that file on my local machine. This whole process should happen via an application created in JAVA.</p> <p>Any idea or advices will be appreciable as well.</p> <p>Thanks, Anoop.</p>
java
[1]
498,592
498,593
Where is the specification that defines this behavior for InputStreamReader?
<p>Considering the below code for an exercise problem, where is the specification that says roughly: "Upon the call to readTokens(), wait for the user to press carriage return and then continue execution."</p> <p>I'm not fully understanding why my code works, why does the program pause after "Enter Data: " is displayed and wait for a carriage return? Where is this behavior defined and how can it be changed?</p> <pre><code>import java.io.*; import java.util.LinkedList; public class StreamTokeTwo { private int ttype = 0; StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader( new InputStreamReader(System.in))); private void setupTokenizer() { tokenizer.resetSyntax(); tokenizer.wordChars(33, 126); tokenizer.whitespaceChars(0, 32); tokenizer.whitespaceChars(44,44); tokenizer.whitespaceChars(47,47); tokenizer.eolIsSignificant(true); } private String[] readTokens() { LinkedList&lt;String&gt; list = new LinkedList&lt;String&gt;(); String[] array = null; do { try { ttype = tokenizer.nextToken(); } catch (Exception e) { System.exit(1); } if (ttype == StreamTokenizer.TT_WORD) { list.add(tokenizer.sval); } } while (ttype != StreamTokenizer.TT_EOL); array = list.toArray(new String[0]); return array; } public static void main(String[] args) { StreamTokeTwo streamToke = new StreamTokeTwo(); streamToke.setupTokenizer(); for (int i = 0; i &lt; 5; ++i) { System.out.print("Enter data: "); String[] array = streamToke.readTokens(); for (String str : array) { System.out.print(str + " "); } System.out.println(); } } } </code></pre>
java
[1]
5,330,678
5,330,679
How to find out who the ROM provider is?
<p>I have an automatic bug reporting facility in my app that includes useful information for debugging. </p> <p>One thing that I would like to include is the ROM provider. In particular I would like to know if the user is running a custom ROM and which, preferably even with the version number.</p> <p>Any idea how to retrieve this information programmatically?</p> <p>--- Taken from the Quintin (see below)</p> <p><a href="http://code.google.com/p/cyanogen-updater/source/browse/trunk/src/cmupdaterapp/utils/SysUtils.java#19" rel="nofollow">http://code.google.com/p/cyanogen-updater/source/browse/trunk/src/cmupdaterapp/utils/SysUtils.java#19</a>:</p> <pre><code>public static String getReadableModVersion() { String modVer = getSystemProperty(Constants.SYS_PROP_MOD_VERSION); return (modVer == null || modVer.length() == 0 ? "Unknown" : modVer); } </code></pre> <p>Whereby the constant is this: </p> <pre><code>public static final String SYS_PROP_MOD_VERSION = "ro.modversion"; </code></pre> <p>And here is the getSystemProperty();</p> <pre><code>public static String getSystemProperty(String propName){ String line; BufferedReader input = null; try { Process p = Runtime.getRuntime().exec("getprop " + propName); input = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024); line = input.readLine(); input.close(); } catch (IOException ex) { Log.e(TAG, "Unable to read sysprop " + propName, ex); return null; } finally { if(input != null) { try { input.close(); } catch (IOException e) { Log.e(TAG, "Exception while closing InputStream", e); } } } return line; } </code></pre> <p>Could anybody with a CM ROM can run this for me?</p> <p>Btw. Careful, this is GPL code. I for one can not use it. Any easier or non-GPL way?</p>
android
[4]
4,323,349
4,323,350
ihow to acees random items from an array and then put them in another array in iphone sdk?
<p>i have a problem i have an array which has ten items "one" to "ten" i want to get randon items from this array and put them in a new array which can display the random items </p>
iphone
[8]
5,282,873
5,282,874
Read first half of file contents and echo and then the second half
<p>I have a text file that lists the name of a track then after a double space the artist is listed. In order for me to fetch the album art from Last.fm I have to have both the title and artist in the the URL like <code>http://ws.audioscrobbler.com/2.0/?method=track.getinfo&amp;track=TRACK TITLE&amp;artist=ARTIST</code>. Since the artist and track title aren't in separate files, is there a way I can get the part before the double space and call it $title and the part after the double space and call it $artist, so I can just echo it into the URL?</p> <p>This is what I currently have to get the file contents:</p> <pre><code>&lt;?php $current = file_get_contents('RBDS%20Text.txt'); echo $current; ?&gt; </code></pre> <p>Thanks!</p> <p>EDIT:</p> <p>So the text file outputs the "track title [double space] artist"</p> <p>For Last.FM I have to have in the URL <code>track=TRACK TITLE&amp;artist=ARTIST</code></p>
php
[2]
4,303,664
4,303,665
Can I control different progressbars for different ajax events?
<p>I have a form with two places that use ajax to submit the information to server.</p> <pre><code> $("#loading img").ajaxStart(function(){ // this progress bar is used by both ajax submission. $(this).show(); }).ajaxStop(function(){ $(this).hide(); }); &lt;div id="loading"&gt; &lt;img src="loading4.gif" border="0" /&gt; &lt;/div&gt; $('#countyForm').ajaxForm(options); // Case I: use ajax to submit the form $('form#carSelect').change(function(){ // Case II: use ajax to submit the field $.ajax({ ... } }); }); </code></pre> <p>How can I customize the ajax in jQuery so that I can use different progressbar for different ajax submission.</p> <p>Say for case I, I use image1 and case II I use image2.</p> <p>Thank you</p>
jquery
[5]
5,379,122
5,379,123
substring with while loop
<p>I want to read a text from a file. Every line should be split at 180 characters and then each line should be added to a table, but I get the error message "String index out of range -180".</p> <pre><code>import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class ReadAndWrite { public static void main(String[] args) throws IOException { BufferedReader read = new BufferedReader (new FileReader("xyz.txt")); String line = read.readLine(); int len = line.length(); System.out.println(len); int chaCount = 0; while (chaCount &lt; len) { String line2 = line.substring(chaCount, 180); System.out.println(line2); chaCount += 180; } } } </code></pre>
java
[1]
3,728,732
3,728,733
Python: Performance test, ensuring cleanup
<p>I am executing some performance tests on a messaging framework within python, and I am trying to make sure that the code is properly cleaning up after itself.</p> <p>Is there a way to monitor the current number of threads owned by the process? Is there a better way to tell if I am leaking threads?</p> <hr> <p>Just to make sure I clarify what I am looking for as an answer. I need a script and or program that can monitor the number of threads that a process has alive.</p>
python
[7]
3,827,817
3,827,818
How to specify each DataTable in each Row in Datagridview
<h2> Dt0</h2> <h2>DT1 | Dt1</h2> <pre><code>Dt2 | Dt2| Dt3| </code></pre> <p>I want them to arranged like this.All are from Different DataTable.Specifying each Row values. How can i achieve this.</p>
c#
[0]
3,314,641
3,314,642
Input a comma after every 10 digit in Javascript?
<p>I put 10 digit mobile numbers in a Textarea like the follwoing. 242452354643663463636346366363463636365636363634656346 but i need to put comma(,) after every 10 digit number.</p>
javascript
[3]
1,770,789
1,770,790
how to put clickable image jframe
<p>i want to add icons in jframe which does some action while click like buttons. </p>
java
[1]
4,452,161
4,452,162
getting error while installing PHP SDO.dll?
<p>I am installing SDO.dll for PHP in to my machine, i am getting following error:</p> <p><img src="http://i.stack.imgur.com/CGDk6.jpg" alt="enter image description here"></p> <p>Please help me . thanks in advance.. </p>
php
[2]
3,049,439
3,049,440
Best way to programmatically parse and transform ASP.NET Webform pages?
<p>I need to programmatically parse and transform ASP.NET webform pages. It's a requirement that I have =(.</p> <p>Anyone know any tools or frameworks?</p> <p>Update:</p> <p>I just need to modify ASPX pages (not rendered HTML code).</p> <p>There are no inline c# code.</p>
asp.net
[9]
1,538,068
1,538,069
How to send data from iphone to MAC/PC via serial port?
<p>I'm new to these things, and have no idea how to achieve this thing. I want to send some data from iphone to MAC/PC and also want to receive data sent from MAC to iphone. Please help me out or give me some clue, where I can start from. </p>
iphone
[8]
3,923,618
3,923,619
Linking a .cpp file containing a class
<p>How to do this? I'm using a .cpp file which contains the class and all it's methods, a .hpp file which contains linked libraries. If I want to compile a file having the main function, how to do this? Should I declare an extern class? Can I have an example of how linking classes?</p> <p>This is the class in the cpp file: <a href="http://pastebin.com/aQqT0GNx" rel="nofollow">http://pastebin.com/aQqT0GNx</a></p> <p>This is the .hpp file:</p> <pre><code>#ifndef LIST_HPP #define LIST_HPP #include &lt;iostream&gt; using namespace std; #endif </code></pre> <p>This is the main file:</p> <pre><code>#include "List.hpp" int main(int argc, char **argv) { List&lt;int&gt;l; return 0; } </code></pre> <p>It says 'List' is not declared on this scope.</p> <p>@Bo Persson: It seems like you're one of the few who has really understood my question.I programmed in C so I know how to separate a header from source files,but the problems was with templates.</p>
c++
[6]
1,587,890
1,587,891
I want to scan 2 datum and see if it has relevancy or not
<p>So I want to scan 2 Datum, these are texts, then I will rate it if it has relevancy. </p> <p>Example:</p> <pre><code>Data: individual facts Data: statistics, items of information individual facts </code></pre> <p>This is my JS code that will scan the whole webpage:</p> <pre><code>var listitem, thislist; var itemname = new Array(); listitem = getElementsByClass('Forwards'); for(var i = 0; i &lt; listitem.length; i++) { if (listitem[i].innerHTML.match(/Data:/)) itemname.push(listitem[i].innerHTML); } </code></pre> <p>So the itemname array contains the texts. The first array contains: </p> <pre><code>Data: individual facts </code></pre> <p>The second array contains:</p> <pre><code>Data: statistics, items of information individual facts </code></pre> <p>As you can see the second array contains more information:</p> <pre><code>Data: statistics, items of information </code></pre> <p>But they are relevant right?</p> <p>So I want to to return TRUE</p> <p>How would I code this?</p>
javascript
[3]
4,012,153
4,012,154
Extract decimal or Integer from a string in php
<p>Eg:</p> <pre><code>$str .= "Additional tax(2.34)"; $str .= "Additional tax(3)"; </code></pre> <p>Can anyone help me up to extract the number from the string. I need an array format like this </p> <pre><code>Array ( [0] =&gt; 2.34 [1] =&gt; 3 ); </code></pre>
php
[2]
1,591,724
1,591,725
Get java.lang.NoSuchMethodError when running simple codes
<p>I have the following JAVA code. It compiles fine, but when I run it, I got the following error:</p> <p>Exception in thread "main" java.lang.NoSuchMethodError: Edge.(LVertex;D)V at Test.main(Test.java:27)</p> <p>Any clue? Thanks in advance!</p> <pre><code>import java.util.ArrayList; class Vertex{ public int key; public ArrayList&lt;Edge&gt; edges; public double minDistance = Double.POSITIVE_INFINITY; public Vertex(int key) { this.key = key; edges = new ArrayList&lt;Edge&gt;(); } } class Edge{ public Vertex target; public double weight; public Edge(Vertex t, double w) { target = t; weight = w; } } public class Test { public static void main(String[] args) { Edge e = new Edge(new Vertex(1), 1.0); } } </code></pre>
java
[1]
4,321,980
4,321,981
using jQuery to drop down menu using the tab key
<p>I have a dropdown menu that needs to drop when using the keyboard (tab key) as well as when you hover over it. I've tried everything I've found, but can't get the tab key to work. </p> <p>I can't get the code to format right so I'm linking to it: <a href="http://www.cameron.edu/snippets/cameron.js" rel="nofollow">http://www.cameron.edu/snippets/cameron.js</a></p> <p>An example can be seen here: <a href="http://www.cameron.edu" rel="nofollow">www.cameron.edu</a></p>
jquery
[5]
3,334,509
3,334,510
Callback animation to begin only after ALL children have finished animating
<p>I have a div wherein I would like to fade all of the child elements out at once, but fade in a new element but only after all children have completed fading out. Using my current code below, the #Message div starts fading in after the first child element and is actually placed after the last child. Once the last child fades out completely, the #Message div then "jumps" up into position. I want to avoid this "jump".</p> <pre><code>$('#DIV').children().fadeOut("slow", function() { $('#Message').fadeIn("slow"); }); </code></pre> <p>How can I make certain the fadeIn() animation doesn't begin until fadeOut() is complete on ALL child elements of #DIV?</p> <p>Edit: I should note that my #Message div is located <strong>inside</strong> of #DIV.</p>
jquery
[5]
4,677,209
4,677,210
jQuery: value undefined
<p>i am rendering a select box using Ajax call in php and the output is coming like </p> <pre><code> &lt;select onchange = 'addtolist(this.val)' name='select_val' id='select_val' class= 'required'&gt; &lt;option value='xzvfxcv'&gt;xzvfxcv&lt;/option&gt; &lt;option value='dfscs'&gt;dfscs&lt;/option&gt; &lt;/select&gt; </code></pre> <p>ok and here is my function addtolist</p> <pre><code>function addtolist(id){ alert(id); } </code></pre> <p>now while changing the select box i am getting the <code>undefined</code> </p> <p>please help me out out what might i am doing wrong ?</p>
jquery
[5]
583,797
583,798
PHP script misbehaving
<p>I have a small script that defines a variable called <code>$prPrice</code>. This script is not working in the way that I intend, as in some of the products that contain a certain department code are display prices relating to other department codes. So i assume that the way i have initially put this together is somehow wrong.</p> <p>My question would be this, can anyone spot a problem with, or provide suggestions for bettering the following simple php script:</p> <pre><code>// Cost plus 2.5% if ($prDept = (204 || 205 || 209 || 1501 || 1601 )) { if ($_SESSION['tax'] == "on" || !isset($_SESSION['tax'])) $prPrice = ((($prCost1 / 1.14) * 1.025) * 1.14); else if ($_SESSION['tax'] == "off" &amp;&amp; $prTaxable == "1") $prPrice = ($prCost1 * 1.025); else if ($_SESSION['tax'] == "off" &amp;&amp; $prTaxable == "0") $prPrice = (($prCost1 / 1.14) * 1.025); </code></pre> <p>}</p>
php
[2]
1,925,872
1,925,873
jquery: scroll to an element within an overflowed div
<p>i have 20 list items inside of a div that can only show 5 at a time. what is a good way to scroll to item #10, and then item #20.</p> <p>i know the height of all the items.</p> <p>the scrollTo plugin does this, but its source is not super easy to understand without really getting into it. <strong>important -</strong> i dont want to use this plugin</p> <p>lets say i have a function that takes 2 elements <strong>$parentDiv, $innerListItem</strong></p> <p>neither $innerListItem.offset().top nor $innerListItem.positon().top gives me the correct scrollTop for $parentDiv</p>
jquery
[5]
3,071,548
3,071,549
WP Supersized & Easy Fancybox Conflict
<p>I am using WP Supersized and Easy Fancybox Wordpress plugins. Everything is works fine till the point I am not clicking the link to open a fancybox. Image is opening perfectly just having some issues with the position. Its shifting towards the left on opening up.</p> <p>Here is the link to my demo page where I am using fancybox : <a href="http://martinushoeve.dig-id.be/?page_id=5" rel="nofollow">http://martinushoeve.dig-id.be/?page_id=5</a></p> <p>Regards.</p>
jquery
[5]
3,853,362
3,853,363
How to make Bitmap compress without change the bitmap size?
<p>I using this method to compress image </p> <pre><code>if(bitmapObject.compress(Bitmap.CompressFormat.PNG, 100, fOut)) { ... } </code></pre> <p>But that image that i get is much small ( in the dimension ) that was before the compress action. </p> <p>My application need to send the compressed image thru the network - so i want to send as less data as i can ... but i must to keep the original size of the image. </p> <p>Is there some other way to keep the original bitmap dimension with some compress ? </p>
android
[4]
2,775,555
2,775,556
Python - Way to recursively find and replace string in text files
<p>I want to recursively search through a directory with subdirectories of text files and replace every occurrence of {$replace} within the files with the contents of a multi line string. How can this be achieved with python?</p> <p><strong>[EDIT]</strong></p> <p>So far all I have is the recursive code using os.walk to get a list of files that are required to be changed.</p> <pre><code>import os import sys fileList = [] rootdir = "C:\\test" for root, subFolders, files in os.walk(rootdir): if subFolders != ".svn": for file in files: fileParts = file.split('.') if len(fileParts) &gt; 1: if fileParts[1] == "php": fileList.append(os.path.join(root,file)) print fileList </code></pre>
python
[7]
4,768,115
4,768,116
Web Navigation not working after adding access rules
<p>Hey I ran into a problem after I added authentication roles and access rules. I added folders to my website so I could set restrictions on the web pages located in those folders. I moved all the appropriate pages into the corresponding folders (admin pages into the admin folder, employee pages into the employee folder). When that was done I set up all my access rules and roles in the ASP.NET configuration. Everything seemed to work fine but now my sitemap doesn’t work and I get the file not found error when trying to navigate my website. This might be an easy fix but I am new to ASP.NET, any suggestions? </p>
asp.net
[9]