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,451,151
5,451,152
How to pull variable from one form to another form on same web page
<p>I have a php web page that has 2 separate forms on it that both show results at the bottom of the page. The first form uses one drop-down menu (titled Quickshow) with 6 choices that filters the results when selected, with the top choice being the default selection when the page is opened. The second form has 6 drop-down menus, each with multiple choices, that filters the results once the "Filter Results" button is clicked. </p> <p>My problem is when the second form is used, it is using the default selection from the first form instead of staying with the selected choice from the first form. I understand the code that is making the first choice the default, and also allowing it to change for the first form, but how do I keep (call?) the optional choices for the second form? Below is the code being used for both forms. The first part is the web (.php) page portion, the second part is on the template (.tpl) page that is being pulled over to the web page. I didn't write the pages, but am trying to fix the filter on it.</p> <p><strong>.php page</strong> function enumRequests() {</p> <pre><code>$getQuickShow = 1; if (!$_REQUEST['feature_quickshow'] == '') { $getQuickShow = (int)$_REQUEST['feature_quickshow']; } $quickShow = eval(quickShow($getQuickShow)); $whereArray[] = (string)$quickShow; if ($_REQUEST['resultsFiltered']) { $quickShow = eval(quickShow($getQuickShow)); //$whereArray[] = (string)$quickShow; foreach ($_REQUEST AS $key =&gt; $val) { if ($val) { $val = mysql_real_escape_string($val); if (strpos($key, 'fld_') === 0) { $newKey = str_replace('fld_','',$key); $whereFragment = "{$newKey} = '{$val}'"; $whereArray[] = (string)$whereFragment; } } } } </code></pre> <p>}</p> <p><strong>.tpl page</strong></p> Quick Show:<br>[@quickshow] <p> </p> <p>Thanks in advance for any help I receive with this.</p>
php
[2]
1,259,338
1,259,339
What is the fastest way to flatten arbitrarily nested lists in Python?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/406121/flattening-a-shallow-list-in-python">Flattening a shallow list in Python</a><br> <a href="http://stackoverflow.com/questions/2158395/flatten-an-irregular-list-of-lists-in-python">Flatten (an irregular) list of lists in Python</a> </p> </blockquote> <p>I've found solutions before, but I'm wondering what the fastest solution is to flatten lists which contain other lists of arbitrary length.</p> <p>For example:</p> <pre><code>[1, 2, [3, 4, [5],[]], [6]] </code></pre> <p>Would become:</p> <pre><code>[1,2,3,4,5,6] </code></pre> <p>There can be infinitely many levels, so the solution would probably need to be implemented recursively.</p> <p>Ideally, empty lists would be ignored like in the example above (no exceptions and errors). I expect this behaviour would emerge as a result of a neat recursive solution anyway.</p> <p>Something else which doesn't affect me now, but I don't want to ignore is that some of the list objects can be strings, which mustn't be flattened into their sequential characters in the output list.</p>
python
[7]
4,498,700
4,498,701
C# Uri AppDomain.CurrentDomain.BaseDirectory relative path
<p>How do you get the relative path to AppDomain.CurrentDomain.BaseDirectory into a Uri.</p> <p>I need to step up "cd ......" from the AppDomain.CurrentDomain.BaseDirectory and then down to other folders.</p> <p>Do you know how?</p> <p>Thanks in advance</p> <p>Regards</p>
c#
[0]
3,602,928
3,602,929
Associating image file document types with iPhone apps
<p>I'm currently developing an app that needed to associate with different file types (PDF and all the image file types) so far I've managed to associate my app with PDF files but the problam is when i tried to do the same with image files it just doesn't work.</p> <p>is it even possible to associate PNG, JPG etc to you app ?</p> <p>If it is, am i doing it right ? (the same way i took care of the pdf through the app plist "CFBundleDocumentTypes" )</p> <p>I'll really appriciate any kind of help </p>
iphone
[8]
1,832,225
1,832,226
A site is available but it always responses "Internal Server Error"
<p>The code looks like: </p> <pre><code>url ="http://www.example.com" for a in range(0,10): opener = urllib2.build_opener() urllib2.install_opener(opener) postdata ="info=123456"+str(a) urllib2.urlopen(url, postdata) </code></pre> <p>which just post some data to a specific URL(e.g. <a href="http://www.example.com" rel="nofollow">http://www.example.com</a>), however, I always get the error message,</p> <pre><code>Traceback (most recent call last): File "test.py", line 9, in &lt;module&gt; urllib2.urlopen(url, postdata) File "c:\Python26\lib\urllib2.py", line 126, in urlopen return _opener.open(url, data, timeout) File "c:\Python26\lib\urllib2.py", line 397, in open response = meth(req, response) File "c:\Python26\lib\urllib2.py", line 510, in http_response 'http', request, response, code, msg, hdrs) File "c:\Python26\lib\urllib2.py", line 435, in error return self._call_chain(*args) File "c:\Python26\lib\urllib2.py", line 369, in _call_chain result = func(*args) File "c:\Python26\lib\urllib2.py", line 518, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 500: Internal Server Error </code></pre> <p>I am sure the site is working, so how can I fix the problem? Any help would be greatly appreciated.</p>
python
[7]
637,730
637,731
Using $.length() to check for presence of <li> not working
<p>I want to check if a list item already exists on the page before adding it. My code below attempts to do this by checking the length of the ID for the list item. However, no matter what my if statement always resolves to true. Can someone tell me what the problem is?</p> <pre><code>function addSpotsToMarketTree(dmaName, spot) { var id = "#" + dmaName + "-spots"; var liID = "#" + spot + "-" + dmaName; if ($(liID).length == 0) { $(id).append("&lt;li id='" + liID + "'&gt;" + spot + "&lt;/li&gt;"); } } </code></pre>
jquery
[5]
817,557
817,558
insertCell(columnIndex) using jquery
<p>How do we replace the <code>insertCell()</code> function in <code>jQuery</code> to insert a cell to a row. </p> <pre><code>var cell = row.insertCell(0); </code></pre>
jquery
[5]
4,436,246
4,436,247
jQuery scope confusion
<p>I am using the following jQuery code to find the position of the active link on my top menu navigation:</p> <pre><code>$(document).ready(){ // Handles the triangle image sprite for the top navigation $('#topnav a') .on({ mouseenter: function() { var pos = $("#topnav a.active-top").offset(); console.log("Top: " + pos.top + " Left: " + pos.left ); // Get the position of the current hovered "a" element var upSprite = $("#upArrow").show(), pos = $(this).offset(), aWidth = $(this).width(), offsetTop = 27, // Adjust this to raise or lower the sprite offsetLeft = aWidth / 2; // Centers the element under the link upSprite .css({ "top": pos.top + offsetTop, "left": pos.left + offsetLeft }); //console.log("Top: " + pos.top + " Left: " + pos.left); }, mouseleave: function() { // Hide the arrow once the mouse leaves $('#upArrow').hide(); } }); } </code></pre> <p>Now when I paste the exact same code outside of this event handler</p> <pre><code> $(document).ready(function () { var pos = $("#topnav a.active-top").offset(); console.log("Top: " + pos.top + " Left: " + pos.left ); } </code></pre> <p>I get a complete different value for my pos.left. </p> <p>As I understand .offset() should give me the position relative the document and unlike .position() which gives me the position relative to the parent container. </p> <p>Is the code being fed a different type of context when it's in the scope of the .on() event handler? I have tried using $.proxy() to no avail. Any tips are appreciated. Thanks. </p>
jquery
[5]
2,123,142
2,123,143
How can I make this function with substr work when rk is null or ""
<p>I have the following function in C#:</p> <pre><code> public string getRowKey(string topic, string rk) { return string.Join("", from s in topic.Split('.') select s.PadLeft(2, '0')).PadRight(4, '0') + rk.Substring(4); } </code></pre> <p>I have a problem because if rk is null or equal to "" then the function is failing. Can someone explain how I can fix this. I am getting an error about index values. Note that if rk is null or "" then I just don't want that last part with rk.Substring(4) added.</p>
c#
[0]
5,284,678
5,284,679
php explode every third instance of character
<p>How can I explode every third semicolon (;) as a piece?</p> <p>example data: $string = piece1;piece2;piece3;piece4;piece5;piece6;piece7;piece8;</p> <p>example output would be:</p> <p>$output[0] = piece1;piece2:piece3;</p> <p>$output[1] = piece4;piece5;piece6;</p> <p>$output[2] = piece7;piece8;</p> <p>Thanks!</p>
php
[2]
2,035,038
2,035,039
How do I add and subtract a number in a jQuery .click function?
<p>I will use jQuery to perform the following:</p> <p>Upon click of elements with the class "checkbox":</p> <ul> <li>add class "checkmark"</li> <li>remove class "checkbox"</li> <li>update a div with "You have x apps in your request list" where x is the number that have been clicked</li> <li>When a class with "checkmark" has been clicked, it will subtract from the number that is displayed</li> </ul> <p>My example code does not show all of this function, but I am able to accomplish this except for updating the number that have been clicked / "unclicked".</p> <p>`</p> <pre><code>$("span.checkbox").click(function() { if(!oldVal) { var oldVal = "0"; } var newVal = parseFloat(oldVal) + 1; var oldVal = newVal; $("#wishlistapps").html('&lt;li&gt;You have ' + newVal + ' apps in your request list&lt;/li&gt;'); }); </code></pre> <p>`</p>
jquery
[5]
4,114,673
4,114,674
String Replace Problem
<p>I have a string replace problem. I have a result like:</p> <pre><code>"Animal.Active = 1 And Animal.Gender = 2" </code></pre> <p>I want to replace something in this text. </p> <p><code>Animal.Active</code> part is returned from a database and sometimes it is returned with the <code>Animal.Gender</code> part. </p> <p>When <code>Animal.Gender</code> part comes from the database I have to remove this <code>And Animal.Gender</code> part. </p> <p>Also if the string has <code>Animal.Active = 1</code>, I have to remove <code>Animal.Active = 1 And</code> part. Note the <code>And</code>. </p> <p>How can I do this? </p>
c#
[0]
837,650
837,651
jquery dropdown show hide tr
<p>How do implement the jquery if I want when selected 1 the table will only show tr 1 and when I selected 2 it will show tr 2 and etc?</p> <pre><code>&lt;select name="select_main_table"&gt; &lt;option value="1" selected="selected"&gt;Show line 1&lt;/option&gt; &lt;option value="2" &gt;Show line 2&lt;/option&gt; &lt;option value="3" &gt;Show line 3&lt;/option&gt; &lt;/select&gt; &lt;table id="main_table"&gt; &lt;tr id="show1"&gt;&lt;td&gt;line 1&lt;/td&gt;&lt;td&lt;line 1/td&gt;&lt;/tr&gt; &lt;tr id="show2"&gt;&lt;td&gt;line 2&lt;/td&gt;&lt;td&lt;line 2/td&gt;&lt;/tr&gt; &lt;tr id="show3"&gt;&lt;td&gt;line 2&lt;/td&gt;&lt;td&lt;line 2/td&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre> <p>Thanks in advance?</p>
jquery
[5]
4,978,926
4,978,927
Does Java have a using statement?
<p>Does Java have a using statement that can be used when opening a session in hibernate?</p> <p>In C# it is something like:</p> <pre><code>using (var session = new Session()) { } </code></pre> <p>So the object goes out of scope and closes automatically.</p>
java
[1]
412,229
412,230
MVC in Javascript
<p>How to create a sample application (say "hello world!" example) in Model - View - Controller concept using Javascript + HTML 5?</p>
javascript
[3]
4,434,986
4,434,987
using setOnItemClickListener to delete an entry from listview
<p>I have a listview and I want to able to select one of the entries here in order to delete it. For example, my entry in listview looks like this:</p> <p>John Smith</p> <p>john@hotmail.com</p> <p>4857394</p> <p>NewYork</p> <p>So I want to select this one and delete it. I find this set OnItemClickListener in order to select it. I have delete function. I just need to select name "John Smith" when I click this entry. I don't know what I can write inside function here.</p> <pre><code>listContent.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position,long id) { listContent.getItemAtPosition(position); } }); </code></pre>
android
[4]
3,527,253
3,527,254
C++ class type copy-initialization
<p>If I write </p> <pre><code>T t = T(); </code></pre> <p>T is a class.</p> <p>I think this is calling T's default constructor and then the copy assignment operator. But the compiler is allowed to get rid of the assignment.</p> <p><strong>I'm trying to find the description of this behavior written in the C++ standard, but I can't find it. Could you point me to the right spot in the standard?</strong></p> <p>I'm asking this because I'm being asked to replace this :</p> <pre><code>T t; </code></pre> <p>with</p> <pre><code>T t = T(); </code></pre> <p>because of a coding rule checking program.</p> <p>and it happens that the T class is noncopyable and has a private copy constructor and copy assignment operator... So I'd like to see that the compiler is effectively always getting rid of the copy in this case.</p> <p><strong>edit:</strong> I have been mislead by something weird: the noncompyable class was actually inheriting from boost::noncopyable in this case it does compile. But if I declare the copy constructor and copy assignment operator private, it does not compile. exemple. This compiles : </p> <pre><code>class BA { protected: BA() {} ~BA() {} private: BA( const BA&amp; ); const BA&amp; operator=( const BA&amp; ); }; class A : BA { }; int main( void ) { A a = A(); return 0; } </code></pre> <p>and the following does not : </p> <pre><code>class A { public: A() {} ~A() {} private: A( const A&amp; ); const A&amp; operator=( const A&amp; ); }; int main( void ) { A a = A(); return 0; } </code></pre>
c++
[6]
943,794
943,795
how to add 3 buttons in a android layout and let each be 33,3% width?
<p>i have a problem, i need to put 3 buttons in a android layout, but:</p> <ul> <li>they should all be in one row</li> <li>they should all be 33,3% width of the display width</li> </ul> <p>i tryed some things with a table and stack layout but did not manage to get it to work with the width.</p> <p>please help me</p>
android
[4]
5,341,461
5,341,462
If a thread is waiting on a console.readline is the thread suspended?
<p>If a thread is waiting on a console.readline is the thread suspended. If not what is it's state?</p>
c#
[0]
2,057,175
2,057,176
How to hide all children of a container except a specific one using jQuery?
<pre><code>&lt;div id="container"&gt; &lt;div id="specific_one"&gt;..&lt;/div&gt; ... &lt;/div&gt; </code></pre> <p>I want to hide all children of <code>#container</code> except <code>#specific_one</code>, how to do that?</p>
jquery
[5]
4,215,546
4,215,547
Does javascript have to be in the head tags?
<p>I believe javascript can be anywhere (almost), but I almost always see it in between <code>&lt;head&gt;&lt;/head&gt;</code>. I am using jquery and wanted to know if it has to be in the head tags for some reason or if will break something if I move it. Thank you.</p> <p>EDIT: Why is it almost always in the head tags?</p>
javascript
[3]
453,210
453,211
Move last child to first position
<p>My HTML:</p> <pre><code> &lt;div id="my-slider"&gt; &lt;img src="/slider/pic/bf3.jpg" alt="picture"&gt; &lt;img src="/slider/pic/bf3_cq.jpg" alt="picture"&gt; &lt;!-- etc --&gt; &lt;/div&gt; </code></pre> <p>On specific event I want to move last img tag to first position (according to parent)</p> <p>I try:</p> <pre><code> curr.css('left', 0); curr.prepend(curr.parent()); </code></pre> <p>I can change css, but second line raising error:</p> <blockquote> <p>HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy</p> </blockquote> <p>Could someone give me any advice?</p>
jquery
[5]
1,824,378
1,824,379
Contingency code
<p>Can somebody please let me know, what does contingency code mean...??\</p> <p>I read it in c++ complete ref, and it related it with virtual functions, that due to late binding, since calls to virtual functions are resolved at run-time, we dont have to write a lot of "contingency code". But it did not explain what contingency code meant.</p>
c++
[6]
5,446,682
5,446,683
What does it mean for a function to return an interface?
<p>I just saw a member function like this: </p> <pre><code>public Cat nextCat(GameState state); </code></pre> <p>But Cat is an interface like this: </p> <pre><code>public interface Cat { void makeCat(GameState state); } </code></pre> <p>So I am confused as to how to interpret this. I know what it means when something returns an object or a primitive. But what does it mean to return an interface? How to use this function's return value? </p>
java
[1]
2,909,611
2,909,612
Android layout - Screen wont move up to allow input in EditText at the bottom
<p>Hopefully this is just something easy since I'm still wet behind the ears with programming for android. My issue is that i have a couple EditText boxes at the bottom of my layout. When in the emulator they work as expected, you touch the edittext and the screen scrolls up so you can see the content. However when i try it on my droid inc the edittext is covered by the keyboard. </p> <p>See screen captures at links (can't post them since I'm new...)</p> <p><a href="http://www.revta.com/Stack%20Overflow/device.png" rel="nofollow">Droid Screen capture</a></p>
android
[4]
4,471,581
4,471,582
C# Program to get modified date from URL directory
<p>I am fairly new to C# and was hoping for some assistance. I currently use Visual Studio 2008. What I am wanting to do is the following:</p> <p>I have a server (\backupserv) that runs a RoboCopy script nightly to backup directories from 18 other servers. These directories are then copied down to \backup in directories of their own:</p> <p>Example: It copies down "Dir1", "Dir2", and "Dir3" from Server1 into \backupserv\backups\Server1 into their own directories (\backupserv\backups\Server1\Dir1, \backupserv\backups\Server1\Dir2, and \backupserv\backups\Server1\Dir3).</p> <p>It does this for all 18 servers nightly between 12am and 6am. The RoboCopy runs via schedule task. A log file is created in \backupserv\backups\log and is named server1-dir1.log, server1-dir2.log, etc. </p> <p>What I am wanting to accomplish in C# is the ability to have a 'report' showing the modified date of each text log file. To do this I need to browse the \backupserv\backups\log directory, determine the modified date, and have a report displayed (prefer HTML if possible). Along with the modified date I will be showing more information, but that is later.</p> <p>Again, I am fairly new to C#, so, please be gentle. I was referred here by another programmer, and was told I would get some assistance.</p> <p>If I have missed any detail please let me know and I will do my best to answer.</p>
c#
[0]
2,730,201
2,730,202
How can I print a string to the console without a newline at the end?
<p>My question is.</p> <p>what is it you type when you want your answer next to your question in c# </p> <p>I mean like this but you type the answer next to the question.</p> <pre><code>string product; Console.WriteLine("What is the product you want?"); product = Console.ReadLine(); </code></pre>
c#
[0]
5,172,099
5,172,100
Create a jQuery object collection from separate jQuery objects
<pre class="lang-js prettyprint-override"><code>$.fn.sortByDepth = function() { var ar = []; var result = $([]); $(this).each(function() { ar.push({length: $(this).parents().length, elmt: $(this)}); }); ar.sort(function(a,b) { return b.length - a.length; }); for (var i=0; i&lt;ar.length; i++) { result.add(ar[i].elmt); }; alert(result.length); return result; }; </code></pre> <p>In this function I try to create a jQuery collection from separate jQuery object. How can i do that ?</p> <p>The code below doesn't work:</p> <pre class="lang-js prettyprint-override"><code>result.add(ar[i].elmt); </code></pre> <p>The jsfiddle: <a href="http://jsfiddle.net/hze3M/14/" rel="nofollow">http://jsfiddle.net/hze3M/14/</a></p>
jquery
[5]
1,824,527
1,824,528
Java version validation
<p>I need to validate java version. I use </p> <pre><code>String version = System.getProperty("java.version"); </code></pre> <p>How to simple parse that to know for example that installed JRE is in min. <code>1.6.0_18</code> version ? I wonder is that naming convention of java version is standard.</p>
java
[1]
4,738,994
4,738,995
Notifications for WIFI, Bluetooth, Camera, SMS, CAll
<p>I like to implement a application which runs in the background and should check wheather the wifi, camera, bluetooth settings are changed (i.e. wheather it is turned on or off), and incoming calls, outgoing calls, outgoing sms, mms etc. Is there any way to get notifications for the above change in settings such that my application which runs in the background handles all these settings changes . I know its feasible only with jailbroken devices by using private api's. I like to know the procedure to implement these features.</p> <p>Any help would be greatly appreciated .</p> <p>Best Regards,</p> <p>Mohammed Sadiq.</p>
iphone
[8]
798,526
798,527
Differences with jQuery 1.4.2 and 1.7.1?
<p>I build my site on jQuery version 1.4.2 (not realizing about any updates) but now it doesn't seem to work in IE8. When searching for a solution i thought about an update. When i use jQuery 1.7.1. however, some strange things occur. For example this example on jsFiddle</p> <p><a href="http://jsfiddle.net/64d2T/" rel="nofollow">http://jsfiddle.net/64d2T/</a></p> <p>When running this example in 1.4.4 it works fine, but when i run the code in 1.7.1 the format is messed up.</p> <p>Does anybody know this problem and i'm a doing some basic stuff wrong?</p>
jquery
[5]
4,384,193
4,384,194
Delete key and value from a property file?
<p>I want to delete key and value which is stored in a property file. How can i do that????</p>
java
[1]
2,010,766
2,010,767
PHP - Splitting array (name and value) into different strings?
<p>I have the following array:</p> <pre><code>Array ( [name] =&gt; hejsan [lastname] =&gt; du ) </code></pre> <p>I'm trying to loop through every item in the array, and store the name of the item in the array, and the value of that item, in two seperate strings.</p> <p>Something like this:</p> <pre><code>$name1 = "name"; $value1 = "hejsan"; $name2 = "lastname"; $value2 = "du"; </code></pre> <p>Is that possible?</p> <p>Thanks in advance!</p>
php
[2]
5,337,504
5,337,505
Strategies for managing use of types in Python
<p>I'm a long time programmer in C# but have been coding in Python for the past year. One of the big hurdles for me was the lack of type definitions for variables and parameters. Whereas I totally get the idea of duck typing, I do find it frustrating that I can't tell the type of a variable just by looking at it. This is an issue when you look at someone else's code where they've used ambiguous names for method parameters (see edit below).</p> <p>In a few cases, I've added asserts to ensure parameters comply with an expected type but this goes against the whole duck typing thing. </p> <p>On some methods, I'll document the expected type of parameters (eg: list of user objects), but even this seems to go against the idea of just using an object and let the runtime deal with exceptions.</p> <p>What strategies do you use to avoid typing problems in Python?</p> <p>Edit: Example of the parameter naming issues: If our code base we have a task object (ORM object) and a task_obj object (higher level object that embeds a task). Needless to say, many methods accept a parameter named 'task'. The method might expect a task or a task_obj or some other construct such as a dictionary of task properties - it is not clear. It is them up to be to look at how that parameter is used in order to work out what the method expects.</p>
python
[7]
4,159,825
4,159,826
Problem in writing wstring to a file for hebrew/arabic language
<p>I want to read hebrew(unicode) using xerces parser. I am able to read the value in XMLCh. However, while writing it to another file I get gargabe value. I tried using ofstream, wofstream but didnot helped.</p> <p>Let me know your suggestions</p>
c++
[6]
764,404
764,405
Replace html of a div after anchor tag?
<p>This is a quick example not my actual code. Onclick of the div <code>button</code>, how do i replace the html after the anchor tag or parent div <code>title</code>? The jQuery code here replaces everything in the div <code>title</code> i only want to replace what is after the anchor tag.</p> <p>script</p> <pre><code>$(function() { $('.button').live('click',function() { var info = $(this).next('.information').html(); $(this).next('.title').html(info); }); }); </code></pre> <p>html</p> <pre><code>&lt;div class='container'&gt; &lt;div class='button'&gt;Click Me&lt;/div&gt; &lt;div class='information' style='display:none;'&gt;information&lt;/div&gt; &lt;div class='title'&gt;&lt;a href='http://www.example.com/' class='link'&gt;&lt;/a&gt;title&lt;/div&gt; &lt;/div&gt; </code></pre>
jquery
[5]
1,774,192
1,774,193
jQuery: link loses its class's clickability when appended
<p>Here is my AJAX call:</p> <pre><code> $.ajax({ type: 'POST', url: '&lt;?php echo site_url('channel_partners/cms/get_news'); ?&gt;', data: data, dataType: 'json', success: function(data, status, xhr) { var json = JSON.parse(data); for (var i=0; i&lt;json.length; i++) { $('ul#news').append( '&lt;li id="' + json[i].article_id + '"&gt;&lt;a class="deleteItem" title="Delete Item" href="#"&gt;Delete&lt;/a&gt; &lt;a id="editItem" title="Edit Item" href="#" target="_blank"&gt;Edit&lt;/a&gt; &lt;a href="#" target="_blank"&gt;' + json[i].title + '&lt;/a&gt;&lt;/li&gt;' ); } }, error: function(xhr, status, error) { //alert('Error: ' + status + ' ' + error); console.log(xhr) } }); </code></pre> <p>My question is this: When I have just a regular link with a class of "deleteItem", it fires a deleteItem click event. The event works fine. But when the HTML is added programatically through jQuery, the link is not clickable any more. Why is it not clickable. It's like jQuery isn't recognizing it. What do I need to do to make the event fire? I tried adding the class programatically but that didn't work. </p>
jquery
[5]
397,771
397,772
What is the difference between "return new A()" and "return a = new A()"
<p>I saw in many libraries, when returning some result, is used return <code>a = new A()</code> (e.g. <code>return entrySet = new EntrySet()</code>) instead of returning just <code>new EntrySet()</code>, what's the difference ?</p>
java
[1]
4,696,278
4,696,279
application not installing on android simulator
<p>I am trying to run Android Application.When i install the application on android stimulator Its showing error in the console </p> <pre><code>[2011-02-21 16:37:44 - TFLAPPv1] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY [2011-02-21 16:37:44 - TFLAPPv1] Please check logcat output for more details. [2011-02-21 16:37:44 - TFLAPPv1] Launch canceled! </code></pre> <p>Plz help</p> <p>Thanks in advance Tushar</p>
android
[4]
3,497,577
3,497,578
Print ASCII line art characters in C# console application
<p>I would like to have a C# console application print the extended ASCII Codes from <a href="http://www.asciitable.com/">http://www.asciitable.com/</a>. In particular I am looking at the line art characters: 169, 170, 179-218. Unfortunately when I tried, I ended up getting 'Ú' for 218 and expect to see the other characters from <a href="http://www.csharp411.com/ascii-table/">http://www.csharp411.com/ascii-table/</a>. </p> <p>I'm aware that ASCII only specifies character codes 0 - 127. I found another post with a reference to SetConsoleOutputCP(), but was not able to get that to work in a C# class or find an example of how to do so.</p> <p>Is it possible to print the line art characters in a C# console application? If it is can someone provide a URL to an example or the code?</p>
c#
[0]
2,559,671
2,559,672
help with error SCRIPT5007: Unable to set value of the property 'onclick'
<p>I have a link in the html page and it has the <code>id="redirect"</code></p> <p>and this in (script.js)</p> <pre><code>window.onload = initAll(); function initAll(){ document.getElementById("redirect").onclick = clickHandler; } function clickHandler(){ alert("Sure!"); return true; } </code></pre> <p>I'm getting this error message </p> <pre><code>SCRIPT5007: Unable to set value of the property 'onclick': object is null or undefined </code></pre> <p>I tried this in (IE9,IE8,chrome,Firefox 4.0.1) and still not running, please help</p>
javascript
[3]
4,745,021
4,745,022
json_decode returns null on a valid value php
<p>Here is my code:</p> <pre><code> echo '&lt;br/&gt;'; echo 'Json data from DB '.json_encode($output); $data=array(); $array=json_decode($output,true); echo '&lt;br/&gt;'; echo 'Concerted into an array '.json_encode($array); </code></pre> <p>and here is the output:</p> <pre><code>Json data from DB [{"0":"1","key-1":"1","1":"1","key-2":"1","2":"1","key-3":"1","3":"1","key-4":"1"}] Concerted into an array null </code></pre> <p>why json_devode returns null? If I try the same like this:</p> <pre><code>$data = '[{"0":"1","key-1":"1","1":"1","key-2":"1","2":"1","key-3":"1","3":"1","key-4":"1"}]'; // convert to an array $data = json_decode($data, true); </code></pre> <p>then it is printed out normally:</p> <pre><code>Json data from DB [{"0":"1","key-1":"1","1":"1","key-2":"1","2":"1","key-3":"1","3":"1","key-4":"1"}] Concerted into an array {"0":"1","key-1":"1","1":"1","key-2":"1","2":"1","key-3":"1","4":"1","key-4":"1"} </code></pre>
php
[2]
1,219,413
1,219,414
c# - ListBox + type item name to select it?
<p>I am a beginner learning c# and i am playing around with windows forms.</p> <p>I am using Microsoft.visualbasic.Compatibility.FileListbox and i want to be able to type a name of an item to go to it. i.e select it.</p> <p>I enabled "KeyPreview" on the form but this doesn't work for me.</p> <p>can you please assist.</p>
c#
[0]
2,985,735
2,985,736
Returns the number of characters in a Word
<pre><code>private static StringBuffer sb; public static void main(String[] args) { // Text in a string String text = "This is a poor sentence in grammar."; String[] words = text.split("[ .!?]"); for (int i = 0; i &lt; words.length; i++) { int counter = 0; if (words[i].length() &gt;= 1) { for (int k = 0; k &lt; words[i].length(); k++) { if (Character.isLetter(words[i].charAt(k))) counter++; } sb = new StringBuffer(); sb.append(counter).append(" "); } } System.out.println(sb); } </code></pre> <p>Can we optimize this code more? My Ouptut is:-</p> <pre><code>4 2 1 4 8 2 7 </code></pre>
java
[1]
1,258,141
1,258,142
How to format a duration in java? (e.g format H:MM:SS)
<p>I'd like to format a duration in seconds using a pattern like H:MM:SS. The current utilities in java are designed to format a time but not a duration.</p>
java
[1]
978,015
978,016
get checkbox , textbox , button names or id s from events in c#
<p>I am trying to get id or name of for example checkbox from event in a windows form application in c#. Is it possible ? Thank you..</p> <pre><code> private void aktifMWcheckBox_CheckedChanged(object sender, EventArgs e) { string cbname = sender.Name; // is it possible something like that ??? } </code></pre>
c#
[0]
2,477,875
2,477,876
Is there a way to be notified by the DOM when an element is removed?
<p>My initial research has come up empty and I am not sure if this is possible. I am looking for a solution using straight up javascript. I cannot use jQuery due to constraints of the device. Basically, I want to attach an event for when an element is removed and provide a function to execute.</p> <p><strong>[EDIT]</strong><br /> We do the DOM manipulation via a function call. Right now, we currently don't traverse down the whole tree to remove every single element. We only remove the parent for instance. I was hoping to provide a shortcut by attaching to an event, but I guess I will have to go the long way around and provide the additional logic in the function. The reason I need this, is because we need to be able to run cleanup operations on the DOM when specific elements are removed.</p> <p>Right now the priority is only Opera support, but I would like to accomplish a cross browser solution.</p>
javascript
[3]
2,863,637
2,863,638
object.style.height doesn't work
<p>I've googled this but didn't find an answer, this is strange. In Javascript in Firefox when I do object.style.height it doesn't return anything. Would anybody know why?</p> <p>In CSS I've put</p> <pre><code>#movable { height: 100px; .... </code></pre> <p>In HTML I've put</p> <pre><code>&lt;div id="movable"&gt;&amp;nbsp;&lt;/div&gt; </code></pre> <p>And in JS:</p> <pre><code>alert(movable.style.height); </code></pre>
javascript
[3]
5,312,521
5,312,522
Android camera:I want start camera and capture images automatically when i received a message from particular number,please help me
<p>I want start camera and capture images automatically when i received a message from particular number,please help me.</p>
android
[4]
24,523
24,524
Generating and adding a new class to an existing assembly in runtime
<p>According to MSDN it's possible to create a NEW assembly in runtime using, for example, <code>Reflection.Emit</code> and add a new class in it, I just would like to avoid such an overkill and create the class in an existing assembly. </p> <p>Is it possible?</p>
c#
[0]
5,967,135
5,967,136
JavaScript prototype problem
<p>If I call <code>myRobot.Speak.sayHi()</code> it always returns <code>undefined</code>. Please, what am I doing wrong? Thanks for reply!</p> <pre><code>var Factory = (function() { // Constructor var Robot = function() { }; // Public return { extendRobot: function(power, methods) { Robot.prototype[power] = methods; }, createRobot: function() { return new Robot(); } }; }()); Factory.extendRobot('Speak', { sayHi: function() { return 'Hi, ' + this.name; } }); var myRobot = Factory.createRobot(); myRobot.name = 'Robin'; myRobot.Speak.sayHi() // =&gt; ‘Hi, Robin’ </code></pre>
javascript
[3]
1,128,435
1,128,436
Initializing lots of constants to consecutive integers. C-like enum in Java?
<p>I have to initialize about 10-12 constants to consecutive integers. I am doing this at the moment:</p> <pre><code>class MyClass { public static final int A = 1; public static final int B = 2; public static final int C = 3; public static final int D = 4; . . . } </code></pre> <p>Just wondering if there's a neater way to do this. Maybe something like enum in C?</p>
java
[1]
2,554,354
2,554,355
set<class> insert problem
<p>why is the following programm not working? How can i fix it?</p> <pre><code>#include &lt;iostream&gt; #include &lt;set&gt; using namespace std; class K { private: long a; }; int main () { K a; set&lt;K&gt; b; b.insert(a); return 0; } </code></pre>
c++
[6]
961,756
961,757
Sound Pool Crashing
<p>I use sound pool to play a sound when a user presses a button. After a number of button presses the app force closes. The sound that is playing is only a few seconds long. Is there a better way to implement audio?</p> <p>I use this class:</p> <pre><code>public class SoundManager { private SoundPool mSoundPool; private HashMap&lt;Integer, Integer&gt; mSoundPoolMap; private AudioManager mAudioManager; private Context mContext; public SoundManager() { } public void initSounds(Context theContext) { mContext = theContext; mSoundPool = new SoundPool(200, AudioManager.STREAM_MUSIC, 0); mSoundPoolMap = new HashMap&lt;Integer, Integer&gt;(); mAudioManager = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE); } public void addSound(int Index,int SoundID) { mSoundPoolMap.put(Index, mSoundPool.load(mContext, SoundID, 1)); } public void playSound(int index) { int streamVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC); mSoundPool.play(mSoundPoolMap.get(index), streamVolume, streamVolume, 1, 0, 1f); } public void playLoopedSound(int index) { int streamVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC); mSoundPool.play(mSoundPoolMap.get(index), streamVolume, streamVolume, 1, -1, 1f); } public void clear(){ mSoundPoolMap.clear(); mSoundPool.release(); } } </code></pre>
android
[4]
1,489,008
1,489,009
Altering a linked list
<p>You are given a Single Linked List <code>a-&gt;b-&gt;c-&gt;d-&gt;1-&gt;2-&gt;3-&gt;4-&gt;e-&gt;f-&gt;g-&gt;h-&gt;5-&gt;6-&gt;7-&gt;8</code> . You have to alter this list to look like <code>a-&gt;1-&gt;b-&gt;2-&gt;c-&gt;3-&gt;d-&gt;4-&gt;e-&gt;5-&gt;f-&gt;6-&gt;g-&gt;7-&gt;h-&gt;8</code> .</p> <p>My approach uses an extra list where we remove the numbers form the list and store them separately. Then to merge the lists together. Can someone suggest better techniques to do this?</p>
c++
[6]
3,549,160
3,549,161
Format date with time in bind variable APX
<p>I have in my ASPX this bind variable </p> <pre><code>Text='&lt;%# Bind("PLANSTART","{0:dd/MM/yyyy HH:MM}") %&gt;' </code></pre> <p>The imput date is this one 28.09.12 13:45 and I want to display "September 28, 2012 13:45" but I optain this: "September 28, 2012 13:00 " </p> <p>thanks</p>
asp.net
[9]
948,723
948,724
Show only Browser version
<p>On Stackoverflow i have found a piece of code which shows me my Browser version:</p> <pre><code> navigator.sayswho= (function(){ var N= navigator.appName, ua= navigator.userAgent, tem; var M= ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i); if(M &amp;&amp; (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1]; M= M? [M[1], M[2]]: [N, navigator.appVersion,'-?']; return M; })(); </code></pre> <p>This is giving me the folowing output:</p> <p>IE: MSIE10.0</p> <p>Chrome: Chrome26.0.1410.64</p> <p>FireFox: Firefox19.0</p> <p>Opera: Opera12.12</p> <p>Safari: Safari5.1.7</p> <p>I was wondering if it is possible with this function to show only the version numbers so without Chrome, FireFox etc. So only: 26.0.1410.64 etc. </p>
javascript
[3]
3,814,012
3,814,013
Android Sqlite Database: it couldn't recognize the new column or new table I added in an exsiting database
<p>I had a working database. I just added one more column in a table. It keeps saying no that column. So I changed the table name. Now it says that no that table name. Then I changed the database name. it still gave error. it works fine after I changed back the table name and remove the extra column I added. Could you please help me figure out what's wrong? How do I run my code on a clean emulator? How do I verify that the code that creates the table is getting executed? How do I get the sqlite db off the emualtor and look at it using a sqlite database browser to check that the table does actually exist?</p> <p>Many thanks! Tong</p>
android
[4]
1,593,228
1,593,229
jquery showing elements on hover
<p>I have a number of divs(myDiv) on a page. When the user hovers over one of the divs I would like to: after a little delay, display another div(myPop) on top. Almost like a tooltip. The code below is just not quite doing it. If the user moves the mouse across a number of myDivs then you can wait and see all the myPops fadein. I really want to just completely hide all the myPops that the user previously caused to be fadeIn. Because you end up with sort of trailing effect of all these myPops being displayed.</p> <pre><code> $(".myDiv").hover(function () { $(this).find(".myPop").fadeIn('slow'); }, function () { $(this).find(".myPop").fadeOut('fast'); } }); </code></pre>
jquery
[5]
2,451,964
2,451,965
How to get multiple values from multiple selection
<p>Any possibility to get multiple values from multiple selection.. </p> <p>Sample Code below:</p> <pre><code>&lt;form action="" method="post"&gt; &lt;select name="category" multiple="multiple"&gt; &lt;option value="Internet"&gt;Internet&lt;/option&gt; &lt;option value="Google"&gt;Google&lt;/option&gt; &lt;option value="Yahoo"&gt;Yahoo&lt;/option&gt; &lt;option value="Bing"&gt;Bing&lt;/option&gt; &lt;/select&gt;&lt;p/&gt; &lt;input type="submit" value="Submit" name="submit" /&gt; &lt;/form&gt; &lt;?php echo $cat = $_POST["category"]; ?&gt; </code></pre>
php
[2]
4,465,469
4,465,470
How to create a handler that will return the 'ID' of the list element 'LI' Clicked
<p>I am trying to create a handler that will return the 'ID' of the list element Clicked. I have tried many variations (with and without the For loop), but I can't seem to make it work. Your help is appreciated.</p> <h1>Script</h1> <pre><code>function getItems () { var cList = document.getElementById("cMenu"); var cItems = cList.getElementsByTagName("LI"); for (var i = 0; i &lt; cItems.length; i++) { cItems[i].onclick = function(){ var theId = this.id; }; } console.log(theId); } </code></pre> <h1>HTML Source</h1> <pre><code>&lt;ul id="cMenu"&gt; &lt;li&gt; Parent item 1 &lt;ul&gt; &lt;li id="item1"&gt;Child item 1&lt;/li&gt; &lt;li id="item2"&gt;Child item 2&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; Parent item 2 &lt;ul&gt; &lt;li id="item3"&gt;Child item 3&lt;/li&gt; &lt;li id="item4"&gt;Child item 4&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre>
javascript
[3]
1,178,076
1,178,077
Getting two different Day values from Date()
<p>So I have a database full of daily events that I want to show on a php page. I've connected to the database &amp; populated the table - no problems. I then created a list of links that show the days of the week, so that the user can click on the day and the table will be populated by whatever event is scheduled for that day:</p> <pre><code>&lt;ul id="day-list"&gt; &lt;li&gt;&lt;a href="?eventDay=Monday"&gt;Monday&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="?eventDay=Tuesday"&gt;Tuesday&lt;/a&gt;&lt;/li&gt; ...etc etc... you get the idea. &lt;/ul&gt; </code></pre> <p>In the code prior to setting up the day list, I have this:</p> <pre><code>$theDay = isset($_GET['eventDay']) ? $_GET['eventDay'] : date('l', time()) // I've also tried date('l'); $data = $conn-&gt;query("SELECT * FROM 'my_table' WHERE 'event_day' = '$theDay';"); </code></pre> <p>This is supposed to choose either whatever day the user selected, or today's day if $_GET['meetingDay'] is null/nil. It does actually works, however, I've notice about 9pm (my time) it switches over to the next day. I've also written <em>date('l')</em> and <em>date('l', time())</em> on the same page elsewhere and THAT displays the correct time, I just have this issue with $theDay variable.</p> <p>I've looked into mysql &amp; php timezones, and anything I research yielded me no results on my page (things like mysql's 'set time_zone' and php's 'date_default_timezone_set'). Does anyone know what's going on here?</p>
php
[2]
5,200,002
5,200,003
Integer (number) to String
<p>Here is my simple question</p> <p>We can convert <code>integer, float, double</code> to String like <code>String s = "" + i;</code> so <strong>why</strong> do we need <code>String s = Integer.toString(i);</code> ? just requirements of OO programmig ? </p> <p>Thanks</p>
java
[1]
5,307,105
5,307,106
Mutiple string store in different variable c++
<p>This is my first time i post here so i'll try to be clear in my question. So i need to store different string with space in variable. Im working with eclipse and i have a problem. </p> <p><em><strong>This is the code</em></strong></p> <pre><code>using namespace std; string p_theme; string p_titre; int p_anneeEdition; string p_pays; string p_auteur; string p_editeur; string p_isbn; cout &lt;&lt; "Veuillez saisir le thème:" &lt;&lt; endl; getline(cin, p_theme, '\n'); cout &lt;&lt; "Veuillez saisir le titre:" &lt;&lt; endl; getline(cin, p_titre, '\n'); .... </code></pre> <p><em><strong>This is what the console show to me</em></strong></p> <pre><code>Veuillez saisir le thème: Veuillez saisir le titre: </code></pre> <p>The problem is that i dont have the time to enter the string "Theme" before the second cout. I've tried different way, with a char buffer it did'nt work i enter in a loop. So if someone can answer that would be really aprreciated.</p> <p>Thanks a lot</p>
c++
[6]
4,143,987
4,143,988
How to make child page for each story of parent webpage.?
<p>I have posted stories from database to my view.php page.i want to link each story's title with its own webpage (child page of view.php page).for example..</p> <pre><code>view.php?id=123 </code></pre> <p>is linked to story no .1 and</p> <pre><code>view.php?id=124 </code></pre> <p>is linked to story no. 2</p> <p>thus i want to link each story to its own webpage ...</p>
php
[2]
849,963
849,964
autocomplete textbox from the database
<p>I need my textbox to autocomplete when the user types. The value should come from the database. I am using the textchange property of the textbox.</p> <pre><code>protected void autocomplete(object sender, EventArgs e) { string query = "Select area,codes from tbl_pincode"; SqlConnection conn = new SqlConnection("Data Source=win2008-2;Initial Catalog=h1tm11;User ID=sa;Password=#1cub3123*;Persist Security Info=True;"); SqlCommand com = new SqlCommand(query, conn); conn.Open(); SqlDataReader dr = com.ExecuteReader(); while (dr.Read()) { zipcode.Text = dr.GetValue(0).ToString(); } conn.Close(); } </code></pre> <p>But i m not getting the desired result. Any ideas how to go about it?</p>
c#
[0]
2,057,080
2,057,081
Round up if negative round down if positive php?
<p>Round up if negative round down if positive? I have </p> <p><code>$rounded =1000</code></p> <pre><code>39528,65 round should be --&gt; 39000 </code></pre> <p>AND </p> <pre><code>-30965,77 --&gt; -31000 </code></pre>
php
[2]
2,385,190
2,385,191
keep menu visible in window when scrolling
<p>I want to disable window scrollbar, and give scrollbar to some of my div. how? I used "overflow:hidden", then my div content also hidden. Using ASP.Net, MVC, C# with jquery.</p>
jquery
[5]
5,475,837
5,475,838
reading image path from a database
<p>I'm stuck in something that I'm sure rather easy</p> <p>I have a field in the database that I stored the image name in it, ex 'images/ex1.png'</p> <p>how can I read this into an imageView?? I tried some code in there but can't get it to work</p> <p>a good example is highly </p>
android
[4]
867,188
867,189
jQuery how to select all input fields APART from submit button
<p>I am currently selecting all the input fields of a form using jQuery in the following way:</p> <pre><code>$('#new_user_form *').filter(':input').each(function(key, value) { </code></pre> <p>This works fine although it selects the submit input as well which I don't want it to do. Is there a simple way of making it ignore the submit button?</p> <p>Thanks!</p>
jquery
[5]
946,985
946,986
Create an encrypted ZIP file in Python
<p>I'm creating an ZIP file with ZipFile in Python 2.5, it works ok so far:</p> <pre><code>import zipfile, os locfile = "test.txt" loczip = os.path.splitext (locfile)[0] + ".zip" zip = zipfile.ZipFile (loczip, "w") zip.write (locfile) zip.close() </code></pre> <p>but I couldn't find how to encrypt the files in the ZIP file. I could use system and call PKZIP -s, but I suppose there must be a more "Pythonic" way. I'm looking for an open source solution.</p>
python
[7]
4,886,111
4,886,112
httpd.conf virtual host changes for apple push notification
<p>I have read Ray Wenderlich's awesome tutorials on apple push-notifications from <a href="http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12" rel="nofollow">here</a> and <a href="http://www.raywenderlich.com/3525/apple-push-notification-services-tutorial-part-2" rel="nofollow">here</a></p> <p>Now, in the second tutorial, he is updating the <code>httpd.conf</code> file in MAMP server. I have implemented that whole tutorial and I am able to run the apns at localhost. My requirement is that I want to move the PHP scripts to live server, but the problem I am facing that the domain providers (HostGator) are saying that they will not let us update the <code>httpd.conf</code> file on shared server, instead we have to purchase VPS level 3 or the dedicated server for this. So, we are stuck here. </p> <p>If there is any work around or some other available options for this, please let me know.</p> <p>Thanks in advance. </p> <p>Regards,<br/>Saad </p>
iphone
[8]
1,054,981
1,054,982
Why do we need "out" parameters?
<p>I understand that "out" are just like "ref" types, except that out variables do not have to be initialised. Are there any other uses of "out" parameters? Sometimes I see their use in callback methods but I never understood how they actually work or why we need them instead of global level ref variables?</p>
c#
[0]
5,587,257
5,587,258
How can i retrieve a value from a database table on to the front end (C#)
<p>I want to work on a data that is stored in a database table. So I need to retrieve that value from data base on to a variable. </p> <p><strong>I need a selection query using a where and that data is stored a varchar I need to convert it to time.</strong></p>
c#
[0]
1,966,813
1,966,814
drag and drop file into textbox
<p>I want to drag and drop a file so that the textbox shows the full file path. I have used the drag enter and drag drop events but I find that they are not entering the events.</p> <pre><code>private void sslCertField_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop, false) == true) { e.Effect = DragDropEffects.All; } } private void sslCertField_DragEnter(object sender, DragEventArgs e) { string file = (string)e.Data.GetData(DataFormats.FileDrop); serverURLField.Text = file; } </code></pre> <p>Can anyone point out what I am doing wrong?</p> <p><strong>UPDATE: Does not work if program is set to run with elevated permissions (vista/win 7)</strong></p>
c#
[0]
3,523,349
3,523,350
Failed to install ClubDangoV2Released.apk on device: Too many open files
<p>I am getting the following error and don't know why. Some time before, my app was properly installing on a phone but now this error message is fired. </p> <pre><code>[2012-05-16 11:18:56 - ClubDangoV2Released] Failed to install ClubDangoV2Released.apk on device 'S55706733529a': Too many open files [2012-05-16 11:18:56 - ClubDangoV2Released] com.android.ddmlib.SyncException: Too many open files [2012-05-16 11:18:56 - ClubDangoV2Released] Launch canceled! </code></pre>
android
[4]
1,997,733
1,997,734
bit shift to divide str.length by 2k
<p>I have a chunk of data coming from an ajax call. I need to split this chunk up into smaller chunks of a predefined amount, not by a delimiter character, but by an amount. 2k is what I would like. I am trying to come up with a snippet that would bit shift divide the data, and place each chunk including the remaining data into arrays. So if the original chunk is 1 meg, then I would have <code>chunk[0]=2k</code> of data, <code>chunk[1]=next 2k</code> of data..... and so on until there is no more data to assign.</p> <p>Thanks Pat</p>
javascript
[3]
2,774,136
2,774,137
Passing extra Intent information from Activity to View
<p>I have an activity that is launched from another activity through an intent. The intent carries an extra "id" information. Now, the launched activity has a custom view (actually, a extension of LinearLayout class). I want to access the "id" information in the custom view. Can the activity pass that value to its contained view? Or can the view get a handle to the activity?</p>
android
[4]
4,698,529
4,698,530
Changing the username for a logged on user with FormsAuthentication
<p>I'm using FormsAuthentication in my ASP.NET application (not the whole asp.net membership).</p> <p>When a user logs on I validate against the database and use the following code to create an authentication cookie:</p> <pre><code>FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, RememberMe.Checked); </code></pre> <p>My question is, how do I handle a user changing their username? As the cookie has a different username, my application crashes. </p> <p>Can I modify the authentication token, or do I just log the user out?</p>
asp.net
[9]
1,880,660
1,880,661
Shorthand IF Statement
<p>I'm curious, is there a simpler way to say</p> <pre><code>if(myVar == myVal || myVar == myOtherVal){ /*...*/ } </code></pre> <p>such as:</p> <pre><code>if(myVar == myVal || myOtherVal){ /* */ } </code></pre> <p>I am aware that my proposed code only checkes to see whether <code>myVar</code> equals <code>myVal</code> or <code>myOtherVal</code> is not <code>null</code> (undefined) and <code>false</code>.</p> <p>So, as I stated before, is there a simpler way to write</p> <pre><code>if(myVar == myVal || myVar == myOtherVal){ /*...*/ } </code></pre> <p>Just curious to know if there's some sort of jS shorthand <code>if</code> statment that works like this that I have missed.</p> <p>Thanks in advance.</p>
javascript
[3]
1,052,390
1,052,391
GetElementID of dynamically assigned object
<p>My javascript function accepts a parameter which changes dynamically. I want to get it's dynamically generated ClientID as i m using a server control.</p> <pre><code>function myfun(btn){ var id=btn.name+"1"; document.getElementByID('&lt;%"+id+".ClientID%&gt;') --something like this </code></pre> <p>}</p>
javascript
[3]
4,379,945
4,379,946
Load javascript into bottom of head
<p>I need some help. Is there a way to use javascript to add scripts src's to the end of the head? I have some dynamic scripts that are now allowing me to put my scripts at the bottom of the head Is there a way to do this with javascript.</p> <p>For example, I need these to be at the bottom of the head tag:</p> <pre><code>&lt;script src="/jQuerySlider/jquery-1.6.4.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="/jQuerySlider/jquery.easing.1.3.js" type="text/javascript"&lt;/script&gt; </code></pre>
javascript
[3]
3,507,884
3,507,885
Clarification on C++ name lookup
<p>I have a question about a situation I just came upon at work.</p> <p>setup: in stringStuff.h</p> <pre><code>namespace n1 { namespace n2 { typedef std::string myString; } } namespace n1 { namespace n2 { void LTrim(myString&amp; io_string); void RTrim(myString&amp; io_string); inline void Trim(myString&amp; io_string) { LTrim(io_string); RTrim(io_string); } } } </code></pre> <p>in impl.cpp</p> <pre><code>#include "stringStuff.h" // This actually gets included via other include files #include "globalInclude.h" // contains 'using namespace n1::n2;'. Yes, I know this isn't best practice inline static myString Trim(const myString&amp; in_string) { // impl } static void impl(const myString&amp; in_string, myString&amp; out_string) { size_t N = 10; // just some computed value. out_string = Trim(in_string.substr(1, N)); // This is the line with the error } </code></pre> <p>now, I admit I don't understand C++ name resolution rules quite as well as I should, but when I look at this, it seems like the call to Trim <em>should</em> be ambiguous. </p> <p>The surprising thing is that it compiles just fine on Linux using GCC, calling the function defined in impl.cpp. When I compile on HP-UX using its native compiler, it seems to resolve the call as the one defined in stringStuff.h, and complains about converting a temporary to a non-const ref (which is surprisingly a warning, not an error), and about trying to assign void to a myString.</p> <p>What should be happening according to the C++ standard, and which compiler (if either) is getting it right?</p> <p>BTW, I 'fixed' it in my case by prefixing the call to trim with ::, although that isn't really ideal.</p>
c++
[6]
2,479,558
2,479,559
Availability of Google Map API
<p>I am new to Android development, I need to implement Branch Locator functionality where user can search for bank's branch using Google Map.</p> <p>I understand that to make this work, Google Map library needs to be available on the phone else my code won't work. Is this understanding correct?</p> <p>If this is correct than is there some URL from where the user can download Google Map Library?</p>
android
[4]
916,139
916,140
Exception Handling - throwing an exception without any handlers
<pre><code>void myterminate () { cout &lt;&lt; "terminate handler called"; } int main (void) { set_terminate (myterminate); throw; // throwing an exception. So, terminate handler should be invoked // as no one is handling this exception. getch(); return 0; } </code></pre> <blockquote> <p>But After executing this code, the output is:</p> <blockquote> <p>terminate handler called + "Debug Error!" dialog box appears.</p> </blockquote> <p>I am not sure why it is coming like this !!!! Please help.</p> </blockquote>
c++
[6]
3,464,059
3,464,060
Text citation for every day of the year
<p>I would like to to put on very page of my site (mscperu.org) on the header as include page a different text citation for every day of the year.</p> <p>I found "image changing every day of the year" but I'm no pro so I do not know how to change the javascript so it may bring up a text citation for every day of the year.</p>
javascript
[3]
1,592,200
1,592,201
onChange Select did not display?
<p>What should the possible wrong in this part: since when i select the the list and it work okay. but after load the form the selected name is did not display and it return in default "Select Supplier".</p> <pre class="lang-php prettyprint-override"><code>echo "&lt;select name= 'product' onchange = 'reload(this.form)'&gt; &lt;option value = ''&gt;Select Supplier..&lt;/option&gt;"; while($row_select_p = mysql_fetch_array($SQL_QUERY_PRODUCT_)) { if($row_select_p['supplier_id']== @$product) { echo "&lt;option value = '$row_select_p[supplier_id]'&gt;$row_select_p[supplier_name]&lt;/option&gt;"; } else { echo "&lt;option value = '$row_select_p[supplier_id]'&gt;$row_select_p[supplier_name]&lt;/option&gt;";} } echo "&lt;/select&gt;"; </code></pre> <p>and also i already get the value if the id=> localhost/octagon/store_app/store_view/store_request.php?supplier=2</p>
php
[2]
1,845,177
1,845,178
Why isn't 0-padding allowed in Python?
<p>I've just noticed 0-padding is not allowed in Python and I was wondering why this choice was made?</p> <p>For example:</p> <pre><code>a = 09 </code></pre> <p>doesn't work while</p> <pre><code>a = 9 </code></pre> <p>does</p> <p>How's that?!</p> <p>Thank you very much for your answers!</p>
python
[7]
1,885,814
1,885,815
Unable to see my files in SD card
<p>I have created some text files in the SD card, but I am unable to view my files.</p> <p>I am using this path <code>Environment.getExternalStorageDirectory();</code> to create files.</p> <p>I am not getting any exception while creating files.</p> <p>when I open the DDMS in eclipse I am unable to see my files there also..</p> <p>If I created the files at </p> <pre><code>Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); </code></pre> <p>then I can see my files at <code>/data</code> folder of the device , but not in SD card itself.</p> <p>When I click on the gallery icon in my device, I can see only pictures, videos, camera shots folders only but not my files ..</p> <p>please suggest is that the proper way of creating files in SD card. thanks.</p>
android
[4]
1,573,964
1,573,965
How does jQuery.ready() treat a call to itself?
<p>As an example:</p> <pre><code>$( function(){ //do stuff $( function(){ //do other stuff }); }); </code></pre> <p>Of course written out in code this seems to make no sense. But a plugin which works with HTML elements may use .ready() while itself being executed on an element in the main script's .ready(). How does jQuery handle this exactly? It clearly works, but does it do anything special?</p>
jquery
[5]
5,501,220
5,501,221
Remove day from date format in php
<p>Can someone help me please, I need a function or a way in PHP, to exclude the day from a given date regardless of its format. </p> <p>Thank you. </p>
php
[2]
5,319,324
5,319,325
how to load php extention @dl('ioncube_loader_lin_5.3.so') dynamically in php 5.3
<p>I am trying to load php extension @dl('ioncube_loader_lin_5.3.so') dynamically , but gives me fatal error :call to undefined function dl(). Then I searched alternative for it in php 5.3 but not able to find right information, kindly help.</p>
php
[2]
3,118,686
3,118,687
How can I decrease text size of the spinner in android
<p>I am using a Spinner where there is Default text.I want to decrease the <code>textSize</code>.Can I do this.please help me.</p> <pre><code>android:textSize="8dip" </code></pre> <p>I am using this code..but it is not working.</p> <p>Thank you</p>
android
[4]
2,331,348
2,331,349
Replace Spaces With + icon
<p>what is the way to replace Spaces With + icon using PHP. Suppose some text like "I Love PHP" will automatically converted like this way "I+Love+PHP" .. assuming a field has this text in a variable like> <code>$text = I Love PHP</code> so this variables text spaces will be replace with a + sign in a new variable like this> <code>$text_plus=I+Love+PHP</code> how to do it with PHP?</p>
php
[2]
425,920
425,921
Getting Language for Non-Unicode Programs
<p>Anyone have any idea how to get the value of "Language for Non-Unicode Programs" in Control Panel Regional Settings programmatically using c#?</p> <p>Already tried CultureInfo, RegionInfo and getting the default encoding using the Encoding object, but I can only get the Standards and Formats value or the main code page. </p>
c#
[0]
4,474,088
4,474,089
Don't understand this python For loop
<p>I'm still a python newb, but I'm working through the <a href="http://pyneurgen.sourceforge.net/tutorial_nn.html" rel="nofollow">Pyneurgen neural network tutorial</a>, and I don't fully understand how the for loop used to create the input data works in this instance:</p> <pre><code>for position, target in population_gen(population): pos = float(position) all_inputs.append([random.random(), pos * factor]) all_targets.append([target])` </code></pre> <p>What is the loop iterating through exactly? I've not come across the use of the comma and a function in the loop before.</p> <p>Thanks in advance for any help :)</p>
python
[7]
1,807,256
1,807,257
Selector with 2 parameters
<p>The following selector <code>$('.sub_menu_container',this)</code> has 2 parameters, the selector you want to search for and a second one. In this case its <code>this</code>. What is the use of adding that second parameter? Ive search the jquery docs but didnt find anything that could help me. Is it some kind of reference?</p>
jquery
[5]
5,836,580
5,836,581
Which python module is used to read CPU temperature and processor Fan speed in WINDOWS..?
<p>Which python module is used to read CPU temperature and processor Fan speed in WINDOWS..?</p> <p>Explored WMI python module, how ever i am unable to find the correct option or function to capture the above mentioned info.</p> <p>Actually i tried the follwoing code snip, but it returns 'nothing'.</p> <pre><code>import wmi w = wmi.WMI() print w.Win32_TemperatureProbe()[0].CurrentReading </code></pre> <p>Kindly give some suggestions to get those infos.</p> <p>Br, -Srk</p>
python
[7]
476,899
476,900
How to use form authentication in ASP.Net?
<p>I have one application with Form Authentication.I have different levels of users.</p> <p>When logged as Admin It has to show all the screens and when logged as Client the data need to restricted. I have logged as Client in Internet Explorer.After time out Its showing Admin's data .please tell me the way to get log in page after Timeout.</p> <p>My Config File sttings are : <code>protection="All" enableCrossAppRedirects="false" slidingExpiration="true"</code></p> <p>Thanks, Rakesh.</p>
asp.net
[9]
3,496,944
3,496,945
how to get system or user temp folder in unix and windows?
<p>I am writing a C++ problem. It need to work on both Windows and Unix OS.</p> <p>How to get user or system tmp folder on different OS?</p>
c++
[6]