Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
5,719,493
5,719,494
SQLite or something else?
<p>I am trying to decide on what data storage methods to implement. Here is the situation. Whatever method I choose, it is going to be updated once week (can I update a SQLite db without putting out an update in the market?). The user cannot add or remove items from this ListActivity, they can only pick the ones they want. This data method should be able to remember the selected items during any given week. Let me know what method you would use and why. Thanks so much in advance.</p>
android
[4]
5,247,564
5,247,565
Peripheral Interface Controller (PIC) using PHP language
<p>Can i program the Peripheral Interface Controller (PIC) using PHP language?<br> I search many website and they didn't mention any clues.I hope here could help me.</p>
php
[2]
4,672,358
4,672,359
Fatal error Spinner and ArrayAdapter
<p>I have this part of code for spinner. But I get fatal error. What is wrong in here? Thanks! My Activity extends FragmentActivity.</p> <pre><code> Spinner spinner; String[] layers = {getString(R.string.a), getString(R.string.b), getString(R.string.c)}; LayoutInflater li = LayoutInflater.from(this); View v; v = li.inflate(R.layout.nearest, null); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(MyActivity.this, android.R.layout.simple_spinner_item, layers); spinner = (Spinner) findViewById(R.id.spinner_nearest); spinner.setAdapter(adapter); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setView(v); builder.setCancelable(true); AlertDialog alert = builder.create(); alert.show();} </code></pre>
android
[4]
1,822,890
1,822,891
jQuery animate not working on $(this)
<p>I am trying to animate a bunch of <code>&lt;div&gt;</code>'s with <code>.animate</code> with this function: </p> <pre><code>slideOut: function(container){ var count = container.siblings().size() - 1; container.siblings().each(function(index, item){ $(item).delay( index * 50 ).animate({ "left" : "-1000px" }, "fast", function(){ if (index == count){ container.delay(container.parent().parent().children().size() &gt; 10 ? 10 * 50 + 300 : container.parent().parent().children().size() * 50 + 300 ).animate({ "left":"-1000px" }, "fast", function(){ container.parent().parent().clone(true, true).appendTo(metro.tiles); metro.overlay(container.parent().parent().parent()); }); } }); }); }, </code></pre> <p>and I am using the following function to bring them back in to the DOM: </p> <pre><code>slideInTiles: function(){ $("#contentWrapper").empty(); $("#contentWrapper").append(metro.tiles.children()); $("#contentWrapper li").animate({"left": "0px"}, "fast"); $("#contentWrapper li.activeTile").css({"left": "0px"}, "fast"); }, </code></pre> <p>The problem, however, is that the <code>&lt;li&gt;</code> I click on does not get animated back in to the mix. I have to use <code>.css</code> to bring it back. Where is the bug in the code that is causing this problem? Also, since I am bringing the active <code>li</code> back by using <code>.css</code> it no longer animates out of the view either. I am pretty sure this has got to do with the <code>.clone</code> method. But how, I can't figure. </p>
jquery
[5]
4,137,834
4,137,835
How to make applicationn with Facebook API
<p>hi Hello i have made an application in which i have passed the facebook API. It is working properly but it shows me the facebook login page on first view. But I want particular page of facebook instead of facebook login page.How and where i can pass that URL of particular page on the API of facebook login page. Suggest me any solution for it.</p> <p>Thanks in advance.</p>
android
[4]
5,088,007
5,088,008
Sending Parameters to the Function called by a thread in C#?
<p>Sending Parameters to the Function called by a thread in C#, this is my code:</p> <pre><code>myThread = new Thread(new ThreadStart(myfunc)); myThread.Start(i); public void myfunc(int i) { ... } </code></pre> <p>I get error:</p> <blockquote> <p>No overload for 'installDrivers' matches delegate 'system.Threading.ThredStart'</p> </blockquote>
c#
[0]
3,453,713
3,453,714
C# Top level Items
<p>I am new to C# so please excuse my ignorance on the matter.</p> <p>In C++ you can define functions ( methods not in class ).</p> <p>Can you do that same thing in C#, and I don't mean lambda or anonymous functions. I'm referring to the same way you can in C++.</p> <p>ex.</p> <p><code>public void f() { }</code> -- not in a class.</p> <p>Also this leads me to my second question, what are the only top level items you can define in C#.</p> <p>Thanks :-) </p>
c#
[0]
4,282,290
4,282,291
Intent to folder contains video
<p>Now, I want to display all video in Gallery but I use <strong>Intent.ACTION_GET_CONTENT</strong> it only display images..If display video,I must use what intent?</p>
android
[4]
1,612,668
1,612,669
how to get value from different zones using jquery?
<p>I am trying to pass unique passnum value to different zone information using jquery, so that the passnum information is specific to a specific zone. for example zone1 may passnum = 100 and zone2 may have 50</p> <p>Is it possible to pass the unique passnum value to each of the zones<code>&lt;h5&gt; &lt;/h5&gt;</code>based on the zone using jquery? since there could be hundreds of zone blocks dynamically created.</p> <pre><code>&lt;div class="wrapper" class="zone1"&gt; other divs here (could have unknown amount of div block or tages here &lt;div &gt;&lt;span class="pass-num"&gt;&lt;h5&gt;some num &lt;/h5&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="wrapper" class="zone2"&gt; other divs here (could have unknown amount of div block or tages here &lt;div&gt;&lt;span class="pass-num"&gt;&lt;h5&gt;some num(pass val here) &lt;/h5&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; I have cthe ode below which works when u know the zone and structure $(document).ready(function() { var passnum ="110"; var passtext="All"; $('div.pass-text&gt;h4').text(passtext); $('div.pass-num&gt;h4').text(passnum); }); &lt;/script&gt; </code></pre>
jquery
[5]
2,045,524
2,045,525
How to avoid ANR occured in android?
<p>I am making an application in Android 1.6, there is an 'Application Not Responding' (ANR) error occuring - please suggest how to handle it in activity? </p> <p>I did only calling of web services according to condition and used a timer which runs and calls a particular webservice. One webservice fetches users who show on a gridview, when we click on the gridview seldom ANR occured but not each time.</p>
android
[4]
3,483,312
3,483,313
How to get Bitmap image from OI file manager path?
<p>My application requires an image to be selected from gallery.</p> <p>I start activity:</p> <pre><code>Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent,"Select Picture"), PICK_IMAGE); </code></pre> <p>It will prompt to select from gallery or OI file manager</p> <p>For the OI file manager, I get the path from Uri as follow:</p> <pre><code>Uri selectedImageUri = data.getData(); filemanagerstring = selectedImageUri.getPath(); </code></pre> <p>Now how do I get Bitmap image from the filemanagerstring?</p>
android
[4]
4,788,953
4,788,954
How to display the images from server asynchronously in Android?
<p>I am displaying an image from a server in Android. For that I have gone through the tutorial <em><a href="http://www.androidpeople.com/android-load-image-url-example" rel="nofollow">Android Load Image From URL Example</a></em>. It is very helpful. But it is taking 5 minutes to display the image from the server. So I want to display the image asynchronously. How can I do that?</p>
android
[4]
3,161,370
3,161,371
Verify if Visual C++ 2008 SP1 Redistributable Package is Installed?
<p>Is there a way to know if Visual C++ 2008 SP1 Redistributable Package is installed in the machine using C#.</p> <p>Many thanks,<br> Paulo</p>
c#
[0]
2,042,470
2,042,471
how to stop jquery conflicts?
<p>can someone help me please i am using this piece of jquery to call a jquery lightbox but its interfering with another jquery element on the page. does anyone know if theres a way i can get the two jquery scripts to run along side each other without any problems? thanks.</p> <p>jquery script one:</p> <pre><code> &lt;script type="text/javascript" src="assets/js/photobox2/jquery_1.5-jquery_ui.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="assets/js/photobox2/pirobox_extended_feb_2011.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $.piroBox_ext({ piro_speed :700, bg_alpha : 0.5, piro_scroll : true, piro_drag :false, piro_nav_pos: 'bottom' }); }); &lt;/script&gt; </code></pre> <p>jquery script 2:</p> <pre><code>&lt;script type="text/javascript" src="assets/js/js_photos/jquery.easing.1.3.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="assets/js/js_photos/jquery.mousewheel.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="assets/js/js_photos/jquery.gridnav.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function() { $('#tj_container').gridnav({ type : { mode : 'seqfade', // use def | fade | seqfade | updown | sequpdown | showhide | disperse | rows speed : 500, // for fade, seqfade, updown, sequpdown, showhide, disperse, rows easing : '', // for fade, seqfade, updown, sequpdown, showhide, disperse, rows factor : 100, // for seqfade, sequpdown, rows reverse : '' // for sequpdown } }); }); &lt;/script&gt; </code></pre>
javascript
[3]
3,595,930
3,595,931
UnboundLocalError: local variable 'file' referenced before assignment
<p>Guyz,am running into following error with the belwo code,where is ti going wrong? any cleanup suggestions also accepted</p> <pre><code> for line in file(timedir + "/change_authors.txt"): UnboundLocalError: local variable 'file' referenced before assignment </code></pre> <p>Code below:</p> <pre><code> import os,datetime import subprocess from subprocess import check_call,Popen, PIPE from shutil import copyfile,copy def main (): #check_call("ssh -p 29418 review-droid.comp.com change query --commit-message status:open project:platform/vendor/qcom-proprietary/radio branch:master | grep -Po '(?&lt;=(email|umber): )\S+' | xargs -n2") global timedir change=147441 timedir=datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S') #changeauthors = dict((int(x.split('/')[3]), x) for line in file(timedir + "/change_authors.txt")) for line in file(timedir + "/change_authors.txt"): changeauthors = dict(line.split()[0], line.split()[1]) print changeauthors[change] try: os.makedirs(timedir) except OSError, e: if e.errno != 17: raise # This was not a "directory exist" error.. with open(timedir + "/change_authors.txt", "wb") as file: check_call("ssh -p 29418 review-droid.comp.com " "change query --commit-message " "status:open project:platform/vendor/qcom-proprietary/radio branch:master |" "grep -Po '(?&lt;=(email|umber): )\S+' |" "xargs -n2", shell=True, # need shell due to the pipes stdout=file) # redirect to a file if __name__ == '__main__': main() </code></pre>
python
[7]
5,755,833
5,755,834
Is Calendar.getInstance().getTime() ever going to give me a different answer than new Date()?
<p>I'm trying to consolidate some code that is very messy but I want to make sure I don't break things. In some places I see a date created as <code>Calendar.getInstance().getTime()</code> and in others it's just <code>new Date()</code>. Will it break things if I convert them all to <code>new Date()</code> or is there some reason I may want to use the other?</p>
java
[1]
4,880,693
4,880,694
file upload control in update panel?
<p>In my web application, one of my web pages contains an update panel in which I have a text box, a file upload control and a button. When the user selects a file using the file upload control and then clicks the button I am not getting any file from the file upload control. When I place a break point, the file upload control's showing a null value. Can you help me?</p>
asp.net
[9]
1,964,217
1,964,218
javascript form error
<p>I have my HTML structure in the following format</p> <pre><code>&lt;div&gt; &lt;form class="form-inline" style="padding-top:10px" action="javascript:function()"&gt; &lt;!-- a search bar--&gt; &lt;input id="id" type="text" " placeholder="Something"&gt; &lt;/form&gt; &lt;button onClick="somefunction()"&gt; b&lt;/button&gt; &lt;/div&gt; </code></pre> <p>the problem is I want the search bar to work when I press enter in it but unfortunately it is submitting the button element , I am slightly confused as the button is not a form element and I have specifically defined onClick. I am new to javascript so I am sure it is something small but I have not been able to solve it.</p> <p>ie when I press enter , the "somefunction()" gets active as opposed to "function()"</p>
javascript
[3]
3,620,647
3,620,648
How to Control Fling action of Listview
<p>We have used Custom List View inside that one Text View and two Edit text present. I have put On Item CLick Listener On the Edit text Listener is set properly. What Is problem when fling action is happen then that listener is not setting. Is their any other Listener which can help me to control fling action. </p>
android
[4]
3,529,160
3,529,161
Getting value from an object with property name as a variable
<p>Quick Question</p> <p>Lets say I have</p> <pre><code>$colname = 'offer_id'; </code></pre> <p>and then I want to get a value from an object with the property name like $colname</p> <pre><code>echo $object-&gt;$colname; </code></pre> <p>Usually to do a variable on the fly, I would do <strong>$object->${$colname}</strong> but its not working</p> <p>Any one can help ?</p>
php
[2]
1,134,497
1,134,498
spl_autoload problem
<p>I'm having a problem with this spl_autoload and a static method. The constructor in this class requires two params to function. I'm new to autoload and static classes so I'm out of my league a bit here. Hopefully someone can shed some light on this for me.</p> <p>Here is the call:</p> <pre><code>if(captcha::validate($post))... </code></pre> <p>If I require the class apart from the spl_autoload function, it works as expected. If I let autoload handle it, as it should, the script dies with this message:</p> <blockquote> <pre><code>Fatal error: Class 'captcha' not found... </code></pre> </blockquote> <p>Can someone tell me what I am doing wrong here?</p>
php
[2]
382,187
382,188
Check Input text if empty based upon radio button selected
<p>I have two radiobuttons in a group on my page. Based upon radiobutton selected i want to generate an alert.</p> <pre><code>var d=GetVal(); function GetVal() { var a = null; var f = document.forms[0]; var e = f.elements["radiogroup"]; for (var i=0; i &lt; e.length; i++) { if (e[i].checked) { a = e[i].value; break; } } return a; } </code></pre> <p>At the time of form validation, It is always returning only first radiobutton value when iam reading it in if else loop.</p> <pre><code>if (!checkRadio("form","radiogroup")) { alert("none of the option was selected"); return false; } //if one radio option was selected else { if(d="firstradiovalue"){ alert("first radio selected"); return false;} else{ if(d="secondradiovalue"){ alert("second radio Selected"); return false;} } } </code></pre> <p>At the time of form submission, even if i choose second option i only get alert - "first radio selected". Any help. Thx in advance.</p>
javascript
[3]
5,081,832
5,081,833
Possible to rewrite url clientside with javascript without reloading page
<p>Is it possible to rewrite the URL in the URL-field on the client's browser?</p> <p>So when a person clicks on a link on my page something ajax happens (eg a tab shows up) i want the url to display the action without refreshing the page. </p> <p>Is this possible?</p>
javascript
[3]
4,499,536
4,499,537
Hide div when a different div isn't being hovered over?
<p>My code:</p> <pre><code>$(document).ready(function() { $('.tags').hover(function() { var id = this.id; $.post("tag_process.php", { tag: id }, function(data) { $("#entries").html(data); }); }); }); </code></pre> <p>I want #entries to hide(); when .tags isn't being hovered over. Is that possible?</p>
jquery
[5]
1,270,757
1,270,758
How to chose the selected option among the input fields
<p>Not sure if I can frame my question right. <br /> I have a page which can be customized. So it contains a bunch of radio-button groups, text field, checkboxes, drop-down list and so on. I would want all of the name and values of each of the selected/entered fields in an array at the click of a button. I currently have this which would give me all the input fields along with their values. </p> <pre><code>$('#submit_btn').click(function(){ var fields={}; $(":input").each(function(){ fields[this.name]=$(this).val(); // console.log("%s - %s",this.name,$(this).val()); }); </code></pre> <p>So say I would want to include the name and value of the radio only of which is selected, rather than listing all the radio buttons. Any idea how it could be done in jQuery?</p>
jquery
[5]
3,159,163
3,159,164
Query the android Mediastore for Artist names of Music files
<p>I'm torn about how to implement this because Content Provider URI querys do not support the simple SQL "DISTINCT" query method to return a cursor to the Artists of the songs in the mediastore, removing any duplicate entries.</p> <p>I can query and get a cursor to all the artists, I'm just torn as to how to remove the dupes, or simply not show them.</p> <p>I've tried using matrixcursor to construct a new cursor with the dupe entries removed, but it's slow (build an array of artists, if in that array don't copy to the new matrixcursor, etc.)</p> <p>Can anyone recommend a better solution, or point me in the proper direction??</p> <p>I've also thought about pre-loading the information i need into an array of objects - I'm just concerned with memory overhead in my application.</p> <p>Thank You for any help you may provide.</p>
android
[4]
5,301,189
5,301,190
Add another class to a div with javascript
<p>I have a function that checks the age of a form submission and then returns new content in a div depending on their age. right now I am just using getElementById to replace the html content. BUt I think would work better for me if I could also add a class to a div as well. So for example I have..</p> <pre><code>if (under certain age) { document.getElementById('hello').innerHTML = "&lt;p&gt;Good Bye&lt;/p&gt;"; createCookie('age','not13',0) return false; } else { document.getElementById('hello').innerHTML = "&lt;p&gt;Hello&lt;/p&gt;"; return true; } </code></pre> <p>What I would like to do is have everything in a div and if return false then that div disappears and is replaced with other content.. can I get any ideas on a good way to achieve this with pure javascript. I dont want to use jQuery for this particular function.</p>
javascript
[3]
227,909
227,910
Basic PHP password protected webpage
<p>I am trying to figure out an easy way to have a password protected php page.</p> <p>Essentially it would just have a user name and password field with one username and one password (pre set). If entered wrong it notifies the user, if entered right it reveals the page.</p> <p>I don't want to use a database and I am pretty sure can be done in a simple PHP script, thing is it's a language on my list to do.</p> <p>Anyone help me out here? Thanks a lot in advanced.</p>
php
[2]
1,983,185
1,983,186
Progress status in a long php script in possible?
<p>i have this very simple php script:</p> <pre><code>&lt;?php require 'functions.php'; $token = "some-number"; $id = "other-number"; $albums = get_url_contents("https://graph.facebook.com/".$id."/albums?access_token=".$token); $aObject = json_decode($albums, true); foreach ($aObject['data'] as $i =&gt; $a) { $photos = get_url_contents("https://graph.facebook.com/".$a['id']."/photos?access_token=".$token); $bObject = json_decode($photos, true); foreach ($bObject['data'] as $y =&gt; $b) { if (strpos($b['name'],"#test1") !== false) { echo($b['name']."&lt;br&gt;".$b['source']."&lt;br&gt;".$b['created_time']."&lt;br&gt;"); } } } ?&gt; </code></pre> <p>The execution time is always more than 10 seconds, is any way to notify the user with a perceptual text or something?</p>
php
[2]
1,304,930
1,304,931
Is there any function in jquery I can search child elements text and filter all the child ements by search key?
<p>For example my html is like below,</p> <pre><code>&lt;div id="mainDiv"&gt; &lt;div id="1"&gt;This is animal page&lt;/div&gt; &lt;div id="2"&gt;No animal here&lt;/div&gt; &lt;div id="3"&gt;Jame Bond&lt;/div&gt; &lt;div id="4"&gt;Simple Bond&lt;/div&gt; &lt;/div&gt; </code></pre> <p>And I have a <code>input</code> field like this </p> <pre><code>&lt;input type="text" id="search"&gt; </code></pre> <p>While searching anything it has to list the result in other div.</p> <p>Like when I search for <code>keyword bond</code> it should show like below</p> <pre><code>&lt;div id="mainDiv"&gt; &lt;div id="3"&gt;Jame Bond&lt;/div&gt; &lt;div id="4"&gt;Simple Bond&lt;/div&gt; &lt;/div&gt; </code></pre>
jquery
[5]
4,104,321
4,104,322
SQL-lite efficiency
<p>I want to store my map data in the sql-lite database on iPhone. I want to use the "NSUserDefaults" class for this. What do you think? It will be efficient to ask the database manager to load the map everytime I need it? And how big map can I store there? Is there any limitations? Thank you for the answers!</p>
iphone
[8]
2,873,254
2,873,255
What is wrong with Java's generics?
<p>I have seen several times on this site posts that decry Java's implementation of generics. Now, I can honestly say that I have not had any issues with using them. However, I have not attempted to make a generic class myself. So, what are your issues with Java's generic support?</p>
java
[1]
2,875,543
2,875,544
Java printwriter
<p>I have a proxy class, that receives a request and send the request to another server and gets the response and directs it back to original requestor. I use a socket to connect to the server and use Printwriter to write to it. Something like this </p> <pre><code> private PrintWriter out; public void writeString( String message ) throws IOException { openStreams(); out.print( message); out.flush(); } </code></pre> <p>I start the proxy and send request to server via proxy. The problem is I see a lot of these request/response in the console of the proxy. Is there is a different way of doing this, where the console is left cleaner. I am new to socket programing</p> <p>Thanks in advance</p>
java
[1]
4,014,755
4,014,756
Target div to hide with jQuery
<p>I need to toggle a div on click of an element within that div. I'm not sure if I target properly.</p> <pre><code>$(".clicker").click(function() { $(this).parent(".container").next(".hiddenDiv").toggle(); }); &lt;div class="container"&gt; &lt;div class="textBox"&gt;&lt;/div&gt; &lt;div class="clicker"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="hiddenDiv"&gt;&lt;/div&gt; &lt;div class="container"&gt; &lt;div class="textBox"&gt;&lt;/div&gt; &lt;div class="clicker"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="hiddenDiv"&gt;&lt;/div&gt; </code></pre>
jquery
[5]
103,033
103,034
Problem with .load() in jquery
<p>Ok, I'll put my code:</p> <pre><code>$("#html_contenido").load("../../jsp/comun/contenedor_operativa.html" ,function(){ $("#html_publicidad_reservar").load("../../html/pub/publicidad_reserva/publicidad_reservar_fr.html", function(){ alert($("#html_publicidad_reservar").html()); }); }); alert($("#html_publicidad_reservar").html()); </code></pre> <p>The first alert shows what <code>publicidad_reservar_fr.html()</code> has inside, but the second alert doesn't show it, so in the webpage nothing appears inside <code>#html_publicidad_reservar</code></p> <p>Can anyone tell me what's wrong with this code?</p>
jquery
[5]
1,059,394
1,059,395
to to implement a SQLite Manager for thread-safe read/write access?
<p>I'm planning on improving my SQLite implementation - currently, activities are opening the SQLite DB whenever they need some relevant data, then closing it. Closing the DB is important to avoid exceptions.</p> <p>my design goals:</p> <ol> <li><p>thread-safe access to an applications' SQLite DB</p></li> <li><p>synchronous operation</p></li> </ol> <p>What I thought I would do is implement some kind of "Manager" class instead of my basic "SQLhelper" class. I want synchronous operation so that rules out implementing it as a service with messages.</p> <p>I think the best way to implement this "SQLiteManager" is as a singleton.</p> <p>Are there any better implementations ?</p>
android
[4]
6,033,764
6,033,765
Android: I can't find getFullYear()
<p>I'm using the java Date Class in eclipse for Android as getYear is soon to be deprecated and replaced with getFullYear but the Class doesn't have the getFullYear function... What do I need to do to get it??</p>
android
[4]
6,020,862
6,020,863
Is there a built in way to show/hide an element in jQuery?
<p>I know how to show/hide, or fadeIn/out in jquery, but is there a built in way to toggle between show/hide or fadein/out or do I have first look if the element is display:none, if yes then show otherwise hide?</p>
jquery
[5]
872,933
872,934
Calculating average of image
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4543481/how-calculate-average-from-selected-image">How Calculate Average From selected image</a> </p> </blockquote> <p>How to find the max and min of pixel values and the average pixel value in java coding??? pls sumone help me. </p>
java
[1]
1,923,760
1,923,761
Trigger a function on key up on any input
<p>I want a javascript function to be triggered on key up on any input box. I tried using <code>getElementsByTagName.onkeyup</code> but it didn't work. Along with the solution please send a working jsfiddle. I don't want <code>document.getElementById</code> or <code>onkeyup="function()"</code> as there are many input boxes. It wont look tidy. I even tried</p> <pre><code>$(document).ready(function(){ $('input').onkeyup(function(){ calculate(); }) }) </code></pre> <p>I also want a function that will add 0 to the value of each input on window.onload. Thank You</p>
javascript
[3]
5,267,653
5,267,654
How to enable the back button for Android?
<p>How to enable the back button during the phone call for Android?</p>
android
[4]
5,896,704
5,896,705
Insert javascript variable into a form on another page?
<p>I am wondering if there's a good way to take a variable built in Javascript and then insert it into a form that's on another page.</p> <p>My application is a survey: I've got it so that at the end of the survey, all the results are displayed so they can look over their answers. Now I want to have the user click a link and have the answers of the survey show up automatically in the body of the form where they'll then add their email and contact info and click "send."</p> <p>Any ideas?</p> <p>Knowing that this ISN'T possible is fine too...if not, what alternate methods might I accomplish the end result?</p>
javascript
[3]
1,559,095
1,559,096
jQuery change select list selectedIndex on hover event and also send click?
<p>I have an image on my page that when hovered changes the selectedIndex of a select list. </p> <pre><code>// change the selected index of the select list on element hover $("#mySelectList").attr('selectedIndex', 1); // works </code></pre> <p>The select list also fires another function on change. This works when I manually change the options from the select list but not when I change the selectedIndex on the hover event (code above). </p> <p>My question, is there a way that I can also send a "click" event or something similar? Basically I want to be able to change the selectedIndex of the select list and also have it fire the other function.</p>
jquery
[5]
812,523
812,524
integrate my application with browser android
<p>I would like to create an application wherein if the app is installed on our android mobile,the user should be given a facility to share images through the application on selection of images while browsing.<br> Please let me know how i can achieve this.Can i achieve this using intent filters?<br> Please let me know your valuable suggestions.<br> Thanks in advance. </p>
android
[4]
3,380,878
3,380,879
How to change source path in executable g++
<p>I compile my programs in a compiler machine. Later I run and test the programs in a different environment. If I compile with -fprofile-arcs on then the program tries to write a file in a folder which does not exist in the running environment. Is there a work-around for this problem?</p> <p>Thanks</p>
c++
[6]
3,414,014
3,414,015
How can i return a fibonacci series? Should i use IList<>?
<pre><code>public int Fibonacci(int x) { int prev = -1; int next = 1; for (int i = 0; i &lt; x; i++) { int sum = prev + next; prev = next; next = sum; Console.WriteLine(sum); } return sum; // plz teel me how can i return whole list ?? } </code></pre> <p>How can i return whole output of above series? i.e. if x=3 then 0 1 1 2 so how can i return it?</p>
c#
[0]
3,668,034
3,668,035
Scrolling past header view in a ListView?
<p>I have a typical listview, it has one headerview. I want to set the y scroll value so the headerview is initially hidden to the user. My attempts have brought odd results. I know the exact height of the headerview (40dip), so I figured I should be able to just immediately set the scroll-y pos to that height and be good to go:</p> <pre><code>ListView lv = getListView(); lv.addHeaderView(mHeaderView, null, false); lv.setAdapter(myAdapter); // 1) Works, but the first time I touch the screen, // the listview pops its scroll position to zero // immediately, pretty odd. lv.scrollTo(40 * density); // 2) Does not work in onCreate(), does not work // if wrapped in a post. lv.setSelectionAfterHeaderView(); // 3) Does not work in onCreate(), works if // wrapped in a post. lv.listView.setSelectionFromTop(1, 0); </code></pre> <p>My clicks on the listview seem to be off by one now, looks like the headerview is now being interpreted as the 0th item in the adapter - is that possible? That's why I have the "setSelectionFromTop" call using "1" instead of "0". Maybe this is why "setSelectionAfterHeaderView" is failing.</p> <p>Thanks</p>
android
[4]
620,347
620,348
After downloading an app, "The requested item could not be found on this device" error
<p>When downloading my app from Market, when I tap on the Open button to try to run it, a toaster message says: "The requested item could not be found on this device and so could not be launched." But in fact, it's downloaded alright and its icon shows in app screen, if I tap on the icon, it runs fine. But this message is really annoying and is a turn off for many users.</p> <p>Does anybody have any idea? Thanks in advance!</p> <p><strong>EDIT:</strong> In this app, I have two launcher icons, launching two different activities. Could this be the cause? I mean, when the user clicks the Open button from Market program, which activity would be launch? The first one???</p>
android
[4]
4,465,486
4,465,487
Having trouble writing data to a file
<p>i am currently using this code the top part is right but i cant seem to save it to file</p> <p>this my current code</p> <pre><code>for line in myfile: list_of_line = line.split() if 'Failed password for' in line: ip_address_port = list_of_line[-4] ip_address_list = ip_address_port.split(':') ip_address = ip_address_list[0] print '\'',ip_address,'\'' if ips_desc.has_key(ip_address): count_ip = ips_desc[ip_address] count_ip + count_ip +1 ips_desc[ip_address] +=1 count_ip =0 else: ips_desc[ip_address] = 1 print ips_desc myfile = open('blacklist.txt','w') for ips_items in ips_desc.keys(): myfile.write(ips_items) </code></pre> <p>but last 3 lines dont work any ideas?</p>
python
[7]
1,779,305
1,779,306
PHP - Date returning the wrong value
<p>I have a little bit of code, and it doesnt seem to be working correctly.</p> <p>Im trying to put it into the correct format for my database, what im doing is as follows</p> <pre><code>date('Y-m-d H:i:s', strtotime('24/05/2011')); </code></pre> <p>But everytime i echo it, it returns:</p> <pre><code>1970-01-01 10:00:00 </code></pre> <p>Could someone please let me know where im going wrong.</p> <p>Cheeers</p>
php
[2]
5,214,668
5,214,669
How to add all input values using jquery
<p>I have the dynamically generated input values in my project. I need to get all the values which has similar id's like "<code>test_1</code>". </p> <pre><code>&lt;input type="hidden" id="test_1" value="1"&gt; .... &lt;input type="hidden" id="test_10" value="10"&gt; </code></pre> <p>So here i can use <code>$("input[id^='test_']")</code> to find all input values. IS there any logic to ADD all input values which has id "test_" ?</p>
jquery
[5]
4,720,474
4,720,475
is there any way to assign a variable to unique to every element in html
<p>i have variable "count" in javascript. <code>function click(e){ var count=0; }</code> i need to assign this count variable uniquely to every label.<code>&lt;label id="1" onclick="click(this)&gt;a&lt;/label&gt; &lt;label id="2" onclick=click(this)&gt;b&lt;/label&gt;</code></p> <p>when i click the label it would call function click(). there the count variable should not be global. the count variable for label id=1 call should different value to that of label id=2 call.</p> <p>ie label1.count=1 label2.count=2;</p> <p>is there any way to do like this?????</p>
javascript
[3]
787,137
787,138
How to explicitly say that the application doesn't support LDPI devices
<p>How can I make it so that my application is seen on the Android Market only by devices with mdpi and hdpi densities. </p> <p>There is the <code>&lt;supports-screens&gt;</code> tag and there is the <code>anyDensity</code> parameter but I don't see how I can say what I want. If I set anyDensity to false, what does that mean? Where do I specify which densities I do support?</p>
android
[4]
3,335,780
3,335,781
How do I remove the "reverse character order" function?
<p>How do I remove the function in this code to reverse the order of the characters? All I would like this function to do is replace all vowels imputed with "er".</p> <p>Here is the pastebin: <a href="http://pastebin.com/R9e0JRce" rel="nofollow">http://pastebin.com/R9e0JRce</a></p> <pre><code>// JavaScript Document function flip() { var result = flipString(document.f.original.value); document.f.flipped.value = result; } function flipString(aString) { aString = aString.toLowerCase(); var last = aString.length - 1; var result = ""; for (var i = last; i &gt;= 0; --i) { result += derpChar(aString.charAt(i)) } return result; } function derpChar(c) { if (c == 'a') { return 'er' } else if (c == 'e') { return 'er' } else if (c == 'i') { return 'er' } else if (c == 'o') { return 'er' } else if (c == 'u') { return 'er' } return c; } </code></pre>
javascript
[3]
965,317
965,318
Do com.android.internal.R.attr and android.R.attr have the same set of values?
<p>I need to use a built in value from Android resources. This value is stored <code>com.android.internal.R.attr.listViewStyle</code>. Being unable to get that from within my code, I tried to find the appropriate value I can use insted. Well, I've just found <code>android.R.attr.listViewStyle</code>.</p> <p>Question 1: Are these values same?</p> <p>Question 2: Where can I find the XML for <code>com.android.internal.R.attr.listViewStyle</code>? May be I have to create my own style instead that one. In order to find it out I should look at that file.</p> <p>Sorry if these questions are silly. I'm new to Android development yet.</p>
android
[4]
4,432,032
4,432,033
Getting python to work, Internal Server Error
<p>I'm trying to get Python scripts, called from a web browser, to work. I keep getting the error: </p> <pre><code>500 Internal Server Error </code></pre> <p>When I check my error logs I see the message </p> <pre><code>Premature end of script headers </code></pre> <p>The only documentation of this error online says that it can be the result of having improper line return characters in your script, but I wrote my test script right from the shell with pico. Also, when I run the file from the command line it executes just fine. " So far the only change I have made to apache is to add the .py to the "AddHandler cgi-script" line.</p> <p>Thanks!</p> <hr> <p>Thanks for the quick responses. Here is the latest version of the test code. I added a couple new lines before the output as suggested but still get the same error:</p> <pre><code>#!/usr/local/bin/python print "Content-type: text/html\n" print "\n\n" print "&lt;HTML&gt;" print "&lt;HEAD&gt;" print "&lt;TITLE&gt;Test&lt;/TITLE&gt;" print "&lt;/HEAD&gt;" print "&lt;BODY&gt;" print "&lt;H2&gt;Hi there.&lt;/h2&gt;" print "&lt;/BODY&gt;" print "&lt;/HTML&gt;" </code></pre> <p>Some other details: I am running Apache 1.3 and don't have mod_python. I set apache to recognize .py as mentioned above. I am running the script from the main public_html folder. </p> <hr> <p>An update. It doesn't seem to matter what I put in the shebang line. I tried all of the suggestions and even if I leave it blank the same error is showing up in the errors log and I'm getting a 500 error. </p> <p>I'm running Apache/1.3.41 on linux (red hat 3.4) with WHM/Cpanel installed. </p>
python
[7]
393,659
393,660
JQuery .isNumeric
<p>I have a text box with an id of EmpNum. I cannot figure out how to use JQuery's isNumeric to check to see if the value is Numeric or not.</p> <p>I tried: ('#.EmpNum').IsNumeric </p> <p>but that idd not work.</p>
jquery
[5]
741,744
741,745
How to declare "global" variable in OOP project?
<p>suppose you've this code: </p> <pre><code>namespace StighyGames.CarsAttack { public class CarsAttack { public static Channel[] ch = new Channel[30]; ... } void main { CarsAttack game = new CarsAttack(); } </code></pre> <p>}</p> <p>In another cs file on the same project i declare another Class ... </p> <pre><code>public class AnotherClass { void AFunction() { ch[1] = .. something; } } </code></pre> <p>Error: the name ch doesn't exists in current context !</p> <p>How can i access to game.ch[index] ????</p> <p>Thank you!</p>
c#
[0]
5,061,937
5,061,938
Javascript for loop not looping
<p>I have some code that I'm working on for my work. We're trying to loop through all the links on our page and automatically add an onclick event. However, the loop doesn't appear to be "looping" at all. Could somebody please help?</p> <pre><code>var ourdomainname = "ourdomain.com"; function linkallthelinks(domain) { var links = document.getElementsByTagName("a"); for (i = 0; i &lt; links.length; i++) { var link = links[i]; var href = link.getAttribute("href"); if (href.indexOf(read_today) != -1) { link.setAttribute('onclick', 'alert("Okay")'); } } } //function call linkallthelinks(ourdomainname);​ </code></pre>
javascript
[3]
5,895,921
5,895,922
The type or namespace name 'Helper' does not exist in the namespace 'Google.Apis.Samples
<p>I have added namespace <code>using Google.Apis.Samples.Helper;</code> but after running code I am getting below error which dll I have to add?</p> <blockquote> <blockquote> <p>The type or namespace name 'Helper' does not exist in the namespace 'Google.Apis.Samples</p> </blockquote> </blockquote>
c#
[0]
4,280,871
4,280,872
Invalidate Session in JSP
<p>I'm developing an application that user can log in in the system, and if another user tries to log in with the same id and password of the user that already logged, I need to invalidate the session of this user that already logged in and make him/her go back to the first page and make log in with the new user.</p> <p>How can I develop this?</p>
java
[1]
3,757,267
3,757,268
JDBC connection open or closed?
<p>I have a Java application with a JDBC connection, which performs many different tasks. My question is what is best for performance:</p> <ul> <li>To have an open connection for the duration of the application running?</li> <li>Close and reopen connection based on what tasks are performed and create new connection variables?</li> </ul>
java
[1]
2,396,253
2,396,254
Suggestions for synchronized database
<p>I have not yet implemented any portion of code to deal with this topic. I am looking to get suggestions on the best way to execute the task at hand. To simplify:</p> <p>My application stores data in a local SQLite database. I want to be able to share this database with other people for public access. I was thinking about uploading a copy of the database file to a server, and then allowing other people to copy the database to their devices, make changes, and then replace the file on the server. I want to avoid maintaining a database on the server (the server's only purpose is to hold the shared db file (no operations whatsoever server-side)).</p> <p>A major issue that might arise is: Two users making changes to separate copies of the db will cause data to be lost if each user makes separate modifications and both upload and overwrite to the same file. How would I allow multiple users at any given time to modify the shared file and everyone always has the same data on their device?</p> <p>However, it doesn't have to be with using a server and file ul/dl. The application could send out notifications to all the synchronized devices informing them on the specific record changes.</p> <p>I am not sure which direction to choose. Any help is greatly appreciated.</p>
android
[4]
4,984,800
4,984,801
how the background color changes on button click in android api 4.1 in android?
<p>I want to know that on button click how the background color changed here and it takes place more than the button size..Can anybody tell e that from where the background color is coming to this?? inside the android api 4.1, at path: <strong>Android API-res-layout-log_text_box_1.xml</strong> file looks like this. <pre><code> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;Button android:id="@+id/add" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/log_text_box_1_add_text"/&gt; &lt;com.example.android.apis.text.LogTextBox android:id="@+id/text" android:background="@drawable/box" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:scrollbars="vertical"/&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/log_text_box_1_do_nothing_text"/&gt; &lt;/LinearLayout&gt; </code></pre>
android
[4]
4,932,679
4,932,680
Is it possible to set borders to grid view in android
<p>Is it possible to set borders to grid view in xml. Like, i want each grid cell to contain borders. If so, kindly let me know how to do it. I have set this way. But i am not finding any specific thing to set border.</p> <pre><code> &lt;GridView android:layout_marginTop="95px" android:layout_marginLeft="32px" android:id="@+id/gridview" android:layout_width="340px" android:layout_height="250px" android:columnWidth="35px" android:numColumns="7" android:scrollbars="none" android:verticalSpacing="14px" android:horizontalSpacing="18px" android:stretchMode="columnWidth" android:gravity="center_horizontal" android:background="@color/white"&gt; &lt;/GridView&gt; </code></pre> <p>Thank you Swathi</p>
android
[4]
5,664,450
5,664,451
Is it possible to do programming using iPhone?
<p>Is it possible to do programming using iPhone? Any idea?</p>
iphone
[8]
4,503,583
4,503,584
How to view unicode khmer on android?
<p>public class WebKhmer2Activity extends Activity {</p> <pre><code>@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); WebView mWebView = (WebView) findViewById(R.id.web); String source = "អ្នកជាមនុស្ស​ មិនមែនសត្វ"; mWebView.loadDataWithBaseURL("null",source,"text/html","UTF-8",null); </code></pre> <p>} }//output just like box it should be អ្នកជាមនុស្ស មិនមែនសត្វ</p>
android
[4]
4,250,971
4,250,972
Can I start the same thread two times at the same block?
<p>I start the same thread two times on two lines,</p> <pre><code>new MyThread(0).start(); new MyThread(1).start(); </code></pre> <p>can I?</p>
java
[1]
4,765,127
4,765,128
what is the name and how to implement it in android tablet?
<p><img src="http://i.stack.imgur.com/m9dem.jpg" alt="enter image description here"></p> <p>Does anybody know what is the name of upper part of this image(Buddies,activity,chat,history) which is like tab and also how to implement it in android tablet?</p>
android
[4]
2,114,992
2,114,993
How many objects will be created during this string operation?
<p>Below is code snippet in instance method</p> <pre><code> String x = new StringBuffer().append("a").append("b").append("c").toString() </code></pre> <p>i am under impression , first new stringbuffer is created, then a is appended atlast of string buffer, similarly b and c. After that stringbuffer is converted to string. So as per me 2 objects are created(one for string buffer and another for string). correct? Basically as per me no intermediate objects will be created for String "a","b","c". Is this right?</p> <p><strong>Edit:- as per all of the replies, looks like objects will be created for string literals "a","b","c" But if i go by link <a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/StringBuffer.html#toString" rel="nofollow">http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/StringBuffer.html#toString</a>(), this should not create temporary strings. Search "Overall, this avoids creating many temporary strings." on this link. Agreed it is for 1.4.2 but i hope fundamental remain same for 1.6</strong></p> <p>Yes if i do below instead of above five objects will be created. three for "a","b","c" . one for string buffer. Then at last for string converted from stringbuffer. objects for "a","b","c" and lastly string "abc" will go too pool and be there in for life time </p> <pre><code>String str1="a"; String str2="b"; String str3="c"; String x = new StringBuffer().append(str1).append(str2).append(str3).toString() </code></pre> <p><strong>Is above understanding correct?</strong></p>
java
[1]
4,699,738
4,699,739
Function chaining is also considered as callbacks?
<p>When I implement a chaining such as in:</p> <p>ToUpper().ToString(). ....</p> <p>Would that chaining also be considered as a callback ?</p>
c#
[0]
1,917,085
1,917,086
Targeting class name - "Object doesn't support property or method"
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/10484467/ie-8-object-doesnt-support-property-or-method-getelementsbyclassname">IE 8: Object doesn’t support property or method ‘getElementsByClassName’</a> </p> </blockquote> <p>I've got a table with generated divs placed within each td, each have a generated classname example: "c1" I can drag say "c1" to another cell I want it to update the textbox (class = cell).</p> <pre><code>alert(target_cell.className); //var cellTxt = target_cell.querySelectorAll('.cell'); var cellTxt = target_cell.getElementsByClassName('cell')[0]; cellTxt.setAttribute('value', target_cell.className); alert(cellTxt.value); </code></pre> <p>The target_cell is the new cell but it throws up the error "Object doesn't support property or method" when it tries to update it. I get the same error in IE 8 &amp; 9 using either cellTxt options.</p> <p>Any Ideas? </p>
javascript
[3]
3,910,031
3,910,032
how to access private class list?
<p>i dont know this solution...</p> <p>for example, my code is,</p> <pre><code>class Bank { private : list &lt; Client*&gt; clientList; } class Client { private : list&lt; Account*&gt; accountList; } class account { private list&lt; string&gt; statement; } </code></pre> <p>oh, i want to access statement in bank class! and i think how to access its...</p> <p>1) making <code>list&lt; Account*&gt; getAccountList()</code> method in Client class and <code>list&lt;string&gt; getStatement()</code> method in Account.</p> <p>but why list is private? umm, may as well public?</p> <p>2) making list access method(umm, for example, pop and push?) in All Class..</p> <p>i got 2. but it's terrible. I have a lot to do, and repeated similar function...</p> <p>what is best way? it is way i never know?</p>
c++
[6]
2,391,588
2,391,589
Tab key not working in asp.net
<p>i have set the tab index of each control but it is not working. mean my tab index in not working i have use follow code</p> <pre><code> &lt;asp:DropDownList ID="ddlSupplierName" runat="server" CssClass="form-element-normal" TabIndex="1"&gt; &lt;/asp:DropDownList&gt; </code></pre>
asp.net
[9]
511,282
511,283
iPhone platformer. Controls?
<p>I was thinking of porting an old ZX Spectrum platformer game to the iPhone. How are the controls implemented in iPhone platform games? is it the accelerometer or they draw buttons on the screen that correspond to the directions and the firing?</p>
iphone
[8]
2,587,204
2,587,205
Need help understanding the + operator in Javascript
<p>Why is <code>1 + + + 1 = 2</code> in Javascript?</p> <p>What is this behavior called? Is it documented somewhere? </p> <p>Thanks.</p>
javascript
[3]
601,941
601,942
Change background color of python shell
<p>Is it possible to change background color of the Python Shell from white to black for example. I did find how to change text color, but can't figure out how to change background color. I'm running it under the Windows. Any suggestions?</p>
python
[7]
921,489
921,490
Clicking on an image to increase size
<p>I am looking out for plugins that can display a larger image when the user clicks on it. I am aware of lightbox. Any others to compare?</p>
jquery
[5]
311,211
311,212
Are namespaces bad for performance? (PHP)
<p>I've made some changes for a php framework to suport namespaces and the result wasn't as expected. For a simple test (mostly framework classes loaded) the execution time slowed down with ~10%.</p> <p>From your experience, is it worth it to use namespaces on large apps (considering the actual development level of PHP)?</p>
php
[2]
3,906,061
3,906,062
How to control NAS using iphone as a remote control?
<p>Is there any way or code available to control TV connected to NAS using iphone as a remote control?</p> <p>Any suggestions are welcome. </p>
iphone
[8]
1,427,083
1,427,084
Android: How can I make a Drawable array?
<p>How can I make an array that handles some of my images so that I can use it like this?:</p> <p>ImageView.setImageResource(image[1]);</p> <p>I hope I explained well...</p>
android
[4]
2,549,822
2,549,823
Insert custom ringtone against a contact id
<p>I am trying to insert custom ringtone against a contact id using content provider. But I am failing to do that. My code is given below:</p> <pre><code>File f=new File(contact.getRingtone_file()); Uri r=Uri.fromFile(f); ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, ContactsContract.Contacts.CONTENT_ITEM_TYPE) .withValue(Data.CUSTOM_RINGTONE,r) .build()); </code></pre> <p>Please help me if any one know the way to do the same.</p>
android
[4]
3,639,530
3,639,531
Android: Specify String in different Package in Manifest
<p>Is it possible to specify that a @string value belongs to a different package via the Manifest?</p> <p>i.e. android:text="@string/my_logo_text"</p> <p>Implicitly specifies the value as belonging to the current package. Is there a way to fully qualify that this string belongs to another package?</p>
android
[4]
1,367,977
1,367,978
Extract attachments from .MSG to use them in a PHP application
<p>I'm developing a PHP driven web application and i need to extract attachments from Outlook .msg. I haven't wondered outside PHP, Python and adjacent web languages so please take me easy. If one is curious the task is to check an email address, get the body and attachments and add them to the DMS. I'm googling for hours now and i see there is no easy way (like a PHP class or similar) so any workaround would be much appreciated :)</p>
php
[2]
2,155,445
2,155,446
How to change only text node in element
<p>I have next html:</p> <pre><code>&lt;label for="user_name"&gt; &lt;abbr title="required"&gt;*&lt;/abbr&gt; Name &lt;/label&gt; </code></pre> <p>And I want to change label caption to <code>Title</code> with jquery. So I do</p> <pre><code>$('label[for=user_name]').html('Title') </code></pre> <p>And it replace all inner html (with <code>abbr</code> tag)</p> <p>So, what the easiest way to replace only <code>Name</code>?</p>
jquery
[5]
231,963
231,964
Fake a real call on Android
<p>Is there any chance to fake a call on Android? I want it to ring and behave like there´s a real call (without the need of a second phone).</p> <p>I searched the whole web. In the emulator I would telnet it and type "gsm call 12345", but I don´t know how to do it on a real device (rooted).</p> <p>Thanks, Tom</p>
android
[4]
2,818,757
2,818,758
javascript div container width resize problem
<p>hej guys, I've got a problem trying to resize the width of a div container. I really don't know why it's not working... Thx for responding.</p> <p>here's the code: It really works with Google Chrome. But with IE or Firefox just won't work.</p> <pre><code>&lt;div id="div1" style="position:relative; background-color:#000000; width:100px; height:20px; color:#ffffff; text-align:center;"&gt; &lt;div id="div2" style="position:absolute; background-color:#00ff00; left:0px; top:0px; bottom:0px; width:10px; text-align:right;"&gt; &lt;/div&gt; &lt;/div&gt; &lt;script&gt; var container = document.getElementById("div1"); container.style.width = '300px'; &lt;/script&gt; </code></pre>
javascript
[3]
43,651
43,652
How to dynamically generate the raw resource identifier in android?
<p>I am working on a mobile library app. I have a 3-4 db files of books stored in raw folder. If I know the name of the book then I first copy this file to /databases/book_name.db and then access them as required. I use </p> <pre><code>InputStream fileInputStream = getResources().openRawResource(R.raw.book_name); </code></pre> <p>for accessing these files.</p> <p>Now, I want to pass the book name and then dynamically generate the resource identifier R.raw.book_name using the string book_name. Is there a way by which I can generate this identifier? </p>
android
[4]
4,052,915
4,052,916
accessing DOM elements, when button on click to get (name[i].firstChild.nodeValue;),
<p>I'm trying to alert just the first nodeValue not all of them, when a button is clicked. Buttons and tables are created dynamically from SQL.</p> <pre><code>function dodb() { var name = document.getElementsByName('prezime'); var elements = document.getElementsByName('bt'); for (var i = 0; i &lt;= elements.length; i++) { if (elements[i].type == 'button') { var name1 = name[i].firstChild.nodeValue; alert ("The " + elements[i].value + " button is click"); alert(name1); } } } </code></pre> <p>I solved the problem:</p> <pre><code>for (var i = 0; i &lt;= elements.length; i++) { // if (elements[i].type == 'button') { var oelements = elements[i]; oelements.onclick = (function(value) { var name1 = name[i].firstChild.nodeValue; return function() { alert(value); // alert ("The " + elements[i].value + " button is click"); alert(name1); } })(i); } } </code></pre>
javascript
[3]
5,526,156
5,526,157
What am I missing about reference types in this example?
<p>I have the following code in that I create an object and pass it along through a series of forms to a user control.</p> <pre><code>public class MyObject { public List&lt;AnObject&gt; Objects {get; set;} } </code></pre> <p>Form 1:</p> <pre><code>private void MyObject _myObject = new MyObject{Objects = new List&lt;AnObject&gt;()}; ... Form2 form2 = new Form2(ref _myObject); form2.Show(); </code></pre> <p>Form 2:</p> <pre><code>public Form2(ref MyObject myObject) { UserControl1 myControl = new UserControl1(); myControl.Objects = myObjects.Objects } </code></pre> <p>UserControl1</p> <pre><code>public List&lt;AnObject&gt; Objects {get; set;} ... Objects.Add(new myObject()); </code></pre> <p>When I Add a new myObject() to Objects in UserControl1, it doesn't update my original list on Form1. I am passing myObject by reference. The only thing I can think of that would be somehow unboxing my values is when I assign the list of AnObject to Form 2 to the UserControl1. What am I doing wrong? </p>
c#
[0]
5,109,004
5,109,005
Checking strings for empty
<p>Very tired this morning so if this is obvious then thats my excuse !!!</p> <p>i am using a buffered reader to read through a csv file - but i dont want to add any empty spaces, as in</p> <p>" "</p> <p>the problem is - when i read the line i am checking if the string length is > 0, if so then add, however the string " " is of length 4 - even tho its empty </p> <p>is there a better check i can do</p> <p>thanks </p>
java
[1]
2,101,613
2,101,614
Unable to find an element in jquery
<p>I am getting an error that says 'object expected' when I am calling a method of an element. I am getting this error even if that element exists on the page.</p> <pre><code>$('#asdf').text(); </code></pre> <p>I am calling this in the Onsucceed method of a pagemethod. What may be the reason behind it?</p>
jquery
[5]
4,456,864
4,456,865
Looking for a jQuery plugin to pick a color from an image?
<p>Does anyone know are jQuery plugin that let's me pick a color from an image on a page? If found jPipette so far but that is way to complex. Dont have PHP on the server side.</p>
jquery
[5]
97,323
97,324
Merging and combining arrays in PHP
<p>I have multiple associative arrays, similar to the following:</p> <pre><code>$arr1 = array(0 =&gt; 12, 5 =&gt; 10, 19 =&gt; 48); $arr2 = array(0 =&gt; 14, 7 =&gt; 9, 12 =&gt; 11, 19 =&gt; 30); </code></pre> <p>I would like to merge these arrays so that I have a single set of keys (0, 5, 7, 12, 19) and each points to an array with the values from the original arrays, and <code>null</code> if the value doesn't exist in the original array:</p> <pre><code>$merge = array( 0 =&gt; array(12, 14), 5 =&gt; array(10, null), 7 =&gt; array(null, 9), 12 =&gt; array(null, 11), 19 =&gt; array(48, 30) ); </code></pre> <p>I need to be able to do this for an arbitrary number of arrays. I'm not sure where to start with this. </p> <p>I could, I suppose, iterate through each array, append it's value to the result - but I'd have to check to see if I have the requisite number of elements in each resulting array before appending the current value to that index - which isn't terribly efficient.</p> <p>Ideas or pointers?</p>
php
[2]
1,610,940
1,610,941
Add city and street to personal details in Android
<p>I want to make an application to add personal details to the contacts in Android. I am able to add the name, phone number, etc. using the following code:</p> <pre><code>intent addContactIntent = new Intent(Contacts.Intents.Insert.ACTION, Contacts.People.CONTENT_URI); addContactIntent.putExtra(Contacts.Intents.Insert.NAME, "myname"); addContactIntent.putExtra(Contacts.Intents.Insert.PHONE, "232323222"); addContactIntent.putExtra(Contacts.Intents.Insert.PHONE_TYPE, Contacts.Phones.TYPE_MOBILE); </code></pre> <p>But the problem is that in address field there is city, street, etc. and here I'm not able to add data.</p>
android
[4]
426,898
426,899
Java chat client connecting to server
<p>I have created a chat server that works with telnet. Now, I am trying to write my own client. I need to be able to get an IP address from the user and a port number. I am trying to pass those variables through the ChatClient(). However, when I compile the following code, I receive the following error message: </p> <pre><code>ChatClient.java:24: cannot find symbol symbol : variable ip location: class ChatClient new ChatClient(ip,port); ^ ChatClient.java:24: cannot find symbol symbol : variable port location: class ChatClient new ChatClient(ip,port); ^ 2 errors </code></pre> <p><strong>ChatClient.java</strong></p> <pre><code>public class ChatClient { PrintWriter output; BufferedReader input; Socket client; public ChatClient(int ip, int port) throws Exception { String line; input = new BufferedReader( new InputStreamReader( client.getInputStream()) ) ; output = new PrintWriter(client.getOutputStream(),true); output.println("Enter an ip address: "); line = input.readLine(); output.println("Enter a port number: "); line = input.readLine(); } public static void main(String ... args) { try { new ChatClient(ip,port); } catch(Exception ex) { out.println( "Error --&gt; " + ex.getMessage()); } } // end of main } </code></pre>
java
[1]
1,312,997
1,312,998
Cell_MouseClick, Cell_MouseLeave and Cell_MouseEnter on DataGridView
<p>I want to register two mouse events with the datagridview. One is the CellMouseclick and other is the CellMouseLeave and CellMouseEnter.</p> <p>On Cell_MouseClick, i want to change the colort of the entire row. But when the row is select entire row. On Cell_MouseEnter and Cell_MouseEnter, the color of the row will be changed. But when the row is select after Cell_MouseClick, the CellMouseLeacve and CellMouseEnter should not change the color until the row is deslected. How to do this. Thanks.</p>
c#
[0]
3,241,150
3,241,151
jQuery AJAX - Creating DOM elements
<p>I am having this function in jQuery where I'm getting new posts with AJAX and PHP. And then creating a new div and appending the post to it.</p> <p>Here is my code:</p> <pre><code>function getMorePosts(latestPost){ $.ajax({ type: "POST", url: "/includes/classes/handler.php?do=getMorePosts", data: "&amp;latestPost="+latestPost, cache: false, success: function(data){ if(data){ $('#addUpdate textarea').val(''); $('&lt;div id="newPosts"&gt;&lt;/div&gt;').insertAfter('.myDeskAdd'); $(data).prependTo('#newPosts'); } } }); return false; } </code></pre> <p>Now, data is all of HTML code from my handler.php. Everything works, it's appending and I can see the result on the screen. And it's correct - nice! </p> <p>But here is my problem: When it's added to the screen, it's like I cant 'use' the DOM elements. For example: I have an image which I can click, and then it has to call an alert from jQuery, but it's not. And all other jQuery effects bound to the dom elements created doesn't work.</p> <p>Those elements not working DOES work if I press F5. </p> <p>I have tried <code>html()</code>, <code>prepend()</code>, <code>append()</code> and so on.</p>
jquery
[5]
5,997,379
5,997,380
JQuery Replace Attribute Source Not Working
<p>I have a button named "on" (on.png) and a button named "off" (off.png). They are designed to act as on/off switches, so when clicked, the other should load. Since I don't want to deal with the path (which is the same for both), I am trying to do an attribute replace. The jQuery code below, however, does nothing and I can't find the error. Any help is appreciated.</p> <pre><code>$('#btnDining').css({'cursor':'pointer'}).on('click', function(e){ var src = $(this).attr('src'); $(this).attr('src', function(i, src){ return (src.indexOf('off.png')!=-1)?src.replace("_off","_on"):src.replace("_on","_off"); }); }); // end button click </code></pre>
jquery
[5]
1,934,144
1,934,145
How to check if a folder is empty
<p>I currently need to send files from a folder, i want the service i am running to check in the folder every half an hour....how am i able to know if the folder is clear?</p>
android
[4]