Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
3,906,052
3,906,053
Check if class is present w/jQuery
<p>Is it possible to check if a certain class is present in an element and if yes, create a variable for my function? </p> <pre><code>&lt;a href="#" id="clickMe"&gt;&lt;span class="A open"&gt;&lt;/span&gt;link&lt;/a&gt; </code></pre> <p>For example if class open is present I will create a varialbe "close".</p> <pre><code>$(function () { $('#clickMe').click(function () { // if "open" var myVar = 'close'; // else var myVar = 'open'; }); }); </code></pre>
jquery
[5]
3,440,929
3,440,930
Can I transfer the session value from one browser to another?
<p>I need to transfer the session value in one browser to another browser in my web site</p> <p>For example from Firefox to Google Chrome </p>
php
[2]
622,454
622,455
request error Error Domain=SKErrorDomain Code=0 "Operation could not be completed. (SKErrorDomain error 0.)"
<p>HI all,</p> <p>I am working on IN App purchase,storkit.</p> <p>i am getting this error.</p> <p>"request error Error Domain=SKErrorDomain Code=0 "Operation could not be completed. (SKErrorDomain error 0.)""</p> <p>what does this means????</p> <p>looking for a quick reply.</p> <p>regards shishir</p>
iphone
[8]
1,681,209
1,681,210
Adding similar jQuery behavior to a range of elements
<p>I have added the following behavior to a range of divs.</p> <pre><code>$("div#_FIRST_Menu").click(function () { ... $("div#_FIRST_Content").toggleClass("property1 property2"); }); $("div#_SECOND_Menu").click(function () { ... $("div#_SECOND_Content").toggleClass("property1 property2"); }); </code></pre> <p>Now that the solution works as supposed to i can unleash my passion for code hygiene. The immediate question, the answer to which i can't really see is how to go about {see title here}. I'd like to perform something along the lines of this.</p> <pre><code>$("div#_" + MAGIC_MARKER + "_Menu").click(function () { ... $("div#" + MAGIC_MARKER+ "Content").toggleClass("property1 property2"); }); </code></pre> <p>That way i would be able to neatly compact the code, still keeping it readable. Suggestions?</p>
jquery
[5]
5,964,068
5,964,069
ASP.NET HttpRequest Validation Exceptions
<p>I've read the ASP.NET security principles</p> <p><a href="http://msdn.microsoft.com/en-us/library/ff647397.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ff647397.aspx</a></p> <p>While not a security problem, when a user enters an HTML code then it displays an error page. What are the design patterns/ways around them getting the custom error page? Is it required I HTML encode everything? </p> <p>I have, for example, a password field where I've not been encoding that field. Is there a way to check for any HTML code and return an error? Or just to catch this exception. </p> <p>Somehow throwing up an error page doesn't seem like the best solution but not sure what would be.</p>
asp.net
[9]
2,183,723
2,183,724
Get other user locations
<p>we are developing an android application for our thesis</p> <p>my questions:</p> <p>1) how could we make the application detect other users that are using the app? 2) how could we display the location of the users on the map?</p> <p>Can anyone give us necessary codes?</p> <p>we would be very thankful thanks :D </p>
android
[4]
5,320,646
5,320,647
JavaScript Q. Works in FF&Safari, not IE7 or IE8
<p>I have the following line of code:</p> <pre><code>&lt;li&gt; &lt;label for="q2-1" onclick="setActive(this.id, 'question2-1-input');" id="q2-1-label"&gt;&lt;input disabled="disabled" type="checkbox" name="question2" id="question2-1-input" value="1" /&gt;Opinions&lt;/label&gt; &lt;/li&gt; </code></pre> <p>which calls:</p> <pre><code>function setActive(questionID, questionIDinput) { alert('setActive'); } </code></pre> <p>The above code works great in FF &amp; Safari but not in IE. Is something above not IE friendly?</p> <p>Thanks</p>
javascript
[3]
4,550,619
4,550,620
Android: why is my OnKeyListener() not called?
<p>I defined an EditText-field and I want to be informed when the user edits that fields. So I thought: simple - I add an OnKeyListener and so I did. But even though the text field gets edited (and even displays the entered/modified text) I don't get any callback, i.e. the LOG-output doesn't show up. </p> <pre><code> TextView text = new TextView(this); text.setText(...); ... text.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { TextView tv = (TextView)v; CharSequence val = tv.getText(); Log.v(TAG, "value: " + val); // ... rest omitted for brevity } }); </code></pre> <p>Any idea, why that callback is never called?</p> <p>Michael</p> <p>PS.: Sigh! Android is really full of oddities! It seems that almost nothing I touched so far worked immediatly as one would expect. And - believe it or not - I have LOTS of experience with GUIs, esp. in Java (AWT, Swing, SWT, you name it...) But Android is a really tough beast!</p>
android
[4]
2,288,160
2,288,161
Java/Javascript for website development
<p>Is java or javascript a better language when coding a website emphasizing human computer interactions?</p>
java
[1]
4,921,693
4,921,694
#define mockable virtual in C++
<p>I found this code:</p> <p><code>#define mockable virtual</code></p> <p>Do you have any idea why somebody will define virtual like this? I'm just curios what's the point of doing this</p>
c++
[6]
1,632,001
1,632,002
TreeMap that contains String as key and a boolean as value?
<p>Hello I tried to create a TreeMap in Java but the compiler gives the error saying "unexpected type". Can anyone tell me why? Isn't possible to have primitive data types in a Map?</p> <p>I did solve it by using the java.lang.Boolean instead. But I don't understand why I can't mix a complex data type with a primitive one.</p>
java
[1]
2,396,124
2,396,125
Have occured error in the following given code in the below website
<p><a href="https://developers.facebook.com/docs/mobile/android/build/" rel="nofollow">https://developers.facebook.com/docs/mobile/android/build/</a></p> <p>Have occurred error in the following given code in the below website </p> <pre><code> package com.greatapp; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import com.facebook.android.*; import com.facebook.android.Facebook.*; public class MyGreatActivity extends Activity { Facebook facebook = new Facebook("YOUR_APP_ID"); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); &lt;i&gt; setContentView(R.layout.main); &lt; i&gt; I have gotten error here facebook.authorize(this, new DialogListener() { @Override public void onComplete(Bundle values) {} @Override public void onFacebookError(FacebookError error) {} @Override public void onError(DialogError e) {} @Override public void onCancel() {} }); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); facebook.authorizeCallback(requestCode, resultCode, data); } } </code></pre> <p><code>setContentView(R.layout.main);</code> The error tells us to create a field <code>main</code> in type <code>layout</code>. I tried it but <code>R.java</code> file cannot be modified manually. How can I solve this error?</p>
android
[4]
2,308,340
2,308,341
Updating a comma delimited string list in c#
<p>I have a comma delimited string list that looks something like this:</p> <pre><code>Cat, Animal, 2 Dog, Animal, 3 Luke, Human, 1 Owl, Animal, 0 </code></pre> <p>Now i want to search the list, Find all string elements with animal in them and add one to their number. So in the end of my query the list would look like:</p> <pre><code>Cat, Animal, 3 Dog, Animal, 4 Luke, Human, 1 Owl, Animal, 1 </code></pre> <p>How can i achieve this functionality? I was thinking of using a LINQ query to get all the entries that contain animal and then getting the index of each element in the list, getting all the tokens in each element by using a comma split, parsing the third token into an integer, incrementing by one and rewriting the element at the previously saved index to update the count. This is probably the least efficient method so can anyone suggest a fast, short and sweet solution to this?</p> <p>Thanks</p>
c#
[0]
4,059,512
4,059,513
streching spinner icon
<p>when i am using my own background theme for spinner it is stretching icon.</p> <p><img src="http://i.stack.imgur.com/ssaAe.png" alt="enter image description here"></p> <p>my spinner code is :</p> <pre><code>&lt;Spinner android:id="@+id/spinnerCategory" style="@style/spinner" android:entries="@array/category_array" android:prompt="@string/category_prompt" android:background="@drawable/spinner" /&gt; </code></pre> <p>my spinner.xml is:</p> <pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_window_focused="false" android:state_enabled="true" android:drawable="@drawable/btn_dropdown_normal" /&gt; &lt;item android:state_pressed="true" android:drawable="@drawable/btn_dropdown_pressed" /&gt; &lt;item android:state_focused="true" android:state_enabled="true" android:drawable="@drawable/btn_dropdown_selected" /&gt; &lt;item android:state_enabled="true" android:drawable="@drawable/btn_dropdown_normal" /&gt; &lt;/selector&gt; </code></pre> <p>and images i copied from the sdk 4.</p> <p>so kindly help me out. how can i stop spinner icon stretching. </p>
android
[4]
2,746,845
2,746,846
google python exercises
<p>I'm watching the instructional videos on you youtube and started doing some of the exercises at <a href="http://code.google.com/edu/languages/google-python-class" rel="nofollow">http://code.google.com/edu/languages/google-python-class</a> but I'm puzzled by the below problem in the string1.py file. What I can't seem to understand is, what is the "s" in both_ends(s): doing?</p> <pre><code># B. both_ends # Given a string s, return a string made of the first 2 # and the last 2 chars of the original string, # so 'spring' yields 'spng'. However, if the string length # is less than 2, return instead the empty string. def both_ends(s): # +++your code here+++ # LAB(begin solution) if len(s) &lt; 2: return '' first2 = s[0:2] last2 = s[-2:] return first2 + last2 </code></pre> <p>At the bottom of strings1.py there are some functions:</p> <pre><code>def main() print 'both_ends' test(both_ends('spring'), 'spng') if __name__ == '__main__': main() </code></pre> <p>So how does the program know to substitute "spring" for (s) or is that not what it's doing? I can post the entire file if need be. It's only 140 lines.</p>
python
[7]
3,872,937
3,872,938
Dive into python and-or fail
<p>I am stuck at this particular example from dive into python</p> <p><strong>Example 4.18. When the and−or Trick Fails</strong></p> <pre><code>&gt;&gt;&gt;&gt;a = "" &gt;&gt;&gt;&gt;b = "second" &gt;&gt;&gt;1 and a or b &gt;&gt;&gt;&gt;'second' </code></pre> <p><strong>Since a is an empty string, which Python considers false in a boolean context, 1 and '' evalutes to '', and then '' or 'second' evalutes to 'second'. Oops! That's not what you wanted. The and−or trick, bool and a or b, will not work like the C expression bool ? a : b when a is false in a boolean context.</strong></p> <p>Why does it says it isn't what the user wants, I mean 1 and "" would evaluate to False, while "" or b will evaluate to "second", that's perfectly what should happen, I don't understand why is it wrong?am I missing something?</p>
python
[7]
2,360,655
2,360,656
Reflection and having to rebuild solution C#
<p>I use reflection on a class to get it's custom attributes. I have noticed that when I modify the class's attributes, I need to rebuild the entire solution before reflection gives me the new values.</p> <p>It appears that rebuilding the project does not do the trick. Is this because the metadata is cached?</p>
c#
[0]
92,251
92,252
table schema to datatable c#
<p>How do I read a schema into datatable in c#</p> <pre><code>&lt;header&gt; &lt;xs:schema id="header" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"&gt; &lt;xs:element name="header" msdata:IsDataSet="true" msdata:MainDataTable="Table" msdata:UseCurrentLocale="true"&gt; &lt;xs:complexType&gt; &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt; &lt;xs:element name="Table"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="id" type="xs:int" minOccurs="0" /&gt; &lt;xs:element name="enteredon" type="xs:dateTime" minOccurs="0" /&gt; &lt;xs:element name="enteredby" type="xs:string" minOccurs="0" /&gt; &lt;xs:element name="remark" type="xs:string" minOccurs="0" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:choice&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:schema&gt; &lt;/header&gt; </code></pre> <p>Trying this code but fails:</p> <pre><code> public static Stream StringToStream(string data) { try { System.IO.MemoryStream xmlStream = new System.IO.MemoryStream(); StreamWriter writer = new StreamWriter(xmlStream); writer.Write(data); writer.Flush(); return xmlStream; } catch (Exception) { return null; } } table.ReadXmlSchema(StringToStream(saveData)); </code></pre>
c#
[0]
297,442
297,443
Error while entering text in PopupWindow EditText
<p>I am facing a strange issue in my android app. I have created a app where I have a popup window. In the popup window I have several EditText and few buttons. When I am entering text into the PopupWindow edittext in the emulator, it is working absolutlely okay.</p> <p>But when I am doing the same in the real device, it is throwing error. </p> <p>Please help</p>
android
[4]
2,926,038
2,926,039
When is a JavaScript String not a string?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/10951906/why-does-foo-new-stringfoo-evaluate-to-false-in-javascript">Why does (&ldquo;foo&rdquo; === new String(&ldquo;foo&rdquo;)) evaluate to false in JavaScript?</a> </p> </blockquote> <p>Over <a href="http://stackoverflow.com/questions/3586775/javascript-string-equality-whats-the-correct-way">here</a> I caught the advice that it's best to use non type-coercive string comparison, but in Chrome, I discovered something kind of odd:</p> <pre><code>var t1 = String("Hello world!"); var t2 = new String("Hello world!"); var b1 = (t1==t2); // true var b2 = (t1===t2); // false </code></pre> <p>Is this standard behavior? If so, what are the respective types of t1 and t2? Thanks.</p>
javascript
[3]
845,222
845,223
Showing dynamically generated bitmap in ASP.NET page
<p>I need to create some block diagrams on my ASP.NET page. Is it best done by drawing on <a href="http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.aspx" rel="nofollow"><code>Bitmap</code></a>? How to display this dynamically generated <code>Bitmap</code> object?</p>
asp.net
[9]
4,169,714
4,169,715
problem with laoding image at run time in asp.net
<p>I'm having an image that i have added to the image folder in app_data folder of my application. now problem is that it's showing the image at design time but at runtime it don't show.now if page is postback now it shows the image.</p> <p>what's the prob with this.?</p>
asp.net
[9]
5,326,296
5,326,297
Remove/add value onfocus/onblur if empty in jquery, input field
<p>I know there exists many questions about this, but I dont know what to search.</p> <p>I have a email field, and I want it to have "Write your email here" and when you click/do onfocus it should disappear. Although if you did not write something and go onblur it should appear again.</p>
jquery
[5]
2,939,733
2,939,734
Can I pass a value out of a javascript function?
<p>Can I pass a value out of a javascript function and back to the calling function, e.g.</p> <pre><code>function updateURL(url, name, param) { url = url + "&amp;" + name + "=" + param; } </code></pre> <p>I want to update url and return the new value.</p> <p>Is this possible?</p>
javascript
[3]
3,916,421
3,916,422
Native JavaScript equivilent of text() for single selected element
<p>How would I return <code>Some Text</code>, <code>&lt;a href="abc.html"&gt;Some Anchor&lt;/a&gt;</code>, and <code>&lt;img src="abc.jpg" /&gt;</code> from the following three elements without using jQuery? In other words, how would I return <code>$('#t1).text()</code>, <code>$('#t2).text()</code>, <code>$('#t3).text()</code> without using jQuery? I don't need to return an array if multiple elements as I will only select one element at a time.</p> <pre><code>&lt;td id="t1"&gt;Some Text&lt;/td&gt; &lt;td id="t2"&gt;&lt;a href="abc.html"&gt;Some Anchor&lt;/a&gt;&lt;/td&gt; &lt;td id="t3"&gt;&lt;img src="abc.jpg" /&gt;&lt;td&gt; </code></pre> <p>jQuery does text() as follows. It seems overkill since I am not worried about returning an array for multiple elements.</p> <pre><code>text: function( value ) { return jQuery.access( this, function( value ) { return value === undefined ? jQuery.text( this ) : this.empty().append( ( this[0] &amp;&amp; this[0].ownerDocument || document ).createTextNode( value ) ); }, null, value, arguments.length ); }, </code></pre> <p>Thanks</p>
javascript
[3]
357,596
357,597
Set favicon to bookmarked button in bookmark toolbar
<p>I have an major query that</p> <p><a href="http://www.techmodi.com/demo/starkived/info/how-to-use/" rel="nofollow">http://www.techmodi.com/demo/starkived/info/how-to-use/</a></p> <p>this is my link from where I have drag "starkive" button to bookmark toolbar but this button does not show my website favicon with "starkive" text.</p> <p>I have used following code to drag this button to bookmark toolbar</p> <pre><code> /* &lt;a title="Starkive" href="{literal}javascript:void((function(){var e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','{/literal}{$siteroot}{literal}/includes/js/starit.js?r='+Math.random()*99999999);document.body.appendChild(e)})());{/literal}" onClick="alert('Drag &amp; drop this button into your browser toolbar to save &amp; share'); return false;"&gt;starkive&lt;/a&gt; */ </code></pre>
javascript
[3]
1,571,878
1,571,879
jQuery: Using the attr with custom attributes
<p>Right now I'm doing various invalid things like:</p> <pre><code>&lt;span time="50" distance="60"&gt;&lt;/span&gt; </code></pre> <p>And then grabbing that info with:</p> <pre><code>var time = $('span').attr('time'); var distance = $('span').attr('distance'); </code></pre> <p>And then doing various things with the time and distance in jS/jQuery.</p> <p>To me, this feels wrong. It's insemantic, but I really can't care less about that (actual data is not time and distance but something quite worthless and page specific, nothing that SEs are interested in). But is there some other reason why this is a bad idea?</p> <p>I know there's a metadata plugin which does something similar in a more 'official' way, and I thought about using it. But this .attr stuff is suitable for my needs and I don't see any compelling reason to use the plugin.</p> <p>So basically, is this a decent pattern to use, and if not, why not, and should I be interested in the metadata plugin.</p> <p>Thanks.</p>
jquery
[5]
5,721,351
5,721,352
c++ struct OO vs class OO
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/92859/what-are-the-differences-between-struct-and-class-in-c">What are the differences between struct and class in C++</a><br> <a href="http://stackoverflow.com/questions/3432372/class-and-struct-in-c">class and struct in c++</a> </p> </blockquote> <p>It looks like that struct can has constructor and destructor and members, and looks very simple, so can we use struct instead class, if not, when shall we use struct with functions when shall we use class ?</p> <p><a href="https://github.com/developmentseed/node-sqlite3/blob/master/src/database.h#L32" rel="nofollow">https://github.com/developmentseed/node-sqlite3/blob/master/src/database.h#L32</a></p> <pre><code>struct Baton { uv_work_t request; Database* db; Persistent&lt;Function&gt; callback; int status; std::string message; Baton(Database* db_, Handle&lt;Function&gt; cb_) : db(db_), status(SQLITE_OK) { db-&gt;Ref(); uv_ref(uv_default_loop()); request.data = this; callback = Persistent&lt;Function&gt;::New(cb_); } virtual ~Baton() { db-&gt;Unref(); uv_unref(uv_default_loop()); callback.Dispose(); } }; struct OpenBaton : Baton { std::string filename; int mode; OpenBaton(Database* db_, Handle&lt;Function&gt; cb_, const char* filename_, int mode_) : Baton(db_, cb_), filename(filename_), mode(mode_) {} }; </code></pre>
c++
[6]
302,892
302,893
jQuery vertical itoggle switch?
<p>I was wondering if it was possible to have a vertical jquery switch like the <a href="http://labs.engageinteractive.co.uk/itoggle/" rel="nofollow">itoggle</a> instead of horizontal.</p> <p>Anyone know of any resource or code snippet?</p> <p>Thankyou</p>
jquery
[5]
1,436,158
1,436,159
iphone URL Scheme image upload app
<p>I have developed an application to upload image captured from camera to server. I registered this app to URL Scheme so that i can access camera from web app.</p> <p>I can able to launch the app from web app but do not know how to go back to the web page from where i launched the app.</p> <p>Please help me</p>
iphone
[8]
854,551
854,552
posting url with string parameter that contains LINE BREAKS using java
<p>i want to sent SMS from my JAVA APPLICATION in the following format:<br> NAME: Customer Name<br> ConfNO: 1234<br> Date: 2012-05-15<br> NoOfPax: Seven<br> Since i am using external sms gateway i need to post it as URL from the application. When i recive the SMS i dont see line breaks instead the text display \n. Please help.My Code is </p> <pre><code>String senderid = "SMSALERT"; String to = "97112345678"; String text = "Reservation INFO\nName:Customer Name\nConfNO: KN1234\nTime: 12:00PM\n#Pax:5\nThank You for Choosing US"; String type = "text"; String ppgHost = "www.yahoo.com"; String username = "username"; String password = "password"; String datetime = "2012-05-15 12:00:00"; String path = "index.php"; try { HttpClient httpClient = new DefaultHttpClient(); List&lt;NameValuePair&gt; qparams = new ArrayList&lt;NameValuePair&gt;(); qparams.add(new BasicNameValuePair("username", username)); qparams.add(new BasicNameValuePair("password", password)); qparams.add(new BasicNameValuePair("senderid", senderid)); qparams.add(new BasicNameValuePair("to", to)); qparams.add(new BasicNameValuePair("text", text)); qparams.add(new BasicNameValuePair("type", type)); qparams.add(new BasicNameValuePair("datetime", datetime)); URI uri = URIUtils.createURI("http", ppgHost, -1, path, URLEncodedUtils.format(qparams, "UTF-8"), null); HttpPost httppost = new HttpPost(uri); System.out.println(httppost.getURI()); HttpResponse response = httpClient.execute(httppost); System.out.println(response.getStatusLine()); </code></pre>
java
[1]
3,734,072
3,734,073
I am using this code in php which show
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4524698/php-cannot-modify-header-information">PHP - Cannot modify header information&hellip;</a> </p> </blockquote> <blockquote> <p>error: Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\VertrigoServ\www\alok\cookies\Time\session.php:5) in C:\Program Files\VertrigoServ\www\alok\cookies\Time\session.php on line 8</p> </blockquote> <pre><code>&lt;?php session_start(); $inactive = 10; $session_life = time() - $_SESSION['timeout']; echo "$session_life"; if($session_life &gt; $inactive){ session_destroy(); header("Location: logout.php"); } $_SESSION['timeout']=time(); ?&gt; </code></pre>
php
[2]
108,601
108,602
Get Substring - everything before certain char
<p>I'm trying to figure out the best way to get everything before the - character in a string. Some example strings are below. The length of the string before - varies and can be any length</p> <pre><code>223232-1.jpg 443-2.jpg 34443553-5.jpg </code></pre> <p>so I need the value that's from the start index of 0 to right before -. So the substrings would turn out to be 223232, 443, and 34443553</p>
c#
[0]
3,241,351
3,241,352
Update Panel and AJAX Timer - Removing all controls on each Tick event
<p>I have an ASP.NET UpdatePanel Triggered to refresh based on the Tick event of a Timer.</p> <p>The page parses a custom XML file and inserts UserControls (containing GridViews) on the fly. This is executed from the <code>Page_Load</code> method.</p> <pre><code>if(!Page.IsPostBack) parseXmlFile(); </code></pre> <p>The first time the page loads, all the controls are displayed as expected. The problem is that the first time the timer <code>Tick</code> event is fired, all the UserControls disappear.</p> <p>In the <code>Tick</code> event I call a custom method <code>RefreshData()</code> which in turn rebinds the data to the GridView via an SqlDataSource.</p> <pre><code> public void RefreshData() { GridView1.DataBind(); ... </code></pre> <p>Maybe I don't understand how AJAX works in ASP.NET. </p> <p>I only want to parse the XML file once (which creates all the UserControls in the page). From this point I just want to refresh the data contained in the GridView and change the Visibility state of the GridView.</p>
asp.net
[9]
700,777
700,778
Prevent function overriding in Python
<p>Is there any way I can prevent a child class from overriding a method in the base class?</p> <p>My guess is that there is not, but I'm coming from the .NET world, and I'm trying to make my API as robust as possible, so any input is greatly appreciated.</p> <pre><code>class Parent: def do_something(self): '''This is where some seriously important stuff goes on''' pass class Child(Parent): def do_something(self): '''This should not be allowed.''' pass </code></pre> <p>Is it possible to enforce this? I know the compiler won't help, so maybe by means of some runtime check? Or is it just not a pythonic way of going about things?</p>
python
[7]
170,157
170,158
How to bind event to hide menu
<p>I have created a small plugin to show a dropdown menu when a div is clicked.</p> <p>Below is the code to get it to work</p> <pre><code>$('#clickable_div').click(function() { $('#nav_menu').showMenu({ parent:'#clickable_div' }); }); </code></pre> <p>Jsfiddle with the plugin : <a href="http://jsfiddle.net/HtNK3/" rel="nofollow">http://jsfiddle.net/HtNK3/</a></p> <p>So now basically i want to add a functionality where i need to hide the dropdown div when user clicks anywhere in the document but not on the dropdown div which is open</p> <p>How can this be achieved ? </p>
jquery
[5]
3,944,019
3,944,020
Python TurtleGraphics - Making a randomly moving turtle?
<p>I'm trying to create a randomly moving turtle here by following these steps in a function I've called drunk_turtle():</p> <p>Repeat the following as many times as you like:</p> <ul> <li>Randomly choose an integer, called rand_num, from -1 to 1 (i.e. randomly set rand_num to be -1, 0, or 1)</li> <li>Make the turtle turn right rand_num * 90 degrees;</li> <li>Go forward 5, 10, or 15 --- choose this value at random. 5 = 1*5, 10 = 2*5, 15 = 3*5, ...</li> </ul> <p>How do I make code that does this? I don't really get how to get my random integer or get it to pick randomly 5, 10, or 15. Any help is appreciated. Thanks!</p>
python
[7]
1,546,798
1,546,799
Converting Text to Image
<p>How to Convert Text to Image and show in UIImageview. Can anyone know the conversion from Text to Image?</p>
iphone
[8]
2,902,162
2,902,163
android viewPager implementation
<p>My Task is to make clean scroll right to another screen then press on icon and show popup, I want to use <code>ViewPager</code> to make clean scroll right(swipe) between two pages, and then use <code>Dialog</code> to show the popup, I couldn't find any working sample on how to implement <code>ViewPager</code> between two layouts, someone has working sample??<br> Thanks. David</p>
android
[4]
3,140,969
3,140,970
Insert information in two tables with one mysql query in PHP
<p>I am integrating my website with a forum. So basically when a users registers through my main website, i must insert the account information in my users table and the forum's users table. However there is a slight chance, that the first query may fail, thus leaving one table empty of information, while the other has it.</p> <p>If i can insert the information in both tables with one query, should it fail nothing will be added to the DB</p>
php
[2]
4,817,817
4,817,818
Counting backwards
<p>I've got a list organized like this :</p> <pre><code>[('down', 0.0098000000000000309), ('up', 0.0015000000000000568), ('down', 0.008900000000000019), ('down', 0.023300000000000098), ('down', 0.011599999999999944), ('down', 0.0027000000000000357), ('up', 0.0023999999999999577), ('up', 0.0065000000000000613), ('down', 0.0057000000000000384), ('down', 0.018400000000000083), ('up', 0.009300000000000086), ('down', 0.0038000000000000256), ('down', 0.00050000000000005596), ('up', 0.0082000000000000961), ..... </code></pre> <p>What would be the best way to "compare backwards?" , basically I want to return "yes" ( or whatever .. ) IF we`ve got a series of 2 "downs" followed by one "up" AND the second value is inferior to 0.0095 .</p> <p>I hope he makes sense ..</p>
python
[7]
3,296,762
3,296,763
jquery loop links
<p>i have a php-loop that generates different results from the database, so my output might look like this:</p> <pre><code>&lt;a href="blablabla"&gt;blabla&lt;/a&gt; &lt;a href="blablabla"&gt;blabla&lt;/a&gt; &lt;a href="blablabla"&gt;blabla&lt;/a&gt; &lt;a href="blablabla"&gt;blabla&lt;/a&gt; &lt;a href="blablabla"&gt;blabla&lt;/a&gt; &lt;a href="blablabla"&gt;blabla&lt;/a&gt; </code></pre> <p>Now, I know how to get a clicked element by #id or .class but I don't know (and havent found) how to get a clicked link. (I wont to show the content of it's link in an other div. Do you have a solution?</p>
jquery
[5]
1,370,834
1,370,835
Help understanding javascript convention
<p>I see JQuery plug-ins and other javascript library documents set up like this:</p> <pre><code>(function($,window,undefined){ ...plug-in code... }); </code></pre> <p>Why is it necessary to wrap the script in a function, and what args does can that function receive?</p>
javascript
[3]
437,469
437,470
OnMouseOver effect in JavaScript
<p>I'm trying to do a Cool OnMouseOver effect incorporating JavaScript in my HTML file. I have a picture with a map. I have about 7 different areas inside that map. I would like to add an OnMouseOver effect to each of those areas so that they can zoom in smoothly. Somebody knows how may I achieve this? Thank you very much!!</p> <p>-Diego.</p>
javascript
[3]
4,434,029
4,434,030
Most Pythonic way of creating an infinite loop with a 'while' statement
<p>Which one is the pythonic way of below two expressions. </p> <pre><code>1. while 1: 2. while True: </code></pre> <p>edit:Is there a pythonic way out of two above expressions?</p>
python
[7]
4,410,490
4,410,491
How to find the number of times a specific day of the week occurs during a given time period
<p>I am trying to handle groups which meet either once a week, twice a month or once a month - on any day of the week. I would like to calculate the number of occurrences any given configuration would generate for a given time frame. </p> <p>For example, say a group meets every Friday, from Jan 1 to June 30, how many times would they meet? Or, if a group meets on Tuesday every other week, from Jan 1 to June 30, how many times would they meet? Etc.</p> <p>Is this possible in php? I'm not seeing a solution in the <a href="http://www.php.net/manual/en/class.dateinterval.php" rel="nofollow">DateInterval manual</a>.</p> <p>Thank you for any help. </p>
php
[2]
2,262,274
2,262,275
How to avoid cursor issue?
<p>I have created one form.When I running the form,every where it is(including text also) showing hand instead of arrow(other than textbox).What shall I do to avoid this?</p>
asp.net
[9]
634,754
634,755
How to use StringBuilder properly instead of an excessively long method
<p>I'm wondering how I can use the <code>StringBuilder</code> properly because my current method (<a href="http://pastebin.com/VHjM0KeQ" rel="nofollow">http://pastebin.com/VHjM0KeQ</a>) is way too long, I'm sure I can do a loop or a string builder I'm just not sure how to, thanks.</p>
java
[1]
2,581,785
2,581,786
How to add html tag and page number automatically using jquery
<p>I am using a slideshow that automatically generates button links for every slide that is added to it. I needed the code to also add (slide number) into each button and I was wondering how I would be able to do this</p>
jquery
[5]
913,373
913,374
Android: What type should I give to AdapterView's parameter?
<p>I have an OnItemClickListener to my ListView like this:</p> <pre><code>OnItemClickListener myClickHandler = new OnItemClickListener(){ public void onItemClick(AdapterView parent, View v, int position, long id){ ... } } </code></pre> <p>However Eclipse is giving me the following warning:</p> <p>"AdapterView is a raw type. References to generic type AdapterView should be parameterized."</p> <p>I can't find the right type to put in the parameter, though. </p> <p>Any clues other than disable generics warnings?</p>
android
[4]
4,327,696
4,327,697
Android Preferred Storage
<p>We are developing an application in android,We have to save some lists and data to be used by application.We have saved it in sqlite and we use that data by using cursor.</p> <p>Now my question :</p> <p>What is more efficient to store data in we should continue with sqlite or to store data on strings.xml or we should use shared preferences ??</p>
android
[4]
1,121,314
1,121,315
How to know if an app is downloaded for first time or many times from market?
<p>I am placing an app for free in the Market. I want to restrict the downloads (i.e only 1 download per account). If the person uninstalls my app and tries to download again and re-install it with same gmail account, I want to restrict it.</p> <p>Is that possible? Please help. I am stuck here. Thanks in advance!</p>
android
[4]
5,828,508
5,828,509
Why doesn't the shorthand arithmetic operator ++ after the variable name return 2 in the following statement?
<p>I have a very simple arithmetic operator but am at my wits end why it doesn't return 2. The code below returns 1. I thought that x++ equates to x = x + 1;</p> <p><strong>CODE</strong></p> <pre><code>var x = 1; document.write(x++); </code></pre> <p>However if I run the code as follows, it returns 2 as expected</p> <p><strong>CODE</strong></p> <pre><code>var x = 1; document.write(++x); </code></pre> <p>What am I doing wrong?</p>
javascript
[3]
3,016,160
3,016,161
Create variable names on demand
<p>I'm trying to code a console minigame (for fun), and I need to create a map(graph) with a predefined number of rooms(vertices).</p> <p>I'd like to define a <code>class room</code> and create instances of that class that will be assigned to variable names like <code>room_1</code>, <code>room_2</code> and so on.</p> <p>My problem is, that I don't know how to create these variable names. To cut a long story short, I need a tool/tip/trick to create preformated variable names on demand.</p> <p>F.i let's say that <code>MAX_R=5</code>, then I'll need variables <code>room_1</code> to <code>room_5</code>. Any ideas?</p>
python
[7]
2,336,757
2,336,758
how to get the match strings(either special characters(like +-=.etc) or string(a-z letters) on the given values.
<p>i have here a pure java code, this one gives me an output of "Special Characters are: java.util.regex.Matcher[pattern=[\p{Punct}&amp;&amp;[^_]]+ region=0,8 lastmatch=&amp;&amp;=+-]" as i compile &amp; run, but i want only to have an output of "Special Characters are: &amp;&amp;=+-" based on my given value. and also the same with strings as "strings are: sam" but dont know how to do this, pls help... i used netbeans ide</p> <pre><code> import java.util.regex.Matcher; import java.util.regex.Pattern; class SubstringsOfAString { public static void main(String args[]) { String sample = "sam&amp;&amp;=+-"; Pattern p = Pattern.compile("[\\p{Punct}&amp;&amp;[^_]]+"); Matcher m = p.matcher(sample); boolean b = m.find(); if(b == true) { System.out.println("Special Characters are: " + m ); } else { System.out.println("Nothing" ); } } } </code></pre>
java
[1]
1,132,414
1,132,415
What's that feature of PHP with a section of html/text closed off with start/end functions?
<p>What's that feature of PHP where you have, say a "start" bit of code, then some html or text that would normally send to the browser, then a bit of code to "end" it?</p> <p>For example,</p> <pre><code>&lt;? start_something(); ?&gt; &lt;html&gt;some html&lt;/html&gt; &lt;? end_something(); ?&gt; </code></pre> <p>Yes, this is a built-in feature of php and I am sure of it, but I cannot remember what it's called.</p>
php
[2]
2,004,389
2,004,390
static variable in zend framework
<p>I need storage like object array that works at server level that is above session level.so that in need how to set static variable in Zend framework to store my object array which works as server variable..</p>
php
[2]
3,389,231
3,389,232
date increase in asp.net
<p>i want to increase &amp; decrease date on button click like this &lt; 11\11\09 > . '&lt;' for decrease and '>' for increment. kindly help me to do so.</p>
asp.net
[9]
4,065,537
4,065,538
how can create layout and add images view in to layout using base adapter in android
<p>my all images in mimages i want add any layout </p> <pre><code>public class ImageAdapter extends BaseAdapter { private static final Context Context = null; String qrimage; Bitmap bmp, resizedbitmap; Activity activity = null; private static LayoutInflater inflater = null; private ImageView[] mImages; String[] itemimage; TextView[] tv; String itemname; HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); public ImageAdapter(Context context, JSONArray imageArrayJson) { this.mImages = new ImageView[imageArrayJson.length()]; try { for (int i = 0; i &lt; imageArrayJson.length(); i++) { JSONObject image = imageArrayJson.getJSONObject(i); qrimage = image.getString("itemimage"); itemname = image.getString("itemname"); map.put("itemname", image.getString("itemname")); System.out.println(itemname); byte[] qrimageBytes = Base64.decode(qrimage.getBytes()); bmp = BitmapFactory.decodeByteArray(qrimageBytes, 0, qrimageBytes.length); int width = 100; int height = 100; resizedbitmap = Bitmap.createScaledBitmap(bmp, width, height, true); mImages[i] = new ImageView(context); mImages[i].setImageBitmap(resizedbitmap); mImages[i].setScaleType(ImageView.ScaleType.FIT_START); inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); // tv[i].setText(itemname); } } catch (Exception e) { // TODO: handle exception } } public int getCount() { return mImages.length; } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { } } </code></pre> <p>how can i create layout .how can i add all images to layout..and itemname it contains all items how can i add textview and how can i add same layout in list view i want display images and text in custom layout ..please modify code and send me ..please replay </p>
android
[4]
4,456,272
4,456,273
How to create context menu like in Twitter?
<p>I would like to create one feature in my app like in Twitter app for android. When you use it you have list of tweets. Every item has a text and button. When you click on a button a horizontal menu slides in. I`m wondering how to do something like that ? I know that I need to set OnClickListener for button. That is easy but how to slide in this menu ?</p>
android
[4]
3,134,631
3,134,632
C++ what goes in the header and what goes in the CPP file?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1945846/c-what-should-go-into-an-h-file">C++ - What should go into an .h file?</a> </p> </blockquote> <p>I am a complete noob with C++ and slowly learning. I come from a C# background. I understand what can go into the header file versus what can go into the actual cpp implemention file. But what is the best practice for what goes where? For example, you can declare the class in the header and forward declare functions, but you can also have implementation details as inline functions.</p>
c++
[6]
3,194,623
3,194,624
Does Android support lock-down to a fully replaced interface?
<p><strong>What For?</strong> This question is about how to take a peice of Android hardware and OS and turn it into an interface. It would be our own hardware, never leave the building, and run any program we create. <strong>Why?</strong> The Android has built in battery backup, theft detection (GPS), and an elegant touch screen, and a familiar programming interface.</p> <p><strong>What I want:</strong></p> <ol> <li><p>Can I require that no matter what is pressed on the screen, the user never leaves my app?</p> <p>Are there <strong>instructions</strong> to do this, is it <strong>officially supported</strong>, <strong>or would I have to start hacking away</strong>? (using a system-level interface, removing voice activation (when a user holds down the Search button), disable auto updates, etc)</p> <p>Ideally, I want to just write a single app that replaces the whole interface, and I want a way to hook the app in, without a bunch of extra work (rooting the phone and manually removing built specific built-in apps).</p></li> <li><p>I would also want to lock the USB into a "Charge-only" mode, to prevent mounting of the file system without my app's approval. I am not concerned about a really determined guy who opens up the device and mounts the internal storage unit's filesystem.</p></li> <li><p>In the event of a crash, I would like to have a second app that decides whether or not to restart the first app.</p></li> </ol> <p>Obviously, I don't want the phone to become unusable, even if it is just spare hardware.</p> <p><sub>I am assuming that an Android can operate under Wi-Fi only internet access, (no phone) in the event I skip wireless subscription.</sub></p>
android
[4]
4,926,149
4,926,150
Convert std::string to MSVC specific __int64
<p>May I know how I can convert std::string, to MSVC specific __int64?</p>
c++
[6]
5,852,850
5,852,851
What is the difference between Delegate & Action in C#
<p>If I searched I will definitely get examples of showing what is a Delegate and Action. I have read the basic books giving examples of delegate. </p> <p>But what I want to know is their use in the real world. Please do not give Hello World example or the Animal class they are far too basic</p> <p>For e.g. :</p> <ol> <li>What are the difference between them</li> <li>When to use a delegate or action</li> <li>When not to use a delegate or action</li> <li>When they can be an over kill</li> </ol>
c#
[0]
3,789,295
3,789,296
index is changing every time i'm clicking a button
<p><a href="http://gidzior.net/svg/pom01.html" rel="nofollow">http://gidzior.net/svg/pom01.html</a> panel on the right is the '#right-panel li' and the red button is the 'div.save'</p> <p>buttons from '#right-panel li' should open a window and button 'div.save' should close it and then '#right-panel li' should open it again</p> <p>when i'm clicking button with number from 1 to 9, script put 0 befor number 1-9 and the index is 01,02,03 ..., when i'm clicking it again the index is 001, 002, 003,... and so on, how do I set the index remained the same all the time ?? 01, 02, 03, 04, 05, 06, 07, 08, 09</p> <pre><code>//OPEN A WINDOW $('#right-panel li').each(function(e){ var i = $(this).index()+1; $(this).click(function(){ if(i&lt;=9){ i = "0"+i; } $('#pom01par'+i+'WraperAbsolute').fadeIn("fast"); $('#pom02par'+i+'WraperAbsolute').fadeIn("fast"); $('#pom03par'+i+'WraperAbsolute').fadeIn("fast"); $('#pom04par'+i+'WraperAbsolute').fadeIn("fast"); $('#pom05par'+i+'WraperAbsolute').fadeIn("fast"); $(this).css('background','#adff84'); $('.par'+i+'table').css('background','#adff84'); return false; }); }); // CLOSE A WINDOW $('div.save').click(function(){ $(this).parent().fadeOut("fast"); }); </code></pre>
jquery
[5]
3,228,485
3,228,486
python recursive function not initializing default argument values
<p>So I have a helper function that is supposed to print out the internal nodes and leaves of a binary tree (unsorted). I won't provide the code since I'm in a class, but I can tell you that I have coded it up and it works for the first node I throw in there:</p> <pre><code>def helper(root, internals=[], leaves=[]): #function code here... &gt;&gt;&gt; helper(node) ([13, 14, 27], [10, 11, 12, 17, 19]) </code></pre> <p>which is the correct output, as far as I know. However, when I call the same function again on <em>another</em> node, the output is overwritten into the previous one:</p> <pre><code>&gt;&gt;&gt; helper(pen) ([13, 14, 27, 6, 8, 14], [10, 11, 12, 17, 19, 2, 4, 10, 12]) </code></pre> <p>which is incorrect, since the tree <code>pen</code> does not have the elements 13,14,27 or 10,11,12,17,19. Can someone explain what's going on here? I have to test my function for different cases without restarting the shell every single time. How do I fix this?</p>
python
[7]
5,581,570
5,581,571
Returning a value from a void method in Java
<p>I have a method :</p> <pre><code>public void dbQuery(String query, String what) { try { Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(query); if(what.equals("temp_table")) { String temporary_table = rs.getString("table_name_temp"); System.out.println(temporary_table); return; } } catch (Exception e) { e.printStackTrace(); } finally { if (rs != null) rs.close(); if (stmt != null) stmt.close(); } } String query = "EXEC temptables.dbo.create_temp_cdr 'SIP'"; String temporary_table = db.dbQuery(query,"temp_table"); </code></pre> <p>How do I get the return of a <code>void</code> to use it in another <code>db.dbQuery()</code> ?</p> <p>PS : I need a value from <code>dbQuery()</code> so I can construct another <code>query</code> to call <code>dbQuery()</code> again</p>
java
[1]
2,744,341
2,744,342
python subprocess.popen get into an infinite loop
<p>I'm trying to run the folowing command on a sub process and collecting the output.</p> <pre><code>nmap -n -PN -sT -T4 -p 445,139 10.11.1.0/24 --exclude matrix </code></pre> <p>this command return an error which is fine by me.</p> <p>The problem is when i'm doing this from python like this:</p> <pre><code>import subprocess nmap_process = subprocess.Popen(command, stdout=subprocess.PIPE,stderr=subprocess.PIPE) output,errOutput=nmap_process.communicate() </code></pre> <p>the process hang.<br> if i don't use the stderr param,the first error line of namp is printed in an infinite loop </p> <p>does anybody have any segesstion about how to handle this?</p>
python
[7]
3,593,287
3,593,288
UIBarButton item
<p>I want to add custom button in the navigation bar..<br> can any one suggest how to add?</p>
iphone
[8]
4,058,123
4,058,124
call the java script method from href
<p>I have this variable file_link declared in one of my javascript function, I would like to call the get_links method from this variable, please help me with the correct syntax.</p> <pre><code>var filelink = "&lt;a href='javascript:get_links(" + source_id + ")'&gt;" + name + "&lt;/a&gt;"; </code></pre>
javascript
[3]
194,952
194,953
Android to Windows laptop file transfer via USB from app
<p>I have business requirement where user wants to copy file from Android device into Windows 7 laptop via USB from android app(i.e. programmatically) because there is no wifi or cell data coverage available. I want to know if it is possible or not? How? Example would be appreciated.</p> <p>Thanks</p>
android
[4]
1,128,726
1,128,727
Check if one letter is in a string(word), and what posistion it is at?
<p>I have one method with one letter(string\char?) as argument and one word active at a time. I would like to see if this one letter, is in the word which is active at the time.</p> <p>That could probably have been explained better. Maybe code will do the trick:</p> <pre><code>public void checkLetter(String letter){ for(int i = 0; i&lt;activeWord.length(); i++){ if(letter.equals(activeWord.[i])){ // Run a method which gives the user a correct letter pushed. } else { String failed = "Could not find the letter in the active word."; // Run a method which gives the user one wrong letter pushed. } } } </code></pre> <p>So, this is going to be a hangman game for android i'm making for fun. Right now i have images as letters. When the letter(image) is pressed, this method runs, and the letter pushed will be the argument.</p> <p>Does anyone have any good ideas how i can find out if the letter is in the word, and which posistion it is in?</p> <p>I would love some help :)</p> <p>EDIT: Btw, the current code returns int every time ofc, cause the [i] is an int. This is where im strugling to get the code to return a string. Do i have to split the word up into letter before i can equal them to another string? Thanks.</p>
java
[1]
5,060,576
5,060,577
code problem finding id and index
<p>new to programming and android, so I really have no idea what im doing. can anyone tell me why this code returns incorrect values of -1 for index and a 10 digit number for id, when I clearly assign an id and the index should not be -1 because its 0 based??</p> <p>I would think that the problem is somewhere in the code that gets the focused view, but ive tried findFocus and getCurrentFocus, and both return the same thing. Here is the code, thanks!</p> <pre><code>llmain = (LinearLayout) findViewById(R.id.linearLayoutMain); linflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); int pos = 0; View myView = linflater.inflate(R.layout.action, null); myView.setId(pos); pos++; llmain.addView(myView); myView.requestFocus(); View v = getCurrentFocus(); if(v instanceof EditText) { id = v.getId(); index = llmain.indexOfChild(v); Context context = getApplicationContext(); CharSequence text = "index is:" + index + "id is:" + id; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } } </code></pre>
android
[4]
2,933,477
2,933,478
How to apply themes runtime?
<p>I want to build the application that contains themes with skins &amp; css files.</p> <p>That themes list should be seen to the user on web page. Whenever user select the theme in themes list that theme applied to the application throughout all pages.</p> <p>Please rely me if you have any about to steps how to apply dynamic themes to the web application in master content pages.</p> <p>I tried to apply themes on one single content page but the problem is I can not getting the value of dropdownlist selected item in the Page_Init event. It gives error object reference not set to an instance of object. how to catch the dropdownlist value in Page_Init method.</p> <p>Also if I want to set the theme in web.config then how I can change that on runtime.</p> <p>Please give reply..........</p> <p>Regards Girish</p>
asp.net
[9]
4,079,195
4,079,196
Verify URL exists from file
<p>So I have some code that I use to scrape through my mailbox looking for certain URL's. Once this is completed it creates a file called links.txt </p> <p>I want to run a script against that file to get an output of all the current URL's that are live in that list. The script I have only allows for me to check on URL at a time</p> <pre><code>import urllib2 for url in ["www.google.com"]: try: connection = urllib2.urlopen(url) print connection.getcode() connection.close() except urllib2.HTTPError, e: print e.getcode() </code></pre>
python
[7]
4,378,722
4,378,723
java.lang.OutOfMemoryError:PermGen space
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/88235/dealing-with-java-lang-outofmemoryerror-permgen-space-error">Dealing with &ldquo;java.lang.OutOfMemoryError: PermGen space&rdquo; error</a> </p> </blockquote> <p>In Catalina.out log, I am getting the below mentioned exception. Application is too slow. java.lang.OutOfMemoryError:PermGen space</p> <p>What I need to do?</p>
java
[1]
2,807,721
2,807,722
Problem with testing for checkbox being marked
<p>I have an input array like</p> <pre><code>&lt;input id='delete[18]' name="delete[18]" value="1" type="checkbox"&gt; &lt;input id='delete[19]' name="delete[19]" value="1" type="checkbox"&gt; </code></pre> <p>This Javascript code for check does not work. Why?</p> <pre><code>if (delete_question.19.checked == 1) { if (confirm('msg')) { return true; } else { return false; } } </code></pre>
javascript
[3]
4,558,920
4,558,921
jQuery: Append and prepend unclosed HTML to an element
<p>In an application I'm creating, I am allowing the end-users to add a "Text Formatting" prefix and suffix to a jQuery countdown.<br> The elements for the countdown are fetched with AJAX, and inserted to DOM with jQ. </p> <p>An example for these two fields can be:<br> Prefix: <code>&lt;span style="color:blue"&gt;</code><br> Suffix: <code>&lt;/span&gt;</code></p> <p>What I need to do then is wrap all the code needed for the countdown between these two.<br> But when I try to add them, all jQuery methods I've tried (append &amp; prepend) and PrototypeJS' <code>Element.insert()</code> will close any open tags in the prefix, rendering the suffix useless. </p> <p>I even tried the following: </p> <pre><code>$( this ).parent().html( data['prefix'] + $( this ).parent().html() + data['suffix'] ); </code></pre> <p>This resulted in the element being removed from the DOM tree. Also tried to locally store the innerHTML and fiddle with it before pushing it back to <code>.html()</code>. </p> <p>And I can not combine those two fields together, and use <code>.wrap()</code> on it, as either of them can be a completely perfect HTML string. </p> <pre><code>&lt;span class='tag'&gt;This is a tag&lt;/span&gt; </code></pre> <p>If I tried to use <code>.wrap()</code> on that, I assume the rest of my code would end up inside that.</p>
jquery
[5]
2,861,829
2,861,830
Parser error while running application
<p><code>Could not load file or assembly 'ScriptReferenceProfiler' or one of its dependencies. The system cannot find the file specified.</code></p> <p>I get this error after running the application. What is the likely issue? I am using visual studio 2008, .NET 3.5 sp1 for C#.</p> <p>*ASP.NET application debugging after the build.</p> <p>** Assembly load trace</p> <p><code>=== Pre-bind state information === LOG: User = ORG-FA431C61BE1\ahsan LOG: DisplayName = ScriptReferenceProfiler (Partial) LOG: Appbase = file:///C:/Documents and Settings/My Documents/Visual Studio 2008/myproj/myproj/ LOG: Initial PrivatePath = C:\Documents and Settings\My Documents\Visual Studio 2008\myproj\myproj\bin Calling assembly : (Unknown).</code></p> <p><code>LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Documents and Settings\My Documents\Visual Studio 2008\myproj\myproj\web.config LOG: Using machine configuration file from C:\WINDOWS.0\Microsoft.NET\Framework\v2.0.50727\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: The same bind was seen before, and was failed with hr = 0x80070002.</code></p>
c#
[0]
2,653,754
2,653,755
Pickerview within enclosing view
<p>using iphone sdk 4.0. I have added a UIPickerView to a view. I want the UIPickerView to be NON transparent ( as it is) but i want the background view to have an alpha of 0.3.</p> <p>THis is so that the upper portion of the view (which is full size screen) is see through and the lower portion which has the picker is solid. However when i set the alpha for the background view its affecting the pickerview and making that seethrough.</p> <p>Anyone know how to do this?</p> <p>Thanks</p>
iphone
[8]
5,655,649
5,655,650
Refactoring this javascript code
<p>I have this javascript code and im not happy the way it is written..</p> <pre><code>function notesViewModel() { _this.colName = "CreatedDate"; _this.sortOrder = "desc"; _this.notes = ko.observableArray(); _this.SortItems = function (colname) { var newNotes = _this.notes(); if (_this.sortOrder === "desc") { this.notes(newNotes.sort(notesViewModel._getSortFunction = function (a, b) { return a[colname] &lt; b[colname] ? -1 : 1; })); switchSortOrder(); } else { this.notes(newNotes.sort(notesViewModel._getSortFunction = function (a, b) { return a[colname] &gt; b[colname] ? -1 : 1; })); switchSortOrder(); } }; function switchSortOrder() { if (_this.sortOrder === "asc") { _this.sortOrder = "desc"; } else { _this.sortOrder = "asc"; } } ko.applyBindings(_this, $("body").get(0)); return _this; } </code></pre> <p>how can I pass the sort order into anonymous function and call it to return the required bubble sort? </p>
javascript
[3]
3,584,898
3,584,899
Print to local shared printer on lan in android
<p>I develop an application which has several tasks like report generator, show history etc,</p> <p>now I want to add a method by which I can directly print these report from the printer on local network.</p> <p>so I need that there is a Button named "Print" now when user click this button then my given text is directly print from the shared printer in local network by wifi connection.</p> <p>my printer IP is 192.168.1.50</p> <p>Now How i can do this by coding.</p> <p>please reply</p> <p>Thanks</p>
android
[4]
2,793,585
2,793,586
How do I find the position of an element in a C# array
<p>I have a C# array of integers. The integers in the array are all unique. For example the array contains page numbers: 1,2,4,5,7,9</p> <p>If I am on page 5 I would like to have a previous button to take me to page 4 and 8. </p> <p>My question is how can I find the index position in an array if I just know it's the row that contains the number "5"?</p> <p>Hope someone can help. </p> <p>thanks, </p>
c#
[0]
1,646,661
1,646,662
Android VideoView problem
<p>I am a beginner developer in android, I have a problem with playing video, It works with black screen I am using eclipse Galileo 3.5 with android 1.6 when I use android 2.2 it won't work at all !! Here is the code :</p> <pre><code>import android.app.Activity; import android.graphics.PixelFormat; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.widget.MediaController; import android.widget.VideoView; public class Video extends Activity { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); VideoView videoView = (VideoView) findViewById(R.id.VideoView); MediaController mediaController = new MediaController(this); mediaController.setAnchorView(videoView); // Set video link (mp4 format ) Uri video = Uri.parse("android.resource://video/"+R.raw.boeing707crash); videoView.setMediaController(mediaController); videoView.setVideoURI(video); videoView.start(); } } </code></pre> <p>So what is the problem ?!</p> <p>Thanks in advance.</p>
android
[4]
1,548,210
1,548,211
Is tertiary operator possible here?
<p>I'm trying to set $value1, $value2, $value3 entirely using tertiary operators. This is what it looks like without tertiary </p> <pre><code>if ($chk1 == 20) { $value1 = true; if ($chk2 == 40) { $value2 = 100 ; $value3 = 300; } else { $value2 = 200 ; $value3 = 400; } } else { $value1 = false; } </code></pre> <p>I can set $value2 and $value3, but not sure how to set $value1. Can it be done? </p> <pre><code>if ($chk1 == 20) { $value1 = true; $value2 = ($chk2 == 40) ? 100 : 200; $value3 = ($chk2 == 40) ? 300 : 400; } else { $value1 = false; } </code></pre>
php
[2]
5,549,679
5,549,680
Changing the focus of the edittexts in a list view Using the next Key in SoftKeyBoard
<p>How to configure the next button to change focus to the edit texts in the consecutive rows of the ListView.. I cannot use the android:nextFocusDown="@+id/...." since the edit texts have same id.</p>
android
[4]
1,827,145
1,827,146
How can I split part of a string that is inconsistent?
<p>I have the following string:</p> <p><code>01-21-27-0000-00-048</code> and it is easy to split it apart because each section is separated by a <code>-</code>, but sometimes this string is represented as <code>01-21-27-0000-00048</code>, so splitting it is not as easy because the last 2 parts are combined. How can I handle this? Also, what about the case where it might be something like <code>01-21-27-0000-00.048</code></p> <p>In case anyone is curious, this is a parcel number and it varies from county to county and a county can have 1 format or they can have 100 formats.</p>
c#
[0]
825,111
825,112
How do I resolve this "Undefined function" JavaScript Error?
<p>I keep getting a "Undefined function" <a href="http://en.wikipedia.org/wiki/JavaScript" rel="nofollow">JavaScript</a> error in my error console. Any idea why?</p> <pre><code>&lt;div id="counter" style="width: 40px;"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; var seconds = 60 document.getElementById('counter').innerHTML = seconds function countDown() { if(seconds &lt;= -1) { seconds += 1 } else { seconds -= 1 document.getElementById('counter').innerHTML = seconds setTimeout("countDown()", 1000) } } countDown(); &lt;/script&gt; </code></pre>
javascript
[3]
3,204,563
3,204,564
jquery select all br with display:none;
<p>How do I select an element based on its css?</p> <p>I need to select a br with inline style display:none. This is not the same thing as br:hidden, because that selects elements that are hidden in other ways, and I don't want that.</p> <p>Thanks.</p>
jquery
[5]
3,304,056
3,304,057
How to get the value that return from the javascript function?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/12550002/how-to-return-the-value-of-a-function-after-the-result-of-an-ajax-call-has-come">How to return the value of a function after the result of an ajax call has come?</a> </p> </blockquote> <p>I have one function that use to count the quantity of item in my controller.</p> <pre><code>function GetQtyItem() { var qty; var urlQuantity = "Quotation/CountQuantity"; $.getJSON(urlQuantity, function (quantity) { qty = quantity.ja; }); alert(qty); //3 return qty; } </code></pre> <p>I included the file name with the correct part, and called this function in another view of my asp.net mvc project :</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; var i = GetQtyItem(); alert(i); &lt;/script&gt; </code></pre> <p>But the result in the alert dialog is <code>Undefined</code>.</p> <p>Could any one tell me, how can I alert it with the correct value(3). Thanks in advanced.</p>
javascript
[3]
3,348,499
3,348,500
How can I get a host computer unique ID in PHP?
<p>I need to come up with a way to uniquely identify computers. Something like the system id or info from CPU that can't be hacked easily be obtained in php application run time and then sent over the internet to a central database to activate or validate license keys. </p> <p>System Info:</p> <ul> <li>Web Shared Hosting or Local network</li> <li>Linux(can be any distribution)</li> <li>Apache</li> <li>PHP</li> </ul> <p>Thanks in advance for any reply</p>
php
[2]
3,079,191
3,079,192
load() not working in jquery
<p>Hello Friends check my code <a href="http://jsfiddle.net/sUaky/2/" rel="nofollow">http://jsfiddle.net/sUaky/2/</a> i want to load a web page in a div using the <code>load()</code> function but code is not working plz help me out </p> <p>Thank in advance </p>
jquery
[5]
4,994,169
4,994,170
Adding Paypal Pay Now button in Android app
<p>This may have been asked before but I cannot find a definitive answer </p> <p>I am currently using Google in app billing for my application and users are asking me if they can use Paypal. </p> <p>Is it against the market policy if I add a Paypal Buy now button to my payment screen which opens a URL in a webview and goes to Paypal.com ? ….</p> <p>The app is published in the Android Market</p> <p>Thanks in advance </p>
android
[4]
2,489,602
2,489,603
how to get url string from browser
<p>can i get url what i write on android device browser..</p> <p>please tell me..</p> <p>thanks.</p>
android
[4]
1,726,725
1,726,726
How to run my "C#" application under trustedinstaller account?
<p>How do I run my application under the <code>trustedinstaller</code> account?<br/> I tried creating a Visual Studio setup project and made an <code>msi</code>. But even that doesn't run under the <code>trustedinstaller</code> account. It runs only under the system account.</p> <p>Can someone please guide me on how I can run my windows application under trusted installer account?</p> <p>Just in-case you're wonder why I need it, its because I am supposed to copy some files into the <code>winsxs</code> folder for the client's <code>C++</code> application to work.</p> <p>Thank you so much in advance.</p>
c#
[0]
5,597,062
5,597,063
how can i search sub string from original string
<pre><code>String ORIGINAL = "This is my demo string"; String search = "demo"; </code></pre> <p>I want to get the result as true or false if "demo" is exits into ORIGINAL then result is true otherwise return false </p>
android
[4]
690,850
690,851
android multiple instance of activity?
<p>I have a question regarding activity multiple instance.</p> <p>eg)</p> <p>A1 is an activity, A1 starts A2 using startActivity(), then A2 starts A1 using startActivity() as well, how many instance of A1 exists in current system?</p>
android
[4]
3,530,066
3,530,067
How can I organize my listview by dates?
<p>I want to organize my list view like how they do it in the downloads app: <img src="http://i39.tinypic.com/24qv529.jpg" alt="Downloads"></p> <p>Currently I am using a ecrusor adapter for my data:</p> <pre><code>public class eCursorAdapter extends CursorAdapter { public eCursorAdapter(Context context, Cursor c) { super(context, c); } @SuppressWarnings("static-access") @Override public void bindView(View view, Context context, Cursor cursor) { TextView summary = (TextView)view.findViewById(R.id.title); summary.setText(cursor.getString( cursor.getColumnIndex(mDbHelper.KEY_A))); TextView progress = (TextView)view.findViewById(R.id.progress); progress.setText(""); } @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(context); View v = inflater.inflate(R.layout.download_list, parent, false); bindView(v, context, cursor); return v; } } </code></pre> <p>KEY_DATE in my database holds the date info. So how can I make this similar to the downloads app in android?</p>
android
[4]
675,037
675,038
Using jQuery :gt() with $(this)
<p>I have an issue with using <code>$(this)</code> and <code>:gt()</code> together.</p> <p>I'm trying to convert this pseudo code into working code:</p> <pre><code>$(this).children().gt(3).show(); </code></pre> <p>Will this work? I am trying to show the children of this with an index over 3.</p>
jquery
[5]
4,209,055
4,209,056
How to reverse geocode?
<p>I my iPhone application I have to find the city and country name of current location. How it can be done?</p> <p>Thanks</p>
iphone
[8]