Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
3,445,466
3,445,467
Display looped elements on by one with Jquery
<p>How is it possible to display looped elements with jquery each() one by one, like having a delay between?</p> <pre><code>function text_animate(){ var get_text=$("#animated_text_falling h1").text(); var words =get_text.split(" "); $("#animated_text_falling h1").remove("h1"); var wordCount = 0; $.each(words, function(key, value) { var $word= $('&lt;div id= word_' + key + '&gt;' + value + '&lt;/div&gt;').appendTo('#animated_text_falling').show(); //here somhow to show $('&lt;div id= word_' + key + '&gt;' + value + '&lt;/div&gt;') with delay wordCount++; }); } </code></pre>
jquery
[5]
343,274
343,275
how to add messagebundlefile for language . properties in java
<p>i likely to convert the English words into hindi ... by the use of...</p> <p><strong>java.util.Locale;</strong></p> <p><strong>java.util.ResourceBundle;</strong></p> <p>or keyword file(where all word are asigned)in textfile</p> <p>like this</p> <p>loginform.userid=प्रयोक्ता आईडी</p> <p>loginform.password=पासवर्ड</p> <p>loginform.submit=प्रस्तुत करना</p> <p>loginform.reset=रीसेट करें</p> <p>and use it as a messagebundle en_hi.properties......</p> <p>how do i use or convert the text file into .properties??</p> <p>and use in my program....</p>
java
[1]
2,121,613
2,121,614
Replace part of a string with new value
<p>I've got a scenario, wherein i need to replace the string literal with new text.</p> <p>For example, if my string is "01HW128120", i will first check if the text contains "01HW" If yes, then replace that with the string "MachineID-".</p> <p>So eventually i wanted "01HW128120" to be "MachineID-128120". Sometimes i do get the string as "1001HW128120" - In this case also i require to replace the "1001HW" with "MachineID-" I tried the below code snippet, but this does not work to my expectation.</p> <pre><code>string sampleText = "01HW128120"; if(sampleText.Contains("01HW")) sampleText = sampleText.Replace("01HW","MachineID-"); </code></pre> <p>Any suggestion would be of great help to me.</p>
c#
[0]
1,683,979
1,683,980
New programmer work rate and expectations
<p>I'm a new graduate and yave just started working a few weeks past as a web programmer. I've kind of been thrown in at the deepend and have been put straight on a project that appears on the face of it to be relatively simple, but there a lot of little intricacies that are making it quite difficult. </p> <p>What sort of work rate will employers be expecting a new graduate to work at? My employer hasn't said anything but I feel like I am taking much longer than they anticipated - perhaps even regretting that the have employed me in the first place. Also, I am asking for help with logic and some best ways to tackle some problems and I also feel they think I should know more than I should. Again what would an employer be expecting from the level of a recent graduate. </p> <p>I want to be as good as I can and learn as much as possible but I constantly feel under pressure as I keep thinkin I should be getting through mug more work than I currently am. Is this a common feeling in new programmers and how would my employer approach it if I wasn't performing up to their expectations. Like I said, nothing had been mentioned but I do feel they are wondering why they bothered to hire me. </p> <p>Some advice on this from experienced developers would be great. </p>
php
[2]
2,271,904
2,271,905
How can i write jQuery for below problem?
<p>I need help I am new to jQuery and i want to implement jQuery in one of my webpage. I also have one form having four text boxes. I have two div tags one in another i.e. my code structure is in following way</p> <pre><code>&lt;div&gt; &lt;div&gt; &lt;img&gt; &lt;img&gt; &lt;img&gt; &lt;img&gt; &lt;/div&gt; &lt;div&gt; </code></pre> <p>I just want to do with the help of jquery that</p> <ol> <li>On document ready the first img should be visible out of the four <code>&lt;img&gt;</code> and rest of the three <code>&lt;img&gt;</code> should be hidden between the inner div tag and the cursor focused on first textbox. </li> <li>Now when focus gose to second textbox the current visible <code>&lt;img&gt;</code> should get hidden and only second <code>&lt;img&gt;</code> should be visible.</li> <li>When focus gose to third textbox the current visible <code>&lt;img&gt;</code> should get hidden and only third should be visible.</li> <li>In this way the fourth <code>&lt;img&gt;</code> should be visible when control goes to fourth text box.</li> </ol> <p>Overall when focus goes to any of the textbox the <code>&lt;img&gt;</code> related to it should be visible and the remaining three <code>&lt;img&gt;</code> should be hidden.</p> <p>So please help in doing above jQuery code which do the following functionality with out affecting other images on the same page except the imaged mentioned above.</p> <p>Waiting for your reply, guys!</p>
jquery
[5]
4,282,884
4,282,885
how to find the total no.of inbound and outbound links of a website using php?
<p>how to find the total no.of inbound and outbound links of a website using php?</p>
php
[2]
3,235,358
3,235,359
JQuery in Dynamically loaded UserControl
<p>I am dynamically loading a user control on a click of a checkbox. I need to run a post on the Jquery when a button is clicked on the user control. When I Load my User Control, I cannot run</p> <pre><code>$(document).ready(function(){ alert('I am here!!'); }); as a test. </code></pre> <p>Any Ideas. or do I need a $.getScript() ?.</p>
jquery
[5]
1,636,465
1,636,466
Iphone tabBarController.moreNavigationController options
<p>I have multiple navigationcontrollers on the More Section of the tabBarcontroller,> 4. When I clicked on one of the navigationcontrollers on the More Section,(table view) and then leave , and come back, it always come back to that specific controller view on the More Section. </p> <p>I want to go back to the Table list view on More Section. I don't want to go back to a specific controller view on the More Section. I want the general table view. </p>
iphone
[8]
4,092,651
4,092,652
Formatting a string
<p>I have got a string in the form:</p> <pre><code>8 AM;10:15 AM;3:30 PM;6:15 PM </code></pre> <p>which i need to format in the form</p> <pre><code>8 AM-10:15 AM, 3:30 PM-6:15 PM </code></pre> <p>How can i achieve this?</p>
asp.net
[9]
921,434
921,435
Is there any Sound filtering library in android
<p>I want to capture an audio and convert it into byte array.<br> But when I record the audio, noise gets added to it. </p> <p>Is there any filtering library in android so that I can remove noise in it.</p> <p>Regards,<br> Sneha</p>
android
[4]
4,287,390
4,287,391
How can I create an application with resizeable frames
<p>How can I create an app in one window with multiple frames.</p> <p>For example if i want the lower portion of the screen to be taken up by a webbrowser object, and the top split into two halves with different items in.</p>
c#
[0]
5,640,293
5,640,294
C# syntax to get access to webcontrol in different file (aspx)
<p>Within my Website project, I have some aspx pages, javascript files, and a custom C# class I called MyCustomReport. I placed a Image box with an ID of Image1 inside SelectionReport.aspx. I need to get access to that Image1 inside MyCustomReport.cs so I can turn it on and off based on conditions. What code do I need to do this? Thanks everyone</p>
c#
[0]
3,632,424
3,632,425
Getting javascript error with a for loop even though it's working
<p>I'm trying to check a series of check boxes depending on the results I get from a string. Since the values in this string are separated by commas I do the following:</p> <pre><code>var busLines = 'AB, CD, EF, GH, IJ, KL' var temp = busLines.split(', '); </code></pre> <p>So now my array 'temp' should be the individual elements of my string:</p> <pre><code>temp[0] = 'AB' temp[1] = 'CD' temp[2] = 'EF' and etc... </code></pre> <p>Each one of those values that are being returned in my array of 'temp' correspond with a check box with the same ID. So when I loop through and value 'AB' comes up, the check box id='AB' will get checked.</p> <p>That is why I try this:</p> <pre><code>for (var i = 0; i &lt; temp.length; i++) { document.getElementById(temp[i]).checked = true; } </code></pre> <p>When I test it out id does exactly what I want it to do, but it gives me the following error:</p> <p>Message: 'document.getElementById(...)' is null or not an object Line: 530 Char: 9</p> <p>I don't understand why I am getting an error when what I want it to do works. Any suggestions?</p>
javascript
[3]
3,234,934
3,234,935
Enabling buttons
<p>Problem,</p> <p>with a UIButton, I can do this:</p> <pre><code>myButton.enabled = YES; or myButton.enabled = NO; </code></pre> <p>However, I can't do the same with a UIBarButtonItem (navigation bar buttons,)</p> <p>So, how do I stop the user clicking it? </p>
iphone
[8]
493,783
493,784
Implement Android Custom Tabbar
<p>I need to develop this layout in android device, im using a tabview and three tabs in the design. TabWidget need to bottom of the screen and also i need a way to develop this kind of layout for tabwidget.</p> <p><img src="http://i.stack.imgur.com/lh2eM.png" alt="enter image description here"></p>
android
[4]
5,427,984
5,427,985
Get the __FILE__ constant for a function's caller in PHP
<p>I know the <code>__FILE__</code> magic constant in PHP will turn into the full path and filename of the currently executing file. But is there a way I can get the same information for a function's calling file? For example:</p> <pre><code>//foo.php: include "bar.php"; call_it(); //bar.php function call_it() { echo "Calling file: ".__CALLING_FILE__; } </code></pre> <p>which would output <code>Calling file: ....../foo.php</code>.</p> <p>I know there's no <code>__CALLING_FILE__</code> magic constant, or a magic constant to handle this, but is there a way I can get that information? The least-hackish solution would be ideal (eg. using a stack trace would be pretty hacky) but in the end I just need it to work.</p>
php
[2]
4,521,892
4,521,893
How to make System.err write in one block
<p>I'd like to solve following issue: imagine that you are doing lots of outputs in System.out, and from time to time there is an Exception thrown. When you look into the console, you can see that the exception's trace text is mixed up with normal output done by System.out. I understand that these two are different streams (System.out and System.err) and I guess that the output of the exception is done internally by some other thread, that is why it is mixed up.</p> <p>However, is it somehow possible for the code to stop until output for the exception is done? The only solution I can think of is to put Thread.sleep, but maybe there might be some option I am not aware of. </p> <p>Just curious really :) It'd be nice for debugging (that's the reason I ask, because reading the output and exceptions mixed up in between is terrible)</p>
java
[1]
1,402,645
1,402,646
Iphone/IPad Safety Integrity Level
<p>As a device, does anyone know their SIL level (as defined by IEC 61508)? i.e. a SIL Level 4 product must have the device and software to Level 4.</p>
iphone
[8]
2,861,772
2,861,773
PHP: File upload always returning nothing
<p>Hey guys I'm working on a file uploader and I have come across a problem. In my code I am checking to see if a file has been selected via the file upload form, here is the form code:</p> <pre><code>&lt;form method="post" action="actions/save.php?id=&lt;?print($id);?&gt;" enctype="multipart/form-data"&gt; Listing Photo: &lt;input type="file" name="file"/&gt; &lt;input class="add" type="submit" name="submit" value="Save"/&gt; &lt;/form&gt; </code></pre> <p>The user selects the file to upload then clicks the "Save" button. Now in my uploading code i am trying to check if the file form has been set like this:</p> <pre><code>$file = $_POST['file']; if(isset($file)) { //Continue } else { //Go back } </code></pre> <p>Now my problem is that even if the file input is set (File selected) it goes to the "Go back" part of the code.</p> <p>Any suggestions or a different way of checking?</p> <p>Any help is appreciate, Thanks.</p>
php
[2]
2,637,953
2,637,954
How can I load all keys from a dict as local variables, a better aproach?
<p>Giving this dictionary:</p> <pre><code>&gt;&gt;&gt; options = {'DATABASES': {'default': {'ENGINE': 'django.db.backends.sqlite3'}}} </code></pre> <p>What would be the best way to get this?:</p> <pre><code>&gt;&gt;&gt; foo(options) &gt;&gt;&gt; print DATABASES {'default': {'ENGINE': 'django.db.backends.sqlite3'}} </code></pre> <p>I am solving this as locals().update(options), but I was thinking, if there is maybe a better solution.</p>
python
[7]
3,664,821
3,664,822
jquery hide element depending of value of input tag
<p>What i want is the <code>select</code> div to be displayed only if the value of the input tag next to it is zero. How do i do this? Here is the jsfiddle <a href="http://jsfiddle.net/mdanz/xdFkJ/" rel="nofollow">http://jsfiddle.net/mdanz/xdFkJ/</a></p> <pre><code>&lt;style type="text/css"&gt; .select { overflow:hidden; display:block; background-color:red; width:100px; height:100px; } &lt;/style&gt; &lt;script type="text/javascript"&gt; $(function() { var value = $('.row').val(); if(value!=0) { $('.select').hide(); } }); &lt;/script&gt; &lt;div class='select'&gt;&lt;/div&gt;&lt;input type='text' class='row' value='0' /&gt; &lt;div class='select'&gt;&lt;/div&gt;&lt;input type='text' class='row' value='1' /&gt; &lt;div class='select'&gt;&lt;/div&gt;&lt;input type='text' class='row' value='1' /&gt; &lt;div class='select'&gt;&lt;/div&gt;&lt;input type='text' class='row' value='0' /&gt; </code></pre>
jquery
[5]
2,876,897
2,876,898
Uiimage as photolibrary file or camera
<p>I want to select a image from Photo library or camera and have to save it into my photo album(If its already there i want to put 1 more copy)</p> <pre><code>-(IBAction) getPhoto:(id) sender { UIImagePickerController * picker = [[UIImagePickerController alloc] init]; picker.delegate = self; if((UIButton *) sender == choosePhotoBtn) { picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; } else { picker.sourceType = UIImagePickerControllerSourceTypeCamera; } [self presentModalViewController:picker animated:YES]; } -(IBAction) savePhoto:(id) sender { UIImage *myImage =UIImagePickerControllerSourceTypePhotoLibrary||UIImagePickerControllerSourceTypeCamera UIImageWriteToSavedPhotosAlbum(myImage, self, @selector(image:didFinishSavingWithError:contextInfo:), nil); printf("Hello world"); } </code></pre> <p>Here my savePhoto function os not working</p>
iphone
[8]
4,261,010
4,261,011
Incrementing through object properties?
<p>Is it possible to increment ( not loop ) through object properties. I know that objects don't guarantee ordering but I want to increment through them any ways.</p> <p>For example, for an array one can do:</p> <pre><code>arr[index++]; </code></pre> <p>But this does not work for an object:</p> <pre><code>obj[key++]; </code></pre> <p>as I do not think the ++ operator is defined for use on keys.</p> <p>I don't want to have to build a complex object structure that stores indexes with keys. I want to do it natively.</p> <p>I am well aware of the for-in structure but I want to increment as needed, not loop.</p>
javascript
[3]
3,960,476
3,960,477
Download part of HTML page as text (PHP)
<p>So I have an 'export' application that arrives the user at an end page with a textarea with lots of text. Now the workflow is to copy and paste that text from the textarea into a file.</p> <p>The exported code is getting larger, and we want to encourage users to do this more often, so the copy/paste route is no longer desirable. (Not to mention that my xterm->ssh->screen->vi chain doesn't paste 250K characters so well) </p> <p><strong>So the problem is this: I have a textarea that has exported code in it, and I want to provide a button that is 'Download this Code to a file'</strong></p> <p>I'm fairly sure that I will have to hit the server again, but I just want to check all my bases. The ways I can think of doing this (sending generated textarea value as a file ot the browser)</p> <ul> <li><p>Create a script that receives said text as a POST and sends it back with the right Content Headers. This is no desirable because we would be POSTing 250k, which would be slower than:</p></li> <li><p>Create a script that regenerates the text area and provide a button the original page that hits the scripts and downloads the file. <em>This is the option I am leaning towards</em></p></li> <li><p>Use Javascript somehow and perhaps beable to skip the server all together and just send the $('.exported').val() to the browser with the right headers? Not sure how to do this atm.</p></li> </ul> <p>So if anyone has suggestions that'd be great, maybe I'm overlooking something. Thanks!</p> <p>edit: <a href="http://stackoverflow.com/questions/609530/download-textarea-contents-as-a-file-using-only-javascript-no-server-side">http://stackoverflow.com/questions/609530/download-textarea-contents-as-a-file-using-only-javascript-no-server-side</a></p> <p>This question says the JS route is not possible (probable)</p>
php
[2]
3,254,673
3,254,674
Get the source into a string from the next page after a POST
<p>I am posting data to a form and all works well, but afterwards I need to get the source(html) of the page where it reffers to after I POST'ed the data.</p> <p>Is this possible and if so how?</p> <p>I am using this method to POST:</p> <pre><code> string HttpPost(string uri, string parameters) { HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uri); webRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.2; rv:9.0.1) Gecko/20100101 Firefox/9.0.1"; webRequest.ContentType = "application/x-www-form-urlencoded"; webRequest.Method = "POST"; byte[] bytes = Encoding.ASCII.GetBytes(parameters); Stream os = null; try { webRequest.ContentLength = bytes.Length; os = webRequest.GetRequestStream(); os.Write(bytes, 0, bytes.Length); } catch (WebException ex) { MessageBox.Show(ex.Message, "HttpPost: Request error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (os != null) { os.Close(); } } try { WebResponse webResponse = webRequest.GetResponse(); if (webResponse == null) { return null; } StreamReader sr = new StreamReader(webResponse.GetResponseStream()); return sr.ReadToEnd().Trim(); } catch (WebException ex) { MessageBox.Show(ex.Message, "HttpPost: Response error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return null; } </code></pre>
c#
[0]
5,532,022
5,532,023
Pickerview within enclosing view
<p>using iphone sdk 4.0. I have added a UIPickerView to a view. I want the UIPickerView to be NON transparent ( as it is) but i want the background view to have an alpha of 0.3.</p> <p>THis is so that the upper portion of the view (which is full size screen) is see through and the lower portion which has the picker is solid. However when i set the alpha for the background view its affecting the pickerview and making that seethrough.</p> <p>Anyone know how to do this?</p> <p>Thanks</p>
iphone
[8]
1,944,858
1,944,859
is it possible to set a View as wallpaper on home screen in android?
<p>my question is that I am creating a custom analog clock by extending View, I want to display this clock on home screen as a wallpaper. Can anybody know the answer..any suggestions are appreciated...thanks in advance. </p>
android
[4]
5,665,639
5,665,640
Right way to do scrollable view of custom buttons?
<p>I've just started playing with Android in the last few days and have begun to put together a simple application. I am struggling to work out whether I'm doing things the "right" way or just making life difficult for myself.</p> <p>The app displays a series of connected nodes on the screen, similar to a mind-map. I want to be able to tap the nodes in order to edit them. When the map of nodes becomes larger than the screen, I need to be able to scroll on both X and Y axes as needed to see the whole map. Image of current implementation at <a href="http://ubergeek.org.uk/images/nodetest.png" rel="nofollow">http://ubergeek.org.uk/images/nodetest.png</a>.</p> <p>Currently I don't have scrolling working, however I assume that I can do that by making the root view a ScrollView and sticking an AbsoluteLayout inside that (though it's deprecated, I wish to place objects at specific X/Y coordinates).</p> <p>The nodes themselves are currently each a pair of roundrects (one for the outline and one for the fill) and a drawText and are being drawn in the main activity's onDraw(). In order to make these clickable buttons I believe I need to create a custom view for the button in order to use its onClick() events. I can then create a view object for each of my nodes and add them to the AbsoluteLayout view.</p> <p>Does this sound like a reasonable way to do it in Android, or is this a horrible abuse of the API? :)</p> <p>Thanks!</p>
android
[4]
5,389,928
5,389,929
How to detect whether network service state changed in android?
<p>How to detect network service state changes in roaming?</p> <pre><code> &lt;N/wSate 1&gt; &lt;N/wstate 2&gt; </code></pre> <p>For Eg: India --> England --> China</p> <p>Here how to detect n/w state change from 1 to 2??</p> <p>Thanks, Chitra</p>
android
[4]
2,113,425
2,113,426
Multiple checkbox selection values to be displayed into the different cells of TableView
<p>I have to select dynamically (random) check boxes which will be displayed into the previous list page below the cell values &amp; for all cells it must be different as per the selection of those check boxes for the particular selected cells &amp; when i will select particular cell from the list the listed check boxes should be selected in the list of the check boxes.</p> <p>Is this possible? If possible then please tell me how.</p>
iphone
[8]
1,158,852
1,158,853
How to measure javascript parse time
<p>In our company we combine every Javascript file into one big (around 700kb but growing) minified and gzipped Javascript file. I am trying to assess the performance differences between using one big Javascript file for every page (minified and gzipped) and using several Javascript files, one for each page.</p> <p>An obvious difference is that the big Javascript file can be cached by browsers after it has been loaded on the first page request and creates little overhead thereafter while when using several js files, there will be at least one uncached get request on each different page. So I would be trading a slower first initial page load for slower successive initial page loads.</p> <p>In order to find out when the slow initial page load (using one big Javascript file) will become problematic enough to justify the work of breaking up the combined file into smaller files and changing our build procedure, I would like to find out how long it takes for the code to be parsed, so I can estimate the total loading and parsing time.</p> <p>So far my approach has been to add a script tag to a test page which takes the current time, appending a bigish script with Javascript and after that meassuring time again like so:</p> <pre><code>var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script') script.setAttribute('type', 'text/javascript'); script.src = 'path/700kbCombineFile.js'; start_time = new Date().getTime(); head.appendChild(script); </code></pre> <p>At the end of 700kbCombineFile.js, I appended:</p> <pre><code>console.log(new Date().getTime() - start_time) </code></pre> <p>Then I subtract the network transfer time obtained from firebug and receive approximately 700ms for a 700 kb file and about 300ms for a 300 kb file.</p> <p>Does this approach make sense? Why not? Is there a better way/any tools for doing this?</p>
javascript
[3]
2,456,217
2,456,218
Discover mobile devices using wifi
<p>I'm doing some work for my theses in networking, and have stumbled into a little problem. One of the first steps in the work I must do consists on having a computer working as an AP (I am using hostapd for this) and with it, detect all the devices in the room which currently have wifi turned on (do not need to be associated with any AP).</p> <p>I have found a thread that pretty much asks the same ( <a href="http://stackoverflow.com/questions/5820456/discover-mobil-devices-using-wifi">discover mobil devices using wifi</a> ), and I understand the answers that were given, but they don't give any hint as to how this can be done. The post ends saying that the person was able to do this using Kismet, however I can only seem to use Kismet to discover clients already associated with an AP.</p> <p>Can someone point me in the right direction here please? If not using Kismet, then maybe suggest a different tool that works with Ubuntu.</p> <p>Ps. I will need to run a continuous scan of the "room" to find any new devices and then send this information to an event manager written in Java.</p>
java
[1]
236,975
236,976
I'm having trouble understanding page validation
<p>Okay, so I have my asp.net page with all of my comparison and requiredfield validators. This leaves me with two concerns.</p> <ol> <li><p>What additional validation do I need? Do I need anything in the code behind? I want them to be unable to hit the 'save' button until their textbox information is complete, and it seems to be doing this with just the validator controls, but I'm unsure if there are other steps I need to take.</p></li> <li><p>If I have a requiredfield validator and I want to turn it off under special circumstances, where in the codebehind would I set it to true? Can I do it on the 'save' button click, before it prevents the button from functioning?</p></li> </ol>
asp.net
[9]
3,846,983
3,846,984
Format string using RegEx
<p>String to be formatted </p> <p>"new Date(2009,0,1)"</p> <p>String after formatting</p> <p>"'01-Jan-2009'"</p>
c#
[0]
4,529,025
4,529,026
javascript get child by id
<pre><code>&lt;div onclick="test(this)"&gt; Test &lt;div id="child"&gt;child&lt;/div&gt; &lt;/div&gt; </code></pre> <p>I want to change the style of the child div when the parent div is clicked. How do I reference it? I would like to be able to reference it by ID as the the html in the parent div could change and the child won't be the first child etc.</p> <pre><code>function test(el){ el.childNode["child"].style.display = "none"; } </code></pre> <p>Something like that, where I can reference the child node by id and set the style of it.</p> <p>Thanks.</p> <p>EDIT: Point taken with IDs needing to be unique. So let me revise my question a little. I would hate to have to create unique IDs for every element that gets added to the page. The parent div is added dynamically. (sort of like a page notes system). And then there is this child div. I would like to be able to do something like this: el.getElementsByName("options").item(0).style.display = "block";</p> <p>If I replace el with document, it works fine, but it doesn't to every "options" child div on the page. Whereas, I want to be able to click the parent div, and have the child div do something (like go away for example).</p> <p>If I have to dynamically create a million (exaggerated) div IDs, I will, but I would rather not. Any ideas?</p>
javascript
[3]
1,114,642
1,114,643
Make selected by value
<pre><code>&lt;select id="selectBox"&gt; &lt;option value="2"&gt; two &lt;/option&gt; &lt;option value="4"&gt; four&lt;/option&gt; &lt;option value="6"&gt; six &lt;/option&gt; &lt;/select&gt; </code></pre> <p>I have value 4, Now how to make <code>selectBox</code> selected with value 4 with javascript?</p>
javascript
[3]
2,540,121
2,540,122
using header function to redirect
<p>I'm new to programming in PHP. Kindly bear me...</p> <p>when using header function, refresh option is not working when using variable from post method(dynamically). when hard-coded the number its working. I tried different options. You can see my whole code here.not succeeded to make refresh work dynamically. Can someone help?</p> <pre><code>&lt;?php if($_POST['time']&gt;0) { $t = $_POST['time']; $u =$_POST['url']; echo "You will be redirected to the " .$u . " website in " .$t. "seconds"; //header("refresh:5; url=http://www.google.com"); //header("refresh:($_POST['time']);url=($_POST['url'])"); header('refresh: ' .$t); header('Location: '.$u); exit; } ?&gt; </code></pre>
php
[2]
4,801,559
4,801,560
bitmap not showing
<p><code>file.name = "/sdcard/Pictures/Screenshots/Screenshot_2013-01-15-10-42-02.jpg";</code></p> <p>however, every time i try to open the file by clicking the bitmap, it causes the opening application to crash, not my application. also, the bitmap doesn't show the image somehow. </p> <p>Adapter.java (to bitmap)</p> <pre><code>public View getView(int position, View convertView, Viewgroup parent(){ case Image: Bitmap bp = new BitmapFactory().decodeFile(file.name); image.setImageBitmap(bp.createBitmap(200,200,Config.ARGB_8888)); break; } </code></pre> <p>my dialog displays directory "/sdcard" and all its files. upon selecting the file/image, the path is saved along with the bitmap image.</p> <p>(eg: <code>file.name = "/sdcard/Pictures/Screenshots/Screenshot_2013-01-15-10-42-02.jpg";</code>) also, the bitmap doesn't show the image somehow. </p> <p>i have set the write external storage permission. and code snippet are as below. i have really no idea what's going wrong. i also have tried all file types, such as txt, pdf, doc, etc, all causing the open file application to crash, and not opening the file.</p> <p>Adapter.java (to bitmap)</p> <pre><code>public View getView(int position, View convertView, Viewgroup parent(){ case Image: Bitmap bp = new BitmapFactory().decodeFile(file.name); image.setImageBitmap(bp.createBitmap(200,200,Config.ARGB_8888)); break; } </code></pre>
java
[1]
2,090,238
2,090,239
php scripts are downloaded, not executed, which I wished
<p>I am using Ubuntu 10.10 with Apache2, PHP5, Mysql etc. (local Web server environment) installed.</p> <p>When I try to call a PHP script thru a call from a form i.e. (action=scriptname.php), the script is downloaded, not executed. Pl help.</p>
php
[2]
2,973,572
2,973,573
jQuery toggle div and toggle text
<p>I want to make the link "Add additional comment" when clicked to show a text area and the text to toggle as "Remove comment". When "Remove comment" is clicked it should hide text area and the text need to change as "Add additional comment".</p> <p>The code I used is</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function( ){ $("#addcmt").click(function( ) { $(".commentarea").toggle( ); if ($("#addcmt").text = "Add additional comment") { $("#addcmt").text("Remove comment"); } else { $("#addcmt").text("Add additional comment"); } }); }); &lt;/script&gt; </code></pre> <p>The html is</p> <pre><code>&lt;div class="addlcomment"&gt; &lt;a id="addcmt"&gt;Add additional comment&lt;/a&gt; &lt;/div&gt; &lt;div class="commentarea" style="display:none;"&gt; &lt;textarea name="strcomments1" tabindex="2"&gt;&lt;/textarea&gt; &lt;/div&gt; </code></pre> <p>The text toggle is not working.</p> <p>Any help is appreciated.</p>
jquery
[5]
3,029,377
3,029,378
Filter rows from Cursor so they don't show up in ListView
<p>I have a Cursor that returns rows I use with a SimpleCursorAdapter to populate a ListView. I would like to filter some of the rows so they don't get displayed in my ListView. I use the data from the rows elsewhere in my Activity so I don't want to change my SQL to filter them with a WHERE clause.</p> <p>What is the best way to keep a row from being displaying in my ListView? Ideally I would check a column in my row and then only add rows to the ListView that satisfy a condition.</p>
android
[4]
5,869,591
5,869,592
JQuery and multiple radio button groups problem
<p>I am having trouble using JQuery to work with multiple radio button groups. The JQuery code, for some reason, cannot tell the difference between the two groups of radio buttons and cannot tell which group of radio button I clicked on.</p> <p>Here is the HTML code:</p> <pre><code>&lt;!-- Radio button group 1 --&gt; &lt;input type="radio" name="group_1" value="full_day_ticket"/&gt; &lt;input type="radio" name="group_1" value="half_day_ticket"/&gt; &lt;!-- Radio button group 2 --&gt; &lt;label&gt;&lt;input type="radio" name="group_2" value="boarder"/&gt; Snowboard&lt;/label&gt; &lt;label&gt;&lt;input type="radio" name="group_2" value="skier"/&gt; Ski&lt;/label&gt; </code></pre> <p>And the JQuery code is as follows:</p> <pre><code>$("input:radio[@name='group_2']").click(function() { alert('group 2 clicked'); } </code></pre> <p>Now when I click on the radio buttons named 'group_1', JQuery thinks that I clicked on a radio button in 'group_2' and displays the alert window. For some reason, it seems that JQuery is not recognising the @name='group_2' filter and captures clicks on all radio buttons on the page, instead of just the radio buttons named 'group_2'.</p> <p>Has anyone come across this problem before? Or am I doing something stupid?</p> <p>Thanks!</p>
jquery
[5]
3,528,385
3,528,386
Android KeyEvent getSize or getPressure
<p>Is there a way to <code>getSize()</code> and <code>getPressure()</code> from a KeyEvent like you would with a MotionEvent?</p> <p>In other words, MotionEvents have <code>getSize()</code> and <code>getPressure()</code> methods, but KeyEvents do not have these methods. Moreover, MotionEvents and KeyEvents are sibling classes, so they KeyEvent doesn't inherit these methods.</p>
android
[4]
2,338,145
2,338,146
Can I send a user-entered phone number to a server on iPhone?
<p>I know that Apple does not permit developers to read the phone number of the device and send that to a server.</p> <p>However, I can't find anything about whether I can send the phone number of the current device <strong>if the user enters it into the app</strong>.</p> <p>I would like to let people sign up to my service using only their phone number as an identifier (i.e. no need for an email address) and to send them an SMS with a secret code to authenticate them.</p> <p>Thanks.</p>
iphone
[8]
756,069
756,070
read and process stdin output of another console application
<p>I want to manipulate the output of a console trace tool in a python script. So I want to read each line that the tool writes to stdout and maybe do something with that line and print it to the screen.</p> <p>I have this script:</p> <pre><code>import sys for l in sys.stdin: print l </code></pre> <p>and I start the trace tool like this:</p> <pre><code>qspy -c COM7 | my_script.py </code></pre> <p>the problem is when I hit enter the first time: nothing happens. When I hit enter again, I see all the output that was created by the tool but it also quits (the trace-tool quits on any character). What am I doing wrong?</p> <p>i'm on windows.</p> <hr> <p>EDIT:</p> <p>I've tried all the suggestions, with little success:</p> <p>first of all i created this little script to produce some output on stdout:</p> <pre><code>import time while 1: time.sleep(1) print "test" </code></pre> <p>this does not work at all (no output):</p> <pre><code>import sys for line in sys.stdin: print line, sys.stdout.flush() </code></pre> <p>this one also doesnt do anything:</p> <pre><code>import fileinput, sys for line in fileinput.input(): print line, sys.stdout.flush() </code></pre> <p>this one works, but only with the test-script, not with qspy:</p> <pre><code>import sys for line in iter(sys.stdin.readline, ''): print line, sys.stdout.flush() </code></pre> <p>i did call the scripts like this:</p> <pre><code>test.py | python -u my_script.py </code></pre> <p>and did also:</p> <pre><code>set PYTHONUNBUFFERED=1 </code></pre>
python
[7]
2,612,682
2,612,683
values of one combo box on basis of other combo box - php
<p>i have two tables categories and sub-categories in database. On my form i have two combo boxes category and sub categories. Now i want that when i change category, subcategories should change accordingly. I can do it if arrays are defined in javascript. but in my case subcategories are to load from database on the basis of value of category selected. i can fetch data from database using php. if data is in php array how will i pass it to javascript. how can i solve this problem without ajax? if the solution is JSON then how can i implement json as i never used it.</p>
php
[2]
1,052,782
1,052,783
How to ensure process window launched by Process.Start(ProcessStartInfo) has focus of all Forms?
<p>c#.How to ensure process window launched by Process.Start(ProcessStartInfo) has focus of all Forms? Thanks,</p>
c#
[0]
3,210,515
3,210,516
How Vector and Hashtable are thread-safe in collection?
<p>I know that both of them have thread safe methods. I want to know how they are thread safe? What is the implementation? This is a common question in all interviews. </p>
java
[1]
953,012
953,013
How to upload images from Android device to Facebook Server
<p>Friend's , I need to upload an image from android device to Facebook server of the login users profile,anyone help me to implement this feature by using corresponding API.</p>
android
[4]
4,735,057
4,735,058
How to use timer for update time after 5 min in registry
<p>How to use timer for update time after 5 min in registry. My registry file in <code>"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"</code> file. Its run only first time when computer start.I want to update time in registry after 5 min automatically. </p>
c#
[0]
2,365,502
2,365,503
time() with different timezones
<p>How can i get user's local time using php time() or there is another way to do it? Which means it will be in their timezone.</p> <p>I need to calculate time ago with user's local time, here's a nice script i found for the time ago function:</p> <pre><code>&lt;?php function timeago($time) { $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade"); $lengths = array("60","60","24","7","4.35","12","10"); $now = time(); $difference = $now - $time; $tense = "ago"; for($j = 0; $difference &gt;= $lengths[$j] &amp;&amp; $j &lt; count($lengths)-1; $j++) { $difference /= $lengths[$j]; } $difference = round($difference); if($difference != 1) { $periods[$j].= "s"; } return "$difference $periods[$j] $tense"; } ?&gt; &lt;?php $date = strtotime('2012-04-15 07:41:03'); $datep = timeago($date); echo $datep; ?&gt; </code></pre> <p>from the above script , i use the time() but it only gets my server time not the local time at my side. how can i get my local time(user's local time)?</p>
php
[2]
4,282,753
4,282,754
How to close a program while not in main
<p>Is there a line in c++ that allows me to terminate my program while I am not in main()? </p> <p>For example, a code where if you die you have to quit the game? I don't want it to rely on the "trust" system.</p>
c++
[6]
4,739,834
4,739,835
Good way to tokenize a string to store values? Or alternative for user input
<p>Hello again Stackoverflow, I'm here again asking a question for my C++ programming class. The problem I am facing is mostly to due with user input from the keyboard. I need to be able to take the user input to decide what function to call and what arguments to give the function. For example something like <code>add 5</code> would call the add function with the argument 5. At first I tried overloading the >> operator to take both a string and an int but the problem I ran into was the program was unable to take input without the int such as <code>deletemax</code> so I had to throw that idea out. So now I am back to tokenizing the input but we are not allowed to use Boost for this program so I came up with something like this using sstream</p> <pre><code> bool out = false; string token; string In; int num; do { cout &lt;&lt; "heap&gt; "; cin &gt;&gt; In; istringstream iss(In); while(getline(iss, token, ' ')) { cout &lt;&lt; token &lt;&lt; endl; //I know this is incorrect but just not what to replace it with } out = ProcessCommand (token, num); //Takes string and int to call correct functions } while (out != true); </code></pre> <p>The problem lies in that I'm not quite sure how to correctly tokenize the string so I can get 2 string and convert the second string to an int. Can anyone offer me some assistance? I would greatly appreciate it. Also if there is a better way to go about this than I am trying I would also like to hear it.</p> <p>Thanks for any help you can give me.</p>
c++
[6]
2,028,679
2,028,680
Python - value in list of dictionaries
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1580270/whats-the-best-way-to-search-for-a-python-dictionary-value-in-a-list-of-dictiona">What&#39;s the best way to search for a Python dictionary value in a list of dictionaries?</a> </p> </blockquote> <p>I have a list of dictionaries in the form</p> <pre><code>my_dict_list = [] my_dict_list.append({'text':'first value', 'value':'number 1'}) my_dict_list.append({'text':'second value', 'value':'number 2'}) my_dict_list.append({'text':'third value', 'value':'number 3'}) </code></pre> <p>I also have another list in the form:</p> <pre><code>results = ['number 1', 'number 4'] </code></pre> <p>how can I loop through the list of <code>results</code> checking if the value is in <code>dict</code>, e.g.</p> <pre><code>for r in results: if r in my_dict_list: print "ok" </code></pre>
python
[7]
3,978,440
3,978,441
ListBox Inside DataList Control Always Giving the Text of the First Item
<p>I have a ListBox inside DataList control. The Autopostback is set to true in the ListBox. </p> <p>For some reason when I select an item from the ListBox control and I check in the ListBox_SelectionChanged event it is always the First item of the ListBox items. Why is that?</p> <p>I just checked and the SelectedIndex is set to 0 even if I select the 5th or 6th item in the ListBox. </p> <pre><code> &gt; &lt;ItemTemplate&gt; &lt;div style="background-color:#FFCC99; border:2px solid black; padding:2px"&gt; &lt;div style="background-color:lightgreen; border:2px solid black; padding:2px"&gt; &lt;%# Eval("NounTypeName") %&gt; &lt;/div&gt; &lt;asp:ListBox ID="lbNounTypes" AutoPostBack="true" DataTextField="Key" DataValueField="NounTypeId" SelectionMode="Single" DataSource='&lt;%# Eval("Attributes") %&gt;' runat="server" onselectedindexchanged="lbNounTypes_SelectedIndexChanged"&gt; &lt;/asp:ListBox&gt; protected void lbNounTypes_SelectedIndexChanged(object sender, EventArgs e) { var lb = sender as ListBox; // lb.SelectedIndex is also 0 </code></pre> <p>I think I may have found the problem. The ListBox DataValueField is same for a ListBox and the SelectedItem is returned based on the selection of the value. </p>
asp.net
[9]
4,358,499
4,358,500
How to programatically get a list of all iPhone calls and messages?
<p>Is it even possible, without jailbreak?</p>
iphone
[8]
1,076,593
1,076,594
How does atoi() function in C++ work?
<p>So...I know that the atoi function in the C++ standard library is supposed to convert a string into an integer...how does it work?...(I'm trying to learn stuff and I was just wondering)...if you could show me the code from it or make your own that would do the same task it'd be greatly appreciated...thanks in advance.</p>
c++
[6]
5,955,868
5,955,869
Applying one jQuery change event to infinite potential html inputs, use same id for them all?
<p>I need to have the ability for the user to click a '+' which adds a new drop-down to an infinitely expanding collection of drop-downs. If I give them all the same id, will the jQuery change event know which one called the change event based on $(this) or do I need to have a new id for each new drop-down that is created during the page lifetime?</p> <p>...if there is another control that must change in relation to which drop-down was changed, will there be a way to know which one relates to it if they all have the same id? (picture two drop-downs side by side where changing the first one changes the options on the second one, so it's like an infinitely expanding collection of PAIRS of drop-downs that relate to each other)</p>
jquery
[5]
4,240,987
4,240,988
Stop scroll on click on anchor in a tab navigation in jquery
<p>How to stop the window from scrolling when an anchor is clicked or opened? <a href="http://domainsoutlook.com/s/site/stackoverflow.com.html#meta_info" rel="nofollow">http://domainsoutlook.com/s/site/stackoverflow.com.html#meta_info</a> Try some other tabs and the window scrolls down.</p> <p>Also, could it be possible to reload the whole page when an anchor/tab is clicked/changed?</p>
jquery
[5]
3,262,604
3,262,605
blank lines at the top of source code page
<p>I am running into a weird issue, a php file which return a valid JSON except that it output a ton of blank lines at the very top of the file, so if the real output contains 300 lines of code, what I get is 300 + 500 blank lines at the beginning.</p> <p>Please not that these blank lines are visible only when I show the source code of the page in my browser. How to get rid of that? </p>
php
[2]
2,769,688
2,769,689
Passing a variable into a php array
<p>I'm trying to pass a variable into an array, looks like php does not like it. Is there any work around to pass a dynamic variable into a php array? I have a result set which is a multi-dimensional array, the variable I'm trying to pass into the second array is part of the result set.</p> <p>a and b are column aliases. I need <code>$name</code> to be part of each row</p> <pre><code>$name=array1[$i]['name']; array('a','b',"$name") </code></pre> <p>Thanks for any suggestions!</p>
php
[2]
1,122,526
1,122,527
Android:Need to set Image before to TextView
<p>i need to set a image dynamically before to text view on the below mentioned code , so how to do this.?my code is below..</p> <pre><code>if (attchStringArray.length &gt; 0) { LinearLayout attachemntLayout = new LinearLayout(mainContext); LinearLayout.LayoutParams layoutParam = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); TextView attNameView = new TextView(mainContext); ImageView Ivbackground= new ImageView(mainContext); attNameView.setText(attchStringArray[2]); attachemntLayout.addView(attNameView, layoutParam); attachemntLayout.setBackgroundResource(R.drawable.bg_for_answers); attachmentsection.addView(attachemntLayout); } </code></pre>
android
[4]
3,048,814
3,048,815
Question about generic function parameter
<p>I'm just wondering why passing a <code>System.Collections.Generic.List&lt;string&gt;</code> into this function <code>test(ICollection&lt;object&gt; t)</code> will not work, why can't I pass it in like passing a <code>string</code> into <code>test2(object t)</code>?</p> <p>Doesn't make much sense to me!</p>
c#
[0]
700,605
700,606
itrerate through list of lists
<p>so i have a lists within a list. i'm trying to grab the lists that are within this list. i know i can get the outer list data as seen bellow. But how do i grab the data for all the lists inside the outer list? </p> <p>this is what i have:</p> <pre><code>public void iterateThroughList() { Iterator&lt;Test1&gt; itr = databaseList.iterator(); if (itr != null) { while (itr.hasNext()) { Test1 test1= itr.next(); System.out.println(test1.getName()); // set up itr2 to point to list within list??? how do i set this guy up? if(itr2 != null) { while(itr2.hasNext()) { } } } } } </code></pre>
java
[1]
466,567
466,568
Asp.net ready modules
<p>I need to add the ability to register users in my web site. I'm sure that 1000's of programmers already did this, so why should I build from scratch? Does someone knows where can I find a module like this as well as other modules?</p> <p>Thanks</p>
asp.net
[9]
3,073,376
3,073,377
C#: How to get the full path of running process?
<p>I am having a application that is changing some settings of other application (it is a simple C# application that run by double clicking (no setup required)).</p> <p>After changing the settings I need to restart the other application so that it reflects the changed settings. </p> <p>So to do, I have to kill the running process and start the process again, But the problem is after killing I am not able to find the process. (Reason is system do not know where the exe file is..)</p> <p><strong>Is there any way to find out the path of running process or exe, if it is running?</strong> </p> <p>I do not want to give path manually, i.e. if it is running get the path, kill the proccess and start again else .... I will handle later</p>
c#
[0]
3,505,605
3,505,606
Android C2DM Completed project
<p>I am developing an Android project where I have to use C2DM. I need a C2DM sample project or Source code.Please any one help me to give completed project.</p>
android
[4]
786,333
786,334
Another question, this time regarding breaking a string down for validity
<p>Thanks a bunch for the tip on the static to all of you folks who answered! Feeling a little less frustrated now.</p> <p>I am not going to ask questions step by step through my whole assignment, but I want to make sure that this is the way to go about one of the next tasks. I have written the following, which compiles fine (the purpose is to check the string to make sure that it is numeric, and the user may have also entered the ISBN as a number with or without dashes):</p> <pre><code> private String validateISBN(String bookNum) { String[] book; int j=0; for ( int i=0;i&lt;bookNum.length();i++) if (character.isDigit(bookNum.charAt[i])) bookNum.charAt[i]=book[j];j++; </code></pre> <p>I haven't written the next part, which has to allow for an X as the last digit in the string (which is apparently how ISBN numbers work). I would assume that if the above is correct (or close), that all i need to do is check that the ninth character is a digit or an X, by writing something like: if book[9] isDigit() || if book[9] == "x" || if book[9] == "X";</p> <p>Is that about right (ISBN numbers are always 10 numbers or 9 numbers and an X at the end)?</p>
java
[1]
2,304,158
2,304,159
JQuery, how to make page scroll when div slides down so you can see it
<p>I have some jquery code which opens hidden divs on my page from a dynamic list of data, the trouble is if you click a row from low down on the page it opens the div below the bottom of the page and you have to scroll down to see it, is there a way to set some sort of anchor or get jqyer to scroll to bottom of div when it opens so the user can see it?</p> <p>here is my code:</p> <pre><code>//CHECK IF ROW IS VISIABLE if (!$('#'+rowid).is(':visible')) { //HIDE ANY OPEN ROWS $("#tableToggle tr.toggleable").fadeOut('fast', function() { }); //DO SLIDE LOAD FUNCTION $('#'+rowid).slideDown('slow', function() { }); $("#einfo"+rowid).load(url, function(response, status, xhr) { if (status == "success") { $("#loader"+rowid).hide(); $('#einfo'+rowid).slideDown('slow'); } }); //HIDE ALL TOGGLEABLE ROWS }else { $("#tableToggle tr.toggleable").fadeOut('fast', function() { });} </code></pre> <p>Thanks for looking, hope you can help</p>
jquery
[5]
2,955,036
2,955,037
Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity
<blockquote> <p>Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "USD_en_productdata/USD_en_productdata.xml"</p> </blockquote> <p>the code</p> <pre><code>$src=simplexml_load_file("USD_en_productdata/USD_en_productdata.xml"); foreach($src-&gt;ProductItem as $i){ } </code></pre>
php
[2]
5,148,194
5,148,195
Grab content from another website
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3577641/how-to-parse-and-process-html-xml-with-php">How to parse and process HTML/XML with PHP?</a> </p> </blockquote> <p>I want to grab anything thats inside the code below on a website.</p> <pre><code>&lt;table class="eventResults byEvent vevent"&gt;&lt;/table&gt; </code></pre> <p>How can I accomplish this? Thanks</p>
php
[2]
5,755,668
5,755,669
Alternative to php preg_match to pull data from an external website?
<p>I want to extrat the content of a specific div in an external webpage, the div looks like this:</p> <pre><code>&lt;dt&gt;Win rate&lt;/dt&gt;&lt;dd&gt;&lt;div&gt;50%&lt;/div&gt;&lt;/dd&gt; </code></pre> <p>My target is the "50%". I'm actually using this php code to extract the content:</p> <pre><code>function getvalue($parameter,$content){ preg_match($parameter, $content, $match); return $match[1]; }; $parameter = '#&lt;dt&gt;Score&lt;/dt&gt;&lt;dd&gt;&lt;div&gt;(.*)&lt;/div&gt;&lt;/dd&gt;#'; $content = file_get_contents('https://somewebpage.com'); </code></pre> <p>Everything works fine, the problem is that this method is taking too much time, especially if I've to use it several times with diferents $content.</p> <p>I would like to know if there's a better (faster, simplier, etc.) way to acomplish the same function? Thx!</p>
php
[2]
12,921
12,922
Dynamically Return a Class of a Type Determined During a Method Call via Class.forName()
<p>I know that I can dynamically determine the return type of a method by passing in a class and then declaring that class as the return type, as in the following example:</p> <pre><code>public static &lt;returnType&gt; returnClass dynamicConstructor (Class&lt;returnType&gt; returnClass){ //Dynamically construct an object using a zero parameter constructor return (returnClass) object; } </code></pre> <p>The code that would be called would be:</p> <pre><code>DynamicConstructor.construct(constructedClass); </code></pre> <p>This code is nice because when you're calling the method in code, it's simple and encapsulated. However, I would like to take it one step further and make the parameter a string containing the full class name, then have the method determine the type of the object via <code>Class.forName(className)</code>. The trouble with this is that I can't figure out how to return the type as determined later on. Using method overloading, the code I have is:</p> <pre><code>public static ?????? dynamicConstructor (String className){ try { return dynamicConstructor(Class.forName(className)); } catch (ClassNotFoundException e) { System.out.println("Could not find class at path " + classPath); e.printStackTrace(); return null; } } </code></pre> <p>The problem is that I have no idea what to put in the part labeled <code>??????</code>. I want to be able to somehow reference the class determined by <code>Class.forName(className)</code>. Is this possible?</p>
java
[1]
2,667,277
2,667,278
Two clicks to get value of LI Item in jQuery - Should take 1
<p>I have a jQuery issue.</p> <p>I have a HTML list setup as follows : </p> <pre><code>&lt;ul class="areas"&gt; &lt;li title="Volunteering"&gt;Volunteering&lt;/li&gt; &lt;li title="Partnership &amp;amp; Support"&gt;Partnership &amp;amp; Support&lt;/li&gt; &lt;li title="Business Services"&gt;Business Services&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>When the user clicks the outer div - styled select, I then filter through these items and add the title to a span.</p> <p>The problem I have is, That it is taking two clicks for the "Volunteering" to appear in the span.</p> <p>I have mocked up a <a href="http://jsfiddle.net/355Qk/" rel="nofollow">jsFiddle</a> of this</p> <p>My jQuery looks like this :</p> <pre><code>$('ul.areas').css('display', 'none'); $('.styled-select').click(function() { var cur = $('.areas li.current'); next = cur.next('li'); var value = cur.attr('title'); if (next.length === 0) { // wrap if necessary next = $('.areas li:first'); } cur.removeClass('current'); // move the current class next.addClass('current'); $('.service-area').html(value); }) </code></pre> <p>How can I get it to work in just one click instead of two?</p> <p>Thanks in advance.</p>
jquery
[5]
549,896
549,897
Get other classes from an element with Jquery
<p>I am working on a small bit of script that will allow for easy and flexible creation of buttons.</p> <p>My buttons are made of three parts, a left, a right and a streched middle piece. There are three different sizes and three different colours of each.</p> <p>I have written the code that resizes the button to fit the text. Now I am looking to add the ability to easily set the colour and size.</p> <p>I was thinking of using three classes something like <code>&lt;div class="button blue big"&gt;</code> My script already loops through the button classes using each. Now I need to find out what other classes are set and adjust the pictures and dimentions used to fit. </p> <p>So how can I find out what other class selectors an element has? </p> <p>Also I am fairly new to jquery/javascript so I am wondering if storing the design as class selectors is the best way.</p>
jquery
[5]
329,638
329,639
Is there any way to Intercept incoming calls/sms to either block/unblock it?..Android
<p>hi Is there any way to intercept incomming calls/sms (to block or unblock it) on the basis of mobile numbers which are added to screening list. Thanks in Advance...</p>
android
[4]
4,665,301
4,665,302
Android Muticolum listview onListItemClick
<p>I have done Muticolum listview onListItemClick .Its working fine.Problem is </p> <p>This line <code>String selection = l.getItemAtPosition(position).toString();</code> return this <code>{routeName=TestRoute2, outlets=5, routeCode=VRT002}</code> .I want to get it selected row's 3rd column value.How to get it.</p> <p>Please help me..</p> <p>Thanks in advance..</p>
android
[4]
4,030,490
4,030,491
How to Make Custom Media Player or VideoView?
<p>How to Make Custom Media Player or VideoView? Please Help Me Thanks in Advance.</p>
android
[4]
4,292,295
4,292,296
javascript - different behaviour on page refresh
<p>I have a really weird problem. I have a site (running wordpress), and I use jquery roundabout plugin.</p> <p>When I visit the site with the address bar, the site is displayed fine. When I'm already in the site and I hit refresh - everything is messed up. I checked in both chrome and firefox, and I get the same result. In IE there is no problem. Also, I noticed that the problem occurs only when doing a soft refresh (F5) and it's ok when doing a hard refresh (Ctrl+F5)</p> <p>You can check for yourself in my test site <a href="http://50.112.34.111" rel="nofollow">http://50.112.34.111</a> try to press enter in the address bar a few times - should display ok. try to refresh - and you'll see the problem...</p>
javascript
[3]
4,279,566
4,279,567
Use jQuery to insert values into input fields?
<p>In the code below, I would like to use jQuery to put the word <code>"username"</code> into the value field. Then, when the user selects the input box, the word "username" would disappear leaving an empty input field for the user to input his username. </p> <p>Can this be done with jQuery?</p> <pre><code>&lt;p class="login-username"&gt; &lt;input type="text" name="log" id="user_login" class="input" value="" size="20" tabindex="10"&gt; &lt;/p&gt; </code></pre>
jquery
[5]
3,486,174
3,486,175
Convert resource/stream to File
<p>How can I do this?</p> <pre><code>File myFile = getFile(this.getClass.getResourceAsStream("test.txt")) </code></pre> <p>OR</p> <pre><code>File myFile = getFile(this.getClass.getResource("test.txt")) </code></pre> <p>What code will I write in <code>getFile()</code> method?</p>
java
[1]
4,847,355
4,847,356
How to implement the functionality of autoscrolling page if the element is below page fold in javascript?
<p>I want to implement a similar functionality like <a href="http://www.templatemonster.com" rel="nofollow">Template Monster's</a> menu. I am trying to create a feature list which slides down when the user clicks on the feature. But if the link is at the bottom of the page and the user clicks on that link, the feature list is shown below the view area and the user doesn't know that it is open until he manually scrolls the browser window down. </p> <p>I want to incorporate a functionality that if the feature list is not in the viewable area, the browser window automatically scrolls down to show the full list (templatemonster.com has done so with their drop down menus).</p> <p>Can anybody help me?</p> <p>Thanks,</p> <p>Gaurav</p>
javascript
[3]
4,020,147
4,020,148
Does python have one way of doing things?
<p>I have always seen in python articles/books that python is simple and it has only one way of doing things. I would like someone to <strong>explain to me this concept</strong> keeping in mind the example below, if I wanted to get the min and max values of sequence I would do the following;</p> <pre><code>seq=[1,2,3,4,5,6] min(seq) #1 max(seq) #6 </code></pre> <p>but I can also do this;</p> <pre><code>seq[:1] #1 seq[-1] #6 </code></pre> <p>surely this are two ways of doing one simple thing. This confuses me a bit.</p>
python
[7]
5,601,137
5,601,138
Javascript toString quirk
<p>Suppose I have a simple function defined that does nothing: <code>function fn() { }</code></p> <p>Now, when I run <code>toString(fn)</code> I get "[object Object]". When I run <code>toString.call(fn)</code> I get "[object Function]". Does anyone know why I get a more specific type when using the <code>call</code> method?</p> <p>EDIT: This behavior is exhibited in FireFox run through FireBug console. Both <code>toString.constructor</code> and <code>toString.call.constructor</code> yield "Function()".</p>
javascript
[3]
134,932
134,933
Background task is running only when iPhone is connected with xcode
<p>Hi all using following code for background task it works fine ,when iPhone is connected with xcode , but when I ran the app without connected xcode ,then background tasks won't work</p> <pre><code>- (void)applicationDidEnterBackground:(UIApplication *)application { back=1.0f; NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init]; NSRunLoop *runLoop=[NSRunLoop currentRunLoop]; timer=[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(changeCounter) userInfo:nil repeats:YES]; [runLoop run]; [pool release]; } </code></pre> <p>Please help why this is happening</p>
iphone
[8]
4,462,147
4,462,148
Javascript - get contents of div, decode base64, replace the same div with decoded contents
<p>Lets say I have a page with a div, which might or might not (no control over contents) have base64 encoded contents. I have a button, which when clicked will get the contents of the div, decode the base64 and then replace that same div with the decoded contents.</p> <p>I know that innerHTML can get contents of whichever element.<br> I know that <code>btoa()</code> and <code>atob()</code> can decode base64, and there are enough functions on the web to do it for IE.</p> <p>I however don't know how to combine the two, and afterwards replace the contents of that same div with the decoded result. What would be the best way to do above thing? Jquery is available, other frameworks are not.</p>
javascript
[3]
3,646,592
3,646,593
Accessing calling object from MethodCallExpression
<p>I'm trying to learn about Expression trees, and I've created a method that takes an</p> <pre><code>Expression&lt;Func&lt;bool&gt;&gt; </code></pre> <p>and executes it if it satisfies some conditions - see the code below.</p> <pre><code> private static void TryCommand(Expression&lt;Func&lt;bool&gt;&gt; expression) { var methodCallExpression = expression.Body as MethodCallExpression; if (methodCallExpression == null) { throw new ArgumentException("expression must be a MethodCallExpression."); } if (methodCallExpression.Object.Type != typeof (MyClass)) { throw new ArgumentException("expression must be operating on an instanceof MyClass."); } var func = expression.Compile(); var success = func.Invoke(); if(!success) { Console.WriteLine(methodCallExpression.Method.Name + "() failed with error code " + (func.Target as MyClass).GetError()); } } </code></pre> <p>The problem that</p> <pre><code>(func.Target as MyClass) </code></pre> <p>is null. Clearly I'm doing something wrong! How do I access the instance that the method is operating on?</p>
c#
[0]
5,982,460
5,982,461
Put javascript in one .js file or break it out into multiple .js files?
<p>My web application uses jQuery and some jQuery plugins (e.g. validation, autocomplete). I was wondering if I should stick them into one .js file so that it could be cached more easily, or break them out into separate files and only include the ones I need for a given page.</p> <p>I should also mention that my concern is not only the time it takes to download the .js files but also how much the page slows down based on the contents of the .js file loaded. For example, adding the autocomplete plugin tends to slow down the response time by 100ms or so from my basic testing even when cached. My guess is that it has to scan through the elements in the DOM which causes this delay.</p>
javascript
[3]
5,411,990
5,411,991
Endless Adapter with custom listview adapter in android
<p>I am using <a href="https://github.com/commonsguy/cwac-endless" rel="nofollow">this link</a> to create custom listview in my app. </p> <p>First I want to display listview with 5 items. As I scroll the list it should parse data and load listview for next 5 items.</p> <p>Listview row contains 5 textviews.</p> <p>How can I achieve this? </p> <p>Please help me.</p> <p>Thanks in advance </p>
android
[4]
2,337,825
2,337,826
how to insert an hidden field value along side with a checkbox in to the database
<p>i am new here but i have a problem in inserting the id and the value of the checkboxes into my database here is the code of the form:</p> <pre><code> &lt;?php include('db.php'); $sql = "select * from sheet1 order by course_level asc"; $r = mysqli_query($dbc,$sql) or die(mysqli_error($dbc)); $co = ''; while($row = mysqli_fetch_array($r)) { $co .= '&lt;tr&gt;&lt;td&gt;'.$row['course_level'].'&lt;/td&gt;&lt;td&gt;&lt;input name="courses[]" type= "checkbox" value = "'.$row['course_code'].'"&gt;'.$row['course_code'].' &lt;/td&gt; &lt;td&gt;'.$row['course_title'].'&lt;/td&gt;&lt;td&gt;'.$row['course_lecturer'].' &lt;/td&gt;&lt;input type=hidden name=cid[] value="'.$row['cid'].'"&gt; &lt;/tr&gt;'; } ?&gt; </code></pre> <p>And this is the action code:</p> <pre><code> &lt;?php include('db.php'); if(isset($_POST['courses'])) echo 'lie'; else echo 'true'; foreach($_POST['courses'] as $row=&gt;$id){ $courses=$id; $cid = $_POST['cid'][$row]; $sql = "insert into selected_courses values ('','$courses','$cid')"; $r = mysqli_query($dbc,$sql); } if($r) echo 'done'; ?&gt; </code></pre> <p>thanks a lot.</p>
php
[2]
1,020,405
1,020,406
ViewSwitcher to switch between views
<p>Could anyone please help me getting the dynamic paging with the three views? I have a situation where I'd like to use the pager, but have potentially hundreds of images to show, and need to keep in memory .</p> <p>However i wanted to be able to scroll through the multiple pages infinitely. In other words, when on the first page, be able to flip previous to the last page. Also when on the last page, be able to flip next to the first page. Then i have a situation where i did not know how many pages i wanted to flip through. I should dynamically generate the number of pages and be able to flip through</p>
android
[4]
5,308,596
5,308,597
Check a checkbox and change the font color of another option
<p>Here is my demo code <a href="http://jsfiddle.net/Wwdmm/3/" rel="nofollow">http://jsfiddle.net/Wwdmm/3/</a></p> <p>But nothing is happening when I click on <code>require</code>. I want to click <code>require</code> and then change the font color of <code>option2</code> and upon uncheck <code>option2</code> removes its class.</p> <p>What's the mistake? The selection is there. Thanks</p> <pre><code>jQuery(document).ready(function(){ $('#id_run_options_0').change(function(){ if (this.checked){ alert('checked'); $('#id_run_options_1').addClass('highlight-option2'); }else{ alert('unchecked'); $('#id_run_options_1').removeClass('highlight-option2'); }}); }); </code></pre>
jquery
[5]
2,910,650
2,910,651
Javascript Conflict (mootools, jquery_notification)
<pre><code>&lt;link href="css/jquery_notification.css" type="text/css" rel="stylesheet"/&gt; &lt;script type="text/javascript" src="js/jquery_v_1.4.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/jquery_notification_v.1.js"&gt;&lt;/script&gt; &lt;link rel=stylesheet href="css/mootime.css" type="text/css" media=screen&gt; &lt;script src="js/mootools1.2.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="js/mootime.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>Only one of the following javascript is working.... Please tell me a solution</p>
javascript
[3]
692,299
692,300
Replacing links detected in a HTML with other links using JS
<p>I'm having a bit of trouble figuring out how to do this one. </p> <p>Here's the scenario. My e-commerce site has a blog with a lot of content, promoting the products I sell, reviewing them etc. 99% of the posts on the blog link back to the products they are talking about.</p> <p>I'm going to be changing the URL where my ecommerce system is located. Therefore my blog is going to end up sending people to a lot of 404 pages.</p> <p>The idea I've had is to be able inclue a JS file which will on load, scan the document for existing links then, if found, swap them out with ones which are now correct.</p> <p>I hope this make sense.</p> <p>Cheers, Jim</p> <hr>
javascript
[3]
222,663
222,664
SocketTimeoutException problem - how to continue after exception
<p>I write and read in my function using Socket class. I used </p> <pre><code>synchronized(socket){ .//write; //read; } </code></pre> <p>I am doing this (repeat) every 50-1000 ms. Problem is when somebody ( unknown reason ) pluged off cable ( I got SocketTimeoutException). When he pluged in again, I need to continue. What to do ? Do I need to close this socket in catch block and create new ? Or something else ?</p>
java
[1]
4,526,878
4,526,879
Can we messure height of a div using php?
<p>Hi Can we messure height of a div using php? Any body knows the solution please help me :(</p>
php
[2]
5,599,203
5,599,204
Accessing column's value in datagridview
<p>I have a datagrid getting its data from the database. This datagrid has a column named "Room number".</p> <p>I want to add content double click event so that when the user clicks on a specific room number database should be accessed and get the data related to that room number from database and display it on a separate form.</p> <p>How to access this column by name that is "Room Number"?</p> <pre><code>private void dgMaster_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { } </code></pre>
c#
[0]
869,202
869,203
What are the free and commercial IDEs?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1715697/what-is-the-best-ide-to-develop-android-apps-in">What is the best IDE to develop Android apps in?</a> </p> </blockquote> <p>I'm using Eclipse and ADT plugin, I want to know the options of commercial and free IDEs more serious for developing applications for Android</p>
android
[4]
849,427
849,428
How to find minimum date from 3 dates using javascript function?
<p>I want to find minimum date from 3 dates (8/1/2011,6/1/2011,7/1/2011) format is (mm/dd/yyyy) using java script.</p> <p>Thanks in advance.</p> <p>Kanak Vaghela</p>
javascript
[3]
1,468,900
1,468,901
Could not load file or assembly for c1webreport1 tool in compnentone studio
<p>I'm using Licensed componentone product in my ASP.NET application and spcefically i use C1WebReport1 control from the product.while upgrading C1WebReport1 control from version 2.5.20072.239 to 2.6.20093.53207,i get the error message as</p> <p><strong>"Could not load file or assembly 'C1.Web.C1WebReport.2, Version=2.6.20093.53207, Culture=neutral, PublicKeyToken=594a0605db190bb9' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"</strong></p> <p>can any one help me to bring complete solution?</p> <p>Thanks in advance.</p> <p>Regards Omprakash</p>
asp.net
[9]