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
1,777,320
1,777,321
when we use JavaScriptSerializer deserializer?
<p>can u explain this with example.</p>
c#
[0]
3,078,853
3,078,854
Windows application Suddenly terminated
<p>Hi my windows application suddenly stops working and gives the error on Windows 7 OS.</p> <p>"A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available."</p> <p>Even the Error log is not written in My Error Log File.</p> <p>I have try and Catch block to my each function..</p> <p>Why??</p>
c#
[0]
3,790,291
3,790,292
Too many timeouts in android?
<p>i have an Http client in my android app that changes messages with a server.<br> lately 2 out of every 3 ( approx) messages i send to the server get timed out<br> is that normal?<br> Thanks in advance!<br> Omri</p>
android
[4]
5,821,389
5,821,390
Switching a Repeater's ItemTemplate at runtime
<p>Is it possible to define multiple templates for a Repeater's ItemTemplate and switch between them according to some condition?</p> <p>I use a repeater to view a list of posts but want to have a different view for rows that belong to the current user (e.g. contains a LinkButton for deleting the post)</p> <p>If this is not possible, then is it possible to use a Multiview control inside a Repeater's ItemTemplate?</p>
asp.net
[9]
1,469,068
1,469,069
Reference One App_Code Class from Another
<p>Can I access one class in an App_Code sub folder from another (one being C# and the other VB) in an ASP .NET Web Site Project? I am not having any luck.</p>
asp.net
[9]
5,859,900
5,859,901
Gallery swipe in android
<p>I have a Horizontal Gallery in the bottom of the activity , My problem is that gallery detect swipe action from the whole layout not just when you on it , from any point in the screen you can drag it, how can i stop that ??</p>
android
[4]
4,678,993
4,678,994
jquery get value from input when get value from slider
<p>I have a input text </p> <pre><code>&lt;span id="slider-result-dist"&gt;&lt;/span&gt; &lt;div class="slider_dist slider"&gt;&lt;/div&gt; &lt;input type="text" name="filter_dist_sea" id="dist-sea" value="&lt;?php echo $states['filter_dist_sea'] ?&gt;" /&gt; &lt;/div&gt; </code></pre> <p>I have create a slider </p> <pre><code>$( ".slider_dist" ).slider({ animate: true, range: "min", value: 100, min: 1, max: 1000, step: 100, slide: function(event, ui) { $( "#slider-result-dist" ).html( ui.value+' Mt' ); $('#jea-search-dist-sea&lt;?php echo $uid ?&gt;').attr('value', ui.value); } }); }); </code></pre> <p>I need to use the function change like this, but does not work</p> <pre><code>$('#dist-sea').change(function() { alert('change'); }); </code></pre> <p>I know the good way is this :</p> <pre><code>$( ".slider_dist" ).slider({ slide: function(event, ui) { alert(ui.value); } }); </code></pre> <p>It' s possible get the value from input when change from slider ?</p>
jquery
[5]
1,179,711
1,179,712
Change color of navigation buttons of default mail composer
<p>I have used navigation bar category to color my navigation bar. All works fine. But when I add mail composer picker, navigation bar gets coloured but buttons are default blue. How can I change those?</p> <p>I have used image in navigation bar in category. </p>
iphone
[8]
5,420,909
5,420,910
jQuery size() method vs length attribute
<p>Is there any difference between <code>$(".selector").size()</code> and <code>$(".selector").length</code> ?</p>
jquery
[5]
4,915,313
4,915,314
dynamically set control ID
<p>i have few texboxt and dropdownlist, which their id would be something like "txtName1, txtName2, txtName3..." and "ddlAction1, ddlAction2, ddlAction3...."! I would to to dynamically set the textboxt and dropdownlist id into something like this:</p> <pre><code>for i as integer = 0 to 6 a = txtName+i.text b = ddlAction+i.SelectedValue next i </code></pre> <p>Need help from you guys to do this! thanks....</p>
asp.net
[9]
6,003,544
6,003,545
saving image from a webpage + saving its name too using PHP
<p>how can i save an image from a web page , for example:</p> <pre><code>http://othersdomain.com/image/colorful.jpg </code></pre> <p>How can i save the image and save it to my directory "image" inside FTP. and also get the "colorful" name from the link. </p> <p>As a conclusion , it will get colorful.jpg and save in my directory with the same name and type then echo out the link to it(on my web server).</p> <p>after being saved to my server , it will echo out somehting like this:</p> <pre><code>http://mydomain.com/image/colorful.jpg </code></pre>
php
[2]
3,528,269
3,528,270
How to add an event listener with a callback function that accepts attributes?
<p>And also, how to remove it then?</p>
javascript
[3]
1,226,485
1,226,486
c++ variable visibility
<p>PLEASE READ THE SECOND EDIT FIRST.</p> <p>I am looking for books or websites that explain in detailed the c/c++ memory management models. One of the things I am trying to understand is:</p> <pre><code>namespace A { SomeClass A; } </code></pre> <p>vs</p> <pre><code>namespace A { static SomeClass A; } </code></pre> <p>vs</p> <pre><code>SomeClass A; </code></pre> <p>vs</p> <pre><code>static SomeClass A; </code></pre> <p>Thank you very much.</p> <p>EDIT: Sorry for the confusion, I mixed the concepts together, and asked the wrong questions. </p>
c++
[6]
508,825
508,826
php - regular expression - PCRE does not support \L, \l, \N, \P,
<p>I need to use the following regular expression to validate some Asian characters</p> <pre><code> $regexp = "/^[\-'\u2e80-\u9fff\sa-zA-Z.]+$/"; // with warning $regexp = "/^[\-'\sa-zA-Z.]+$/"; // without warning </code></pre> <p>preg_match() [function.preg-match]: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X.</p> <p>Do you know how to change the regular expression pattern so that I can validate the Asian characters from <code>\u2e80-\u9fff</code></p> <p>I am using the latest XAMPP</p> <pre><code>Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 </code></pre> <p>Thank you</p>
php
[2]
2,788,090
2,788,091
AP Computer Science Logical Operators
<p>Which of the following will evaluate to true only if boolean expressions <code>A</code>, <code>B</code>, and <code>C</code> are all <code>false</code>?</p> <blockquote> <p><em>Answer:</em> <code>!(A || B || C)</code><br> <em>My answer:</em> <code>!(A &amp;&amp; B &amp;&amp; C)</code></p> </blockquote> <p>Why is my answer incorrect? If <code>A</code>, <code>B</code> and <code>C</code> are all <code>false</code> and the <code>!</code> is distributed, it will make all of them <code>true</code>, thus returning <code>true</code>.</p> <hr> <p>Given that <code>a</code>, <code>b</code> and <code>c</code> are integers, consider the boolean expression</p> <pre><code>(a &lt; b) || !((c == a * b) &amp;&amp; (c &lt; a)) </code></pre> <p>Which of the following will guarantee that the expression is <code>true</code>?</p> <blockquote> <p><em>Answer:</em> <code>c &lt; a</code> is <code>false</code></p> </blockquote> <p>Doesn't the result rely on <code>(c == a * b)</code> being <code>false</code> also because of the <code>&amp;&amp;</code>? </p>
java
[1]
4,074,906
4,074,907
Is there a default default constructor?
<p>If you don't provide a copy constructor, one is created automatically. This is called the default copy constructor. A default constructor is a constructor that doesn't take any parameters. If you don't provide any constructors, a default constructor is created automatically. Is this called the default default constructor?</p>
c++
[6]
41,713
41,714
Encrypting hypelinkfields in gridview
<p>I need to encrypt the Url's in my web application. I followed Mads Kristensen's (http://madskristensen.net/post/HttpModule-for-query-string-encryption.aspx) article for encrypting Urls. It is working perfectly. However, I have hyperlinkfield in a gridview for which I am using datanavigateurlformatstring and datanavigateurlfields properties to create the query string e.g</p> <pre><code> &lt;asp:HyperLinkField Text="Edit" datanavigateurlfields="DocumentId" datanavigateurlformatstring="~\admin\edit_document.aspx?DocumentId={0}" /&gt; </code></pre> <p>When the hyperlinks are clicked, the link opens and the urls are encrypted. However, if I hover my mouse over the hyperlinks, I can see data in the query string with no encryption. Any idea how to encrypt the query string when the mouse is hovered over the hyperlink?.</p> <p>Thanks.</p>
asp.net
[9]
2,594,620
2,594,621
How to change the divider color in the listview?
<p>I need to change the divider color in the listview. The code I am using to accomplish this is quoted below:</p> <pre><code> &lt;ListView android:id="@+id/restaurant_list_widget" android:layout_width="1px" android:layout_height="1px" android:layout_weight="1" android:background="@drawable/list" android:divider="#FFFFFF" android:dividerHeight="4px"&gt; &lt;/ListView&gt; </code></pre> <p>I still get a black 1px wide divider. What am I doing wrong?</p> <p>Update: ListItem </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="5dp" android:background="@color/list_background" &gt; &lt;TextView android:id="@+id/restaurant_list_item_name" android:layout_marginBottom="4dp" android:textStyle="bold" android:textSize="15dp" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="#fff" android:text="Restaurant Name Goes Here"&gt;&lt;/TextView&gt; &lt;TextView android:id="@+id/restaurant_list_item_detail" android:textSize="10dp" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt;&lt;/TextView&gt; &lt;/LinearLayout&gt; </code></pre>
android
[4]
1,936,504
1,936,505
How come some people append f to the end of variables?
<p>In the tutorial I'm reading for OGRE3d <a href="http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Intermediate+Tutorial+1" rel="nofollow">here</a> the programmer is constantly adding <code>f</code> at the end of any variable he initializes, like <code>200.00f</code> or <code>0.00f</code> so I decided to erase <code>f</code> and see if it compiles and it compiles just fine, what is the point of adding <code>f</code> at the end of the variable?</p> <p>EDIT: So you're saying if I initialize a variable with <code>200.03</code> it won't initialize it as a floating point but if I were to do so with <code>200.03f</code> it would? If not where does the f become useful then?</p>
c++
[6]
3,334,458
3,334,459
Get string value from a byte string
<p>I have to get the value from byte string this is the byte string </p> <p>4W3CfJ//nw1CpeA5NfXx9Ia32JyVmgpRrQCzUabFUvv0fqXYLVeNBT6XKjBehFNGtQ3Sng3Zucqu+RcXUzJ3KA==</p> <p>now how can I get the value from it</p>
c#
[0]
3,648,004
3,648,005
Cannot retrieve Selected option value
<p>I can able to get the selected option value in onchange event. But, when clicking the ok button in the same page , I can't get the value selected. Please help me.. </p> <p>Code is as follows: </p> <pre><code>&lt;select id ="userstoassign"&gt; &lt;option value="s1"&gt;S1&lt;/option&gt; &lt;option value="s2" selected="selected"&gt;S2&lt;/option&gt; &lt;option value="s3"&gt;S3&lt;/option&gt; &lt;/select&gt; &lt;input type="button" name="ok" id="ok" value="ok"/&gt; $("#ok").live('click', function(){ var username= $("#userstoassign option:selected").val(); alert(username); }); </code></pre> <p>Note: In onchange event, I can get the selected value. Temp fix is I'm getting that value in onchange event in a variable and will use it in onclick event. Even in onchange event I'm getting default value if I use the code "$("#userstoassign option:selected").val();"</p> <pre><code> $('#userstoassign').live('change',function(){ selectedUser=this.value; alert(selectedUser); }); </code></pre>
jquery
[5]
3,331,332
3,331,333
Javascript: how to return own function?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6959426/can-a-javascript-function-return-itself">Can a JavaScript function return itself?</a> </p> </blockquote> <p>Consider the following javascript function:</p> <pre><code>var x = function(msg) { alert(msg); return x; }; x('Hello')('World!'); </code></pre> <p>This wil alert 'Hello' and 'World!'. Now I would like to rewrite the function without using a <code>var x</code> into something like:</p> <pre><code>(function(msg) { alert(msg); return this; })('Hello')('World'); </code></pre> <p>But this doesn't work. What am I doing wrong? How can I return my own function from the function?</p>
javascript
[3]
3,543,486
3,543,487
jquery click without being attached to the DOM
<pre><code>var html = '&lt;div&gt;&lt;a href="#" id="test"&gt;Btn&lt;/a&gt;&lt;/div&gt;'; $(html).find("#test").click(function(){ console.log("clicked"); }); //later $(htmlNode).html(html); </code></pre> <p>Why don't I receive the "clicked" log?</p>
jquery
[5]
3,235,080
3,235,081
Transcript from audio files
<p>i want to extract text from a recorded audio file. i would appreciate if someone can help me.I tried using trancribe and sphinx but none of them fulfilled my purpose.</p> <p>thanks.</p>
java
[1]
1,751,441
1,751,442
Using a std::vector<char> as a variant
<p>I want a simple variant with </p> <ul> <li>minimal overhead</li> <li>that can be passed to functions written in the C language</li> </ul> <p>so I decided to use a std::vector like this<br></p> <pre><code>typedef std::vector&lt;char&gt; SimpleVariant; SimpleVariant data; </code></pre> <p>(1) store a std::string<br></p> <pre><code>for(std::string::iterator it = str.begin(); it != str.end(); ++it) { data.push_back( *it ); } data.push_back('\0'); </code></pre> <p>(2) store a double</p> <pre><code>data.resize(64); std::sprintf(&amp;data[0], "%.*g", 20, val); </code></pre> <p>(3) get a string<br></p> <pre><code>std::string str = std::string( m_data.begin(), m_data.end() ); </code></pre> <p>(4) get a double<br></p> <pre><code>double dbl = boost::lexical_cast&lt;double&gt;(&amp;data[0]); </code></pre> <p>Is this a reasonable approach given my requirements? Is there lightweight variant that I can use instead of trying to reinvent the wheel? <br> I am aware of boost::variant and boost::any they are too heavyweight for my needs</p>
c++
[6]
2,123,662
2,123,663
Enable button in JQuery dialog
<p>I can disable it fine using this:</p> <pre><code>button.attr('disabled', 'disabled' ).addClass( 'ui-state-disabled' ); </code></pre> <p>But how do I re-enable it? When I use this:</p> <pre><code>button.attr('enabled', 'enabled' ).addClass( 'ui-state-enabled' ); </code></pre> <p>It doesn't work.</p>
jquery
[5]
3,988,407
3,988,408
Bindingsource error value does not fall within the expected range
<p><img src="http://i.stack.imgur.com/IKR3S.jpg" alt="enter image description here">I am trying to add BindingSource to my default.aspx. In properties window, when I click on triangle for datasource, a message box appears saying </p> <p>Value does not fall within the expected range</p> <p>Why is that? How can I set it? Thanks</p>
asp.net
[9]
1,069,153
1,069,154
Access entire urls for a particular keyword
<p>My project need to compare output(only urls) of google and yahoo for a particular keyword.</p> <p>Can i access entire urls for a particular keyword from google and yahoo? Do they provide any library or any other thing for that?how can i do that?..</p>
c#
[0]
1,621,416
1,621,417
open file with fill and sign on drive, android
<p>How can I configure drive on android to open my pdf files with Fill and sign application? NB: Fill and sign doesn't appear among the options. Thanks.</p>
android
[4]
515,461
515,462
How to replace whitespaces with dashes
<p>My idea is to remove special characters and html codes and replace the whitespaces to dashes let us doing it step by step</p> <pre><code>$text = "Hello world)&lt;b&gt; (*&amp;^%$#@! it's me: and; love you.&lt;p&gt;"; </code></pre> <p>now i'm want the output become <code>Hello-world-its-me-and-love-you</code> I've tired this code for removal of special characters and html codes </p> <pre><code>$array = array(); $array[0] = "/&lt;.+?&gt;/"; $array[1] = "/[^a-zA-Z0-9 ]/"; $textout= preg_replace($array,"",$text); </code></pre> <p>Now the output will be like this <code>Hello world its me and love you</code> so is there any way i can modify this code so that the text output become exact as i do needs <code>Hello-world-its-me-and-love-you</code></p> <p>~ thank you</p>
php
[2]
1,930,794
1,930,795
How can I track the reason why an ASP.NET Session times out?
<p>I'm trying to track down an issue on an ASP.NET v3.5 application where the <code>HttpSession</code> times out before its (default) 20 minutes. We're seeing behaviour where the session is lost only a few minutes into a session, at random and with no discernible cause such as unhandled exceptions. As far as I can tell, the ASP.NET worker process is not dying, otherwise that would have explained the dropped session.</p> <p>What approach should I use to monitor when the session is dropped? Is there some event I can listen to, or some other hook in the <code>System.Web</code> namespace?</p> <p>Also, can someone confirm that the countdown to expiration is reset by web activity? That is, the session's lifetime gets reset to the (default) 20 minutes each time the web client makes an HTTP GET or POST?</p>
asp.net
[9]
4,030,204
4,030,205
building framework-res.apk, system crashes after replace
<p>I am trying to add two buttons .xml file which is in /frameworks/base/core/res/res/. I can add buttons without any "android:id" attribute for button view and that works properly on device too. But if try to give id to the buttons added to access them from .java files, the systems is not able to bootup ( all system services are dieing )</p> <p>how can i give id to the button in xml file ? please can anyone help me ?</p>
android
[4]
1,417,412
1,417,413
Implement the selection sort algorithm using stack or queues?
<p>Implement the selection sort algorithm using stack or queues?</p>
c++
[6]
1,000,344
1,000,345
Using getElementsByTagName to select all divs
<p>I am working on a project where I can only use JS to manipulate an HTML file. I am wanting to change the background color of all divs within the HTML and I currently have the following. </p> <pre><code>//Highlight Function function highlight(e) { e.target.style.backgroundColor = "orange"; } function unhighlight(e) { e.target.style.backgroundColor = "green"; } function init() { //Mouseover var divs = document.getElementsByTagName("div")[0]; divs.addEventListener('mouseover', highlight, false); divs.addEventListener('mouseout', unhighlight, false); } window.addEventListener("load", init, false); </code></pre> <p>The HTML looks like this </p> <pre><code>&lt;div id="div1"&gt;&lt;/div&gt; &lt;div id="div2"&gt;&lt;/div&gt; &lt;div id="div3"&gt;&lt;/div&gt; &lt;div id="div4"&gt;&lt;/div&gt; </code></pre> <p>Obviously the current code only changes one of the divs, how do get it to select all of the divs by only manipulating the JS</p>
javascript
[3]
5,140,135
5,140,136
How to make Tk() function from Tkinter module work
<p>I am using Tkinter module in Python console .But the Tk() function is not working and is showing errors like module needs arguments.</p>
python
[7]
1,805,524
1,805,525
get contents of url in python
<pre><code>import urllib2 response = urllib2.urlopen('http://api.xyz.com') html = response.read() </code></pre> <p>IN <a href="http://api.xyz.com" rel="nofollow">http://api.xyz.com</a> </p> <pre><code>{ "responseHeader":{ "status":0, "QTime":18, "params":{ "indent":"on", "q":"", "wt":"json",}}, "response":{"numFound":7984,"start":0,"maxScore":1.0,"docs":[ { "id":"21", "first_name":"anurag" }, { "id":"31", "first_name":"abhishek" } ] } </code></pre> <p>Problem is: this url will return json output. and i want to read that json file but it is showing error: string indices must be integers, not str. </p>
python
[7]
3,446,529
3,446,530
Java : how do I get the precision part in the decimal?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/8890472/java-how-do-i-get-the-part-after-the-decimal-point">Java : how do I get the part after the decimal point?</a> </p> </blockquote> <p>In my <a href="http://stackoverflow.com/questions/8890472/java-how-do-i-get-the-part-after-the-decimal-point">previous post</a> I didn't give proper explanation. This is my exact scenario.</p> <p>I have a <code>double</code> variable <code>d = 1.15</code>.</p> <p>I want the number after the decimal point, i.e. "15".</p> <p>What is best way to achieve this in Java?</p> <p>I have tried like this:</p> <pre><code>Double d = 1.15; String str = d.toString(); int len = str.substring(str.indexOf(".")).length() - 1; int i= (int) (d * (long)Math.pow(10,len) % (long)Math.pow(10,len)); </code></pre> <p>But I didn't get the proper answer because when I convert <code>d.toString()</code> the answer is <code>14.999999999999986</code>.</p>
java
[1]
4,063,985
4,063,986
PHP zip_open what temporary directory is it using for the temp files
<p>How can I find out the temporary directory that zip_open is using to temporary hold the extracted files. Is there a way to extract this from a resource handler getrieved from this:</p> <pre><code> $zip = zip_open($src_file) while ($zip_entry = zip_read($zip)) </code></pre> <p>$zip_entry - being the zip resource handler</p> <p>I suspect it is not using the php temporary directory, that I can check from </p> <pre><code>sys_get_temp_dir(); </code></pre>
php
[2]
1,183,338
1,183,339
How To Make A Rounded Segmented Button Group On The iPhone
<p>So I'm looking how to make a similar button group for an application on the iPhone that looks like the buttons in the Yelp About Me page or Twitter for Mobile application on the profile pages. Are these just a segmented controller? Or possibly images? I can't really find any resources for this online, so I figured I'd ask here. Let me know! Thanks!</p>
iphone
[8]
5,250,799
5,250,800
Android onBackPressed/onUserLeaveHint
<p>Just a bit of advice needed really. I have an Activity running with my game in it and when the user presses the Back button it will exit back to the Main Menu using the onBackPressed() method, but I am also overriding the onUserLeaveHint() to do the same action if the Home Button is pressed or a phone call is received. However this method is also called when the Back button is pressed, meaning that the Main Menu Intent is called twice with one on top of the other.</p> <p>If anyone has an idea about how to get around this issue or a better way of handling the two events it would be much appreciated.</p> <p>Thanks.</p>
android
[4]
3,023,358
3,023,359
How to make user input in java be of the type double?
<p>This line:</p> <pre><code>arr[i] = sc.nextDouble(); </code></pre> <p>from this code:</p> <pre><code>public class z01 { public static void main(String[] args) { @SuppressWarnings("resource") Scanner sc = new Scanner(System.in); System.out.println("Enter array size: "); int n = sc.nextInt(); double[] arr = new double[n]; double min = 0; for(double i = 0; i &lt;n; i++){ System.out.println("Enter element " + (i + 1)); arr[i] = sc.nextDouble(); if(i%3 == 0 &amp;&amp; i &lt;= min){ min = i; } } if(min != 0){ System.out.println("The smallest number divisible by 3 is" + min); } else { System.out.println("No number is divisible by 3"); } } } </code></pre> <p>Gives this warning:</p> <pre><code>Type mismatch: cannot convert from double to int </code></pre> <p>How do I make user input in java be of the type double?</p>
java
[1]
1,508,518
1,508,519
PHP get the calling object on a method
<p>Is there a way to get the actual calling object from a method?</p> <p>For example, I have a scenario where I do something like this:</p> <pre><code>$user = new User; $user-&gt;setName('name'); $user-&gt;save($user); </code></pre> <p>Instead of passing the $user to the save method, it would be nice to just have it get the calling object information.</p> <p>I know I can do <code>get_called_class()</code> but that doesn't return the actual object's data. I was also looking at PHP's Reflection classes but didn't see anything exactly right.</p> <p>Any ideas?</p> <p>Thanks!</p>
php
[2]
677,599
677,600
Alert message onfocus
<p>I don't get it. Why does this alert on page load? How to make it alert only "onfocus"?</p> <pre><code>&lt;input id="mail" name="E-post" value="E-post"&gt; &lt;script&gt; window.onload = function () { function onfocusFunction() { alert('Why!?'); } var myMail = document.getElementById('mail'); myMail.onfocus = onfocusFunction(); } &lt;/script&gt; </code></pre>
javascript
[3]
5,338,188
5,338,189
unable to download all songs from server
<p>in my app i am having a button called download all clicking on which i have to download all songs present on my server. i am able to download one song at a time. Below is my code:</p> <p>NetworkManager *manager = [[NetworkManager alloc] init];</p> <pre><code>NSString *Mp3filePath = [manager GetFile:SongUrl]; NSLog(@"aaaaa"); SongUrl= [[NSString alloc] initWithString:@"my URL"]; NSLog(@"aaaaa"); NSLog(@"songurl--%@",SongUrl); </code></pre>
iphone
[8]
3,711,513
3,711,514
Call to a member function prepare() on a non-object with PDO
<p>I have a function which uses:</p> <pre><code>require_once("connect.php"); function get_username($uid){ $stmt = $pdo-&gt;prepare("SELECT username FROM users WHERE uid= ?"); try { $stmt-&gt;execute(array($uid)); } catch (PDOException $e) { echo $e -&gt; getMessage(); exit; } $row = $stmt-&gt;fetch(); return($row['username']); } $id = 1; echo get_username($id); </code></pre> <p>But it says :</p> <pre><code>Call to a member function prepare() on a non-object </code></pre> <p>I'm a bit confused on what this means i have wrong, i'm wondering if its because I am using it in a function ?</p> <p>EDIT:</p> <p>My Connect script¬</p> <pre><code>$dsn = 'mysql:dbname=test_db;host=127.0.0.1'; $user = 'test_user'; $password = 'test_pass'; try { $pdo = new PDO($dsn, $user, $password); } catch (PDOException $e) { echo 'Connection failed: ' . $e-&gt;getMessage(); exit; } $pdo-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); error_reporting(E_ALL); session_start(); </code></pre>
php
[2]
534,962
534,963
modifying a cloned element and reinserting in dom - jquery
<pre><code> //dom &lt;div id='toBeCloned'&gt;&lt;span&gt;Some name&lt;/span&gt;&lt;/div&gt; &lt;div id='targetElm'&gt;&lt;/div&gt; //js $(function () { //creating a clone var _clone = $('#toBeCloned').clone(true); // target element var _target = $('#targetElm'); //now target element is to be filled with cloned element with data of span changed var _someData = [1, 2, 3, 4]; //loop through data $.each(_someData, function (i, data) { var _newElm = {}; $.extend(_newElm, _clone);//copy cloned to new Elm _newElm.find('span').html(data); //edit content of span alert('p'); // alert added to show that append in next line inspite of adding new element to dom just updating the previous one _target.append(_newElm);//update target }); }); expected Result: 1 2 3 4 resut iam getting is 4 </code></pre>
jquery
[5]
2,561,920
2,561,921
Android Softkeyboard not showing up when form field is focused via JS
<p>So I'm using the jQuery plugin, RSV(real simple validation) because the client would like to use alert boxes as opposed to inline alerts for the form validation. This site is for mobile browsers. The problem I'm running into is that when there's an error, an alert dialogue comes up to tell the user about their offense. When the alert is closed, the offending field is focused. The problem with the android is that the soft keyboard doesn't show up. Here's the code that generates the error handling:</p> <pre><code>function timsErrorFunction(f, errorInfo) { for (var i=0; i&lt;errorInfo.length; i++) { // errorInfo[i][1] contains the error string to display for this failed field, e.g. alert(errorInfo[i][1]); // errorInfo[i][0] contains the form field node that just failed the validation, e.g. errorInfo[i][0].focus(); errorInfo[i][0].style.color = "red"; } return false; // always return false! Otherwise the form will be submitted } </code></pre>
android
[4]
3,732,763
3,732,764
How to unlock android phone through code remotely
<p>I have written an application that locks android phone remotely. That is when a special code is sent from server then application locks the phone based on the special code. This is the code I am using.</p> <pre><code>if (!mDPM.isAdminActive(mDeviceAdminSample)) { // try to become active – must happen here in this activity, to get result Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN); intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN,mDeviceAdminSample); intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION,"Admin is added to do security operation."); startActivityForResult(intent, 0); } else { // Already is a device administrator, can do security operations now. mDPM.lockNow(); } </code></pre> <p>The above code is working and it's locking the phone. </p> <p>I am able to unlock the phone by entering password from soft keypad. Is there any way to unlock it through code?</p> <p>My question is how to unlock the phone through code.(This unlocking should be done remotely in the manner I explained for locking) </p>
android
[4]
3,144,007
3,144,008
Php division by 0, help needed?
<p>I keep getting division by 0 error in php.</p> <p>I am currently using the following: </p> <pre><code>$ratio = 1/$rate["rate"]; </code></pre> <p>the value $rate["rate"] is 0.827 (a value returned from a feed)</p> <p>Please can anyone help with this.</p> <p>Thanks</p>
php
[2]
1,039,262
1,039,263
How to delete a Row from the DB in android
<p>I'm new to android ... i have developed a Database application , were i'm able to insert the textfield details , but i want to delete the specific row , i need to search by name and delete the user.</p> <p>can someone help me on this :</p> <p>My DB code is:</p> <pre><code>public void deleteRow(String firstname) { try {db.delete(TABLE_NAME,TABLE_ROW_ONE + "=?" + new String[]{firstname},null);} catch (Exception e) { Log.e("DB ERROR", e.toString()); e.printStackTrace(); } } </code></pre> <p>Activty code is :</p> <p>deleteButton.setOnClickListener ( new View.OnClickListener() { @Override public void onClick(View v) {deleteRow();} } );</p> <p>private void deleteRow() { try {</p> <pre><code> db.deleteRow(textFieldOne.getText().toString()); updateTable(); emptyFormFields(); } catch (Exception e) { Log.e("Delete Error", e.toString()); e.printStackTrace(); } } </code></pre> <p>textFieldOne is the first name of the user.</p> <p>can someone help me on this .. </p>
android
[4]
1,821,142
1,821,143
java assertion botch negative time
<p>I am getting this error "java assertion botch: negative time" in this environment java 1.5 update 22 websphere 6.1.013 oracle 11.1.07 kodo</p> <p>Do you know what it could be It happens when a select statement is send to the Oracle server, but it just happens in websphere , everithing works fine in weblogic and tomcat</p>
java
[1]
5,681,653
5,681,654
Best practices for web application workflow?
<p>Note: By workflow i'm not referring to workflow technology, such as Workflow foundation. </p> <p>All too often I find myself being required to design pages that flow through a series of steps. </p> <p>1) Select from a set of options. Submit. 2) Populate a page with results. Make changes. Submit. 3) Do something based on the previous results. Submit. 4) Confirm previous actions. Submit. 5) Goto 1.</p> <p>An ecommerce site with shopping cart would be a textbook example of this.</p> <p>Now, there are any number of ways to deal with this. My question is, what is the recommended way to do it in asp.net? In PHP or ISAPI I would just use standard html controls, get the post data and do stuff with it, each on a different page. </p> <p>ASP.NET seems to be more oriented towards single page solutions. Do your work, postback to yourself, then display your results in the same page.. moving along until the end, using something like a MultiView or UpdatePanels to do the job. But the key being, you don't postback to another page.</p> <p>Now I understand that Microsoft has added cross-page postbacks to .NET in recent versions, but this seemss less baked and kind of cumbersome. It's difficult to work with data that was posted back unless you expose it via properties or something from your previous page.</p> <p>How do you handle the scenario I layed out above? Do you use a multi-view or updatepanel and do it all in one page? Or do you do it in several pages? What is your best practices in this regard? Do you have any specific designs you tend to use? How do you go about structuring the sites workflow?</p>
asp.net
[9]
2,959,024
2,959,025
simple constructor issue
<p>Lets say I have this class called class1, class1 contains one default constructor and one that takes one parameter (say a string for example). Inside that constructor I set up a variable, lets call it "string var". I want var to get the value from the string that I passed to the constructor while creating that object, but I want to be able to use var outside of the constructors scope, is that possible? since constructors doesen't return values and whatnot.</p> <p>To clarify here is a code example of what I want to do:</p> <pre><code>class class1 { public class1(string songPath) { System.Media.SoundPlayer songPlayer = new System.Media.SoundPlayer(songPath); } //here I want to use my songPlayer I created with the passed string as songPath } </code></pre>
c#
[0]
2,293,259
2,293,260
Binary "[" error on structure while using for function
<p>I'm trying to make a Q3BSP map information debugger.</p> <p>I'm stuck at texture debugger part, this is the code used in that part:</p> <pre><code>for( i = 0; i &lt; nTextures; i++ ) { printf( "Texture id %d\n", i ); printf( "\tTexture name %s\n", Texture[i].name ); printf( "\tTexture flags %d\n", Texture[i].flags ); printf( "\tTexture contents %d\n", Texture[i].contents ); } </code></pre> <p>But this kind error appears to show up:</p> <blockquote> <p>error C2676: binary '[' : 'Q3BSPTexture' does not define this operator or a conversion to a type acceptable to the predefined operator</p> </blockquote> <p>Here is the Q3BSPTexture structure:</p> <pre><code>typedef struct { char name[64]; // Texture name. int flags; // Surface flags. int contents; // Surface contents } Q3BSPTexture; </code></pre> <p>I'm suspecting that the structure hasn't the limit setted like char <strong>[32]</strong></p> <p>But I like to hear solution from professionals!</p>
c++
[6]
2,631,902
2,631,903
Account balance incorrectly calculated
<p>The result of running the below code is:</p> <pre class="lang-none prettyprint-override"><code>Final account balance is: -97.0 </code></pre> <p>But the answer should be 150.0, right? Where have I gone wrong?</p> <pre><code>class Account { double initBalance; Account(double initBalance) { initBalance=this.initBalance; } double getBalance() { return initBalance; } void deposit(double amt) { initBalance=initBalance + amt; } void withdraw(double amt) { initBalance=initBalance - amt; } } class TestAccount { public static void main(String args[]) { Account acct=new Account(100); acct.deposit(50); System.out.println("Final account balance is: " +acct.getBalance()); } } </code></pre>
java
[1]
4,814,470
4,814,471
C++ file read fails after 685 successes
<p>I'm working on a piece of C++ through which I read a file. Currently there are only two places (inside a function) where the file is being read from using the .get() method.</p> <p><strong>1)</strong> The first place is rarely used (in all about six times)</p> <p><strong>2)</strong> The second place is heavily used. I have a for loop with the .get() method called inside, instead of the .ignore() method (with no loop) - I wanted to quantify how many times I could read from the file before the file failed.</p> <p>I added a variable which incremented every single time the .get() method was called. It always fails on the 685th call for some reason.</p> <p><strong>Additionally</strong>, if I eliminate the second place, calling the .get() method once I've .ignore()'d past the 684th character will still cause the file to fail. So it isn't the amount of times .get() is called that is causing the fail - its the place in the file being read from.</p> <p>There is absolutely NO WAY it could have reached the EOF. 685 characters is &lt; 1% of the file.</p> <p>I checked the 685 character in the file with a hex editor and there didn't seem to be anything special or remarkable about it.</p> <p>So why is the file failing? I don't want to show you the exact code, but if you need clarification I can try to elaborate a little more, as I realize this is still a little vague.</p> <p>Thanks in advance.</p>
c++
[6]
2,944,433
2,944,434
What does the function then() mean in JavaScript
<p>I've been seeing code that looks like:</p> <pre><code>myObj.doSome("task").then(function(env) { // logic }); </code></pre> <p>Where does then() come from?</p>
javascript
[3]
938,722
938,723
jQuery selection by pattern
<p>I have a table of form elements where each row represents a record and column represents a field. I need to select all form elements in a given column.</p> <p>Form elements in the same column have the same name format. For example, form elements that represent a location would have a name in the format <code>record*.location</code>, where <code>*</code> is an index. </p> <p>Is it possible to select them with a single jQuery selection? If so, how does it compare to doing <code>document.getElementById()</code> on each one of them in a loop, performance wise?</p>
jquery
[5]
1,106,191
1,106,192
receive notification when current task ends
<p>I'm writing an android app where I'd like to maintain the current location for the user while my app is open. I'm trying to figure out how to know when to stop listening for updates from my LocationManager, but can't seem to figure out a good way to know when the current task is paused.</p> <p>Is there an easy way to say something like onTaskFinish() or onTaskPause()? </p>
android
[4]
4,665,700
4,665,701
Get name and values of a form post
<p>How can I print the name and values of a submitted form.</p> <p>Thanks for any help.</p>
php
[2]
1,729,530
1,729,531
Local network php gallery - need to grab images off drive?
<p>Ok, I'm building a simple php gallery that'll act as a photo browser for several pcs and tablets across the house. I have a NAS which has a single drive containing all our photos and I'd like my php app to randomly select 50 every day and display them as a slideshow.</p> <p>Can anyone tell me if this is possible with php or whether I'll need to have a separate application grabbing the random selection each day and creating some sort of feed for it to access?</p> <p>Any thoughts much appreciated!</p>
php
[2]
1,626,278
1,626,279
Running PHP files in cloud 9
<p>Just installed cloud 9 on my computer and I can't run PHP files on it (but JS works fine), any idea of what the reason for that?</p>
php
[2]
2,803,045
2,803,046
android how to control shutter time
<p>I develop a camera app ,I want to control camera's shutter time ,is that possible to realize?and what I want to realize final is prolong the exposure function,thank for your answer.</p>
android
[4]
2,821,807
2,821,808
Android INSTALL_FAILED_UID_CHANGED
<p>I have been doing debugging on Android using my Nexus 4, however I recently encountered this error here. After doing some research on this error, it seems to be an issue with the app not being deleted properly. The app I am debugging runs fine on my other Android devices as well as the emulators, this error is only occuring on my Nexus 4. I plugged my device into computer, and have tried deleting the data/data folders but I am still getting the same issue. I also checked settings-apps to check it was definitely uninstalled. </p> <p>Does anyone have any idea how to resolve this issue? According to some users, I need root access to properly delete data/data, is this true? Or is there another way around this?</p>
android
[4]
1,063,487
1,063,488
How to convert char to an array of bits in c++?
<p>I need to get each Character of a string as a sequence of bits either in an array or just traverse over it in a loop, either way works. This is something I used to do in ASM way back, and am not sure how that can be done in c++.</p> <p>EDIT: I am trying to replicate what I did sometime back with asm, reading a file in memory and traversing it bit by bit, manipulate each bit, do some more cyphering and save it back.</p> <p>Basically a simple Encryption. Its not a homework neither it is a project.</p>
c++
[6]
706,813
706,814
Generate random word ( from two known words )
<p>SO I can do this with numbers:</p> <pre><code>&lt;?=number_format(mt_rand(0,1));?&gt; </code></pre> <p>What I want to do is echo instead of 0 or 1</p> <p>the words <strong>firstclass</strong> or <strong>secondclass</strong></p> <p>Because I cannot use numbers as class identifiers ( css ) So essetinally, this is just for displaying random stuff within a list and prepending the class identifier with either firstclass or secondclass.</p> <pre><code>.firstclass {display:none;} </code></pre> <p>I am not ace with php, so I guess I need to set up an array, and somehow attribute:</p> <p>0 = firstclass 1 = secondclass </p> <p>within the array, so that i can get my little test script working.</p> <p>Any suggestions please.</p>
php
[2]
6,005,082
6,005,083
Capturing the image from android activity and return to the same activity from where the call to capture image was called
<p>I am new to android.I am developing a survey app in android which will help in taking the survey.In this app i have a field where the picture can be taken of those who is giving the survey.The problem i am facing is as soon as i click the button to capture the image,the image is captured and saved successfully but i am coming out of the survey with certain fields unfilled.Is there any way by which i can return to the same field from where the call to capture the image is given.. Please help </p>
android
[4]
521,038
521,039
Message user for being idle
<p>I already have auto logout snippet and now I want the user to know that they are being idle for about minutes. </p> <p>What is the easiest way to message user for being idle in 1 hour? Can this be done in javascript?</p>
javascript
[3]
245,943
245,944
jquery to check for empty field
<p>How can i use jquery to check for the empty input field / to check if the field contains a specified string? </p> <p>I understand that valid8(); does something similar. Any working example?</p>
jquery
[5]
2,172,353
2,172,354
calendar api to set many dates
<pre><code> import java.util.Calendar; import java.util.Date; public class Employee { private Calendar doj; public Employee(Calendar date) { // TODO Auto-generated constructor stub this.doj=date; } public Date getDoj() { Date cal=Calendar.getInstance().getTime(); return cal; } } import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.List; public class TestEmployeeSort { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub List&lt;Employee&gt; coll = getEmployees(); printList(coll); } public static List&lt;Employee&gt; getEmployees() { List&lt;Employee&gt; col = new ArrayList&lt;Employee&gt;(); //SimpleDateFormat format=new SimpleDateFormat("DD/MM/YYY"); col.add(new Employee(null)); return col; } private static void printList(List&lt;Employee&gt; list) { System.out.println("Date Of Joining"); for (int i = 0; i &lt; list.size(); i++) { Employee e = list.get(i); System.out.println(e.getDoj()); } } } </code></pre> <p>This prints the current date. But i want to set the date like the following where i have used date. But i want to do the same using calendar api</p> <pre><code>public static List&lt;Employee&gt; getEmployees() { List&lt;Employee&gt; col = new ArrayList&lt;Employee&gt;(); col.add(new Employee(5, "xyz","abc", new Date(1986, 6,12), new Date(1986, 6,12))); return col; } </code></pre>
java
[1]
3,464,044
3,464,045
Set the current directory when running a SimpleHTTPServer
<p>Is there any way to set the directory where you want to start a SimpleHTTPServer or BaseHTTPServer?</p> <p>Thanks</p>
python
[7]
2,538,386
2,538,387
What is the best .NET type for collections where each key can have multiple values?
<p>I have one key but different values for that key, I tried HashTable but i dont think that is the rite way of doing it. </p> <p>I'll explain in detail what is is requirment is: </p> <p>I have a Key - "Asp.net" for that i have n no of values - 61, 67, 100</p> <p>So i have to store this somewhere like Dictionary or hash table.</p> <p>TIA</p>
c#
[0]
1,715,533
1,715,534
What is the difference between DateTime.UtcNow and DateTime.Now.ToUniversalTime()
<p>To me they're both the same. Is UtcNow simply a shortcut?</p>
c#
[0]
5,973,647
5,973,648
cannot set a variable to base on user input post method
<p>Hello i´m trying to set info from a post method into a variable that sets a session named name the value that the user input. I get the following error:</p> <blockquote> <p>Notice: Undefined index: name in F:\xampp\htdocs\Impossible game\index.php on line 18</p> <p>This is line 18: $session = $_POST['name'];</p> </blockquote> <pre><code>&lt;form action="ms1.php" method="POST"&gt; Name &lt;input type="text" name="name"&gt; &lt;input type="Submit" value="Begin"&gt; &lt;/form&gt; &lt;?php $session = $_POST['name']; session_start(); $_SESSION['name'] = $session; </code></pre> <p>the previous error is gone and now this appears</p> <blockquote> <p>Notice: Undefined variable: session in F:\xampp\htdocs\Impossible game\index.php on line 23 below is line 23</p> </blockquote> <pre><code> $_SESSION['name'] = $session; </code></pre>
php
[2]
726,778
726,779
How to distinguish Click event from touch event in onTouchEvent method when app is running in device?
<p>I override the onTouchEvent method of Activty. In this method i would like to listen to actions: touch and click and give them two different reactions. The problem is when i test my app in emulator, everything works fine. But not in device. As in device, when i just click a button, i don't just get ACTION_DOWN and ACTION_UP but a few ACTION_MOVE signals after ACTION_DOWN.</p>
android
[4]
2,068,107
2,068,108
Is it possible to access UIBarButtonItem using tag?
<p>I hope to access UIBarButtonItem on an UIToolbar using tag. The codes show below</p> <pre><code>UIBarButtonItem *myBarButtonItem=(UIBarButtonItem*)myUIToolBar.items[i]; </code></pre> <p>but myBarButtonItem returns no object(0x0)</p>
iphone
[8]
3,427,156
3,427,157
hiding the tr tags and showing them after the uncheck
<p>I posted <a href="http://stackoverflow.com/questions/3714242/how-do-i-fade-out-all-the-other-tr-tags-with-jquery">this question</a> about 15 minutes ago and I got some good responses. But one thing i forgot is if the user unchecks the checkbox all the others that were hidden need to reappear again.... any ideas</p> <p>i was using this</p> <pre><code>$(function() { $('input:checkbox').click(function() { $(this).closest('tr').siblings().each(function() { $(this).hide("slow"); }); }); }); </code></pre> <p>but maybe there is a better way and how do i show the others that are hidden after I uncheck the checkbox</p>
jquery
[5]
2,035,896
2,035,897
How to compare two Dates without the time portion?
<p>I would like to have a compareTo method that ignores the time portion of a java.util.Date. I guess there are a number of ways to solve this. What's the simplest way?</p>
java
[1]
5,411,118
5,411,119
Javascript - Online CSS Editor
<p>I'm searching for an online JavaScript CSS editor like this:</p> <p><img src="http://i.stack.imgur.com/rwPNu.jpg" alt="alt text"></p> <p>Did somebody know of one?</p>
javascript
[3]
4,860,876
4,860,877
Insert element after several characters
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/7068653/jquery-or-javascript-to-add-one-line-break-br-after-x-amount-of-characters-i">Jquery or javascript to add one line break &lt;br /&gt; after x amount of characters in a &lt;div&gt;</a> </p> </blockquote> <p>I'd like to insert a <code>br</code> tag five characters into the content of the element. For example, from this:</p> <pre><code>&lt;p&gt;qwertyuiopasdfghjklzxcvbnm&lt;/p&gt; </code></pre> <p>To this:</p> <pre><code>&lt;p&gt;qwert&lt;br /&gt;yuiopasdfghjklzxcvbnm&lt;/p&gt; </code></pre> <p>How can I do this with jQuery?</p>
jquery
[5]
2,257,276
2,257,277
this property is not supported by object?
<pre><code>$(document).ready(function(){ ('#mainField').click(function(){ $("#editor").animate({width: 985, height: 200}, 1500); $("#closeEditor").css("display", "inline"); }); }); </code></pre> <p>This piece of code doesn't work, whats wrong?! It says: "this property is not supported by object" at the 2nd row..?</p>
jquery
[5]
3,305,942
3,305,943
Asp.net "allowDefinition=MachineToApplication" error
<p>I have edited the relevant .cs files in my web service. But after editing I end up with the following error: "It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS." Can you please let me know what should be the problem? Because there are no Warnings, no issues, it's just one error. Please help me. Thank you in advance.</p>
asp.net
[9]
3,375,350
3,375,351
jquery animating dynamic height div
<p>quick question. im trying to animate a few things with jquery and although its working, this is the problem im having.</p> <p>well first heres the code:</p> <pre><code>$(document).ready( function(e){ // vars var question = $('#faqQues'); var answer = $('#faqAns'); var ansCont = $('#faqAnsCont'); question.click(function(){ if(answer.css("display") != "none"){ answer.animate({'height':0}, 500, hmm); function hmm(){ answer.css("display","none"); } } else { answer.css("display","block"); answer.animate({"height":'100'},500); } }); }); </code></pre> <p>essentially all i want to do be able to click something and it animate its height(up down). the problem comes in on this code block</p> <pre><code>else { answer.css("display","block"); answer.animate({"height":'100'},500); } </code></pre> <p>specifically on this line</p> <pre><code>{"height":'100'} </code></pre> <p>what i want to happen is that it animates back to the divs default height. I dont want to add a number <code>(like the 100 above)</code> height because the divs inner content is always going to change hence the dynamic height but if i remove the height, it breaks. Ive tried a few other things including something like maybe</p> <pre><code>.animate({"height":'**divNameHere**.height()'},500); </code></pre> <p>but although it dont get errors, it doesnt work either lol.</p> <p>So here i am asking for help. what changes do i need to make to this so that it animates back to whatever that divs height is without directly putting in a number?</p> <p>Any Tips, code, links etc i'll gladly appreciate</p>
jquery
[5]
1,248,150
1,248,151
How to attach EventArgs/custom params when you assign a delegate to the event?
<p>I have this code:</p> <pre><code>this.form.Resize += new EventHandler(form_Resize); </code></pre> <p>But I want to assign some objects for later access in the <code>form_Resize</code> event, how can I do that?</p> <p>and do I access the data in the EventArgs?</p>
c#
[0]
5,269,387
5,269,388
C++ Programming Creative Issue Solving
<p>I must be an idiot, but I just cannot find a way to solve this issue:</p> <p>I want to make a program that takes a jumbled set of chars. and find all possible English words. My issue is that for the life of me I can't figure out how to make all possible combinations of words. I'm fine with the dictionary cross-check, but it's the jumbling that I'm having issues with. Could someone help with this?</p>
c++
[6]
289,503
289,504
automatically downloading and installing an exe file
<p>I need to automate the process of downloading and installing an exe file abc.exe from say 'http://10.34.45.21:8080/cruisecontrol/artifacts/xxx_trunk_nightly_build/xxx/test/'</p> <p>I mean now i have to manually goto ''http://10.34.45.21:8080/cruisecontrol' then click on each folder before i finally click on the abc.exe file. Then it downloads the exe on my machine. Then i have to double click on the exe to install it. I want to automate this whole process such that when i run the script it will automatically download the exe file and install it. Is it possible to do this using php?</p> <p>I am very much a beginner. Any help will be of use.</p>
php
[2]
622,846
622,847
java : Inside Enhanced for loop cannot Object to String
<p>I have taken this example from net . But when i tried it is not compiling saying cannot convert Object to String </p> <pre><code>import java.util.ArrayList; public class Test { public static void main(String[] args) { ArrayList names = new ArrayList(); names.add("Amy"); names.add("Bob"); names.add("Chris"); names.add("Deb"); names.add("Elaine"); names.add("Frank"); names.add("Gail"); names.add("Hal"); for (String nm : names) System.out.println((String)nm); } } </code></pre> <p>If it is a normal for loop i could have done list.get(element index).toString() . but how to do in enhanced for loop ??</p>
java
[1]
953,295
953,296
How to extend this jQuery function
<p>I want to extend this function and make my own, this new function should have same functions as the old one but additionalOkClicked should be overwritten with my own function.</p> <p>How do I do this?</p> <pre><code> (function ($) { $.LocationDialog = { mainInit: function() { //some code here }, init: function(callingNum) { //some code here }, additionalOkClicked: function() { //i want to override this function } }; })(jQuery); </code></pre>
jquery
[5]
490,690
490,691
jQuery - What's the most efficient way to filter out first and second elements found?
<p>I am using the latest and greatest jQuery.</p> <p>I will have a ten divs with content. On page load, I need to close all divs except the first and second. Only the first two divs I want visible. </p> <p>Under those visible two divs are "show more" and "show less" buttons. When the user clicks the show more button, all divs will slide down. When the user clicks the show less button, all but the first two divs should slide up. </p> <p>I know how to get at the first, the last, but I don't know how to filter out the first and the second element. I know I could get this done with more tinkering than I have already done, but I want to know the most efficient and readable way of getting it done. Can you help me? </p> <p>One page load, this should go through and close all but the first and second divs:</p> <pre><code>$(".BrandParagraph").each(function() { // should close all but first and second $(this).slideUp; }); $(".ShowMore").click(function() { // slide down all $(".BrandParagraph").slideDown(); }); $(".ShowMore").click(function() { // slide up all but first and second $(".BrandParagraph").slideDown(); }); </code></pre>
jquery
[5]
5,691,119
5,691,120
jQuery - can't get dialog popups to pop up, they appear on the page instead
<p>I have a couple small divs that I am trying to pop up when something happens, but they are not popping up, but instead appearing within the content of the page.</p> <p>Would anyone know why that happens? Also, the jQuery is supposed to show a spinner gif to indicate you should wait, but it doesn't render that either.</p> <p>Thanks in advance!</p>
jquery
[5]
1,550,581
1,550,582
Using a List in another class
<p>I have a list in a class and now I want to update its properties in another class. I am doing this by first the user is asked to enter index of list for the record s/he wants to update but when I do so I am getting an outofrange exception error. Can someone tell me what am I doing wrong. Here is what I did to get the list from the other class:</p> <pre><code>public class JuniorStudentsClass { public List&lt;Student&gt; mystudent = new List&lt;Student&gt;(); public List&lt;Student&gt; GetList() { return mystudent; } public class SeniorStudentsClass : JuniorStudentsClass { Student st = new Student(); static JuniorStudentsClass js = new JuniorStudentsClass(); List&lt;Student&gt; seniorList = js.GetList(); public void Updatestudent(int index) { SearchItem(index); GetList(); Console.WriteLine("current record:"); Console.WriteLine("id is:" + seniorList[index].Id); Console.WriteLine("year is:" + seniorList[index].Year); Console.WriteLine("name is:" + seniorList[index].Name); Console.WriteLine("surname is:" + seniorList[index].Surname); Console.WriteLine("dob is:" + seniorList[index].DOB); Console.WriteLine("address is:" + seniorList[index].Addr); foreach (Student st in mystudent) { Console.WriteLine("enter new students year:"); st.Year = Int16.Parse(Console.ReadLine()); seniorList[index].Id = st.Id; seniorList[index].Name = st.Name; seniorList[index].Surname = st.Surname; seniorList[index].DOB = st.DOB; seniorList[index].Addr = st.Addr; seniorList.Add(new Student(st.Id, st.Year, st.Name, st.Surname, st.DOB, st.Addr)); } public int SearchItem(int search) { int found = -1; if (mystudent != null) { foreach (Student st in mystudent) { found++; if (Student.Equals(search, st)) { break; } } } return found; } } </code></pre>
c#
[0]
2,330,219
2,330,220
When to use Structs in C#
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/521298/when-to-use-struct-in-c">When to use struct in C#?</a> </p> </blockquote> <p>I'm reading a C# tutorial in the net <a href="http://www.csharp-station.com/Tutorials/Lesson12.aspx" rel="nofollow">http://www.csharp-station.com/Tutorials/Lesson12.aspx</a>.<br> And I came to the topic about <strong>Structs</strong>.</p> <p>I'm just confused about this thing.<br> When does struct is advantageous to use or what are the practical uses of this?</p>
c#
[0]
5,985,803
5,985,804
Unsorted List inside a unsorted list created with DOM
<p>So I have creted an UL list with Javascript, but the hierarchy wont get right... And I really dont know how to embeed dem with each other...</p> <p>This is the look Im strungling for.</p> <pre><code>&lt;div class="dice-toolbar-wrapper"&gt; &lt;ul&gt; &lt;li class="add"&gt;&lt;/li&gt; &lt;li class="remove"&gt;&lt;/li&gt; &lt;li class="roll"&gt;&lt;/li&gt; &lt;li&gt; &lt;ul class="dice-toolbar-counter-wrapper"&gt; &lt;li class="zero"&gt;&lt;/li&gt; &lt;li class="zero"&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>This is how I create the list.</p> <pre><code> dice_toolbar_wrapper_close = createElementWithClass('div', 'dice-toolbar-wrapper'); outerDiv.appendChild(dice_toolbar_wrapper_close); document.getElementById("page-content-wrapper"); add_remove_roll = createElementWithOutClass('ul'); dice_toolbar_wrapper_close.appendChild(add_remove_roll); document.getElementById("dice-content-wrapper"); </code></pre> <p>But this is what I get after rendering the page.</p> <pre><code>&lt;div class="dice-toolbar-wrapper"&gt; &lt;ul&gt; &lt;li class="add"&gt;&lt;/li&gt; &lt;li class="remove"&gt;&lt;/li&gt; &lt;li class="roll"&gt;&lt;/li&gt; &lt;/ul&gt; &lt;ul class="dice-toolbar-counter-wrapper"&gt; &lt;li class="zero"&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>Any tips on how i can change the li tags ?</p> <p>Thanks</p>
javascript
[3]
3,911,019
3,911,020
JavaScript Encapsulation
<p>So I've been looking into full development object oriented JavaScript practices, and wonder about the following examples.</p> <p>As I understand it, (and it makes sense to me) that the following 'secret' field is 'private' :</p> <pre><code>var MyObject = function() { var secret = 'sshhh'; this.getSecret() = function() { return secret; } } </code></pre> <p>and this is because the field secret has function scope that the inner function can access, but nothing outside ... so far so good.</p> <p>But I've seen the following around (and especially in Douglas Crockford's book) : </p> <pre><code>var MyObject = function() { var secret = 'sshhh'; return { getSecret : function() { return secret; } } }(); </code></pre> <p>and was wondering what the difference is, why is it better? I understand that in this case we're not even returning the same object that the private field exists in, but don't see a huge benefit as you can't access the field directly either way.</p>
javascript
[3]
5,547,125
5,547,126
Java: how to write formatted output to plain text file
<p>I am developing a small java application. At some point i am writing some data in a plain text file. Using the following code:</p> <pre><code>Writer Candidateoutput = null; File Candidatefile = new File("Candidates.txt"), Candidateoutput = new BufferedWriter(new FileWriter(Candidatefile)); Candidateoutput.write("\n Write this text on next line"); Candidateoutput.write("\t This is indented text"); Candidateoutput.close(); </code></pre> <p>Now every thing goes fine, the file is created with the expected text. The only problem is that the text was not formatted all the text was on single line. But if I copy and paste the text in MS Word then the text is formatted automatically.</p> <p>Is there any way to preserver text formatting in Plain text file as well?</p> <p>Note: By text formatting I am referring to <code>\n</code> and <code>\t</code> only</p>
java
[1]
4,467,174
4,467,175
List<T> to IEnumerable<T> problem in interface
<pre><code>namespace WpfApplication3 { public class Hex { public String terr; } public class HexC : Hex { int Cfield; } public interface IHexGrid { IEnumerable&lt;Hex&gt; hexs { get; } } public class hexGrid : IHexGrid //error CS0738: 'WpfApplication3.hexGrid' does not { public List&lt;Hex&gt; hexs { get; set; } } public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); List&lt;HexC&gt; hexList1 = new List&lt;HexC&gt;(); genmethod(hexList1); //but this compiles fine } void genmethod(IEnumerable&lt;Hex&gt; hexList) { string str1; foreach (Hex hex in hexList) str1 = hex.terr; } } } </code></pre> <p>The full error message is: 'WpfApplication3.hexGrid' does not implement interface member 'WpfApplication3.IHexGrid.hexs'. 'WpfApplication3.hexGrid.hexs' cannot implement 'WpfApplication3.IHexGrid.hexs' because it does not have the matching return type of 'System.Collections.Generic.IEnumerable'.</p> <p>Why doesn't List implicitly cast to IEnumerable above? Thanks in advance!</p>
c#
[0]
1,291,541
1,291,542
Change "HUE" of an image with PHP GD Library?
<p>I'd like to change the "hue" of an image using the PHP image processing functions. Which is the correct filter to apply?</p> <p>Note: I'm from a photoshop background, so in the event my interpretation of "hue" is different from others, here's what I mean...</p> <p>In photoshop, you can use the "Hue" filter to change the color of an image without actually affecting the design of the image.</p> <p>I'm currently using the function below to recolor my images, but the function fails to meet my needs due to the fact that it completely repaints the image, losing the design.</p> <pre><code> function set_theme_color_header($hex) { $info = hexToRGB($hex); //utility function that converts hex to rgb $token = "header.gif"; $img = imagecreatefromgif("header-template.gif"; $color = imagecolorallocate($img, $info["red"], $info["green"], $info["blue"]); imagecolorset($img, 0, $info["red"], $info["green"], $info["blue"]); imagegif($img, $token); } ?&gt; </code></pre>
php
[2]
402,961
402,962
if statement not working with database
<p>Why isn't this code working?</p> <pre><code>$welcome = mysql_query("SELECT welcome FROM users WHERE id = '" . $_SESSION['user']['id'] . "'"); if($welcome == '0') { echo 'register is 0'; } else { echo 'register is 1'; } </code></pre> <p><code>$_SESSION['user']['id']</code> returns as 1, by the way.</p>
php
[2]
3,033,913
3,033,914
JavaScript functions not defined?
<p>For some reason, Firefox is throwing "function not defined" errors at this piece of JS:</p> <pre><code> $(function() { // on document ready function updateAlerts() { $.ajax({ url : "/check.php", type : "POST", data : { method : 'checkAlerts' }, success : function(data, textStatus, XMLHttpRequest) { var response = $.parseJSON(data); // Update the DOM to show the new alerts! if (response.friendRequests &gt; 0) { // update the number in the DOM and make sure it is visible... $('#notifications').show().text(response.friendRequests); } else { // Hide the number, since there are no pending friend requests or messages var ablanknum = '0'; $('#notifications').show().text(ablanknum); } } }); } function friendRequestAlert() { $.ajax({ url : "/check.php", type : "POST", data : { method : 'sendFriendAlert' }, success : function(data, textStatus, XMLHttpRequest) { var response = $.parseJSON(data); if (response.theFRAlert !== '0') { // Display our fancy Javascript notification. $.jgrowl('' + response.theFRAlert + ''); } } }); } function messageAlert() { $.ajax({ url : "/check.php", type : "POST", data : { method : 'sendMessageAlert' }, success : function(data, textStatus, XMLHttpRequest) { var response = $.parseJSON(data); if (response.theAlert !== '0') { // Display our fancy Javascript notification. $.jgrowl('' + response.theAlert + ''); $('#therearemessages').show().text(response.theAlert); } } }); } }); </code></pre> <p>I checked through my code and nothing seems to be wrong. </p>
javascript
[3]
2,121,588
2,121,589
iphone/android vpn
<p>I have a question about the native application and vpn on iphone and android. If I setup a vpn for only certain urls and not route all the traffic through vpn. In this setup, would a native application that is accessing the url, gets it traffic routed too? I would assume so but thought if there are gotchas. </p> <p>Please suggest for both android and ios. </p>
android
[4]