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
4,199,510
4,199,511
AVAudioPlayer stops playing the audio when iPhone goes to sleep
<p>I need to play a background sound all the time as long as my application is running. I tried to use AVAudioPlayer for this purpose. However, it stops playing the sound as soon as the iPhone goes to sleep mode.</p> <p>Could you let me know how can I fix this problem?</p> <p>Thanks</p>
iphone
[8]
4,465,519
4,465,520
Need direction on where to begin my programming journey. Non language specific just a foundation..where do I start?
<p>Sorry if this is in the wrong forum but I'm taking the plunge and I want to learn how to program from the ground up. I've been using VB.NET but only by copying/pasting what I could find on the net.</p> <p>I am wanting to start fresh. I'm looking for direction on what types of things I should be researching for a good primer for programming before I even consider a language.</p> <p>Any ideas?</p> <p>Thanks</p>
c#
[0]
3,989,362
3,989,363
C++ typedef question
<p>if I make a <code>typedef someobject* pntr</code>;</p> <p>I can use this typedef to make a pointer to point to an object of type someobject. but can I also use a pointer made from this typedef to point to an array of someobject? </p>
c++
[6]
1,512,687
1,512,688
Remove web address from string
<p>Input is </p> <pre><code>Catch up on all episodes and series at ChannelChooser. .channelchooser.com/ - Cached - Similar </code></pre> <p>I want to the remove web address and terms like cached,similar.I need to extract only text. </p> <p>Thanks in advance</p>
java
[1]
5,795,005
5,795,006
Any elegent method to build relation between string and integer in Java?
<p>I have a class which has many fields of the type String. I want to write a method as a setter for all these fields, so I need a switch. Here comes my question, how to map the field name into an integer to be fit in switch? I don't want <code>Integer.parseInt()</code>, because I don't know what char may be and couldn't choose a appropriate radix. I don't want to manually build a map neither. Is there any handy trick?</p>
java
[1]
4,691,827
4,691,828
Java - Converting hours(in double) to minutes(integer) and vice versa
<p>I need the correct formula that will convert hours to minutes and vice versa. I have written a code, but it doesn't seem to work as expected. For eg: If I have hours=8.16, then minutes should be 490, but I'm getting the result as 489.</p> <pre><code> import java.io.*; class DoubleToInt { public static void main(String[] args) throws IOException{ BufferedReader buff = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the double hours:"); String d = buff.readLine(); double hours = Double.parseDouble(d); int min = (int) ((double)hours * 60); System.out.println("Minutes:=" + min); } } </code></pre>
java
[1]
3,309,224
3,309,225
Creating a font with just a few characters
<p>Not even sure how to phrase the subject line properly, but what I want to do is this:</p> <p>I want to use a few special characters in my app, e.g. x̄, which are not in the system's built-in font.</p> <p>I could simply define my own ttf font with the specific characters in it, but I'd like the system font to be used for everything else.</p> <p>Is there a way to specify a "fail-over" font?</p>
android
[4]
285,095
285,096
iPhone - current date considering daylight saving
<p>My country is located in GMT+0. We are +1 hour now, because we are in daylight saving.</p> <p>When I do</p> <pre><code>[NSDate date]; </code></pre> <p>it was supposed to return the current date and time, but when I do that, I receive the GMT time not considering the daylight saving. </p> <p>This is what the docs say about the date command</p> <p><strong>Creates and returns a new date set to the current date and time.</strong></p> <p>Why Apple does that to us? Why everything is so complex? Is this a bug? Is there a way to get the current real time the device is on? the same time that is displayed on the device's clock?</p> <p>My app depends on dates and times and having a wrong date for an user located in a different timezone around the world that is on summertime or wintertime will be a disaster.</p> <p>Thanks.</p> <hr> <p>EDIT</p> <p>After several answers, I have tried this code:</p> <pre><code>NSDate *wrongToday = [NSDate date]; NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setDateStyle:NSDateFormatterMediumStyle]; [dateFormatter setTimeStyle:NSDateFormatterMediumStyle]; [dateFormatter setTimeZone:[NSTimeZone localTimeZone]]; NSString *currentTime = [dateFormatter wrongToday]; NSDate *today = [dateFormatter dateFromString:currentTime]; </code></pre> <p>guess what, today = wrongToday... in other words, no change, I continue to have the wrong date without daylight saving. what is more amazing is that currentTime shows in NSString the date with daylight saving...</p> <p>any clues? thanks again.</p>
iphone
[8]
727,323
727,324
Size of the given structure
<pre><code>struct x { char a : 1; // statement 1 char c : 3; // statement 2 }; </code></pre> <p>what will be the size if this structure. What is the meaning of statement 1 and 2?</p>
c++
[6]
3,656,780
3,656,781
How to use Graph API in facebook
<p>I wish to develop a Facebook application i don't know how to use Post in Graph API if any one one could help me..</p>
android
[4]
1,993,419
1,993,420
Jquery .Post problem
<p>For some reason, this is not submitting to the server. </p> <pre><code>function get(){ $.post('something_help.php', name: 'blah',function(output) { alert(output); }); } </code></pre> <hr> <pre><code>&lt;?php echo $_POST['name']; ?&gt; </code></pre>
jquery
[5]
3,701,138
3,701,139
Google support for enterprise Android development
<p>Does Google offer any support program for enterprise Android development?</p> <p>Something similar to Apple's <a href="http://developer.apple.com/programs/ios/enterprise/" rel="nofollow">iOS Developer Enterprise Program</a>?</p> <p>A search on Internet didn't yield any results, so I'm wondering if anyone here know of such an existing/future program?</p>
android
[4]
770,690
770,691
How should I choose the right Android phone for testing my app?
<p>I am looking to buy an Android phone to test my first Android app on.</p> <p>What things should I pay attention to to make sure I pick the most suitable device?</p>
android
[4]
3,677,999
3,678,000
Javascript Create custom callback
<p>All i need to do is to execute a callback function when my current function execution end</p> <pre><code>function LoadData() { alert('the data have been loaded'); //call my callback with parameters i want Ex. //callback(loadedData , currentObject); } </code></pre> <p>Consumer for this function should be like this </p> <pre><code>object.LoadData(success); function success(loadedData , currentObject) { //todo some action here } </code></pre> <p>So how to implement this</p>
javascript
[3]
4,256,745
4,256,746
Make barcode generator in android
<p>i made a barcode generator using code128 but when my barcode generate then it wont display in my layout. so plz suggest me some solution that how to display generated barcode in my layout enter code here </p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); l1=(LinearLayout) findViewById(R.id.linear); Code128 barcode = new Code128(); Bitmap b = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888); canvas=new Canvas(b); barcode.setData("11223344556688777"); barcode.setProcessTilde(false); barcode.setUom(IBarcode.UOM_PIXEL); barcode.setX(1f); barcode.setY(75f); barcode.setLeftMargin(10f); barcode.setRightMargin(10f); barcode.setTopMargin(10f); barcode.setBottomMargin(10f); barcode.setResolution(72); barcode.setShowText(true); barcode.setTextFont(new AndroidFont("Arial", Typeface.NORMAL, 12)); barcode.setTextMargin(6); barcode.setTextColor(AndroidColor.black); barcode.setBackColor(AndroidColor.white); RectF bounds = new RectF(30, 30, 0, 0); try { barcode.drawBarcode(canvas, bounds); l1.draw(canvas); l1.addView(t1); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } </code></pre>
android
[4]
4,723,548
4,723,549
Swapping content with jquery and adding fadein effect
<p>Wondering if anyone has an answer to this conundrum?</p> <p>I've got some Jquery working which swaps content within a div when some text is clicked:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $("#changeText").click(function() { $("#textBox").html("&lt;div&gt;This text will be changed to something else. in a div&lt;/div&gt;"); }); }); &lt;/script&gt; &lt;a id="changeText"&gt;Find out more&lt;/a&gt; &lt;br /&gt; &lt;div id="textBox"&gt;&lt;div&gt;This text will be changed to something else&lt;/div&gt;&lt;/div&gt; </code></pre> <p>But, when the content is swapped I'd like to be able to fade out the old content and fade in the new. Is there a way of doing this?</p>
jquery
[5]
4,435,821
4,435,822
Why does an inline conditional in Java auto-cast numbers?
<p>In the following inline conditionals, one might expect an integer and a double to be printed, respectively:</p> <pre><code>System.out.println(true ? 0 : 0.0); System.out.println(false ? 0 : 0.0); System.out.println(true ? new Integer(0) : new Double(0.0)); System.out.println(true ? 0 : ""); </code></pre> <p>Instead they are both printed as doubles when occurring together:</p> <pre><code> 0.0 0.0 0.0 0 </code></pre> <p>Why are numbers auto-cast when occurring with other numbers in inline conditionals?</p> <p><strong>Edit</strong>: If this is occurring because <code>System.out.println</code> is overloaded what is the case for:</p> <pre><code>list.add(true ? 0 : 0.0); list.add(false ? 0 : 0.0); list.add(true ? new Integer(0) : new Double(0.0)); list.add(true ? 0 : ""); System.out.println(list); </code></pre> <p>outputs:</p> <pre><code>[0.0, 0.0, 0.0, 0] </code></pre>
java
[1]
3,679,218
3,679,219
How to change table row on every fifth cell using while or for?
<p>Let's say we have a query that gives a result from database's records. I want to put those records on a table, but not like row after row. I would like to make a table that will change row on every fifth cell. How can I do this using <code>while</code> or <code>for</code>?</p> <p>Here is just an example of what I have made for now, but I can't make it change row on every fifth cell...</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;?php $count = 0; while ($count &lt;= 5){ ?&gt; &lt;td&gt;&lt;?php echo $id[$count]-&gt;id; $usrname[$count]-&gt;usrname;&lt;/td&gt; &lt;?php $count++;}?&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>Any idea???</p>
php
[2]
5,341,717
5,341,718
Javascript: way to implement 100% tamperproof private variables?
<p>I was reading Crockford's tutorial <a href="http://javascript.crockford.com/private.html" rel="nofollow">http://javascript.crockford.com/private.html</a>. private variables are implemented by function inside constructor that makes possible to associate private variables to closure.</p> <p>Generally javascript libraries are open, so <b>anyone can see and modify the private variables by modifying the inner function of constructor thru instances/objects</b>. like this: <b>c1.radius = function (){return 500;};</b></p> <p>Be more precisly: <b>In real OOPS no one can modify private variable by objects but here we can.</b></p> <p>Can anyone please suggest me the way to make it full tamper proof like JAVA or C?</p> <pre><code>function Circle(radius) { this.radius = function(){ return radius;} } Circle.prototype = { constructor: Circle, area: function(){ return (Math.PI)* (Math.pow(this.radius(),2)); } }; c1 = new Circle(5); console.log(c1.radius()); console.log(c1.area()); c1.radius = function (){return 500;}; </code></pre>
javascript
[3]
4,309,403
4,309,404
Hover images effect
<p>i need similar script to this - <a href="http://d2o0t5hpnwv4c1.cloudfront.net/358_jquery/example%20files/all-examples.html" rel="nofollow">http://d2o0t5hpnwv4c1.cloudfront.net/358_jquery/example%20files/all-examples.html</a></p> <p>This works if images have the same resolution, but I have images with different width.</p> <p>have a similar script, where the resolution does not matter?</p>
jquery
[5]
26,784
26,785
Why is Class.getAnnotation() requiring me to do a cast?
<p>I'm using Java 1.6.0_25.</p> <p>I have an annotation defined:</p> <pre><code>@Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface Resource { String value(); } </code></pre> <p>And later when I use getAnnotation:</p> <pre><code>Resource resource = (Resource)cls.getAnnotation(Resource.class); </code></pre> <p>the compiler and IDE agree that I must cast the result, but getAnnotation is declared in the Java 1.5 documentation as:</p> <pre><code>public &lt;A extends Annotation&gt; A getAnnotation(Class&lt;A&gt; annotationClass); </code></pre> <p>Since Resource.class is of type Class, it seems to me that this means that cls.getAnnotation(Resource.class) should return type Resource, and I should need to cast.</p> <p>All examples I've found using getAnnotation don't have a cast, so I must be doing something wrong.</p>
java
[1]
2,826,948
2,826,949
Empty vector of type <stuff*>
<p>I have a vector populated with objects:</p> <pre><code>std::vector&lt;Stuff*&gt; stuffVector; </code></pre> <p>and am trying to delete all elements of it using a cleanup function</p> <pre><code>void CleanUp() { for (std::vector&lt;Stuff*&gt;::size_type i = 0 ; i &lt; stuffVector.size() ; i++) { stuffVector.erase(stuffVector.begin()+i); } cout &lt;&lt; stuffVector.size() &lt;&lt; endl; if (stuffVector.size() == 0) cout &lt;&lt; "Vector Emptied" &lt;&lt; endl; } </code></pre> <p>This always reports back with a size of however many objects are in the vector, and doesn't actually seem to delete anything at all. It's odd as a similar function works elsewhere to delete a specific object from the vector:</p> <pre><code>void DestroyStuff() { if (stuffVector.size() &gt; 1) { for (std::vector&lt;Stuff*&gt;::size_type i = 0 ; i &lt; stuffVector.size() ; i++ ) { if(stuffVector[i]-&gt;CanDestroy()) { stuffVector.erase (stuffVector.begin()+i); } } } } </code></pre> <p>The above works fine, but CleanUp() does not. Why might this be happening?</p>
c++
[6]
780,515
780,516
I am searching for verticalmenu in jquery and css.. submenu should show up on click event. Can anybody help me?
<p>MI am hard time in finding jquery menu which works with click event. Suggests me the links where I can download such menu</p>
jquery
[5]
4,963,207
4,963,208
Camera.Parameters.FLASH_MODE_TORCH
<p>My problem is that the TORCH MODE is disabled when the get function onPictureTaken. How to make a torch mode on work during a photographic survey?</p>
android
[4]
3,439,148
3,439,149
Write tab separated csv file in c#
<p>I am currently developing an application in C# where I need to write a tab separated CSV file from the data that it retrieves from a MySQL Database. The database retrieval works fine. </p> <p>The problem that I am having is writing the file. Between each variable that I am writing I am using the \t which I thought put a tab into the csv, therefore when opening in excel each variable will be in its own cell. </p> <p>However for some reason it is not doing this it just writes the whole line as one long string. Below is an example of the code that I am code that I have written:</p> <pre><code>while (reader.Read()) { int bankID = reader.GetInt16("ban_bankID"); int userID = reader.GetInt16("ban_userID"); string bankUsername = reader.GetString("ban_username"); string accountName = reader.GetString("ban_accountName"); string accountType = reader.GetString("ban_accountType"); decimal overdraft = reader.GetDecimal("ban_overdraft"); char defaultAccount = reader.GetChar("ban_defaultAccount"); string line = bankID + "\t" + userID + "\t" + bankUsername + "\t" + accountName + "\t" + accountType + "\t" + overdraft + "\t" + defaultAccount + "\n"; tw.WriteLine(line); </code></pre> <p>Thanks for your help with this problem.</p>
c#
[0]
5,523,079
5,523,080
display icons (or content) on mouseover
<p>In twitter, when you hover your mouse over a message a star and a reply icon appears on the right.</p> <p>Similarly, in facebook when you hover your mouse over to an update, the little 'hide' icon appears on the right also giving a little context menu.</p> <p>I want to have a similar approach in my project for drag &amp; drop handles. What I can decide is the what the most efficient way is it to accomplish this goal.</p> <p>is it that everytime I hover the mouse onto a div with an id, do I just inject the html with .append() or similar? or do I show/hide the already existing html.. or is there a better way?</p>
jquery
[5]
3,709,719
3,709,720
check compiler with break point
<p>When I tried to focus on compiler in code, I made break point on code.</p> <pre><code>if (!IsPostBack) { using (SqlConnection Con = Connection.GetConnection()) { if (Request.QueryString["Category_Id"] != null &amp;&amp; DDlProductFamily.SelectedIndex &lt; 0) { SqlCommand Com = new SqlCommand("SelectAllCtageories_Front", Con); Com.CommandType = CommandType.StoredProcedure; Com.Parameters.Add(Parameter.NewInt( "@Category_Id", Request.QueryString["Category_Id"])); SqlDataAdapter DA = new SqlDataAdapter(Com); DA.Fill(dt); DataList1.DataSource = dt; DataList1.DataBind(); } </code></pre> <p>But I cannot check condition although I had the value of query string.</p>
c#
[0]
3,883,152
3,883,153
Is there a way to expand the notifications with a key press, instead of touch?
<p>The reason: I'm trying to make Android work in a device without touch screen.</p>
android
[4]
5,359,838
5,359,839
add animation to show user that add goods to tabbar badge
<p>I notice there are some app, when I tap a button, it will display an animation look likes something drop from the button to uitabbaritem, and badge of the uitabbaritem will increade.</p> <p>I try to do smashing in my app, but no result</p> <p>Welcome any comment</p>
iphone
[8]
678,241
678,242
jquery to modify a link
<p>I have the following HTML:</p> <pre><code>&lt;TD class=ms-sctabcf &gt; &lt;A href="http://localdev.industrial.com:80/en-US/SearchM3/Pages/results.aspx?k=test+contenttype%3a%22IABusinessProduct%22&amp;amp;s=IA_xx-XX_Content"&gt;All Results &lt;/A&gt;&lt;/TD&gt; </code></pre> <p>I need a jquery function that removes the "contenttype%3a%22IABusinessProduct%22" from the anchor tag.</p> <p>Something like this should do it:</p> <pre><code>function removeContentTypeFromAllResultsLinkOnGeneralSearch(){ var anchorTag = $('.ms-sctabcf').has('text=All Results').find('a'); var currentLink = anchorTag.link; // remove the "contenttype%3a%22IABusinessProduct%22" from the link. ( match any content type value using regular expression) var modifiedLink = currentLink.regex.replace("contenttype%3a%22.*?%22",""); anchorTag.link = modifiedLink; } </code></pre> <p>Can you help me turn my pseudocode into a real jquery/javascript function? </p> <p>Also, I need to select the a tag only if it has the inner text of "All Results". what is the jquery selector for that?</p>
jquery
[5]
3,245,637
3,245,638
How to use subList()
<p>I have a JSF page which displays list of Glassfish log files. I use lazy loading for pagination. I keep the list of the log files names into Java <code>List</code>.</p> <pre><code>private List&lt;directoryListObj&gt; dataList = new ArrayList&lt;&gt;(); dataList = dataList.subList(firstRow, lastRow); </code></pre> <p>And here is the problem. For example I have 35 files into the directory. When I do this </p> <pre><code>dataList = dataList.subList(5, 15); </code></pre> <p>It works fine. But when I do this:</p> <pre><code>dataList = dataList.subList(30, 38); </code></pre> <p>I get error wrong index because I want to get index outside of the List. How I can for example return List elements from 30 to 35? I want if I want to get index from 30 to 40 but if there only 35 indexes to get only 5.</p>
java
[1]
2,835,142
2,835,143
Add adjacent digit repetetions in an 10 digit number until no adjacent repetetions in a number
<p>How to add same adjacent digits in a number for eg: 9112322544 would be 9223458. and again add same adjacent digits if any until no repetition in number using c++??</p>
c++
[6]
4,369,130
4,369,131
php fetchpage() function help, identifying image sizes from a url in php
<p>hey guys so im building an application and one of teh features it will have is the ability to show photo links from twitter inline sort of like what tweetdeck has done in their chrome browser version and sites like crowdreel have been able to do, i spent some time researching how to grab image tags from urls on google and found this fantastic script <a href="http://www.bitrepository.com/extract-images-from-an-url.html" rel="nofollow">http://www.bitrepository.com/extract-images-from-an-url.html</a></p> <p>the script is great and does exactly what i need, however now my challenge is that the array returned from the links returns every image in the page including thumbnails ads etc, so a link to a page like this: <a href="http://lockerz.com/s/69901787" rel="nofollow">http://lockerz.com/s/69901787</a></p> <p>will return an array with quite a few image links to sort through, however what i need is a link to the main image so that i can display it inline with tweets, my idea is that i run some sort of code to figure out which of the images in the page is the largest? what are your thoughts on this? is this the right method or is there something easier thats built into php perhaps? thanks for all your help guys!</p>
php
[2]
2,476,201
2,476,202
In StartActivityForResult how to get requestCode from child
<p><br> I have Four activity say A, B, C and D<br> My situation is A will start the activity B by startActivityForResult. </p> <pre><code>startActivityForResult(new Intent(this,B.class),ONE); </code></pre> <p>In other situation i will B with other situation. like </p> <pre><code> startActivityForResult(new Intent(this,B.class),TWO); </code></pre> <p>In B i need to check I need to call C or D depending requestCode. I.e if ONE need to start C else D So i need to know who to check the requestCode in the child Activity (B here )<br> Or in other words I want to get with what request code did B started in the Activity B<br> Thanks in advance </p>
android
[4]
2,662,658
2,662,659
How do I capture the mouse move event in my winform application
<p>I would like to capture the mouse move event in my main form. Although I am able to wire up the MouseEventHandler for the mian form the event no longer fires when the cursor is over a usercontrol or any other control. How do I ensure that I always have the mouse position.</p>
c#
[0]
5,618,896
5,618,897
Adding a ID to a <li> based on part of an <a> tag
<p>I have the following code:</p> <pre><code>&lt;li class="zoneName"&gt;&lt;a href="/Default.aspx?PageID=4869007"&gt;CYKF&lt;/a&gt;&lt;/li&gt; &lt;li class="zoneName"&gt;&lt;a href="/Default.aspx?PageID=4868459"&gt;YKA&lt;/a&gt;&lt;/li&gt; </code></pre> <p>I need to add and ID to each of the &lt; li > tags in this list. I need that ID to be the number at the end of the href string. Below is what I'd like it to be</p> <pre><code>&lt;li class="zoneName" id="4869007"&gt;&lt;a href="/Default.aspx?PageID=4869007"&gt;CYKF&lt;/a&gt;&lt;/li&gt; &lt;li class="zoneName" id="4868459"&gt;&lt;a href="/Default.aspx?PageID=4868459"&gt;YKA&lt;/a&gt;&lt;/li&gt; </code></pre> <p>Any help is appreciated.</p>
jquery
[5]
5,874,910
5,874,911
stringstream won't convert to correct number value
<p>[SOLVED] See my answer below.</p> <p>I am trying to use stringstream (named ss) to convert some strings to ints and some to double and such, but the values are all coming out wrong. I have a vector of strings named vec, initialized like this:<br/> [0] = ID # in hex<br/> [1] = phone number<br/> [2] = last name<br/> [3] = first name<br/> [4] = sales number<br/> [5] = percent of sales<br/> Now I go through the vector and put the values into int, string, or double:</p> <pre><code>std::string lname, fname, pnum; int ID; double sales, percent; if(vec.size()!=6) { //throw exception } else { ss&lt;&lt;std::hex&lt;&lt;vec[0]; ss&gt;&gt;ID; pnum = vec[1]; lname = vec[2]; fname = vec[3]; ss&lt;&lt;vec[4]; ss&gt;&gt;sales; ss&lt;&lt;vec[5]; ss&gt;&gt;percent; } </code></pre> <p>but the output looks like this for every customer. What are my ints always 1 and my doubles always this weird number?</p> <p>Customer made: Langler Tyson 1 7667230284 2.12303e-314 2.12201e-314 </p>
c++
[6]
824,677
824,678
Python Vertical Array Slicing
<p>Can anyone show me how to slice the structure below:</p> <pre><code>[[1, A], [2, B], [3,C]] </code></pre> <p>Into two separate lists:</p> <pre><code>[1, 2, 3] [A, B, C] </code></pre> <p>I can obviously do this using code, but wondered if Python was able to do it natively?</p>
python
[7]
78,968
78,969
where should inheritance classes be stored?
<p>I want to create classes that can be inherited by other classes to use along my project. i.e. i want to create a separate class for each Mail method, each class will implement differently the Compose method, and more Mail classes will be created in the future.</p> <p>My question is - Where should I create these classes/interfaces? in the App_Code ?</p>
asp.net
[9]
6,008,133
6,008,134
What is jquery and hashtable usage
<p>I am new to jquery. I want know jquery "how it works in webpage"? Is there any useful site to learn jquery completely??? I want to know about hashtable in jquery?</p>
php
[2]
3,813,534
3,813,535
How to retain the state of button click in android
<p>I have two layout for one activity like layout-port and layout-land with different designs .if user click button in potrait mode and change to landscape mode activity is restarting or refreshing again can anybody tell how to avoid this can anybody tell how to maintain the state activity can anybody provide example</p> <p>Thanks in advance</p>
android
[4]
2,902,708
2,902,709
Save a table as text
<p>What i have right now:</p> <pre><code>oname = open("1231.txt","w") def cC_(): d_=" fahrenheit celsius" print(d_) for i in range(-300,213,1): c_=(i-32)*(5/9) a_=str(i)+'°F' b_=str(round(c_,3))+'°C' print("%10s" % (a_), ' ',"%10s" % (b_)) oname.write(cC_()) oname.close() </code></pre> <p>My Question: i cannot get a table which like the function's print in text.</p> <p>fahrenheit celsius</p> <pre><code>-300°F -184.444°C -299°F -183.889°C -298°F -183.333°C -297°F -182.778°C -296°F -182.222°C -295°F -181.667°C -294°F -181.111°C -293°F -180.556°C -292°F -180.0°C </code></pre> <p>.........</p>
python
[7]
464,780
464,781
Purpose of if(0){ //code }?
<p>Quick question. I just came across the following in a JS file:</p> <pre><code>if (0) { // code } </code></pre> <p>What's the purpose of this if statement? Which cases would the code execute? It currently doesn't run the code in the if clause.</p>
javascript
[3]
1,178,028
1,178,029
I am (also) having trouble making connections between code and Interface Builder
<p>I have the exact same question as this <a href="http://stackoverflow.com/questions/441941/i-am-having-trouble-making-connections-between-code-and-interface-builder">post</a> but with a better description of the problem.</p> <p>Using Inteface Builder (IB) I am unable to connect a button to the View Controller ("File Owner") in Apple's <a href="http://developer.apple.com/iphone/library/samplecode/MoviePlayer%5FiPhone/index.html" rel="nofollow">MoviePlayer</a> sample. It will only connect to "First Responder" yet somehow, the Sample has accomplished this (see image).</p> <p>To put it another way, if I take the MoviePlayer sample, open "MainWindow.xib" in IB and delete the connection between "Button" and "My Movie View Controller" (see image), <strong>I am unable to recreate that connection</strong>.</p> <p><img src="http://www.chrisbennet.com/IntefaceBuilderQuestion.jpg" alt="alt text" /></p> <p>I know it must be a noobie question but I'd be unbelievably grateful to anyone who can help me with this.</p> <p>Thanks in advance, </p>
iphone
[8]
5,819,658
5,819,659
Modify __new__ attribute for inmutable types in Python
<p>im trying to modify the behaviour of the 'int' type in Python.</p> <p>it says </p> <p><code>'__new__' is readonly.</code></p> <p>Is there a way to do it? </p> <p>thanks.</p>
python
[7]
5,139,165
5,139,166
Can a Tab Page be a parent of MDI child windows?
<p>I am using C# to create a form application which has a couple of tab pages. I want to contain MDI child windows in one of the Tab page. Is it possible? I tried something like childForm.MdiParent = this.tabPage1.Handle, but I got a compile error because the type doesn't match. Would you have a good idea to do this?</p>
c#
[0]
1,782,242
1,782,243
example of using log collector from my app
<p>the open source Log Collector looks very useful and I would like to integrate it into my app. Although the source code site mentions a usage example I cant see anything like this except for the mention re usage inside the source code itself. Is there any other info on this?</p>
android
[4]
1,954,374
1,954,375
Android : HttpClient Secure
<p>I am new to Android . I have a requirement , send a data from Android mobile to server. I have done using HttpClient. Now the problem is whether it is secure connection? How we can make sure this is secure way?Please guide me this topic: </p> <pre><code>ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); nameValuePairs.add(new BasicNameValuePair("user", user.getText().toString())); nameValuePairs.add(new BasicNameValuePair("pass", pass.getText().toString())); Log.w("log_tag", "User" + user + "Pass" + pass); //http post try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://192.168.1.173/android/androidTest.php"); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); Log.w("log_tag", "====" + user + "====" + pass); HttpEntity entity = response.getEntity(); // is = entity.getContent(); Intent intent = new Intent(); intent.setClass(this,Result.class); intent.putExtra("user", user.getText().toString()); intent.putExtra("pass", pass.getText().toString()); startActivity(intent); }catch(Exception e){ Log.e("log_tag", "Error in http connection "+e.toString()); } </code></pre>
android
[4]
4,902,644
4,902,645
Facebook Album Creation php
<p>When I issue the following post command to create the album, nothing is created.</p> <pre><code> $album_url="https://graph.facebook.com/".$fanpage_id."/albums?" . "name=" . urlencode($album_name) . "&amp;message=" . urlencode($album_description) . "&amp;method=POST" . "&amp;access_token=" . $fanpage_token; file_get_contents($graph_url); </code></pre> <p>However, the album can be created with the below hard code. Something wrong in the above post command? </p> <pre><code> $album_url = 'https://graph.facebook.com/xxx/albums?name=%22album%20php%20%20name%22&amp;message=%22Album%20php%20%20description%22&amp;method=POST&amp;access_token=xx; file_get_contents($album_url); </code></pre>
php
[2]
2,608,762
2,608,763
Roles/responsibilities of FragmentActivities vs. Fragments
<p>Say I have an application with two instances of FragmentActivity, FragActivityA and FragActivityB, and two ListFragments, FragA and FragB.</p> <p>In portrait, FragActivityA presents FragA, and upon selection starts FragActivityB presenting FragB.</p> <p>Should FragA implement OnItemClickListener for the ListView (some networking business is performed on press), or FragActivityA? Should FragA show a DialogFragment, or should there be a callback to FragActivityA to show it?</p> <p>When in landscape, FragActivityA presents both FragA and FragB. Now, if the answers to the above are yes, FragActivityA needs to include most methods of FragActivityB, duplicating most of the code. If the answers are no, then FragA or FragB need to present and handle DialogFragments themselves.</p> <p>I'm looking for a little guidance on where I should be writing most of my code (my gut feeling is inside the Fragments), but Fragments displaying DialogFragments seems strange to me.</p>
android
[4]
4,536,428
4,536,429
how to set system properties in C#
<p>how can i set system properties in C#. </p> <p>In java i can use:</p> <pre><code>System.setProperty("webdriver.chrome.driver","/path/to/where/you/ve/put/chromedriver.exe"); </code></pre> <p>how to do this in C#?</p>
c#
[0]
1,241,697
1,241,698
How to store a list of sets of three strings?
<pre><code>std::vector&lt;std::pair&lt;std::string &gt; &gt; </code></pre> <p>can be used to store a list of a pair of strings. Is there a similar way to store a list of triplets of strings?</p> <p>One way I can think of is to use <code>std::vector</code></p> <pre><code>std::vector&lt;std::vector&lt;std::string &gt; &gt; v (4, std::vector&lt;std::string&gt; (3)); </code></pre> <p>but this will not allow me to use the handly <code>first</code> and <code>second</code> accessors.</p> <p>So, I wrote my own class</p> <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; using namespace std; template &lt;class T&gt; class triad { private: T* one; T* two; T* three; public: triad() { one = two = three =0; } triad(triad&amp; t) { one = new T(t.get1()); two = new T(t.get2()); three = new T(t.get3()); } ~triad() { delete one; delete two; delete three; one = 0; two = 0; three = 0; } T&amp; get1() { return *one; } T&amp; get2() { return *two; } T&amp; get3() { return *three; } }; int main() { std::vector&lt; triad&lt;std::string&gt; &gt; v; } </code></pre> <p>I have two questions</p> <ol> <li>Can my class code be improved in any way?</li> <li>Is there any better way to do store triplets of strings than the three ways described above?</li> </ol>
c++
[6]
4,608,560
4,608,561
Making Request to a Web API in c#
<p>I have an application to send sms. we have purchased a sms api and they have given links to request. Now my question is how to request this links in c# and get back the result.</p>
c#
[0]
1,271,370
1,271,371
array_combine empty values
<p>One array is 35 elements (mysql column names) </p> <p>Array ( [1] => ID...) </p> <p>second is only few elements: </p> <pre><code>Array ( [1] =&gt; 63 [2] =&gt; REF213211 [3] =&gt; aaa [7] =&gt; Warszawa [8] =&gt; Wola [12] =&gt; 100 [14] =&gt; 1 [15] =&gt; 100 [35] =&gt; 1 ) </code></pre> <p>I need to combine first array as keys for second array </p> <p>Please help </p>
php
[2]
3,585,890
3,585,891
Use name of object to run a function
<p>I would like to do the following in JavaScript:</p> <pre><code>var myObject.name = myString; function newFunction(){myObject.name} </code></pre> <p>Is it possible to use a string as the contents of a function? How would you convert it to be usable?</p>
javascript
[3]
808,375
808,376
Data storage for Android app
<p>I need to write an application with a lot of questions with 4 variant aanswer for each (tests, in short). Where to store the actual answers and the questions? Create a file, or use SQLlite, or Strinq.xml (although it seems this is the most desirable not).</p> <p>If I use SQLlite, then for example, if somebody download app, all of my questions and answers should already be there. </p>
android
[4]
2,380,860
2,380,861
Check pixels pattern
<p>How can I check for a pixel pattern in PHP?</p> <p>I mean I wanna use as condition that pixel A has xxx value and the following pixel B has another value yyy.</p> <p>This is what I wrote:</p> <pre><code>$img = imagecreatefrompng("myimage.png"); $w = imagesx($img); $h = imagesy($img); for($y=0;$y&lt;$h;$y++) { for($x=0;$x&lt;$w;$x++) { $rgb = imagecolorat($img, $x, $y); $r = ($rgb &gt;&gt; 16) &amp; 0xFF; $g = ($rgb &gt;&gt; 8) &amp; 0xFF; $b = $rgb &amp; 0xFF; echo "#".$r.$g.$b.","; $pixel = $r.$g.$b; if ($pixel == "481023" and $pixel+1??? } echo "&lt;br /&gt;\r\n"; } </code></pre> <p>I'd like to ask also if I can speed up the whole thing by incrementing the $x value by 2 every for cycle. This because I have a pattern of 2 pixels, maybe I can use something like:</p> <pre><code>for($x=0;$x&lt;$w;$x+2) { //... if ($pixel == "xxx") {//check the following pixel} else if ($pixel == "yyy") {//check the previous pixel} } </code></pre>
php
[2]
5,109,611
5,109,612
Java Script: New Date Format is not working for Nov and December
<p>I am trying to change my date format </p> <pre><code> var d = new Date(); var curr_year = d.getFullYear(); var curr_Month = d.getMonth() +1; var curr_date = d.getDate(); var todayDate = var tDate = ( curr_Month +"/"+curr_date +"/"+ curr_year); </code></pre> <p>This is working perfectly fine ,But for the month November it shows 10,instead of 11 and for the month of December it shows 11 instead of 12 ...for the rest of months it all fine ..</p> <p>NOTE : This problem is only in mozilla and opera ,in internet explorer its working fine !</p> <p>Any idea </p> <p>Thanks </p>
javascript
[3]
263,584
263,585
Call a method of running java application on the same instance of the application from command prompt
<p>Is there any way to call a certain method in a running java application?</p> <p>Forexample: I have a java application running, Now I want to call a method <code>uk.co.planetbeyond.chatservice.Stopper.stop()</code> on the same instance of the application. Can I do that?</p>
java
[1]
2,690,176
2,690,177
Android - How to create a basic class and use it?
<p>I have defined a class that contains properties of a specific answer object The class look like this and is defined inside the class that is trying to use it</p> <pre><code>protected class Answer { String QuestionId = ""; String AnswerValue = ""; String Correct = ""; public String getQuestionId() { return QuestionId; } public void setQuestionId(String arg) { QuestionId = arg; } public String getAnswerValue() { return AnswerValue; } public void setAnswerValue(String arg) { AnswerValue = arg; } public String getCorrect() { return Correct; } public void setCorrect(String arg) { Correct = arg; } } </code></pre> <p>Not sure if the above is OK When I try to use the class I get null pointer errors I'm using it like this</p> <pre><code> ArrayList&lt;Answer&gt; answerList = new ArrayList&lt;Answer&gt;(); for(int a=0;a&lt;answers.getLength(); a++){ Element eAnswer = (Element) answers.item(a); Answer anAnswer = new Answer; NodeList answer_nodes = eAnswer.getChildNodes(); for (int ian=0; ian&lt;answer_nodes.getLength(); ian++){ Node ans_attr = answer_nodes.item(ian); String tag_name = ans_attr.getNodeName(); if(tag_name.equalsIgnoreCase("answer")){ anAnswer.setAnswerValue(ans_attr.getTextContent()); } } answerList.add(anAnswer); } </code></pre> <p>Answer anAnswer = new Answer; gives a compilation error All I'm trying to do is to create a list of answers which have a name value pair for a number of properties</p> <p>Any guidance on this greatly appreciated - Especially if there is a better way</p>
android
[4]
1,459,530
1,459,531
Remove the Close button in the program's title bar
<p>Goal:<br> Don't want the user to use the X mark (upper right of the program's screen) to exit the program.</p> <p>Problem:<br> Don't know how to remove that icon that allows user to exit the program?</p>
c#
[0]
949,097
949,098
jQuery .html() and a variable inside
<p>I would like to put variable FLC in inside <code>$("#FNC").html('');</code> but don't know how to, any tips?</p> <p>DEMO:</p> <pre><code>var FLV = $("#random-input-box").val(); $("#FNC").html('&lt;input id="random-input-box" style="width: 99px;" value="FLC" disabled="disabled" /&gt;'); </code></pre>
jquery
[5]
665,968
665,969
NSScanner, reaching the end of parsing string
<p>I have a string that's like</p> <p>"Condition: <strong><em>some text which can have a comma in it but not always</em></strong>, Type <em><code>more text</code></em> Product: <strong><em>more text, can be NULL sometimes</em></strong></p> <p>What I did was:</p> <pre><code>NSString *condition = @"Condition:"; NSString *type = @", Type"; NSString *product = @"Product:"; NSScanner *scanner = [NSScanner scannerWithString:myString]; [scanner scanString:condition intoString:NULL]; [scanner scanUpToString:type intoString &amp;conditionName]; [scanner scanUpToString:type intoString:NULL]; [scanner scanUpToString:product intoString:&amp;typeName]; [scanner scanString:product intoString:NULL]; // stuck here </code></pre> <p>I don't know how to scan till the end of the string since scanString:intoString: takes a NSString parameter. I wasn't sure how to put these into a while loop either to scan till the end. Any thoughts? Thanks.</p>
iphone
[8]
2,237,612
2,237,613
Android Bundle NullPointer
<p>In my Android application I want to transfer data between activities; mentioned FirstActivity.class and SecondActivity.class. But in my FirstActivity it is showing a <code>NullPointerException</code>. Can you tell me what's wrong in my class?</p> <p>FirstActivity.class:</p> <pre><code>Bundle bundle = getIntent().getExtras(); fingerPrintID = bundle.getString("ThumbInfo"); </code></pre> <p>SecondActivity.class:</p> <pre><code>Bundle bundle = new Bundle(); bundle.putString("ThumbInfo", FingerImageData.toString()); Intent enroll=new Intent(First.this,Enroll.class); enroll.putExtras(bundle); startActivity(enroll); </code></pre>
android
[4]
1,905,405
1,905,406
Logout for twitter, linkedin and last.fm
<p>I am able to logged into my application with linkedin, twitter and last.fm but on logout I logs out of the application and not linkedin, twitter and last.fm.I want user to logout of both linkedin, twitter and last.fm and my application at the same time. please anyone suggest me how to do that.</p> <p>thanks in advance!</p>
php
[2]
3,431,420
3,431,421
Jquery DataTables, sort by specific column?
<p>Here's the page: </p> <p><a href="http://csuvscu.com/" rel="nofollow">http://csuvscu.com/</a></p> <p>I need to sort by the Date Column, right now it needs to read Nov 6, Nov 5 and lastly Oct 7. </p> <p>How do I do this? </p>
jquery
[5]
4,885,024
4,885,025
How to invoke a remote program in Java?
<p>Is it possible to invoke an exe on a remote computer, supposing we know the absolute path of the exe where it lies?</p> <p>I have written a client and a server program and am able to get both work as expected when both are running. But now, all I want to do is to invoke the server program from client if server is not running. Seems like defeating the purpose of server-client model but still.</p> <p>If that is possible without knowing the login credentials of the remote system, then it'd be cool. Eg: There are softwares like 'PsExec' that need login credentials.</p> <p>I understand that, such a feature may not be there, as it would mean a serious security threat, but, I am just wondering if there is some sort of a workaround.</p>
java
[1]
5,442,795
5,442,796
retrieve data from sql to datagrid view
<p>this code wont run it supposed to fill the datagridview some data but all i got was the rows of how many data was retrieve but no values on each cells</p> <pre><code> public void refDGV() { con.OpenConnections(); SqlCommand cmd = new SqlCommand(); SqlConnection cn = new SqlConnection(); SqlDataAdapter da = new SqlDataAdapter(); DataSet ds = new DataSet(); cmd.Connection = cn; cmd.CommandType = CommandType.Text; cn.ConnectionString = con.connections1; cmd.CommandText = "Select dtransdate, ntotal_pass, nincomeday, ndiesel_exp, nstartkm, nendkm from ROUTE2 where ccontrol_no = '" +txtCN.Text + "'"; da = new SqlDataAdapter(); da.SelectCommand = cmd; ds = new DataSet(); da.Fill(ds, "Data"); dgroute.DataSource = ds; dgroute.DataMember = "Data"; dgroute.Columns[0].HeaderText = "Date"; dgroute.Columns[1].HeaderText = "Total Passenger"; dgroute.Columns[2].HeaderText = "Income Day"; dgroute.Columns[3].HeaderText = "Diesel (w/ reciept)"; dgroute.Columns[4].HeaderText = "Start"; dgroute.Columns[5].HeaderText = "End"; } </code></pre>
c#
[0]
313,802
313,803
php if statement in javascript
<p>dear all</p> <p>i have a error when i put if statement to rules validation javascript</p> <p>example</p> <pre><code>var jenis = "prabayar"//echo json_encode </code></pre> <p>and this is the script </p> <pre><code>if(jenis == "prabayar") { rules: { user: { required: true, number: true, } }, messages: { user: { required: "* Maaf field user masih kosong.", number: "* Field user harus angka.", } } } </code></pre> <p>how to put a if statement to javascript rules validation?</p> <p>thank you so much</p> <p>sorry for my bad english</p> <p>BR</p> <p>Puja</p>
javascript
[3]
5,166,824
5,166,825
How to get the contents of a text file (stored locally in the documents directory) into an NSString?
<p>How to retrieve the contents of a <strong>TEXT FILE</strong> stored locally in the documents directory?</p>
iphone
[8]
4,203,302
4,203,303
What does & in &$data do?
<p>A quick beginner's question in PHP.</p> <p>What does &amp; in &amp;$data do and what are differences with $data?</p> <pre><code>function prepareMenu(&amp;$data) { $this-&gt;db-&gt;where('parentid',0) ... ... </code></pre>
php
[2]
1,191,864
1,191,865
caculating dates with php
<p>I have a general question on calculating dates with php.</p> <p>What happens if I store a timestamp like this in my database:</p> <pre><code>$db_timestamp = '2010-01-31 00:00:00'; </code></pre> <p>and then run a daily script that checks if a month has passed since the timestamp was saved in the database:</p> <pre><code>if ($db_timestamp == make_unix_timestamp(mktime(0, 0, 0, date("m") - 1, date("d"), date("Y")), TRUE, 'eu'))) { do something }; </code></pre> <p>my problem is that i just realized that this wouldn't work for all dates. in this case 'do something' would not be called in February, since February doesn't have a 31st day. any idea on how to implement something like that?</p>
php
[2]
2,245,432
2,245,433
how to get value of hidden field value?
<p>I have an asp.net application in which i want to get the value of hidden field value in to my code behind page.</p> <p>Actually its executing code first and after that its executing javascript.</p> <p>That's why i am not getting the value. Please tell me how can i get the value.</p> <p>Javascript</p> <pre><code>function changeCSS(colr,wd) { chooseStyle(colr, wd) var CssTitle = document.getElementById('&lt;%= hdCssTitle.ClientID %&gt;'); CssTitle.value = colr; } </code></pre> <p>and code behind page is</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { string CssTitle = hdCssTitle.Value; } </code></pre>
asp.net
[9]
5,890,070
5,890,071
why isn't this click trigger on a tab list working with jQuery?
<p>I've inherited support for a rails site with jQuery and I'm still learning jQuery. Looks like they're using tab navigation, and trying to trigger a click on the next tab with a 'Next' link below. Here's the relevant snippet:</p> <pre><code>&lt;script type="text/javascript"&gt; jQ().ready(function(){ jQ("#tabs").tabs(); }); &lt;/script&gt; ... &lt;div id="tabs"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#tab1"&gt;&lt;span&gt;Tab1&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#tab2"&gt;&lt;span&gt;Tab2&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#tab3"&gt;&lt;span&gt;Tab3&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div id="tab1"&gt;stuff &lt;a href="#" onclick="jQ('#container&gt;ul&gt;li:eq(1)').find('a').trigger('click');"&gt;Next&lt;/a&gt; &lt;/div&gt; &lt;div id="tab2"&gt;stuff &lt;/div&gt; &lt;div id="tab3"&gt;stuff &lt;/div&gt; &lt;/div&gt; </code></pre> <p>When you click on the Next link, nothing happens. I'm still trying to parse the syntax of jquery there. From what I read in one of the tutorials, the '#container' is looking for an element with the id='container', right? Could that be the problem? Or does '#container' have special meaning with jQuery?</p>
jquery
[5]
3,722,813
3,722,814
Authorization in ASP.NET for accessing a set of subdirectories depending on login
<p>Scenario: A web application consists of a root directory (open, no authorization) and a number of subdirectories (let's call them Sub1, Sub2 and Sub3). Furthermore, when an user name is provided, there's a method contacting a SP and returning an <code>IEnumerable&lt;String&gt;</code> consisting of the names of subdirectories, which that certain user is supposed to be allowed to access. The above is not changeable.</p> <p>I wonder what the <strong>neatest</strong> way to solve this would be. I can't rely on AD and a simple authorization stored in a cookie or a session variable won't allow for a diversification of accessible subdirectories.</p> <p><em>I'm pretty confident I can make it work but I'd like to do it in bragable style.</em></p> <p>Suggestions? </p>
asp.net
[9]
4,638,518
4,638,519
How can I make a constructor's argument be available from instance initialisers?
<pre><code>class Foo { final String s; final int x = s.length(); Foo(String s) { this.s = s; } } </code></pre> <p>The above code will not compile, because the assignment to x happens before the assignment to s. I could place the assignment to x inside the constructor, but for readability in a real case with 100 fields, I'd rather not.</p> <p>I have come up with a workaround, which I dislike. Can you find a better one?</p> <pre><code>abstract class Hack { final String s; Hack(String s) { this.s = s; } } class Foo extends Hack { final int x = s.length(); Foo(String s) { super(s); } } </code></pre>
java
[1]
2,012,525
2,012,526
Java application installer as a windows service or startup
<p>I am using netbeans to create a project, and the final result needs to be an installer, that when you install the app, it would automatically turn itself on after every computer reset. I was looking (still am) for any software that would help me, but cant find anything.. I found a simple install creator and it makes an installer but it doesnt automatically puts the app as a windows service (i could use the CMD to make it as a service after the installation, but i want it to be automatic).</p> <p>Another alternative is that the installer would put the application exe in the users startup group, but again, i want it to do so automatically.</p> <p>Can someone recommend me some simple software for this. Thank you.</p>
java
[1]
1,931,484
1,931,485
how to parse xml with http post service
<p>guys, I want to parse a xml in android which is got by HTTPPost method service. and I stored that xml in a string variable, but i don't know how to parse it. becoz it is in a string format. can any one give the example code for this? .............</p>
android
[4]
4,597,599
4,597,600
How to implement a HTTP Server in android which can be access by other device with browser?
<p>I have a new requirement to implement a HTTP Server which run in a android device. And this HTTP server is access by other device such as PC with browser. I find a example like it: PAW server for android. But I don't know how to implement it. The PAW server for android is very complicate. Is there any simple way to implement this requirement? I also read this article: <a href="http://stackoverflow.com/questions/7268320/how-to-implement-an-http-server-on-android">How to implement an HTTP server on android</a> </p>
android
[4]
2,288,933
2,288,934
Using a Date as the hash table key
<p>How can I create a hash table object in JavaSript and use a date as the key? So far I've got this:</p> <pre><code>var eventHash = {}; for (var i = 0, l = events.length; i &lt; l; i += 1) { eventHash[events[i].date.getTime()] = events[i]; } </code></pre> <p>And then when I want to find the event associated with today I would use this:</p> <pre><code>var event = eventHash[(new Date(2011, 04, 26, 0, 0, 0, 0)).getTime()]; </code></pre> <p>Can anyone see any pitfalls with this solution, or have any suggestions for improvement?</p>
javascript
[3]
4,796,714
4,796,715
Type casting to EntityCollection<Object>
<p>I have a method taking a parameter EntityCollection</p> <p>Say:</p> <pre><code>DisplayItems(EntityCollection&lt;Object&gt; items); </code></pre> <p>Why is it not possible to call?</p> <pre><code>EntityCollection&lt;Student&gt; students; DisplayItems((EntityCollection&lt;Object&gt;) students); //type casting here </code></pre> <p>How can I achieve this?</p> <p>Please help</p>
c#
[0]
1,195,978
1,195,979
Python text file
<p>I have a txt file which is approx 25 columns wide and 5 columns deep, I have written the following script </p> <pre><code>for line in open("ABC.txt"): fg = line.split("\t") minimum = fg[17] print minimum </code></pre> <p>This is finding column 18 data which is </p> <pre><code>Supplier B 567 4444 2.77 19 </code></pre> <p>Questions is: how can I get just the data for <code>4444</code>?</p> <p>Jezza</p>
python
[7]
4,707,624
4,707,625
Remove the Close button in the program's title bar
<p>Goal:<br> Don't want the user to use the X mark (upper right of the program's screen) to exit the program.</p> <p>Problem:<br> Don't know how to remove that icon that allows user to exit the program?</p>
c#
[0]
968,404
968,405
my php files are nt getting displayed so wat should i do for tht?
<p>how to display Php if else statements and how to define a function in php?</p>
php
[2]
3,051,637
3,051,638
How to show random images on Android?
<p>I have a number of images in my directory. I want to show random images in ANDROID. Please anyone provide me with an example.</p>
android
[4]
4,827,668
4,827,669
get data from h:selectManyListbox without selecting
<p>I want to get data from h:selectManyListbox without selecting any data and bind to backing bean automatically.How to get? Please confirm me about this problem.</p>
java
[1]
2,705,419
2,705,420
Application is starting even after closing
<p>This is my first activity and when I press the back button in the phone , the app closes, but the second activty is popping up even after it closes! may be because the thread is still running? but i tried destroying it but of no avail! any suggestions </p> <pre><code>protected void onCreate(Bundle myclass) { super.onCreate(myclass); setContentView(R.layout.splash); timer = new Thread() { public void run() { try { sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } finally { Intent openStarting = new Intent("nik.tri.MENU"); startActivity(openStarting); } } }; timer.start(); } @Override protected void onPause() { super.onPause(); timer.destroy(); // tried timer.stop() as well finish(); } </code></pre> <p>}</p>
android
[4]
807,414
807,415
how to sort files on server in the client-server model?
<p>I am developing a client server model in which i need to send some TCP dump data to the server. The server will sort the data and will send it back to the client. I wanted to know how to go about this procedure. </p>
java
[1]
2,581,983
2,581,984
Copying files with unicode names
<p>this was supposed to be a simple script</p> <pre><code>import shutil files = os.listdir("C:\\") for efile in files: shutil.copy(efile, "D:\\") </code></pre> <p>It worked fine, until i tried it on a pc with files named with unicode characters! python just converted these characters into question marks "????" when getting the list from os.listdir, and the copy process raised "file not found" exception!!</p>
python
[7]
3,936,823
3,936,824
Python: `1+1j == (1+1j)` but `1+1j.imag == 2`, why?
<p>It's very strange. Looks like python interpret it as <code>(1+1)j.imag</code>, but why? Shouldn't it be <code>1+(1j).imag</code> or <code>(1+1j).imag</code>?</p>
python
[7]
3,625,772
3,625,773
JQuery fire click event on clicking li
<p>I have ul li list and I want to fire a jQuery click event on clicking "li" element but except the first li/first-child. So suppose if I have a below list:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ $(".sample_list li").click(function(){ alert("hello"); }); }); &lt;/script&gt; &lt;ul class="sample_list"&gt; &lt;li&gt;First Child&lt;/li&gt; &lt;li&gt;Second Child&lt;/li&gt; &lt;li&gt;Third Child&lt;/li&gt; &lt;li&gt;Fourth Child&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Now when I click other li's except the first one I should get the alert box. I think I have to write something in this <strong>$(".sample_list li")</strong>, something like <strong>$(".sample_list li:other-child")</strong> but not sure. Please help</p> <p>Thanks in advance</p>
jquery
[5]
5,777,199
5,777,200
Browserless JavaScript
<p>I talked to the Team Lead at Snap-On Tools once, and she told they used an "implementation of JavaScript" for their server-side coding. It's been a while, but I was thinking, WTF is she talking about? Are there interpreters for JavaScript besides those implemented in browsers? </p> <p><strong>How can you create a program or code, especially server-side, using JavaScript that doesn't execute in the context of a browser? What the hell is server-side about JavaScript if it's not generating content after the browser has loaded it? Can "server-side" JavaScript generate content before the HTTP response is deliver&mdash;and if so, how does that work/is set up?</strong></p> <p>I have many issues with JavaScript, but first-class functions are so sexy. And JavaScript Object Notation is so pure; I couldn't imagine an easier way to define data structures. Plus, you can hack out some code pretty quickly with dynamic typing if you're not writing something that's mission critical.</p> <p>As a side question, given the last paragraph, have any suggestions about a good language to learn (comments will suffice)?</p>
javascript
[3]
2,394,049
2,394,050
Bundle Identifier
<p>my bundle identifier : com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</p> <p>app Name : World</p> <p>my account name in apple : S111</p> <p>what's my bundle identifier for insert into itunesConnect for upload app?</p> <p>company name means "Organization Name" that exist in (Info->build) or means apple id ? </p>
iphone
[8]
5,449,627
5,449,628
Clearing a carriage return from memory in C++
<p>I have the following code:</p> <pre><code>int main() { // Variables char name; // Take the users name as input cout &lt;&lt; "Please enter you name..." &lt;&lt; endl; cin &gt;&gt; name; // Write "Hello, world!" and await user response cout &lt;&lt; "Hello, " &lt;&lt; name &lt;&lt; "!" &lt;&lt; endl; cout &lt;&lt; "Please press [ENTER] to continue..."; cin.get(); return 0; </code></pre> <p>}</p> <p>After the user hits return to enter their name, that carriage return is carried forward to the end of the code where it is immediately applied as input to cin.get(), thus ending the program prematurely. What can I place on the line immediately following</p> <pre><code>cin &gt;&gt; name; </code></pre> <p>to stop this from happening? I know that it's possible, as I've done it before, but can't remember what it is or where I can find it. Thanks a lot in advance.</p>
c++
[6]
864,840
864,841
How to get Google plus birthday issue
<p>I was made a Google plus app in my android phone and get the list of all my friends successfully but when i get the date of birth my friends then its return me null even my friend share their birthday with my and mark it as public.</p> <p>my code is </p> <pre><code>String dob=""; if(personBuffer.get(i).hasBirthday()){ dob=personBuffer.get(i).getBirthday(); } </code></pre> <p>its give me null value </p>
android
[4]
5,835,409
5,835,410
How to do a registration confirmation email which will expires within 24 hr
<p>I have a php registration form but now I want to create a registration confirm email which will send to provided email and expires within 24 hr. and when that link is clicked then registration will be confirmed.</p> <p>Please anybody help and provide some code. Thanks in advance. </p>
php
[2]
675,221
675,222
Is this defining a new class or new instance?
<p>New to java. Unclear about this piece of code:</p> <pre><code>ParseQuery query = new ParseQuery("GameScore"); query.getInBackground("xWMyZ4YEGZ", new GetCallback() { public void done(ParseObject object, ParseException e) { if (e == null) { // object will be your game score } else { // something went wrong } } }); </code></pre> <p>With <code>new GetCallback() {....}</code>, is it instancing an instance of GetCallback class or defining a subclass of Getcallback class or both? </p> <p>Is this Java's way of doing anonymous functions in C/Objective-C and Ruby's blocks?</p>
java
[1]
246,889
246,890
Limiting the input for all the textboxes to 2 digits(0-99), whose ID contains a certain text or has specific class. (jQuery)
<p>I have two sets of textboxes which are generated dynamically. All these textboxes has either (<code>**textnormal**</code> or <code>**textnormalHS**</code>) as <strong>class name</strong> and all of them have a specific text ("txtMem") as part of their <strong>ID</strong>. I want to limit the no of characters to be displayed in the texbox to 2.</p> <pre><code>$("input[type='text'][id*='txtMem']").keyup(function () { var $this = $(this); if ($this.val().length &gt; 2) $this.val($this.val().substr(0, 2)); }); </code></pre> <p>doesn't seem to be working.</p>
jquery
[5]
5,352,350
5,352,351
Copy & Paste, 2011 Edition
<p>How can I copy and paste text using JavaScript?</p> <p>Most of the methods I've found via Google don't seem to work with newer browsers/versions of Flash. Are there any methods that still work?</p>
javascript
[3]
2,275,658
2,275,659
Property method in python
<p>Can some1 explain me this behaviour as to why 1) doesnt work while 2) and 3) works 1)</p> <pre><code>class bm(object): ....: def __init__(self,val): ....: self.a=val ....: def get(self): ....: return self.a ....: def set(self,val): ....: self.a=val ....: a=property(get,set) ....: In [43]: ob1=bm('vin') </code></pre> <p>gives me Recursive error ,while the below code works fine 2)</p> <pre><code>class bm(object): ....: def __init__(self,val): ....: self._a=val ....: def get(self): ....: return self._a ....: def set(self,val): ....: self._a=val ....: a=property(get,set) ....: In [43]: ob1=bm('vin') </code></pre> <p>Works fine.I can access ob.a and do ob.a=''</p> <p>Even this works fine 3)</p> <pre><code>class bm(object): ....: def __init__(self,val): ....: self.a=val ....: def get(self): ....: return self._a ....: def set(self,val): ....: self._a=val ....: a=property(get,set) ....: In [43]: ob1=bm('vin') </code></pre> <p>Works fine.I can access ob.a and do ob.a=''</p>
python
[7]