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
2,214,372
2,214,373
Does std Class in PHP creates a Hidden Fields for each property
<pre><code>$Var = new StdClass; if($_POST['somvar']){ $Var-&gt;somvar = $_POST['somvar'] } else { $somevar='' } </code></pre> <p>Why is it creating hidden varaible for this statement "$Var->somvar = $_POST['somvar']" when i see the view source </p> <p>How do i persist the state of this variable when moving to next pages</p>
php
[2]
2,287,739
2,287,740
Android: How to upload a video to facebook after clicking on a button?
<p>I have an app in which i have a requirement to upload a video in facebook after clicking on a button. How can i do that? can anyone of you suggest a solution?</p>
android
[4]
654,131
654,132
Testing FPS using Android plugin for Eclipse?
<p>Ive no doubt this question may have been addressed before but how can I turn on a framerate monitor to use when I run my programs using the android emulator so I can see exactly what my android game is achieving at a given time?</p>
android
[4]
1,714,161
1,714,162
element inside another jquery scrollLeft
<p>For example, I have the following code</p> <pre><code>&lt;div style="width: 100px; overflow: auto;" class="slide-container"&gt; long content here &lt;/div&gt; $(".slide-container").scroll(function (e) { var scrollLeftValue = $(this).scrollLeft(); /* want get scroll left count */ }); </code></pre> <p>When I scroll content left scrollLeftValue is always 0. Any ideas? </p>
jquery
[5]
2,225,731
2,225,732
Android Map View
<p>In my application if i press a button map is loaded in my layout.again i press the button i got error like this.</p> <p>onlu one map is added to a single map activity . how to solve this.</p>
android
[4]
2,495,889
2,495,890
Problem in Jquery If Block
<pre><code>var htm = $.ajax({ type: "GET", url: "./viewforms", async: false }).responseText; var myObject = eval('(' + htm + ')'); alert(myObject.attributes[0]["type"]); $("#updateDiv1").html(myObject.attributes[0]["type"]); alert($("#updateDiv1").text()); l=$("#updateDiv1").text(); alert(l); if(l =="String") { alert("if..."); } </code></pre> <p>In the above code,i m retriving values from database..I m getting correct answer..Now i m comparing my database returned value with the String ..ITs retuning String but dont know why its not entering the IF block..please sugggest me.....</p>
jquery
[5]
5,781,587
5,781,588
backend for python
<p>which is the best back end for python applications and what is the advantage of using sqlite ,how it can be connected to python applications</p>
python
[7]
2,645,899
2,645,900
How to Reverse Hebrew String in Python?
<p>I'm trying to reverse Hebrew string in Python:</p> <pre><code>line = 'אבגד' reversed = line[::-1] print reversed </code></pre> <p>but I get: </p> <pre><code>UnicodeDecodeError: 'ascii' codec can't decode byte 0x93 in position 0: ordinal not in range(128) </code></pre> <p>Care to explain what I'm doing wrong? </p> <p>EDIT: The answers are great, thanks! I'm also trying to save the string into a file using:</p> <pre><code>w1 = open('~/fileName', 'w') w1.write(reverseLine) </code></pre> <p>but now I get:</p> <pre><code>return codecs.charmap_encode(input,errors,encoding_table) UnicodeEncodeError: 'charmap' codec can't encode characters in position 1-3: character maps to &lt;undefined&gt; </code></pre> <p>Any ideas how to fix that, too?</p> <p>EDIT: Found the solution, see my answer below. In short I used </p> <pre><code>codecs.open('~/fileName', 'w', encoding='utf-8') </code></pre> <p>instead of </p> <pre><code>open('~/fileName', 'w') </code></pre>
python
[7]
5,687,040
5,687,041
How do I make a function reference in PHP?
<p>I'm trying to make an associative array with values that are references to functions. What is the proper way to do this? This code works, but gives me a warning.</p> <h3>Code</h3> <pre><code>&lt;?php $mergeCodes = array( 'rev:(\d+)' =&gt; reverse_me, ); $test = "This is a [[rev:1234]] test"; echo "BEFORE: $test\n"; foreach ($mergeCodes as $code =&gt; $callback) { $code = '\[\[' . $code . '\]\]'; $test = preg_replace_callback( "/$code/", $callback, $test ); } echo "AFTER: $test\n"; function reverse_me($input) { return strrev($input[1]); } ?&gt; </code></pre> <h3>Output</h3> <pre> PHP Notice: Use of undefined constant reverse_me - assumed 'reverse_me' in /tmp/test2.php on line 4 BEFORE: This is a [[rev:1234]] test AFTER: This is a 4321 test </pre>
php
[2]
3,850,899
3,850,900
Android SD card storing checking using Emulator
<p>I am storing the information in a file in SD card in Android applicaiton. Can i check in emulator whether the information is correctly storing in sd card?</p>
android
[4]
5,632,225
5,632,226
Show More piece by piece - jQuery
<p>I've been working with the below code, (also found here: <a href="http://viralpatel.net/blogs/dynamically-shortened-text-show-more-link-jquery/" rel="nofollow">http://viralpatel.net/blogs/dynamically-shortened-text-show-more-link-jquery/</a>), to dynamically display more text when a "show more" link is clicked.</p> <p>This shows all of the text at once, however I'd like to display it piece by piece, so clicking "Show More" the first time would show an additional 500 characters, clicking it a second time would show 500 more characters, etc. Any ideas on how to accomplish this? I can somewhat figure out how to do it with set text, but not with dynamic text.</p> <pre><code>$(document).ready(function() { var showChar = 100; var ellipsestext = "..."; var moretext = "more"; var lesstext = "less"; $('.more').each(function() { var content = $(this).html(); if(content.length &gt; showChar) { var c = content.substr(0, showChar); var h = content.substr(showChar-1, content.length - showChar); var html = c + '&lt;span class="moreellipses"&gt;' + ellipsestext+ '&amp;nbsp;&lt;/span&gt;&lt;span class="morecontent"&gt;&lt;span&gt;' + h + '&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;a href="" class="morelink"&gt;' + moretext + '&lt;/a&gt;&lt;/span&gt;'; $(this).html(html); } }); $(".morelink").click(function(){ if($(this).hasClass("less")) { $(this).removeClass("less"); $(this).html(moretext); } else { $(this).addClass("less"); $(this).html(lesstext); } $(this).parent().prev().toggle(); $(this).prev().toggle(); return false; }); }); </code></pre>
jquery
[5]
940,213
940,214
java.util.Properties - how to purge memory on demand
<p>I am running a swing application in which I am getting all the labels, errors, etc. from property file. I have 2 huge global property files for error messages and labels. Huge means - 150kb. </p> <p>Also there are smaller property files and xml files which are cached. They are not big but they might all add up in the end culminating to an OutOfMemory when running on a system with less than 1 GB RAM.</p> <p>I was wondering how do you dispose of the smaller Properties object once you have used it. When you set the object to null, and once the GC runs it will go away. Is there another way where we are guaranteed that the cached properties are purged when needed by an API call?</p>
java
[1]
5,088,894
5,088,895
How to perform an activity using Jquery on page load
<p>I have below code in Jquery</p> <pre><code>$(document).ready(function() { // bind to cells with an ID attribute $("table &gt; tbody &gt; tr &gt; td[id]").mouseover(function() { // grab the anchor from the LI whose ID starts with the cell's ID var $tooltip = $("div:hidden li[id^=" + $(this).attr("id") + "] a"); // append it to the current cell $(this).append($tooltip); }).mouseout(function() { // remove the anchor/tooltip $(this).find("a").remove(); }); }); </code></pre> <p>Now you can see in above code that certain things has been done on <strong>MOUSEOVER</strong> event. The issue is that it does not show my anchor tag until I have <strong>MOUSEOVER</strong> on that particular <strong>TD</strong>. I want when my page gets loaded it will show all the anchor in <strong>TD</strong> without any <strong>MOUSEOVER</strong> or any <strong>EVENTS</strong>.</p> <p>I want to write this code on page load event, please suggest!</p>
jquery
[5]
2,329,088
2,329,089
PHP code line break `\n` causing gap between elements
<p>I'm echoing a series of HTML elements using PHP. I'm using <code>\n</code> to cause code line breaks to make the source code more organized and legible. </p> <p>For some reason, the use of <code>\n</code> in a specific location is causing a mysterious gap between the HTML elements. In firebug, this gap is not showing up as a margin, or padding, but rather just a gap.</p> <p><strong>Here is the PHP in question:</strong></p> <p>Note: As you can see, I have removed all of the PHP inside the tags as I'm pretty sure it is not relevant to this problem.</p> <pre><code>echo '&lt;ul ... &gt;'."\n"; while($row = mysql_fetch_assoc($result_pag_data)) { echo '&lt;li&gt;&lt;a ... &gt;'."\n". '&lt;img ... &gt;'."\n". '&lt;/a&gt;&lt;/li&gt;'."\n"; &lt;---- THIS IS THE \n THAT SEEMS TO BE CAUSING THE GAP } echo '&lt;/ul&gt;'."\n"; </code></pre> <p>Have you ever seen anything like this before, a presentation gap associated with PHP line breaks? If so, what is the reason for it?</p> <p>Is it really that important that I use <code>\n</code> in my code?</p>
php
[2]
123,476
123,477
Drag and drop in jquery
<p>I didn't get the id of dropped div on dropping on another div i get the id_droppable i but didn't get the id_dropped div The alert id_dropped give undefined as result</p> <p>Please help me verify my code and correct my error.</p> <pre><code>$(".full-circle").droppable({ accept: ".unseated_guest", drop: function(event, ui) { var id_droppable = this.id; alert(id_droppable); var id_dropped = ui.id; alert(id_dropped); var name=document.getElementById("div_name_0").value; $(this).css("background-color","red"); $(this).append(ui.draggable); //$(this).draggable('disable'); } }); </code></pre>
jquery
[5]
3,769,572
3,769,573
Compare file extension to file header
<p>I'm starting to design an application, that will, in part, run through a directory of files and compare their extensions to their file headers.</p> <p>Does anyone have any advice as to the best way to approach this? I know I could simply have a lookup table that will contain the file's header signature. e.g., <code>JPEG: \xFF\xD8\xFF\xE0</code></p> <p>I was hoping there might be a simper way.</p> <p>Thanks in advance for your help.</p>
java
[1]
1,097,212
1,097,213
Is bad/good/optionnal to defined vars after created them?
<p>Reading the code of many javascript libraries, I see that many developers use to set variables as soon as they were created them.</p> <pre><code>var i = 0, var c = 0; </code></pre> <p>I prefer instead to defined vars after created them.</p> <pre><code>var i, c; i = 0; c = 0; </code></pre> <p>But there might be an explanation about why this or that way?</p>
javascript
[3]
4,619,264
4,619,265
Is it necessary to filter the include path before autoloading?
<p>is it necessary to filter the paths of files before autoloading them. </p> <pre><code>if (strpos ($class, '.') !== false || strpos ($class, '/') !== false || strpos ($class, '\\') !== false || strpos ($class, ':') !== false) { return 'error: contains bad character'; } else { if (file_exists ($class.'.php')) { require_once $class.'.php'; } } </code></pre>
php
[2]
4,859,815
4,859,816
Is it possible to know which camera is currently using in android?
<p>In my application i want to know whether the camera application is On or not and also the type of camera(Front camera or back) ?</p>
android
[4]
4,527,663
4,527,664
show/hide div jquery
<p>I am keeping having errors from the below code:</p> <pre><code>&lt;input type="button" id="test" name="test" onclick="test();" value="Test"/&gt; function test(){ $('#divUser').hide('fast'); $('#divAddress').hide('fast'); $('#divDetails').show(); } </code></pre> <p>or </p> <pre><code> $('#test').click(function () { $('#Div3').show(); $('#Div1').hide('fast'); $('#Div2').hide('fast'); return false; }); </code></pre> <p>on jsFiddle: <a href="http://jsfiddle.net/mohamad/rFhM6/" rel="nofollow">http://jsfiddle.net/mohamad/rFhM6/</a></p> <p>it is solved: i replaced this: </p> <pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>with</p> <pre><code> &lt;script src="/jscripts/jquery-1.2.6.pack.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>thanks all anyway</p>
jquery
[5]
1,408,984
1,408,985
ListActivity with Recursion Android
<p>my problem is the next one:</p> <p>I want to use a ListActivity with recursion, so that it is called "x" times, and everytime i click in one article on the list, it is re-calling again the same Activity but it is loading different data, cause what I wanna do is to make menu and sub-menus, and the expandableList is not enough for me because there are gonna be n-levels(i will know dinamically.....).</p> <p>Anyone has an idea how can I implement it??</p> <p>Thanks!</p>
android
[4]
367,817
367,818
Using jQuery's .add method
<p>Either I am making a very silly mistake here, or there is a bug with jQuery's <code>.add</code> method. Most likely the former.</p> <p>I am trying to implement a list of items that could be selected. Here's my <a href="http://jsfiddle.net/2weq2/" rel="nofollow">code on jsfiddle</a>.</p> <p>The test case that is failing is the following:</p> <ol> <li>Click the first element to select it.</li> <li>Ctrl-click the second element to select it too.</li> <li>Then click the third element (without <code>Ctrl</code>).</li> </ol> <p>Now, I'd expect the first and second to be de-selected, I believe the implementation also does this. But the second one does not get de-selected.</p> <p>Digging a little, it seems that the <code>.add</code> is actually not adding my elements to the jQuery object set and for the life of me, I can't figure out why.</p> <p>Any suggestions on this? Or is this not the way the <code>.add</code> method is supposed to be used?</p> <p><strong>Edit</strong>: I know jquery-ui has a control for this kind of thing, but I have already evaluated it and it does not work for me. Thanks.</p>
jquery
[5]
3,732,843
3,732,844
How to display data from sqlite in textview
<p>i have a problem... How to display data from sqlite in textview..</p> <p>please help me out..</p> <p>Thank u..</p>
android
[4]
870,115
870,116
How to reference Image Class in C# winforms?
<p>I'm making a new Project which is a class library.</p> <p><img src="http://i.stack.imgur.com/1cX90.png" alt="alt text"></p> <p>my problem is I always got this error:</p> <pre><code>The type or namespace name 'Drawing' does not exist in the namespace 'System' (are you missing an assembly reference?) </code></pre> <p>this is my code: </p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; namespace ClassLibrary1 { public class Class1 { public void ReturnImage(object imageStream) { try { byte[] data = (byte[])imageStream; MemoryStream ms = new MemoryStream(data); return Image.FromStream(ms); } catch { } } } } </code></pre> <p>I'm planning to use this class to serve as a repository of common methods that I will be reusing in my program. In the above code, I have a public method <code>ReturnImage</code> which supposedly will accept an object and returns an <code>Image</code>.</p> <p>But why I get that error? Please help...</p>
c#
[0]
270,992
270,993
Fetching records from database and record is more display it in the other page(like next and previous page on the site button)
<p>Hi i want to create my project where i have to fetch record from database if records is too much for single page i want it to display in the other page so please help me what i have to do for this.</p>
php
[2]
720,391
720,392
Implementing a grid like in the applications launcher screen?
<p>I want to create a screen that will have a similar grid like the applications screen, with <code>horizontal scroll</code> like the applications screen have:</p> <p>I have tried using a <code>Gridview</code> but it only scrolls vertically, is there a way to use a <code>ViewPager</code> to achieve this ? </p> <p><img src="http://i.stack.imgur.com/aU3oZ.png" alt="enter image description here"></p>
android
[4]
5,126,423
5,126,424
problem not showing list on tab click, call new activity "openingtoday"
<p>hello when i click tab then my below class named "openingtoday" fire and i want to load data in list view after xml parsing done,my problem is that when i click tab parsing is done by calling new ProgressTask6().execute(); in oncreate() but item is not showing in list view but when i go back and load again then it display list on tab click means load data on second time when i go back ,i think problem is becoz of i make task asynchronous on tab click ..,i make asynchronous bcoz data showing in list view was taking time but now after making it asynchronous it not run MyAdapter class in oncreate() why??pls thanks alot</p> <p>my code is below..after clicking tab this class fire..</p> <pre><code> public class OpeningToday extends ListActivity { String name = null; String typename = null; static String array_type[]; static int totalartist; static String array_galleryname[]=null; static String array_address[]=null; static String array_galleryurl[]=null; static String array_email[]; static String array_web[]; static String array_phone[]; static String array_latitude[]; static String array_longitude[]; SitesList2 sitesList; static String gallerynames=null; static String addresses=null; @Override public void onCreate(Bundle savedInstanceState) { </code></pre>
android
[4]
4,872,291
4,872,292
How to delete values in two dimensional array (PHP)?
<p>I have an array which looks like</p> <pre><code> $cclArray[0]['url']='test.html'; $cclArray[0]['entity_id']=9; $cclArray[1]['url']='test1.html'; $cclArray[1]['entity_id']=10; $cclArray[2]['url']='test2.html'; $cclArray[2]['entity_id']=11; </code></pre> <p>if i would like to remove a specific array, for example if i want to delete the array element with <code>'url'='test1.html'</code> .. how do i do it?</p> <p>Thanks a lot for helping.</p>
php
[2]
1,011,679
1,011,680
Creating and assigning values to deeply nested objects
<pre><code>var obj={ one:{ two:{ three:{ } } } }; function test(){ obj.one=1; obj.one.two=2; obj.one.two.three=3; alert(obj.one); alert(obj.one.two); alert(obj.one.two.three); } </code></pre> <p>Could someone explain what I am doing wrong and give me a corrected example to go by? </p>
javascript
[3]
1,945,654
1,945,655
How to tell if you update a control on a page?
<p>If I have a checkbox, and I check it, then do something to check its value, it comes up as checked=false.</p> <p>How can I get the checked value?</p> <p>(Sorry about the influx of checkbox related questions, I have been tearing my hair out with a variety of problems all day)</p> <p>Edit:</p> <p>I am checking it in a button. In the buttons click event, it does this:</p> <pre><code>Table t = (Table)branchesPlaceHolder.Controls[0]; foreach (TableRow tr in t.Rows) { if (!((CheckBox)tr.Cells[4].Controls[0]).Checked) continue; . . . </code></pre> <p>So I guess since this is in a buttons click event, I have to do something with javascript like you suggest...</p>
asp.net
[9]
3,318,448
3,318,449
List_view customized button
<p>Hi guys I am new to android:- i want to know how to implement customized button in list view. can any one give a useful link. please guide me.</p>
android
[4]
369,460
369,461
ContentFlow: avoid image-overlapping
<p>I'm using ContentFlow (http://www.jacksasylum.eu/ContentFlow/index.php) and I would like to avoid image-overlapping adding 20px more on both left and right sides. Could you tell me how to implement it? Many thanks! Corrado.</p>
javascript
[3]
4,767,749
4,767,750
Trying to understand error message
<p>I get an error message in VisualStudio that I can't solve on my own. The message is: </p> <p><em>Inconsistent accesibility: property type 'WindowsFormApplication1.ContactFiles.Contact' is less accessible than property 'WindowsFormApplication1.ContactForm.ContactData'</em></p> <pre><code>public ContactFiles.Contact ContactData { get { return m_contact; } set { if (value != null) m_contact = value; } } </code></pre> <p>Preciate help to find the error source for this problem! Thanks!</p>
c#
[0]
2,336,276
2,336,277
Null Pointer to Object problems
<p>Hi can someone tell why in Linux and windows the same problem occurs :</p> <pre><code>#include &lt;iostream&gt; using namespace std; class A { private: int _dmember; public: void func() { cout&lt;&lt;"Inside A!! "&lt;&lt;endl; cout&lt;&lt;_dmember; // crash when reach here. } }; int main () { A* a= NULL; a-&gt;func(); // prints "Inside A!!!" return 1; } </code></pre> <p>can someone tell why this weird behivior occurs ? i mean , the a->func() was not supposed to get inside the func() ,...? this is unwated behavior , </p> <p>why the above behivor occurs?</p> <p>EDIT: Of course , a* =null was intentionaly!! so for all who answered "this is undefined behavior" or "you should never try to call a function on a NULL pointer !!", come on.... that was the point. and this behavior was explained correctly by some of you. </p>
c++
[6]
1,373,032
1,373,033
Performs form action even out of the form
<p>Hi having a problem with this code even if i clicked on cancel it will still proceed to use the action of my form even though the <strong>CANCEL</strong> button is not part of the <strong>form</strong>, Would appreciate any help.</p> <p>Here is the code.</p> <pre><code> &lt;form method="post" action="input_enroll.php" &gt; &lt;div id="overlay1"&gt; &lt;div&gt; &lt;h1&gt; Enter Educational Level Entry&lt;/h1&gt; &lt;input type="text" name="level" &gt; &lt;input type="submit" value="Proceed To Enroll" '&gt; &lt;/form&gt; &lt;input type="submit" value="Cancel" onclick='overlay()'&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>EDIT: Any suggestions what would be a better idea? I'm thinking putting the <strong>cancel</strong> outside the div.</p>
php
[2]
821,104
821,105
Add row using jquery
<p>I am printing a row with id as 'contactlist1', 'contactlist2', 'contactlist3'.... I have done this according to values stored in database. Now I want to add more row with id 'contactlist4', 'contactlist5', on button click event using jquery. Though I have taken values of variables that I am printing according to database in table. Now I wish to add row next to that id...</p> <pre><code>&lt;tr id='contactlist1'&gt; &lt;tr id='contactlist2'&gt; </code></pre> <p>I want to add row as <code>&lt;tr id='contactlist3'&gt;</code> for that I have used command</p> <pre><code>$("#contactlist" + k ).after(newRow); k++; </code></pre> <p>k has value 3 that I have taken in variable. Is this correct to way to present id as <code>'contactlist3'</code> </p>
jquery
[5]
3,355,865
3,355,866
Replacing the content of a Tag in HTML using java script
<p>Html:</p> <p>Input: </p> <pre><code> &lt;div id="ABC"&gt; &lt;div id="DEF"&gt; &lt;a title="Google" href="http://google.com"&gt;google.com&lt;/a&gt; &lt;/div&gt; &lt;div id="GHI"&gt; The text &lt;a title="Some link" href="linkk"&gt;ABCD&lt;/a&gt; to be replaced &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Using the Java script need to get the out put as</p> <p>Output: </p> <pre><code> &lt;a title="Google" href="http://google.com"&gt; The text &lt;a title="Some link" href="linkk"&gt;ABCD&lt;/a&gt;to be replaced &lt;/a&gt; </code></pre> <p>Rule:</p> <pre><code> For every &lt;div id="ABC"&gt; content inside the &lt;div id="DEF"&gt; need to be replaced with the content of &lt;div id="GHI"&gt;. </code></pre> <p>Thank you</p>
javascript
[3]
5,136,619
5,136,620
code for starting an application on receiving SMS from particular number in android
<p>hi there i want to start an application on receiving sms from a particular number or particular port. i am trying it with onReceiveintent but i m struggling. so, anyone there to help me in detail?Please explain me with code. Thanks </p>
android
[4]
3,261,080
3,261,081
what is the usage of `(void)d`
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6145548/what-is-the-purpose-of-the-statement-voidc">What is the purpose of the statement &ldquo;(void)c;&rdquo;?</a> </p> </blockquote> <pre><code>class ArgString : public Arg::Base { public: ... bool CanConvertToInt() const { const char *cstr = mValue.c_str(); char *result = 0; long d = strtol(cstr, &amp;result, 10); (void) d; // what is the usage of this line? return result != cstr; } private: std::string mValue; }; </code></pre> <p>Can someone tell me what the purpose of the following line is?</p> <pre><code>(void) d; </code></pre> <p>Thank you</p> <p>// Update //</p> <p>As some people pointed out, the purpose of the line is to suppress the compilation warning. To me, that is very strange. Because this is much severe warning</p> <pre><code> warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. </code></pre> <p>Why we ignore this big warning and ONLY address the smaller one.</p>
c++
[6]
1,646,691
1,646,692
Problem comparing arrays of Strings with nested loops
<p>This is the problem I am trying to solve: I have two arrays of Strings ("matches" and "visibleObjects"). I would like to search through all the words in the array "matches" to see if there is at least one word from the array "visibleObjects". If this condition is satisfied, I'd like to search through the words in "matches" again this time looking for at least a word from the array "actionWords". This is what I have, where "testDir" is just a debug string that gets printed:</p> <pre><code>protected void Action(){ boolean actionWord = false; String target = null; testDir = "first stage"; firstLoop: for(String word : matches) { testDir += " " + word; for(String hint : visibleObjects) { testDir += " " + hint; if(word.equals(hint)) { target = word; //found a matching word testDir = "Hint found"; break firstLoop; } } } if(target != null) { testDir = "stage two"; secondLoop: for(String word : matches) { for(String action : actionWords) { if(word.equals(action)) { actionWord = true; //found one word from the actionWords array testDir = "Acion OK"; break secondLoop; } } } } if(actionWord){ testDir = target; performAction(target); } } </code></pre> <p>All I get printed is the first word from the array matches and all the words from the array visibleObject once, so it doesnt get past the second loop....</p> <p>Is this code right? Can anyone spot the bug?</p> <p>Thanks for your help!</p>
java
[1]
1,790,911
1,790,912
asp.net slide shows
<p>I want different type of dot net slide show options can you give any suggestions or references or source code</p>
asp.net
[9]
5,754,769
5,754,770
How can we generate email failure notice?
<p>How can we generate email failure notice in java if the email is not delivered due to issues like email address does not exists or delivery failure etc.... something like yahoomail notifications</p> <p>Thanks </p>
java
[1]
5,279,399
5,279,400
Android - Display Image Caption Below Images in Gridview
<p>I am utilizing a version of the "Grid View" example from the Android Developers site:</p> <p><a href="http://developer.android.com/resources/tutorials/views/hello-gridview.html">http://developer.android.com/resources/tutorials/views/hello-gridview.html</a></p> <p>And I would like to display a small text caption below each of the images.</p> <p>Can someone please give an example of how this might be accomplished (i.e. what needs to be edited)? </p> <p>Thanks!</p>
android
[4]
5,496,752
5,496,753
Important, or just Personal Preference?
<p>I have an extension method that returns stuff (strings, lists, bools, etc), and I usually write them like this:</p> <pre><code>public string Return(string firstName) { /* get first name */ string fname = result.FirstName; return fname; } </code></pre> <p>You'll notice that I declared a new variable "fname", and returned it.</p> <p>But lately I've been doing this:</p> <pre><code>public string Return(string firstName) { /* code to get first name */ firstName = result.FirstName; return firstName; } </code></pre> <p>Which turns out to work the same way.</p> <p>And while writing this question, I remembered that I can just do this:</p> <pre><code>public string Return(string firstName) { /* code to get first name */ return result.FirstName; } </code></pre> <p>Does it really matter which way you write this, or does it just come down to personal preference?</p>
c#
[0]
3,185,437
3,185,438
Android:using hashmaps and strings
<p>just started dabbling in Android and have been told that Strings shouldnt be hard coded into Java but put into the string resource folder.</p> <p>I have existing code where in a hashmap the key and value are both strings.How would i go about putting the strings into xml and taking them out of the java part completely?</p> <p>Should I just create a string in the string resource folder like so</p> <pre><code>&lt;string name="hello"&gt;Hello.world&lt;/string&gt; </code></pre> <p>with hello being the key and world being the value and then just parse the string using the . as a delimiter?</p> <p>Hopefuly I've explained myself correctly</p>
android
[4]
2,506,718
2,506,719
listview.getCheckedItemPositions() not returning correct result when item is unchecked
<p>I used <strong>SparseBooleanArray</strong> to get positions of checked listitems in a listview : </p> <pre><code>final SparseBooleanArray checkedItems = lv.getCheckedItemPositions(); // lv is my listview </code></pre> <p>This works fine when I check a list item. But when I unchecked an item from listview, its size didn't decrease. It remained as it was.<br> Let me explain what is happening : I firstly select 3 listitems and I get the size of <em>checkedItems</em> as 3. But when I uncheck one item from the list, its size doesn't change to 2. It is still 3.<br> What needs to be done? Kindly help me out. </p> <p>Stone </p>
android
[4]
1,550,039
1,550,040
How to implement configuration qualfier for multiple screen size in android
<p>I am designing for supporting multiple screen size application using dip like margin_top etc in 3.2 .what are the folder I have to create for value folder? where i Have to specify dip? can anybody tell how to do? .If I had given value-11 folder and loading layout .I got compilation error no resource found error. but I have layout there</p> <p>Thanks</p>
android
[4]
1,725,367
1,725,368
Why is f(x).swap(v) okay but v.swap(f(x)) is not?
<p>We have:</p> <pre><code>vector&lt;int&gt; f(int); vector&lt;int&gt; v; </code></pre> <p>This works:</p> <pre><code>f(x).swap(v); </code></pre> <p>This doesn't:</p> <pre><code>v.swap(f(x)); </code></pre> <p>And why?</p>
c++
[6]
2,840,096
2,840,097
Enum for common names in Request.Form collection
<p>Does ASP.NET contains any enumerator for common field names used in Request.Form collection such as "_<em>EVENTTARGET" and "</em>_EVENTARGUMENT"? I need to refer to those names in multiple places in my app and I would love to be able to type something like <code>this.Page.Request[CommonRequestNames.EventTarget]</code> instead of hard-coding them.</p>
asp.net
[9]
611,814
611,815
Jquery - Replace Variables
<p>I'm looking to create a jQuery script that will replace an html variable if and only if it is inside a certain div. I'd like it to do this for each PostID though.</p> <p>Each variable is unique depending on the post id.</p> <p>Example:</p> <pre><code>&lt;div class="[PostID]"&gt; &lt;div class="special"&gt; &lt;div class="container"&gt; (Variable 1 has been replaced by variable 2 here due to the Special class) [Variable 2] &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I created a quick script but the problem I have is that when the first variable 2 is replaced, that is also the variable that is used to replace the following special classes. They aren't using their own variable.</p> <p>Sorry if this is confusing.</p> <p>Thank you.</p>
jquery
[5]
5,375,544
5,375,545
Creating PDF File
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3521097/how-to-create-pdf-files-on-android">How to create pdf files on android</a> </p> </blockquote> <p>this is my first post so bare with me. I am relatively new to android programming. I have a program that asks the user for information, then I need to put this information on a document/contract. I think I would like to create a pdf file with that information using itext (other alternate ways would also be appreciated). Although, I found that the itext version is not built (at least the free version) for android. My only solution is to create a server, send this information to a server that creates the pdf and then sends the pdf back to my phone. I have no idea how to do this. Or if anyone knows how to make an itext version for android. All help is greatly appreciated!</p>
android
[4]
4,759,953
4,759,954
c# window application layout problem
<p>Creating an application using C# 3.0. In my desktop system the application form layout is perfect. But the same application opens in my laptop, the form layout alignment is different.</p> <p>How do i solve this problem.?</p>
c#
[0]
2,582,178
2,582,179
Using java arrays
<p>I have 7 lines of data in a text file (shown below). </p> <pre><code>name: abcd temp: 623.2 vel: 8 name: xyz temp: 432 vel: 7.6 </code></pre> <p>Using regex, I was able to read this data and I have been able to print it out. Now I need to store this data in some variable. I'm leaning towards storing this data in an array/ matrix. So physically, it would look something like this:</p> <pre><code> data = [abcd, 623.2, 8 xyz, 432, 7.6] </code></pre> <p>So in effect, 1st row contains the first 3 lines, the 2nd row contains lines from 5 to 7. My reason for choosing this type of variable for storage is that in the long run, calling out the data will be simpler - as in: </p> <pre><code> data[0][0] = abcd data[1][1] = 432 </code></pre> <p>I can't use the java matrix files from math.nist.gov because I'm not the root user and getting the IT dept to install stuff on my machine is proving to be a MAJOR waste of time. So I want to work with the resources I have - which is Eclipse and a java installation version 1.6. </p> <p>I want to get this data and store it into a java array variable. What I wanted to know is: is choosing the array variable the right way to proceed? Or should I use a vector variable (altho, in my opinion, using a vector variable will complicate stuff)? or is there some other variable that will <strong>allow me to store data easily and call it out easily</strong>?</p> <p>Btw, a little more details regarding my java installation - in case it helps in some way:</p> <p>OpenJDK Runtime Environment (build 1.6.0-b09) OpenJDK 64-bit Server VM (build 1.6.0-b09, mixed mode)</p> <p>Thank you for your help</p>
java
[1]
4,972,761
4,972,762
Export html and css to a file using jquery
<p>Imagine I have a 3 column layout. <strong>Left, center and right div</strong>. I want to export only the center div. This is my export method so far:</p> <pre><code>function getHtml() { var htmlStartTag = function(){ var attrs = $('html')[0].attributes; var result = '&lt;html'; $.each(attrs, function() { result += ' ' + this.name + '="' + this.value + '"'; }); result += '&gt;'; return result; } return htmlStartTag() + $('html').html() + '&lt;/html&gt;'; } </code></pre> <p>My question is, how can I save the DOM to a html file, say template.html? When the user clicks export, the entire DOM should be saved or downloaded as html file. Is this possible, can you give an example? My application just uses jquery and html. It is not a serverside application!</p>
jquery
[5]
4,172,983
4,172,984
Alternating Item Style
<p>I would actually love to have an AlternatingItemTemplate on a GridView, but all it offers is an AlternatingItemStyle. In my grid, each two column row (in a table layout), has an image in the first column, and a description in the second column. I would like to have the positioning of the image and description alternate on alternate rows. </p> <p>How can I do this?</p>
asp.net
[9]
1,094,723
1,094,724
*Android Error*-Syntax error on token(s), misplaced construct(s)
<p>I'm new at this and is the first time I try to do an android app. I'm trying to do a rock, paper &amp; scissors I know I haven't finish the code but I'm having some error....</p>
android
[4]
5,862,939
5,862,940
Using Curly Braces with $_REQUEST to retrieve its indexes
<p>I've been reviewing a sample code to learn PHP and what I saw made me confused in the following code:</p> <pre><code>$in = $_REQUEST; require_once 'utils.php'; require_once 'utils_user.php'; require_once 'utils_email.php'; require_once 'utils_affiliate.php'; #Load Settings $globalSettings = parse_ini_file("settings.ini", true); if(isInDevelMode()) { $system = "devel"; } if(strlen($in{'system'} &gt; 0)) { $system = strip_tags($in{'system'}); } </code></pre> <p>Here a variable called <code>$in</code> was created and <code>$_REQUEST</code> was assigned to it and then later on in the second if-statement it was written like <code>if(strlen($in{'system'} &gt; 0))</code> and I don't quite understand what <code>$in{'system'}</code> here. It doesn't look like an array but $_REQUEST is an array-like to retrieve its content. Can somebody tell me what these curly braces are used for after <code>$in</code> variable...</p> <p>Thanks. </p>
php
[2]
4,010,061
4,010,062
changing ID of link
<p>I'm having difficulty changing the ID of this link on the fly with jquery. I can change the link text, but not the ID. Any ideas?</p> <pre><code>&lt;a href="#" id="follow-5"&gt;follow&lt;/a&gt; </code></pre> <p>and when you click the link, i'd like for it to look like:</p> <pre><code>&lt;a href="#" id="following-5"&gt;following&lt;/a&gt; </code></pre> <p>here is my jquery code</p> <pre><code>$("a[id^='follow']").live('click', function(e) { e.preventDefault(); var aid = $(this).attr('id').substring(7); $.ajax({ type: "POST", url: "/artist/", data: "command=becomeFan&amp;aid=" + aid, dataType: "html", success: function(data){ $("#follow-" + aid).text("Following"); $("#follow-" + aid).prev("a").attr("id","following-" + aid); } }); return false; }); </code></pre>
jquery
[5]
573,837
573,838
Caused by: java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord
<p>I am getting error like start recording() called uninitialized audio recording in android 2.3.4 version mobile(LG),its working fine in android 2.2 but throwing error in android 2.3.</p>
android
[4]
1,145,843
1,145,844
A particularly interesting program
<p>we did this problem today in math class to kill time after a quiz, and i was wondering if i could make a program along these lines</p> <p>so the idea is this:<br> take the number 123,456,789<br> the first digit from the left is divisible by 1, good, continue<br> the first 2 digits from the left are divisible by 2, good, continue<br> the first 3 digits from the left are divisible by 3, good, continue<br> the first 4 digits from the left are NOT divisible by 4, you get a remainder, bad, restart with different numbers, or go back until one of the numbers can be replaced (the even spaces are pretty interchangeable)<br> the tricky part here is that you cant use the same integer twice<br> the only place we can be sure about is the fifth place, so we can tell that the number will look something like: _ _ _, _ 5 _, _ _ _ </p> <p>i want the program to print the number(s) which is(are) perfectly divisible, all the way to the ones place. im pretty sure that only one number fits this criteria, but id like to know if this is true, which is why im trying to make this program. </p> <p>what i need help with is how i should go about checking if each number divided by its place has no remainder, and how to go back if it doesnt fit. </p> <p>pretty new to coding..anything helps </p>
c++
[6]
4,970,958
4,970,959
Casting array of objects (which implement interface IFoo) to IFoo[] in C#
<pre><code>class A : IFoo { } ... A[] arrayOfA = new A[10]; if(arrayOfA is IFoo[]) { // this is not called } </code></pre> <p>Q1: Why is <code>arrayOfA</code> not an array of <code>IFoos</code>?</p> <p>Q2: Why can't I cast <code>arrayOfA</code> to <code>IFoo[]</code>?</p>
c#
[0]
4,291,914
4,291,915
How to compute a minimum-delta for "remote desktop" sharing?
<p>Many free desktop sharing utility software is there in the market but i am thinking about writing own desktop share utility using c# first time for LAN only. this utility will run on two machines. first time sender apps sends complete image of it's desktop image to another machine called receiver. apps running on receiver machine just receive the image and display on it's own window. second time sender will take the current snap shot of its own desktop and compare with previous one and send only difference to second machine just to send minimum data over the network. if no difference found then send nothing over the network to another machine.</p> <p>so i was looking for image compare code and found many but no one deliver code in such way to form third image with difference. so my question is that when difference will be send to second machine then second machine should form third image with difference image data along with previous image data.</p> <p>no logic is coming to my mind to write code which stitch the difference in data with previous image. please help me with concept or code. thanks</p>
c#
[0]
2,992,619
2,992,620
Embed 3th party activity in my Activity
<p>I'm using the following code to get the activity of a 3th party application and to put it in my activity:</p> <pre><code>LocalActivityManager mgr = getLocalActivityManager(); Intent i = new Intent(this, SomeActivity.class); Window w = mgr.startActivity("unique_per_activity_string", i); View wd = w != null ? w.getDecorView() : null; if(wd != null) { mSomeContainer.addView(wd); } </code></pre> <p>Copyright Synic: <a href="http://stackoverflow.com/questions/3265265/android-using-activitygroup-to-embed-activities">android: using ActivityGroup to embed activities</a></p> <p>However, due Security Restrictions, I'm receiving the following error:</p> <p>java.lang.SecurityException: Requesting code from com.google.android.youtube (with uid 10065) to be run in process com.xxx.xxx (with uid 10144). (It is possible to show your own activity with your own SharedUID from your own application.)</p> <p>Now i'm wondering if there is any way I can avoid this. By using rooted devices(?), bug in Android OS, or anything else. If I can get it to work by rooting my device, how would i achieve it? (not the rooting ofc)</p>
android
[4]
5,636,472
5,636,473
How to pause and wait for command input in a python script
<p>Is it possible to have a script like the following in python?</p> <pre><code>... Pause -&gt; Wait for the user to execute some commands in the terminal (e.g. to print the value of a variable, to import a library, or whatever). The script will keep waiting if the user does not input anything. -&gt; Continue execution of the remaining part of the script </code></pre> <p>Essentially the script gives the control to the python command line interpreter temporarily, and resume after the user somehow finishes that part.</p> <p>Edit: What I come up with (inspired by the answer) is something like the following:</p> <pre><code>x = 1 i_cmd = 1 while True: s = raw_input('Input [{0:d}] '.format(i_cmd)) i_cmd += 1 n = len(s) if n &gt; 0 and s.lower() == 'break'[0:n]: break exec(s) print 'x = ', x print 'I am out of the loop.' </code></pre>
python
[7]
1,245,165
1,245,166
How to get the text before $el with jQuery?
<pre><code>&lt;cite&gt; text here... &lt;a id="target_element"&gt;&lt;/a&gt; &lt;/cite&gt; </code></pre> <p>How to get the text before <code>#target_element</code>?</p>
jquery
[5]
4,990,780
4,990,781
JavaScript string replacement problem
<p>I'm doing some string replacement on text I'm getting back from a JSON web service, the string may look like this:</p> <pre><code>"Hello I am a string.\r\nThis is a second line.\r\n\r\nThis is a bigger space" </code></pre> <p>I want to replace all the <code>\r\n</code> with <code>&lt;br /&gt;</code> tags so that the HTML is formatted, but when I do:</p> <pre><code>var string = result.replace('\r\n','&lt;br /&gt;'); </code></pre> <p>I only get the first instance replaced, not any other.</p> <p>What am I doing wrong?</p>
javascript
[3]
1,134,042
1,134,043
Background task, progress dialog, orientation change - is there any 100% working solution?
<p>I download some data from internet in background thread (I use <code>AsyncTask</code>) and display a progress dialog while downlaoding. Orientation changes, Activity is restarted and then my AsyncTask is completed - I want to dismiss the progess dialog and start a new Activity. But calling dismissDialog sometimes throws an exception (probably because the Activity was destroyed and new Activity hasn't been started yet).</p> <p>What is the best way to handle this kind of problem (updating UI from background thread that works even if user changes orientation)? Did someone from Google provide some "official solution"?</p>
android
[4]
4,236,820
4,236,821
How do i convert the following to MON-FRI using Java code
<pre><code>&lt;Days&gt; &lt;day&gt;Mon&lt;/day&gt; &lt;day&gt;Tue&lt;/day&gt; &lt;day&gt;Wed&lt;/day&gt; &lt;day&gt;Thu&lt;/day&gt; &lt;day&gt;Fri&lt;/day&gt; &lt;/Days&gt; </code></pre>
java
[1]
1,361,258
1,361,259
jQuery binding ajaxStart and ajaxComplete to a form type?
<p>my app has several jquery-ui-dialogs, all which do very different things. Here's the common template between them:</p> <pre><code>&lt;div class="dialog-content"&gt; &lt;form accept-charset="UTF-8" action="/NOT-UNIQUE" class="NOT-UNIQUE" data-remote="true" id="NOT-UNIQUE" method="post"&gt; &lt;div class="ui-dialog-body"&gt; all the fields &lt;/div&gt; &lt;div class="ui-dialog-footer"&gt; &lt;input class="button" id="NOT-UNIQUE" name="commit" type="submit" value="NOT-UNIQUE"&gt; &lt;input type="button" class="button" name="cancel" value="Cancel"&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>What I'd like to do is anytime a .dialog-content form is submitted, is disable the submit button so that users don't submit multiple times.</p> <p>So far I have: </p> <pre><code>$(".dialog-content").live("submit",function(){ // Comment AJAX UI, spinner, disable - Needs to be inside the submit to work dynamically $("form", this).ajaxStart(function() { // Disable button $("input[type=submit]", this).attr("disabled", true); }); $("form", this).ajaxComplete(function() { // Re-enable button $("input[type=submit]", this).removeAttr("disabled"); }); }); </code></pre> <p>But that doesn't seem to work. The goal is to not have to write this for every dialog but once that works for all dialogs.</p> <p>Thoughts?</p>
jquery
[5]
906,264
906,265
Consume Json service without mapping to a class
<p>I am consuming a service that returns a Json array. (essentially it is a web request, and the output is the text of a json array.) Is there a way I can get the results, and find what I need without making my own class to map it?</p> <p>i.e.</p> <pre><code> [TestMethod] public void Successfully_Parse_Json_Items_From_URL() { var content = GetHttpContent(new Uri("http://proactive.mandiant.com"), "findings/view/finding/all/", "application/json"); //returns HttpContent string json = content.ReadAsAsync&lt;string&gt;().Result; //Not sure what to do here. id want this maybe to be an array of keyvalue pairs or something? //...code } </code></pre> <p>If my array was:</p> <pre><code>[{item1: "value", item2: "value"}] </code></pre> <p>I would be interested only in item 2. I don't care what other items there are.</p> <p><strong>Edit</strong></p> <p>So I discovered that what I am looking for is a way to extract "item2" from:</p> <pre><code>[{item1: "value", fields: { item2: "value2"}}] </code></pre> <p>I tried doing:</p> <pre><code>JArray jsonArray = content.ReadAsAsync&lt;JArray&gt;().Result; foreach(JObject obj in jsonArray){ JArray jArray = (JArray)obj.SelectToken("fields"); //This throws an error about unable to case JObject to JArray. } </code></pre> <p><strong>UPDATE</strong> I managed to get this working.</p> <pre><code>foreach(var obj in jsonArray){ string item2 = (string)obj["fields"].SelectToken("item2"); } </code></pre>
c#
[0]
1,401,255
1,401,256
Iframe loading time with multiple sources, 1 value is always bad
<p>I got a script witch puts urls from a txt file into an iframe, then checks the loading time of each source. If i have 4urls in my txt file, i get 3 results witch are good enough for me, but 1 result is always too short (says frame loaded in 0,016 seconds or so, where others take 1-4 seconds to load). If i delete other urls from my list, and only leave the one that gives bad value and then run my script - i get a normal value (few seconds to load).</p> <p>Heres the script im talking about:</p> <pre><code>&lt;script type="text/javascript"&gt; $.get("imones.txt", function (data) { var array = data.split(/\r\n|\r|\n/); var beforeloadingtime = (new Date()).getTime(); var beforeTime = []; beforeTime[0] = beforeloadingtime; $.each(array, function (index, value) { var jsonnuorodos = "http://anyorigin.com/get?url=" + array[index] + "&amp;callback=?"; $.getJSON(jsonnuorodos, function (data) { var iframe = $("#frame_id")[0]; var doc = iframe.document; if (iframe.contentDocument) { doc = iframe.contentDocument; } else if (iframe.contentWindow) { doc = iframe.contentWindow.document; } doc.open(); doc.writeln(data.contents); doc.close(); var loadingtime = (new Date()).getTime(); beforeTime.push(loadingtime); for (i = 0; i &lt; array.length; i++) { var result; result = (beforeTime[i + 1] - beforeTime[i]) / 1000; $("#loadingtimediv" + i).html(result); } }); }); }); &lt;/script&gt; </code></pre> <p>Why do i get this inacurate result when running my script when i have multiple urls?</p> <p>Edit: i think my script doesnt actually wait for 1 url to load completely before adding the next one, can this be the reason im getting false results?</p>
javascript
[3]
4,709,237
4,709,238
is it possible in android to record the call during incoming or outgoing calls
<p>i am here for asking that in android is it possible to record voice call during incoming/outgoing calls without open the speaker of mobile...i had seen a application in android market..it does not correctly record other side voice without opening the speaker because it uses mic for recording purpose..may it be done by some other techniques pls suggest me ..</p> <pre><code>final MediaRecorder Callrecorder = new MediaRecorder(); Callrecorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL); Callrecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); Callrecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); Callrecorder.setOutputFile(recordPath); Callrecorder.prepare(); Callrecorder.start(); thanks in advance... </code></pre>
android
[4]
1,864,488
1,864,489
replace empty string(s) in tuple
<p>Is there an easy way (hopefully a one liner) to replace '' with something like '-'?<br> Many thanks.</p> <pre><code>tup = (1,2,'ABC','','','','text') </code></pre>
python
[7]
1,987,637
1,987,638
Attaching the source of an external jar file
<p>I want to attach the source code to an external <code>jar</code> file that I have. Normally I would just got to <code>configure build path</code>, expand the jar file and edit the source attachment. But since the jar file is an <code>Android Dependency</code> it does not give me that option.</p> <p>so I have 2 questions then, How can I attach the source to an android dependency or how can I make the jar file not an android dependency so I can attach it like i normally would?</p>
android
[4]
4,030,809
4,030,810
How can I get the ID of any element clicked within the $(document) in jQuery/js?
<pre><code>$(document).click(function(e){ alert(e.target); }); </code></pre> <p>That alerts [Object HTMLDivElement], is there another variable with the ID of the object?</p>
jquery
[5]
2,276,891
2,276,892
How to disable and undisable yes and no buttons
<p>I have 2 buttons which are "Yes" and "No"</p> <pre><code>&lt;input class="answerBtns answers answerBtnsOff" name="answerYesName" id="answerYes" type="button" value="Yes" onclick="btnclick(this);"/&gt; &lt;input class="answerBtns answers answerBtnsOff" name="answerNoName" id="answerNo" type="button" value="No" onclick="btnclick(this);"/&gt; </code></pre> <p>What I was attempting to do was that if the "Yes" button is highlighted, then disable the "No" button, if the "No" button is highlighted then disable the "Yes" button, and if none of the 2 buttons are highlighted, then remove the disabled from both buttons.</p> <p>But I can quite seem to get this work, I keep getting errors in my if statement when trying to read the class using .class(), how can I get the function below to work as how I stated I wanted to work?</p> <pre><code>function btnclick(btn) { var context = $(btn).parents('#optionAndAnswer'); if (context.length == 0) { context = $(btn).parents('tr'); } $(btn).toggleClass("answerBtnsOff"); $(btn).toggleClass("answerBtnsOn"); if (btn = 'Yes').class('.answerBtnsOn') { $(btn = 'No').attr("disabled", "disabled"); } else if (btn = 'No').class('.answerBtnsOn') { $(btn = 'Yes').attr("disabled", "disabled"); } else if (btn = 'Yes' &amp;&amp; btn = 'No').class('.answerBtnsOff') { $(btn = 'Yes' &amp;&amp; btn = 'No').removeAttr("disabled"); } return false; } </code></pre>
jquery
[5]
1,662,944
1,662,945
How to send Hindi text from url in android apps
<p>I am designing one android apps .In this apps I want to <strong>send hind text to my sql server by using URL</strong> . So can anyone help me to solve this problem or suggest some solution to send Hindi data to sql server . suggest me some solution to send data to sql server .</p>
android
[4]
3,505,697
3,505,698
python add string to the start of each element in array
<p>In the following i have an array where for each element a string should be added at the start and not append ,how can i do this</p> <pre><code> a=["Hi","Sam","How"] I want to add "Hello" at the start of each element so that the output will be Output: a=["HelloHi","HelloSam","HelloHow"] </code></pre>
python
[7]
4,011,519
4,011,520
How to not hide empty XML nodes PHP
<p>I was wondering how to not just return the closing XML node if it is empty as can be seen with the CustomerFax node below and to also return an the opening node with no content such as OrderType node.. Thanks </p> <pre><code>&lt;PushedOrders clientID="0" domainID="0" username="" password=""&gt; &lt;Order&gt; &lt;OrderType&gt;&lt;/OrderType&gt; &lt;WebOrderID&gt;&lt;/WebOrderID&gt; &lt;CustomerFax/&gt; &lt;/Order&gt; &lt;/PushedOrders&gt; </code></pre> <p>EDIT Adding PHP code that i'm currently using which only returns closing tags when empty.. When I view page source of the sample xml above the empty nodes return between the node tags:</p> <pre><code>$xml = new SimpleXMLElement('&lt;PushedOrders/&gt;'); $xml-&gt;addAttribute(XML_ATTRIBUTE_CLIENTID, '0'); $xml-&gt;addAttribute(XML_ATTRIBUTE_DOMAINID, '0'); $xml-&gt;addAttribute(XML_ATTRIBUTE_USERNAME, ''); $xml-&gt;addAttribute(XML_ATTRIBUTE_PASSWORD, ''); $order = $xml-&gt;addChild('Order'); $content = $order-&gt;addChild('OrderType'); $content = $order-&gt;addChild('WebOrderID'); $content = $order-&gt;addChild('CustomerFax'); echo formatXML($xml-&gt;saveXML('SalesOrder')); </code></pre>
php
[2]
117,158
117,159
How to address co-variant array conversion?
<p>I have an image stitching task that could take a lot of time so I run it as a seperate task like this</p> <pre><code>var result = openFileDialog.ShowDialog(); BeginInvoke(new Action&lt;string[]&gt;(StitchTask), openFileDialog.FileNames); private void StitchTask(string[] fileNames) { // this task could take a lot of time } </code></pre> <p>Do I need to worry about the co-variant array conversion warning below or am I doing something wrong?</p> <blockquote> <p>Co-variant array conversion from string[] to object[] can cause run-time exception on write operation</p> </blockquote>
c#
[0]
621,015
621,016
How to debug a jquery plugin?
<p>What is the best way to debug a jquery plugin? When I open the plugin in visual studio it is shown as a single line in the editor. Also, when debugging with firebug, the plugin code is shown as a series of lines with no indentation which makes it hard to follow.</p> <p>JD</p>
jquery
[5]
3,834,173
3,834,174
Is there a way to load javascript scripts concurrently?
<p>Probably not. But still would be nice to have it. Kinda hard to believe that modern standards do not support it.</p> <p><strong>Update</strong>: I would like to load scripts concurrently as opposed to the asynchronous scripts execution. So that if there are 10 scripts to load (9 small, 1 big) - in that case the big script won't "stuck" the download of the smaller ones.</p> <p><strong>Update2</strong>: I am loading the scripts by adding the <code>script</code> DOM element via javascript.</p>
javascript
[3]
1,083,000
1,083,001
Most efficient way to package php API
<p>I am writing a small api that will involve a number of "commands" with common elements, which involve reading parameters POST'ed to the script(s) and acted upon accordingly</p> <p>I would like to have the most optimum execution, and am not sure if it's better to have one largish script that switches on a $cmd variable, or to have each command in it's own script.</p> <p>it all really depends on how php handles script execution. if for example, the script is parsed and tokenized each time on the fly, it would be better to have a lot of short scripts that don't have redundant code being loaded and parsed/tokenized each time.</p> <p>if however php reads,parses and tokenizes the scripts, and caches the "instructions" in memory, only re-loading/parsing/tokenizeing when the script has actually been edited (eg based on filedate), it would be better to have it all in one script, as then the code could be factorized into functions, and would be easier to maintain, as there would be no repeated code. i don't like the idea of including common files, if that inclusion invokes a reparse each time.</p> <p>hopefully this question is not to generic in nature - i see no need to give sample code as i am really just wanting to know the best way to "package" my api </p>
php
[2]
2,786,661
2,786,662
jquery issue on checkboxes in multi column in table
<p>I have a HTML table (generated with ASP:Repeater control). I have 2 check box columns in the table. Both the columns have a Select All check box in the header. So when we check the Select All, all the check boxes in the respective columns should be checked(pretty usual stuff. So I have handled that). Now the issue is that, when I check/unchecked a check box in column_1XRow_1, then the check box in the column_2XRow_1 should get enabled &amp; checked/disabled &amp; unchecked.</p> <p>`</p> <pre><code>$(document).ready(function() { var $ResubAllChkBx = $('.ResubAll :checkbox'); var $ResubItmChkBx = $('.ResubItm :checkbox'); var $LLLCAllChkBx = $('.LLLCAll :checkbox'); var $LLLCItmChkBx = $('.LLLCItm :checkbox'); $ResubAllChkBx.change(function() { Chk_UnChkResubAll(); }); function Chk_UnChkResubAll() { if ($ResubAllChkBx.is(':checked')) { $ResubItmChkBx.filter(function() { return !this.disabled; }).attr('checked', 'checked');//check only when enabled } else { $ResubItmChkBx.filter(function() { return !this.disabled; }).removeAttr('checked');//check only when enabled } } });` </code></pre> <p>So essentially Re sub is Col1 &amp; LLLC is Col2.</p> <p>I did all this stuff in plain JS code, but due to the load on the page, I start seeing the JS error "A script on this page ......"</p> <p>How do I play around the check/unchecked check boxes in col1 &amp; col2? Please help. I need the code in jQuery.</p> <p>Thanks Bobbie</p>
jquery
[5]
374,928
374,929
Android audio looping
<p>Although a seasoned developer, I'm new to Android, and am wanting to develop an app to loop between user defineable sections of audio recorded via Android's mic in.</p> <p>I'm wanting as low latency as possible when the loop point is hit (i.e. miminal time to seek the start point of the section and resume playback). </p> <p>I'm after some general recommendations such as: </p> <p>audio file format<br> which classes should I be considering for playback (e.g. soundpool, media player etc) </p> <p>Thanks for any advice</p> <p>Dave</p>
android
[4]
2,639,689
2,639,690
How to add date picker control to my toolbox
<p>I am using visual studio 2005 and I have added Datepicker dll in my bin folder.And By doing right click on solution Explorer Add:references,choosed the that dll.But I want display that control in my toolbar.Does I need to create tab for it.Or it automatically get created.</p>
asp.net
[9]
3,484,283
3,484,284
Java compatible English Dictionary API?
<p>I am trying to mimic a simple news reader, a desktop application developed on swings. As a part of this I am looking at including a dictionary lookup for a word from within the tool. I am looking at trying to display the meaning for word as a tool tip that appears upon a double click on JTextpane's content(one single word). </p> <p>So is there an exposed API for dictionary look-up? Also considering the fact that I am using java swings, the speed with which the API performs dictionary look up is also a key concern in my case..</p>
java
[1]
5,416,077
5,416,078
Pass Method as Parameter using C#
<p>I have several methods all with the same signature (parameters and return values) but different names and the internals of the methods are different. I want to pass the name of the method to run to another method that will invoke the passed in method.</p> <pre><code>public int Method1(string) { ... do something return myInt; } public int Method2(string) { ... do something different return myInt; } public bool RunTheMethod([Method Name passed in here] myMethodName) { ... do stuff int i = myMethodName("My String"); ... do more stuff return true; } public bool Test() { return RunTheMethod(Method1); } </code></pre> <p>This code does not work but this is what I am trying to do. What I don't understand is how to write the RunTheMethod code since I need to define the parameter.</p>
c#
[0]
2,143,774
2,143,775
Hide taskbar using Python in Windows XP
<p>Is there a way to hide the Windows taskbar using Python? If not- is there a way to disable or to re-size and lock it using the registry?</p>
python
[7]
5,749,096
5,749,097
How can I make my program return to the beginning in Python?
<p>I'm a really new programmer, just programing for fun. I usually write my programs with a series of while loops to get to different sections of the program at different times. It's probably not the best way, but it's all I know how to do. </p> <p>For example, I'm working on a little program that runs in a shell meant to solve an equation. Here's part of the program that's supposed to bring you back to the beginning.</p> <pre><code>while loop==4: goagain = raw_input("Would you like to do the equation again? (Y/N)") if goagain == "Y": #Get values again loop=2 elif goagain == "N": print "Bye!" #End program loop=0 else: print"Sorry, that wasn't Y or N. Try again." </code></pre> <p>I have it set so that while loop==2, it gets the values to put into the equation and while loop==0, nothing happens. </p> <p>The problem I have, though, is that when my loop changes back to 2, the program just ends there. It doesn't want to back in the code to where I told it what to do while loop==2.</p> <p>So what I need to know is how to get my program to go back to that section. Should I use a different method than the while loops? Or is there a way to get my program to go back to that section?</p> <p>Thanks!</p>
python
[7]
3,784,922
3,784,923
Where do I place code that fires after the page is returned to the browser
<p>I want to send an Email message after a page is returned to the browser. Where do I place this send Email code so that it does not delay the page that is returned to the browser? </p>
asp.net
[9]
1,006,434
1,006,435
Location provider timestamp different between GPS provider and network provider?
<p>I'm using the code from this article provided by google:</p> <p><a href="http://developer.android.com/guide/topics/location/obtaining-user-location.html" rel="nofollow">http://developer.android.com/guide/topics/location/obtaining-user-location.html</a></p> <p>to figure out a user's current location. I've been reading in other questions that the time provided by the GPS location provider is not comparable to the time provided by the network provider, or the system time:</p> <p><a href="http://stackoverflow.com/questions/4418344/android-problem-finding-out-how-recent-latest-gps-fix-is/4481665#4481665">Android problem finding out how recent latest GPS fix is</a></p> <p>Do we need to apply a fix to the google code sample in order for the time comparison to be done correctly? This is getting confusing especially with some other bugs in the location providers:</p> <p><a href="http://code.google.com/p/android/issues/detail?id=23937" rel="nofollow">http://code.google.com/p/android/issues/detail?id=23937</a></p> <p>Thanks</p>
android
[4]
5,244,389
5,244,390
JavaScript Load New Page Question
<p>What I am looking to do is if a user complete a form it will provide access to a new location.</p> <pre><code>&lt;script language="JavaScript" type="text/javascript"&gt; &lt;!-- function validateForm(theForm) { var firstname = theForm.firstname.value; var lastname = theForm.lastname.value; var email = theForm.email.value; if (firstname == "") { alert("Please fill in your First Name."); theForm.firstname.focus(); return false; } if (lastname == "") { alert("Please fill in your Last Name."); theForm.lastname.focus(); return false; } if (email == "") { alert("Please fill in your email address."); theForm.email.focus(); return false; } return true; } </code></pre> <p>I know this part is wrong but I have no idea how to go about doing it. any help would be nice.. </p> <pre><code> if lastname="" if firstname="" if email="" load('www.google.com'); </code></pre>
javascript
[3]
282,974
282,975
How to get the corresponding textview related to a togglebutton in a costum listview?
<p>I have a listview using a costumized ArrayAdapter. I have a textview and a togglebutton inside my list child(single_row.xml). My toggle button is meant to mark/unmark my list items as favorites. In order to update my database (SQLite) I need to access the corresponding textview which is beside the togglebutton. </p> <p>My problem is that it I don't know how to get the corresponding textview. I am not sure how they are related.</p> <p>I hope the question is clear. Thanks</p>
android
[4]
5,803,723
5,803,724
how to add onclick event to create new element in javascript
<p>I have created a <code>label</code> element. I need to add <code>onclick</code> event to that...</p> <pre><code>function a(me) { var d=document.createElement("label"); d.id=me.id; d.onClick="a(10)"; d.innerHTML="welcome"; document.body.appendChild(d); } </code></pre> <p>HTML:</p> <pre><code>&lt;label id="1" onclick="a(this)"&gt;aa&lt;/label&gt; &lt;label id="2" onclick="a(this)"&gt;bb&lt;/label&gt; &lt;label id="3" onclick="a(this)"&gt;aa&lt;/label&gt; </code></pre> <p>actually what happens is when i click the any of three labels in html. another label is created and displays welcome. now when i click the newly created label "welcome" it does not display anything...... that is the onclick event added to newly created label is not working ....... any suggestion.................</p>
javascript
[3]
2,605,268
2,605,269
How can i sample process?
<p>i have application who use specific process during running and i want to sample the process and check if the process crash in order to find the specific file who cause the crash, how can i sample process from my computer and also check if the process id changed ?</p>
c#
[0]
4,270,405
4,270,406
PHP function name on the fly
<p>I have a rather stupid PHP question :D! I would like to simplify the following statement:</p> <pre><code>function hello_input() { return 'Hello World'; } $helper = 'hello'; $helper = $helper . '_input'; $data = $helperinput(); </code></pre> <p>The specific part I want to simplify is the adding of the _input to the $helper so it calls the right function.</p> <p>I thought of something like this but it doesn't work:</p> <pre><code>$data = $helper. 'input'(); or $data = $helper. 'input' . (); </code></pre> <p>Any ideas?</p> <p>Thanks, Max</p>
php
[2]
1,659,163
1,659,164
const attribute in class, should be public or protected?
<p>I have some attributes which are const, so should these attributes be made public or protected ?</p> <p>I was in support of protected because it is used by some of the derived classes, but my friend argued that since it is const, it doesnt make any difference even if it is public, which also makes some sense.</p> <p>But, as I learnt cpp, I thought if possible, we should try to make attributes protected or private and use accessors to change them ??</p> <p>Thanks.</p>
c++
[6]
2,858,263
2,858,264
WinForms/C#: Implementing long scrollable list of images blows up memory
<p>I try to load jpg-images as a long list of picture boxes into a table layout panel. The list of the images should be scrollable smoothly, i.e. without flickering or visible blurring or dithering. There are around 300 images, each with a size of around 150kb (600px x 850px).</p> <p>The problem is that when loading the images into the panel, the memory (RAM) is much more blown up that it should be (considered the size of the images files). If the list is loaded, around 500Mb are blocked in memory, but the images should need around 300 x 150kb = 45MB. </p> <p>It does not matter if I load the image into the picturebox directly or as MemoryStream: The result concerning the memory load is the same.</p> <p>So, something is blowing up my memory-load, to an extent of more than 10 times as much as the image files would need.</p> <p>The question is: How can I get the memory load under around 100Mb without changing image quality or image size. Does anyone have a good idea?</p> <p>Thank you very much in advance</p> <p>rockie</p>
c#
[0]
595,761
595,762
how to change text case using jQuery
<p>I feel like a fool, couldn't figure out how to change case using jQuery. Stackoverflow = stackoverflow.</p> <p>jQuery</p> <pre><code> var name = "Stackoverflow" $('name').toLowerCase(); alert(name); </code></pre>
jquery
[5]