Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
4,232,611
4,232,612
settimeout in for loop is not working
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5226285/settimeout-in-a-for-loop-and-pass-i-as-value">setTimeout in a for-loop and pass i as value</a> </p> </blockquote> <p>i am trying generate dynamic array and using this array as loop .. but in loop settime out is not working or function is not working. Here is my code </p> <pre><code>jQuery(document).ready(function () { temp = new Array(); generateArray(temp); function generateArray(temp) { if (temp.length &lt; 10) { res = randomXToY(1, 10, 0); for (var k = 0; k &lt; temp.length; k++) { if (temp[k] == res) { var test = 1; } } if (test != 1) { temp.push(res); //abc(temp); } generateArray(temp); } else { for (var z = 0; z &lt; 10; z++) { tnest(temp[z]); setTimeout(function () { removeClassImg(temp[z]) }, 3000); } temp = new Array(); generateArray(temp); } } function removeClassImg(result1) { alert(result1); $('#img' + result1).fadeTo(12000, 0.1); return true; } function tnest(result) { alert(result); $('#img' + result).fadeTo(12000, 1); return true; } function randomXToY(minVal, maxVal, floatVal) { var randVal = minVal + (Math.random() * (maxVal - minVal)); return typeof floatVal == 'undefined' ? Math.round(randVal) : randVal.toFixed(floatVal); } }); </code></pre> <p>alert in function removeClassImg is not working .. i am using settimeout in for loop this is not working fine.</p>
javascript jquery
[3, 5]
4,399,962
4,399,963
Keydown event stops triggering when I update HTML
<p>I'm working on a simple program that is built to teach you (me) how to write with the 8pen keyboard for Android.</p> <p>On every keydown I check if the input value matches the "pattern-attribute" the html changes so that a new lesson comes up. This works fine. However when i update the keyup function stops triggering.</p> <pre><code>var lesson = 0; $(document).ready(function() { new_lesson(lesson) lesson++ //den här grejjen aktiverar inte på lektion 2 $("input").keyup(function(event){ var value = $(this).val(); console.log(value) if (isValidInput ('input')) { new_lesson(lesson); } }) }); function isValidInput (input) { return $(input)[0].checkValidity(); } function new_lesson(lesson_number){ $('#form').html('&lt;label&gt;'+data[lesson_number]+'&lt;/label&gt; &lt;input type="text" pattern="'+data[lesson_number]+'"/&gt;') } </code></pre> <p>Why?</p>
javascript jquery
[3, 5]
5,179,721
5,179,722
How to get a null value from database to a checkbox in FormView
<p>i want parse null value and disable checkbox in form view how can i do that that's my current code:</p> <pre><code> &lt;asp:CheckBox ID="FLPCheckBox" runat="server" Text="Full Load Passed" Checked=' &lt;%# (Eval("FullLoadPassed")==DBNull.Value ? false : Eval("FullLoadPassed"))%&gt;' /&gt; </code></pre> <p>Thanks</p>
c# asp.net
[0, 9]
5,893,350
5,893,351
Is there a way to disable a label?
<p>I am using an asp radio button group to list out answers in a form. Here is an example of the structure (I know the text doesn't make sense, bare with me).</p> <pre><code>&lt;asp:RadioButtonList id="Q2" runat="server"&gt; &lt;asp:ListItem Text="Go to &lt;a target='_blank' href='http:www.google.com'&gt;Google&lt;/a&gt;" Value="a"&gt;&lt;/asp:ListItem&gt; &lt;asp:ListItem Text="Go to &lt;a target='_blank' href='http:www.yahoo.com'&gt;Yahoo&lt;/a&gt;" Value="a"&gt;&lt;/asp:ListItem&gt; &lt;/asp:RadioButtonList&gt; </code></pre> <p>So I want to be able to click on the links and not have the radiobutton associated with it become selected. In IE it works fine but in Firefox the radio button will be selected when i click on the link. I don't really need the label to actually select the proper radio button so is there a way to just disable them either in javascript or somewhere in the asp or C# code?</p>
c# asp.net javascript
[0, 9, 3]
5,672,674
5,672,675
Passing a multidimensional PHP array to javascript
<p>I have an array($my_array) that looks something like:</p> <pre><code>array(2) { [25]=&gt;int(10) [30]=&gt;int(8) } </code></pre> <p>I'd like to assign it to a javascript array, but am having difficulties doing it. Any suggestions?</p> <p>Edit: At first, I thought I could just assign it like a string, but that isn't working:</p> <pre><code>var photo_limit = $my_array; </code></pre> <p>I tried also doing a var_dump into my js value.</p> <p>I'm currently trying to use something like:</p> <pre><code>for($i=0;$i&lt;count($my_array); $i++){ echo "a[$i]='".$a[$i]."';\n"; } </code></pre> <p>Thanks.</p>
php javascript
[2, 3]
526,411
526,412
jQuery .css display:none
<p>I'm trying to do the following:</p> <ul> <li>I have 6 div. Inside each div is another div with display:none.</li> </ul> <p>I want to do in jQuery when i click on each div all 6 div change to display:none and the div inside the div clicked to show in the screen.</p> <p>Check this fiddle <a href="http://jsfiddle.net/Weinz/xaMfk/2/" rel="nofollow">http://jsfiddle.net/Weinz/xaMfk/2/</a></p> <p>The only thing that happen it's all goes display:none</p> <p>What can i do? I try also with show and hide and doesn't work</p> <p>Thank you in advance</p>
javascript jquery
[3, 5]
4,864,817
4,864,818
Is there any downloader library like Android Asynchronous Http Client [Java]
<p>I have found Android Asynchronous Http Client library from google: <a href="http://loopj.com/android-async-http/" rel="nofollow">http://loopj.com/android-async-http/</a> This is awesome lib for Android. But it's not have download function. Is there any lib which support async download function.</p>
java android
[1, 4]
2,505,085
2,505,086
Displaying a text field only if a particular value is selected
<p>I've created a dropdown list that contains 3 values:</p> <ul> <li>date wise</li> <li>active students</li> <li>inactive student</li> </ul> <p>How can I select a text field asking what the date of birth of the user is, if and only if the person has selected the "date" field?</p>
php javascript jquery
[2, 3, 5]
2,242,434
2,242,435
Function on ANY checkbox change on the page
<p>I'm new to JQuery in general and I want to have a function activate when ANY checkbox on the page is checked or not. Then it should check what state the checkbox is "checked" or not.</p> <p>I'm not sure how to do this as all the examples I'd seen require the name of the checkbox in order to work. I'd be fine if this was in Javascript aswell.</p> <p>Anyone have any ideas?</p>
javascript jquery
[3, 5]
944,036
944,037
Using JavaScript or jQuery, how do I check if select box matches original value?
<p>Just wondering if there is any way to check if the value of a select box drop-down matches the original value at the time of page load (when the value was set using <code>selected = "yes"</code>) ?</p> <p>I guess I could use PHP to create the original values as JavaScript variables and check against them, but there are a few select boxes and I'm trying to keep the code as concise as possible!</p>
javascript jquery
[3, 5]
1,874,445
1,874,446
How to handle input and parameter validation between layers?
<p>If I have a 3 layer web forms application that takes user input, I know I can validate that input using validation controls in the presentation layer. Should I also validate in the business and data layers as well to protect against SQL injection and also issues? What validations should go in each layer?</p> <p>Another example would be passing a ID to return a record. Should the data layer ensure that the id is valid or should that happen in BLL / UI?</p>
c# asp.net
[0, 9]
3,631,326
3,631,327
Refresh Generic List in ASP.NET after page is postback or refreshed
<p>I have other trouble and I cannot solve it.</p> <p>In ASP.NET I have DropDownList object which takes data from a Generic List. In ASP.NET page</p> <pre><code>&lt;tr&gt;&lt;td&gt;Choose category&lt;/td&gt; &lt;td&gt;&lt;asp:DropDownList id="list_categories" runat="server"&gt;&lt;/asp:DropDownList&gt;&lt;/td&gt; &lt;td&gt; &lt;asp:RequiredFieldValidator ControlToValidate="list_categories" runat="server" Display="Static" ErrorMessage="Select category" ID="verify_category" ValidationGroup="add_link_group"&gt; &lt;/asp:RequiredFieldValidator&gt;&lt;/td&gt;&lt;/tr&gt; </code></pre> <p>and the behind code :</p> <pre><code>private void generate_select( DropDownList select ) { BusinessLayerArcht layer = LoadDataFromBL(); foreach ( CategoriesCtrlDto cto in layer.Categories ) { select.Items.Add( cto.Name ); } } </code></pre> <p>and the Page_Load</p> <pre><code>generate_select( list_categories ); </code></pre> <p>I tried with Clear() but when I added a new link to a selected category , it will be inserted at first category If I don't call .Clear() function then the inseration it's ok but after page refreshing, the list contains duplicate categories</p> <p>Initial I had GMail YMail AOL</p> <p>after inserting a new link or other event which refresh page, the list will shows as : GMail YMAil AOL GMail YMAil AOL</p> <p>If I refresh four times the page then the list has GMail YMAil AOL GMail YMAil AOL GMail YMAil AOL GMail YMAil AOL</p> <p>Repeats four times, so it duplciates at each page postback or refresh. I tried also to clear cache if <code>(Page.isPostBack)</code></p>
c# asp.net
[0, 9]
1,484,349
1,484,350
jquery obj.find problem in javascript
<p>I have this snippet of code, which fails at var link:</p> <pre><code>var obj = $(this[0]); var html = obj.html(); var link = html.find('a[href*=/comment/reply]'); </code></pre> <p>This is an ajax response from a submitted form. The output of what I get back from the var html is as follows:</p> <pre><code>===&gt;&lt;div class="comment-new-success"&gt;&lt;a id="new"&gt;&lt;/a&gt; &lt;a id="comment-482"&gt;&lt;/a&gt; &lt;div class="comment"&gt; &lt;div class="submitted"&gt;Submitted by &lt;a href="/user/1" title="View user profile."&gt;NAME&lt;/a&gt; on Sun, 07/10/2011 - 12:48.&lt;span class="new"&gt; *new&lt;/span&gt;&lt;/div&gt; &lt;div class="content clearfix"&gt;&lt;p&gt;123123123123122&lt;/p&gt; &lt;/div&gt; &lt;div class="links_box"&gt;&lt;ul class="links"&gt;&lt;li class="comment_delete first"&gt;&lt;a href="/comment/delete/482?token=e1fba5ef1c99c5a3760313b53f582972"&gt;delete&lt;/a&gt;&lt;/li&gt; &lt;li class="comment_edit"&gt;&lt;a href="/comment/edit/482"&gt;edit&lt;/a&gt;&lt;/li&gt; &lt;li class="comment_reply last"&gt;&lt;a href="/comment/reply/6/482"&gt;reply&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;&lt;/div&gt;&lt;/div&gt; &lt;/div&gt;&lt;===(string) </code></pre> <p>How do I properly get the "/comment/reply/6/482" variable as the var link in the above example. The code (I thought) should work fine, but doesn't</p>
javascript jquery
[3, 5]
1,357,153
1,357,154
Working with jQuery Collections
<p>I'm trying to increase my understanding of jQuery. Please consider the following code.</p> <pre><code>if ($('.myClass').data('id') == '123') { } </code></pre> <p>How does this work? It looks simple enough until you understand that <code>$()</code> returns a collection of elements. So what does the code above do exactly? How does it make sense to compare the value of the data-id attribute for a <em>collection</em> of elements like this?</p> <p>(I understand I can use <code>each()</code> to explicitly test each element in the collection. My question is about what the code above does.)</p>
javascript jquery
[3, 5]
5,809,298
5,809,299
Could not get XmlDocument.Save to save into a specific file located in a specific location
<p>Strange, I can't get ASP.Net project (using C# mode) to log result into my <code>D:\Web.log</code> file and also no exception was thrown.</p> <p>Is there something wrong with my simple code?</p> <pre><code> private static XmlDocument _doc = new XmlDocument(); private static string LogFileName = "D:\\Web.log"; static void LogToFile(string WebAddress, string IPAddress, string Title) { if (File.Exists(@"" + LogFileName + "")) _doc.Load(@"" + LogFileName + ""); else { var root = _doc.CreateElement("Web"); _doc.AppendChild(root); } try { var el = (XmlElement)_doc.DocumentElement.AppendChild(_doc.CreateElement("Web")); el.SetAttribute("Title", Title); el.AppendChild(_doc.CreateElement("WebAddress")).InnerText = WebAddress; el.AppendChild(_doc.CreateElement("IPAddress")).InnerText = IPAddress; _doc.Save(@"" + LogFileName + ""); } catch (Exception ex) { } } </code></pre>
c# asp.net
[0, 9]
2,814,937
2,814,938
Numeric textbox control from radiobuttonlist selection
<p>I've a radiobutton list like this;</p> <pre><code> &lt;asp:RadioButtonList ID="RadioButtonFirm" runat="server" RepeatDirection="Horizontal"&gt; &lt;asp:ListItem id="option1" runat="server" Value="Firm Code" /&gt; &lt;asp:ListItem id="option2" runat="server" Value="Firm Name" /&gt; &lt;/asp:RadioButtonList&gt; </code></pre> <p>and also an asp:button control</p> <pre><code>&lt;asp:Button ID="btnSearchFirm" runat="server" OnClientClick="Validate();" Text="search" OnClick="btnSearchFirm_Click" /&gt; </code></pre> <p>and a textbox</p> <pre><code> &lt;asp:TextBox ID="txtCriteria" Width="120px" runat="server"&gt;&lt;/asp:TextBox&gt; </code></pre> <p>If I select Firm Code from radio button, user only select numeric value to txtCriteria textbox, else string can be entered. How to validate it?</p>
c# javascript jquery asp.net
[0, 3, 5, 9]
307,651
307,652
Where can i get offline jQuery 1.7 API dump
<p>Hi i am tired googling for jQuery 1.7 API documentation file. Someone please provide me a link, where i can get offline jQuery 1.7 api dump.</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,402,530
3,402,531
Asp.net radio button, how to change the rendered label server side?
<p>I'm having to modify some existing code for a radio button that has a bunch of logic based around the value and Id for a radio button. All I really need to do is change the label and I don't really want to modify the generated input tag since it breaks the messy logic. Does anyone know how to do this server side? Many thanks!</p>
c# asp.net
[0, 9]
1,447,084
1,447,085
how to write the same java code in python
<p>please help me to write the java code in python, My goal is to make sure that every single line from output is stored / overwritten in the variable. </p> <h1>Java</h1> <pre><code>import java.lang.ProcessBuilder; import java.lang.Process; Process _process; BufferedReader _terminal_output; ProcessBuilder process_builder = new ProcessBuilder("curl","https://stream.twitter.com/1/statuses/filter.json?track=justinbieber,PerezHilton,KimKardashian,britneyspears", "-u", "user:pass"); try { _process = process_builder.start(); } catch (IOException e) { System.out.println("\n\nProcess Failed "+process_builder.toString()); System.exit(1); } _terminal_output = new BufferedReader(new InputStreamReader(_process.getInputStream())); </code></pre> <p>That's what I tried, but I don't see the output, and I guess the output deos not stored in the variable.</p> <h1>Python</h1> <pre><code>import subprocess def curl(*args): curl_path = '/usr/bin/curl' curl_list = [curl_path] for arg in args: # loop just in case we want to filter args in future. curl_list.append(arg) _output = subprocess.Popen( curl_list, stderr=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0] return _output _terminal_output = curl('curl', "https://stream.twitter.com/1/statuses/filter.json?track=justinbieber,PerezHilton,KimKardashian,britneyspears", '-u', 'user:pass') </code></pre>
java python
[1, 7]
2,883,154
2,883,155
jQuery: Backstretch plugin - show image loading?
<p>I'm using the <a href="http://srobbin.com/blog/jquery-plugins/jquery-backstretch/" rel="nofollow">Backstretch Plugin</a> to load some full screen images. Everything works fine, but I'd like it to show the image loading (as it would by default) rather than wait with a blank screen until it completely loads. Is this possible? I'm not a JS expert by the way.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
2,064,294
2,064,295
How to Declare Variables
<p>I know this is a little dumb, but how do you do this? I've "RTFM" but I still don't understand concepts like this just don't exist in the languages I'm used to programming. Anyway, my question is simple: how does one properly set a global variable which can be used by all public void functions inside that class? </p> <p>Here is some example code, I will highlight the redundancy in case you don't see it:</p> <pre><code>public class baketimer extends Activity implements OnClickListener { /** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); <b>final Button cupcake1 = (Button) this.findViewById(R.id.cupcake1);</b> cupcake1.setOnClickListener(this); } public void onClick(View v) { switch(v.getId()){ case R.id.cupcake1: <b>final Button cupcake1 = (Button) this.findViewById(R.id.cupcake1);</b> new CountDownTimer(30000, 1000) { public void onTick(long millisUntilFinished) { cupcake1.setText("" + millisUntilFinished / 1000); } public void onFinish() { cupcake1.setText("Done!"); } }.start(); Toast.makeText(this, "Mmm cupcakes!", Toast.LENGTH_SHORT).show(); break;</code></pre> <p>How would I go about declaring <code>cupcake1</code> for the entire class?</p> <p>Thanks in advance!</p>
java android
[1, 4]
4,643,009
4,643,010
Android Pinch/Two Finger rotation on view
<p>On iPhone I simply do this (and it works flawlessly): </p> <p>view.transform = CGAffineTransformRotate(transform, [(UIRotationGestureRecognizer *)recognizer rotation]);</p> <p>I of course am expecting to do more work on the Android side (as usual). I noticed that Android does not have a two finger rotation gesture detector. Any thoughts of how I could implement such behavior?</p> <p>This is what I use for my pinch scale detector:</p> <pre><code>private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener { @Override public boolean onScale(ScaleGestureDetector detector) { mScaleFactor *= detector.getScaleFactor(); // Don't let the object get too small or too large. mScaleFactor = Math.max(0.1f, Math.min(mScaleFactor, 5.0f)); invalidate(); return true; } } </code></pre>
java android
[1, 4]
3,589,909
3,589,910
Map-overlay balloon close
<p>I am developing an application in which i need to set itemize overlay and ballon popup in google mapview so simply i have just continue with <a href="https://github.com/jgilfelt/android-mapviewballoons" rel="nofollow">This</a> and it going good for me.now when i tap on overlayitem, it get balloon with attach data (with help of inflater) now on that inflater file i set one close button wich apear at top of the balloon. so when click on close , balloon will be close. but here i am stuck with event that how can i close this balloon at click event.</p> <p>if it is separate activity then i can defiantly close with simply call finish() method.</p> <p>but here differant matter...so please help me out this...</p>
java android
[1, 4]
2,050,250
2,050,251
Unable to pass the array value in the Hyperlink
<p>Below is the code that I am using with Jquery to pass a value when a hyperlink is selected on sharepoint disp form.</p> <pre><code>for(var i=0;i&lt;retval.length;i++) { strHTML = strHTML + "&lt;a href='url.aspx?ID= '+retval[i]+' &amp;Source= url'&gt;" + retval[i] + "&lt;/a&gt;"; strHTML = strHTML + " "; } strHTML = strHTML + "&lt;/div&gt;"; $("textarea[Title='Test']").closest("span").find("iframe[Title='Rich Text Editor']").contents().find("body").html(strHTML); </code></pre> <p>Its unable to read the value in retval[i], its breaking right at ID. Is the syntax wrong? </p>
javascript jquery asp.net
[3, 5, 9]
3,575,311
3,575,312
Both side Sync database from sqlite to website
<p>I hv apps that sync db from sqlite to sqlserver in website. bt the prbm is that i need to sync both side(server side and phn side). Means when user insert/update/delete any data from web it reflect in phn and also when any changes made phn's db it reflect on website.</p> <p>Curretly im using simple method. which master tables are controled by website and transation are in adnroid phn. so whn syncing process done. it remove all the master data from adnroid db and recreate all stuff. so it take a process. i only need that chnages made on master tables on website and changes reflects on phn, that's the method which i looking for. same way android phn hv transation record when syncing, it remove all data form website and recreate. </p> <p>So, how can i get only those records which is newly inserted or updated or deleted from adnroid phn as well as website....help me plzzzz...</p>
android asp.net
[4, 9]
2,045,274
2,045,275
check input of textboxes
<p>I am working with asp.net and I'm using textboxes for user input. I want to make sure that the user enters digits only. I don't want to use validation controls. If maybe somehow I could use the ASCII value of the text entered by the user to compare whether it's an alphabet or not using C#. I would really appreciate your help.</p>
c# asp.net
[0, 9]
5,111,341
5,111,342
How to escape a double-quote in inline c# script within javascript?
<p>How can I make the following inline c# work within javascript? I have had no luck with escape characters, but I am sure I'm just doing something wrong.</p> <pre><code>var inputId = "&lt;%= applicationForm.FindControl("myInput").ClientID %&gt;"; </code></pre>
c# asp.net javascript
[0, 9, 3]
3,560,166
3,560,167
How to activate <a> event by clicking on another element
<pre><code> &lt;div class="imgtumb"&gt;&lt;img src="..."&gt;&lt;/div&gt; &lt;a href="toBigImg" class="imgtarget"&gt;sometext&lt;/a&gt; &lt;script&gt; $(document).ready(function() { $('div.imgtumb img').click(function() { $('a.imgtarget').click(); }); }); &lt;/script&gt; </code></pre> <p>The link not work (dont open a big image). What i do wrong?</p> <p>----Edited---- Thank you guys, but .trigger() is not working too. I resolved this problem something like this:</p> <pre><code>$(document).ready(function() { $('div.imgtumb img').click(function() { window.location.href = $('a.imgtarget').attr("href"); }); }); </code></pre> <p>----Edited 2--- Question which explained why <a href="http://stackoverflow.com/questions/1694595/can-i-call-jquery-click-to-follow-an-a-link-if-i-havent-bound-an-event-hand">.click() is not working with a tag</a></p>
javascript jquery
[3, 5]
3,699,259
3,699,260
jQuery: Can't use the "find" method twice on a single object
<p>I'm currently trying to use the jquery "find" method on an object twice but it isn't letting me do it, only the first instance of "find" is working. Here is the code that I would like to run...</p> <pre><code>$("#phone_numbers &gt; p:first-child").clone(true).insertBefore("#phone_numbers &gt; span:last-child").find('.phone_type, .phone_number, .user_phones_id').val('').find('.delete_phone').remove(); </code></pre> <p>The above code works just fine except for the last "find" method, it isn't removing the elements with a ".delete_phone" class. </p> <p>However, if I change the code to look like this...</p> <pre><code>$("#phone_numbers &gt; p:first-child").clone(true).insertBefore("#phone_numbers &gt; span:last-child").find('.delete_phone').remove(); </code></pre> <p>It does remove the elements with a ".delete_phone" class. I assume this is because I can't use the "find" method twice in a row, but I'm not sure. </p> <p>Does anyone know what's going on or if there is a way around this problem?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
4,816,342
4,816,343
Group multiple or statements within an IF in javascript
<p>The following code works:</p> <pre><code>$(".valClear").each(function () { if ($(this).val().indexOf(".png") == -1) { $(this).val(''); } }); </code></pre> <p>However this doesn't (the value is removed even if it contains .png or .jpeg), what am I doing wrong?</p> <pre><code>$(".valClear").each(function () { if (($(this).val().indexOf(".png") == -1) || ($(this).val().indexOf(".jpeg") == -1)) { $(this).val(''); } }); </code></pre>
javascript jquery
[3, 5]
2,659,348
2,659,349
How to use different pages for form input and results using AJAX
<p>So, I have a search form in a php page (top.php) which is an include for the site I'm working on, one php page where all the mySQL stuff happens and the results are stored in a variable and echoed (dosearch.php) and lastly a php page where the results are displayed in a div through jQuery (search.php). This is the javascript code: </p> <pre><code>$(document).ready(function(){ $('#search_button').click(function(e) { e.preventDefault(); var searchVal = $('#search_term').attr('value'); var categoryVal = $('#category').attr('value'); $.ajax({ type: 'POST', url: 'dosearch.php', data: "search_term=" + searchVal + "&amp;category=" + categoryVal, beforeSend: function() { $('#results_cont').html(''); $('#loader').html('&lt;img src="layout/ajax-loader.gif" alt="Searching..." /&gt;'); if(!searchVal[0]) { $('#loader').html(''); $('#results_cont').html('No input...'); return false; } }, success: function(response) { $('#loader').html(''); $('#results_cont').html(response); } }); }); }); </code></pre> <p>The #search_term and #category fields are in top.php, the other divs (#loader and #results_cont) are in search.php. How would I go by in order to make the form submit and display the results in search.php from the top.php without problems? It works perfectly if the form and javascript are in search.php but I can't seem to separate those and make it work. What am I doing wrong?</p> <p>PS. Sorry if I'm not clear enough, am at work, really tired. :(</p>
php javascript jquery
[2, 3, 5]
2,735,909
2,735,910
How could I get the current day and current time with AM/PM of computer using jQuery
<p>I want to show current day and time(HH:MM) with AM/PM on my page. How to achieve this task in jQuery. I have done above thing using JavaScript but I just want to know how to do this task in jQuery easily as per the require.</p>
javascript jquery
[3, 5]
5,773,298
5,773,299
Enum to string C# and JavaScript
<p>In my .aspx I've got the following javascript variable defined:</p> <pre><code>var action = &lt;%=ProdView %&gt; </code></pre> <p>In code-behind this returns a custom enum value:</p> <pre><code>protected ProductView ProdView { get; private set; } </code></pre> <p>I would figure that this would automatically be converted to a string in javascript? Looks like no because I get the runtime error "Item is not defined" where Item is the value ProdView.Item. Ultimately I want the action's value to be "Item" as the value.</p> <p>Here's the Enum:</p> <pre><code> public enum ProductView { Product, Item } </code></pre>
c# javascript
[0, 3]
468,842
468,843
What's the difference of keyboard Single Byte Character Code and keyboard Double Byte Character Code
<p>I use jquery code:</p> <pre><code>$.ui.keyCode.COMMA </code></pre> <p>only can Capture Single Byte Character input,How can Capture Double Byte Character also. who can help me ? thanks</p>
javascript jquery
[3, 5]
816,505
816,506
jQuery: Total values in textboxes automatically
<p>I have a series of textboxes with the following IDs:</p> <pre><code>118|1/9/2011 118|1/10/2011 118|1/11/2011 118|1/12/2011 118|1/13/2011 118|1/14/2011 118|1/15/2011 118|Total </code></pre> <p>Using jQuery or just javascript, I need to sum each textbox and assign the value to the total textbox. This needs to happen when a user tabs off or clicks off the textbox. It also needs to be generic enough to handle textboxes with similar IDs such as:</p> <pre><code>119|1/9/2011 119|1/10/2011 119|1/11/2011 119|1/12/2011 119|1/13/2011 119|1/14/2011 119|1/15/2011 119|Total </code></pre> <p>The format stays the same. Only the first numbers to the left of the | will change.</p> <p>Any guidance would be greatly appreciated.</p>
javascript jquery
[3, 5]
1,987,595
1,987,596
jQuery - after()-function fires twice
<p>This is my code snippet:</p> <pre><code>$.ctrl('J', function() { $("#"+currentId).after('&lt;div contentEditable="true"&gt;test&lt;/div&gt;'); }); </code></pre> <p>After running it, 2 divs with "test" will be added instead of 1.</p> <p>What am I missing?</p> <p>This is the CTRL function:</p> <pre><code>$.ctrl = function(key, callback, args) { var isCtrl = false; $(document).keydown(function(e) { if (!args) args = []; if (e.ctrlKey) isCtrl = true; if (e.keyCode == key.charCodeAt(0) &amp;&amp; isCtrl) { callback.apply(this, args); return false; } }).keyup(function(e) { if (e.ctrlKey) isCtrl = false; }); }; </code></pre> <p>Thank you in advance.</p> <p>Greetings</p> <p>Edit:</p> <p>maybe it has something to do with this:</p> <pre><code>$('div[id|="edid"]').focus(function() { $('div[id|="edid"]').removeClass('onFocus'); $(this).addClass('onFocus'); var currentId = $(this).attr('id'); }); </code></pre>
javascript jquery
[3, 5]
5,237,988
5,237,989
JavaScript/jQuery - Fire event after keyup and timeout
<p>I would like to add a feature to my search function that will execute a search n seconds after a keyup event is fired. The idea is that if someone stops tryping for a second or so, they won't have to click the search button. So far I fire the search function on click, when the term is deleted, and on enter. I've marked in my code below where I'd like to have the timer thingy. I am asking this because it is almost 3am and JavaScript is hurting my head. Sorry if duplicate ...</p> <p>Here's what I have:</p> <pre><code>$("#filter").keyup( function(e) { var filter = $("#filter").val(); if( filter == 0 || filter == '' || filter == null ) { test(); } else { *********** timer, then test(); } if (e.which == 13) { e.preventDefault(); test(); } }); </code></pre>
javascript jquery
[3, 5]
1,210,770
1,210,771
QueryString for redirection!
<p>I have used a query string parameter to redirect from Page 1 to Page 2. From Page 2, i wanted to redirect it to Page 3 if Page 2 has been called from Page 1. What should be the condition to check if the querystring is used?? Please help me out!! Thanks guys!</p>
c# asp.net
[0, 9]
4,067,217
4,067,218
Development under Android
<p>I have the Android-based tablet, and I want to do some development actions on it.</p> <p>Is there a way to code and compile Java and Android applications on my tablet?</p>
java android
[1, 4]
5,042,874
5,042,875
Selecting an item in the RadioButtonList, how to get a list of items to a ListBox from database in asp.net c#
<p>I have a <code>RadioButtonList</code> and a <code>ListBox</code>. I have bound <code>RadioButtonList</code> to database. Therefore upon selecting an item in the <code>RadioButtonList</code>, I want to retrieve some data into the <code>ListBox</code>. The code I have tried is :</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { RadioFill(); } public void RadioFill() { SqlDataAdapter mydata = new SqlDataAdapter("SELECT DISTINCT Param_Name FROM Parameter_Value_Master", con); DataSet dset = new DataSet(); mydata.Fill(dset, "Table"); RadioButtonList1.Items.Clear(); RadioButtonList1.DataSource = dset.Tables[0]; RadioButtonList1.DataTextField = dset.Tables[0].Columns["Param_Name"].ColumnName; RadioButtonList1.DataBind(); } protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e) { SqlDataAdapter mydata = new SqlDataAdapter("SELECT Value_Option FROM Parameter_Value_Master", con); DataSet dset = new DataSet(); mydata.Fill(dset, "Table"); ListBox1.Items.Clear(); ListBox1.DataSource = dset.Tables[0]; ListBox1.DataTextField = dset.Tables[0].Columns["Value_Option"].ColumnName; ListBox1.DataBind(); } </code></pre> <p>The issue I am facing here is upon selecting an item, the whole panel in which I have placed both my <code>RadioButtonList</code> and <code>ListBox</code> goes invisible.</p> <p>Kindly help...!! Thankyou...!!</p>
c# asp.net
[0, 9]
1,455,734
1,455,735
html Form validation in js
<p>I have a php project , which contain a form named contact us , In this when a user submit that form a mail has sent to the administrator.. My aim is to design this page as dynamic. I mean ,the admin can add or change the fields in contact us page. I have implemented a text editor to do this. here the admin can design the contact page. My problem is that i want to validate(both server side and client side) all the fields. how is it possible using javascript.. Does any one Know this ?</p>
php javascript
[2, 3]
2,444,314
2,444,315
Writing file from PHP page android
<p>In my project a compressed file is displayed on a php in bytes. I am trying to find a way to read the php page, decompress the file using <strong>GZIP</strong>, and write it out to the assets folder. The file that I am reading in has to be placed in the <code>data/data/package/database</code> file. </p> <p>I have a class that reads a file from the assets folder and places the file into <code>data/data/package/database</code>. </p> <p>Is it possible to write to the assets folder during runtime? If not is there a better way to do this?</p>
java php android
[1, 2, 4]
310,281
310,282
Jquery loading Webpages
<p>Can I load external Website or Webpages into a DIV tag without using Jquery load(); function, since load() function is using AJAX. but apart from that is there any other simple way to loading Webpages </p>
javascript jquery
[3, 5]
2,726,978
2,726,979
Error on this webpage might cause it to work incorrectly
<p>I got the javascript error like "Error on this webpage might cause it to work incorrectly" and inside the pop up box "null is null not an object" while I executing my aspx page. Can any one have the solution for that ?? Thank you...</p>
c# asp.net
[0, 9]
167,385
167,386
Opening the jquery UI dialog inside the div
<p>I have a <code>div#test</code> , with which i bind a <code>dblclick event to opens a jquery ui dialog</code>, now i want to open </p> <p>that <code>dialog inside a floating div</code> ( means a div whose position is absolute and placed on the</p> <p>center of the screen) when the <code>dblclick event triggers</code> on <code>div#test</code> something like :</p> <pre><code> line #1 $("#test").trigger("dblclick"); =&gt; open the dialog line #2 $("floatingdiv").html("I want to open the dialog inside this div after executing the line #1); </code></pre> <p>Help me? Thanks.</p>
javascript jquery
[3, 5]
1,686,290
1,686,291
Grep strings in jQuery
<p>I have a jQuery object (thisClass) that contains 2 or more class names. I am trying to figure out how to return only the class name that is in a predetermined array.</p> <p>Something like this:</p> <pre><code>var thisClass = $(this).attr("class"); var icons = ["glass","leaf","dog","home"]; [Use grep here to return thisClass only as a single class name that is filtered by, or contained in icons.] </code></pre>
javascript jquery
[3, 5]
3,787,564
3,787,565
How to convert this PHP array into a JavaScript array?
<p>What would this PHP array look like in JavaScript?</p> <p>What would be the closest translation?</p> <pre><code>$nursery_rhyme = array(“mary”, “had”, “a”, “little”, “lamb”); </code></pre>
php javascript
[2, 3]
977,727
977,728
Android: Displaying a 2-D animation on top of Existing View/Activity
<p>I've been banging my head against the wall for a couple hours trying to figure out the best way to overlay an animation on top of a current View. I have a ListView, and I want to display an animation (say a frame-by-frame bomb explosion) on top of the ListView when a user clicks a button.</p> <p>Can someone point me in the right direction?</p>
java android
[1, 4]
3,071,553
3,071,554
Keep only first 20 entries in string
<p>I have a string that contains calculations. Each entry has a space in between the next. How do I keep only the most recent 20 entries? </p> <pre><code>Label2.text += TextBox1.Text + "+" + TextBox2.Text + "=" + Label1.Text + " "; </code></pre> <p>Output is:</p> <p>20+20=40 40+20=60 60+20=80 </p>
c# asp.net
[0, 9]
3,417,034
3,417,035
Iterating over variable with jQuery not working
<p>I set this variable at the top of my page <code>setVars = {"n":"2","m":"1","degree":"3","p":"2"}</code></p> <p>I want to iterate over each of the elements in setVars but jquery's each() function isn't working.</p> <p>Here's what I have -</p> <pre><code>$(setVars).each(function(key, value) { elementId = '#' + key+ '-wrapper'; } </code></pre> <p>But <code>key</code> is set to 0 here on the first iteration and <code>value</code> is set to the full setVars object here for some reason. It doesn't make it to a second iteration, it breaks when I step through it and try to go to the second iteration.</p>
javascript jquery
[3, 5]
1,457,359
1,457,360
Javascript and radio buttons. How do I get the vals?
<p>New to SO and javascript. I have been playing with JQuery for a couple of days now and I have a problem that I can't seem to solve. I have absolutely no js experience at all so if someone could help me out by literally spelling out what the issue is, I'd be gratful.</p> <p>I have a single group of radio buttons that will determine if a user is an administrator or a user. I probably have my html messed up also but what I need is the current ticked value so I can save it to a database. If the user is an administrator, the value will be 1 and if he is a user, the val will be 0.</p> <p>Here is my html:</p> <pre><code>&lt;tr&gt; &lt;td class="admMarker"&gt;&lt;label for="admEmpIsAdmin"&gt;Admin&lt;/label&gt;&amp;nbsp;&lt;input type="radio" id="admEmpIsAdmin" name="status" value="1" checked="checked" class="admChkbx"&gt;&lt;/td&gt; &lt;td class="admMarker"&gt;&lt;label for="admEmpIsUser"&gt;User&lt;/label&gt;&amp;nbsp;&lt;input type="radio" id="admEmpIsUser" name="status" value="0" class="admChkbx"&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>Here is the javascript:</p> <pre><code>var admEmpIsAdmin = $("input#admEmpIsAdmin").val(); </code></pre> <p>Can someone please tell me what I am doing wrong here? This code outputs the POST vals but I would also like to know if anyone has any suggestion for me on how to display the current status from the values when they come out of the database.</p> <p>Thanks!</p>
javascript jquery
[3, 5]
1,803,447
1,803,448
separate each value with comma from multiple select
<p>I have a <code>&lt;select multiple='multiple'</code> and I need to show the selected value in a div or some other part of the page.</p> <p>I did this but the string is all smushed together. How can I separate each value with a comma?</p> <p>I made a <a href="http://jsfiddle.net/2C523/12/" rel="nofollow"><strong>live example</strong></a> with what I have so far.</p> <p>Or if you prefer, here is the code:</p> <p><strong>html:</strong></p> <pre><code>&lt;select multiple='multiple' id="selMulti"&gt; &lt;option value="1"&gt;Option 1&lt;/option&gt; &lt;option value="2"&gt;Option 2&lt;/option&gt; &lt;option value="3"&gt;Option 3&lt;/option&gt; &lt;option value="4"&gt;Option 4&lt;/option&gt; &lt;/select&gt; &lt;input type="button" id="go" value="Go!" /&gt; &lt;div style="margin-top: 10px;" id="result"&gt;&lt;/div&gt; </code></pre> <p><strong>js:</strong></p> <pre><code>$("#go").click(function(){ var selMulti = $("#selMulti option:selected").text(); $("#result").text(selMulti); }); </code></pre> <p>If you select the option 1 and 2, the result will be:</p> <p><code>Option 1Option 2</code></p> <p>What I need is:</p> <p><code>Option 1, Option 2</code></p> <p>Thanks</p>
javascript jquery
[3, 5]
1,397,944
1,397,945
FileUpload error in the server
<p>hi I have a FileUpload and I save a picture and this is the error</p> <pre>Access to the path 'D:\Hosting\0000000\html\images\APgt_logo.jpg' is denied.</pre> <p>an my local is working well whats the problem?</p> <p>this is the code </p> <pre><code>new_row["Product_imag"] = FileUpload1.FileName.ToString(); FileUpload1.SaveAs(Server.MapPath("/images/"+ FileUpload1.FileName.ToString())); </code></pre>
c# asp.net
[0, 9]
841,588
841,589
Simple post of info from one c# asp.net page to the next issue
<p>I am not using MVC but forms authentication. I am having trouble getting variable to store when the submit button is pressed. I have spend 2 days researching how to do this. At this point I am just trying to get the username to post on the next page. I truly thought I understood the way viewstate worked after doing this for a year. </p> <p>Code:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { string username = Page.Session["username"].ToString(); Response.Write(username); } } protected void btnSubmit_Click(object sender, EventArgs e) { Page.Session["username"] = txtUsername.Text; } </code></pre>
c# asp.net
[0, 9]
3,718,425
3,718,426
Jquery - keeping it DRY - dynamically named functions?
<p>So I think the best way for me to keep my code is to call a function with a dynamic name. For example, I might need to call "productTemplate", "userTemplate", "orderTemplate", etc...</p> <p>Is this possible with javascript/jquery? Also, is it a performance hit or not so much?</p>
javascript jquery
[3, 5]
2,484,994
2,484,995
Retrieve navigation class name on page load jQuery
<p>I have a list of links that link to sections within the page using anchor tags. I'm trying to grab the current class name initially when the user loads the page and add the class of "active" to the list item. So for instance, if a user goes to www.mydomain.com/#about-section, the navigation will remove the existing 'active' class and then add the class to the current link.</p> <pre><code> &lt;nav id="primary"&gt; &lt;ul&gt; &lt;li class="active"&gt;&lt;a href="#intro-section"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#work-section"&gt;Work&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#about-section"&gt;About&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#contact-section"&gt;Contact&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/nav&gt; </code></pre> <p>How would I go about changing the class depending on which section is in view using jQuery?</p>
javascript jquery
[3, 5]
65,936
65,937
JSON Parsing with GSON
<p>I have the following Json string.How to parse this kind of Json using Gson in Java?Any help would be appreciated.</p> <pre><code>{ "acclst":[{ "accountInfoData":[{ "userId":9, "rid":"1-Z5S3", "acnme":"acc_1234.", "actpe":"Fabricator / Distributor", "mph":"2660016354", "euse":"Biofuels", "com":"0", "sta":"Active", "stem":"BBUSER5", "wsite":"", "fax":"", "zone":"", "crted":"BBUSER4", "statusX":1, "partyId":0, "address":[] } ] } ], "conlst":[], "actlst":[], "prolst":[], "code":"200" } </code></pre>
java android
[1, 4]
5,153,385
5,153,386
Choosing div placement using append in jQuery
<p>Using the following code:</p> <pre><code>&lt;script type="text/javascript"&gt; function moveFront(el){ var me = $('#'+el.closest('div').attr('id')); var parent = me.parent(); parent.find('div:first').prepend(me); //? } &lt;/script&gt; &lt;div class="comments"&gt; &lt;div id="105"&gt; 105 &lt;p&gt;...&lt;/p&gt; &lt;form&gt;...&lt;/form&gt; &lt;div id="116"&gt; 116 &lt;/div&gt; &lt;div id="106"&gt; 106 &lt;/div&gt; &lt;div id="109"&gt; 109 &lt;button onclick="moveFront($(this));"&gt;&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <ol> <li><p>I would like to append a new <code>div</code> element in the element with the ID of 105, however, I don't want it at the end or the start. It should be before the other <code>div</code> elements.</p></li> <li><p>If a button was used, as demonstrated in the <code>div</code> element with the ID of 109, how would I move it as the first <code>div</code> element with the ID of 105?</p></li> </ol>
javascript jquery
[3, 5]
3,919,493
3,919,494
Moving Beyond Factories in Python
<p>Coming to Python from Java, I've been told that factories are not Pythonic. Thus, I'm looking for <strike>a</strike> the Python way to do something like the following. (I'm oversimplifying my goal so that I don't have to describe my entire program, which is very complicated).</p> <p>My script will read in names of people (along with some information about them) and, from this, construct objects of type Person. The names may be repeated, and I only want one Person instance per name. These People may also belong to subclasses Man and Woman.</p> <p>One way to do this would be to create a PersonFactory which would either return a newly instantiated Man or Woman <em>or</em> a reference to the previously instantiated Man/Woman with the same name. The other would be to create a set of all Person objects and check each time for the presence of a Person with the given name before instantiating a new object. Neither approach strikes me as Pythonic, though. The first seems a bit too cumbersome for Python (creating a whole class just to handle creation of another object? Really?) and the second will get expensive quickly, as I have a lot of names to process.</p>
java python
[1, 7]
3,760,252
3,760,253
How do I cancel action of a form after an alert?
<p>When the user submits the form, <code>writeToStorage</code> is fired and it checks if the user is in localStorage and if it is, an alert is run. After this alert I don't want the action to execute. I tried <code>return false;</code> but obviously that does not stop the python script from running. How do I stop the action of the form in case the alert is triggered?</p> <pre><code>function writeToStorage() { var chooser = localStorage.getItem("chooser"); if (chooser) { alert("you are already a user); //return false; } else { //the rest of the program } }; # if alert is run the action of the form should not run &lt;form name="choice_form" id="choice_form" action="/g/choicehandler" method="post" onsubmit="writeToStorage()"&gt; &lt;textarea name="choice" rows="7" cols="50"&gt;&lt;/textarea&gt;&lt;br /&gt; &lt;input type="hidden" name="chooser" id="form_chooser" /&gt; &lt;input type="submit" value="submit your choice"&gt; &lt;/form&gt; </code></pre>
javascript python
[3, 7]
1,139,526
1,139,527
Can I do both javascript and a PHP form?
<p>I want to take advantage of some jquery functions for sending messages like having a modal dialog but I also want to include users not running javascript.</p> <p>If I have a jquery function to handle the dialog but the user doesn't have javascript enabled whats the best way to redirect them to my PHP page for composing and sending a message?</p> <p>I'm assuming the jquery code takes highest priority since it's client side but then do I wrap my php code in tags?</p> <p>Is there a more elegant solution?</p>
php javascript jquery
[2, 3, 5]
3,210,639
3,210,640
JavaScript for GridView row TemplateFields
<p>I'm creating a program where, in each GridView row, there is a checkbox and a textbox, which are unchecked and disabled by default respectively. When the checkbox is ticked, I need to fire a bit of JavaScript to enable that textbox, and vice versa for when is unticked. So far I am doing this:</p> <p>JS:</p> <pre><code> &lt;script type="text/javascript"&gt; function onholdev(index) { var chk = document.getElementById('&lt;%=grdCons.Rows[index].FindControl("chkHold").ClientID %&gt;'); var txt = document.getElementById('&lt;%=grdCons.Rows[index].FindControl("txtReason").ClientID %&gt;'); if (chk.checked == true) { txt.disabled = false; } else { txt.disabled = true; txt.value = ""; } } &lt;/script&gt; </code></pre> <p>C# (RowDataBound event)</p> <pre><code> CheckBox chkHold = ((CheckBox)e.Row.FindControl("chkHold")); chkHold.Attributes.Add("onchange", "onholdev(" + e.Row.RowIndex + ")"); </code></pre> <p>But in the JS, it's saying the 'index' variable does not exist, in the first line of the function (that begins with var chk). Am I doing this right?</p>
c# javascript asp.net
[0, 3, 9]
5,548,349
5,548,350
text replace with jquery
<p>So im using jquery to search and replace certain text in my html page. Which is:</p> <pre><code>function offon(){ $("#sidebar li").each(function(){ $(this).html($(this).html().replace(/Off Premise/, "Liquor Store")); $(this).html($(this).html().replace(/On Premise/, "Bar/Restaurant")); }); } </code></pre> <p>This is the createmarker function, it uses a 3rd part tooltip the div is "simple_example_window" that contains all the html. I tried using simple_example_window for the div in the offon function but it did not do anything. </p> <p><a href="http://gmaps-utility-library-dev.googlecode.com/svn/trunk/extinfowindow/docs/examples.html" rel="nofollow">http://gmaps-utility-library-dev.googlecode.com/svn/trunk/extinfowindow/docs/examples.html</a> is the plugin.</p> <pre><code>function createMarker(point, name, address, type) { var marker = new GMarker(point, customIcons[type]); markerGroups[type].push(marker); var html = '&lt;span class="name"&gt;&lt;b&gt;' + name + '&lt;/b&gt;&lt;/span&gt; &lt;br/&gt;' + address + '&lt;br/&gt;' + type; GEvent.addListener(marker, 'click', function() { marker.openExtInfoWindow( map, "simple_example_window", html, {beakOffset: 2} ); </code></pre> <p>It works like a charm. The only problem now is my tooltips in google maps are not changing.</p> <p>Any ideas?</p>
javascript jquery
[3, 5]
5,659,353
5,659,354
How do I know this function is return empty..and how do I show it?
<p>Hi I am not familiar with javascripts...so cant understand how do I check which variable return empty?? if tweet is there then it fill with tweets but if not then it wont show up. but I want know which varible is fills the container and if I want show "there is no tweets for you" then where will I add that??</p> <pre><code>$(document).ready(function() { $.twtter.start({ searchType:"searchWord", searchObject:"google", lang:"en", live:"live-180", placeHolder:"twitterdiv", loadMSG: "Loading messages...", imgName: "loader.gif", total: 6, readMore: "Read it on Twitter", nameUser:"image", openExternalLinks:"newWindow", }); $("#twitSearch").submit(function(){ $.twtter.start({ searchType:"searchWord", searchObject:$(".twitSearch").val(), live:"live-180", }); return false; }); }) </code></pre> <p>the result is displayed in </p> <pre><code>&lt;div id="twitterdiv"&gt;&lt;/div&gt; </code></pre> <p>THanks</p>
php javascript
[2, 3]
2,690,331
2,690,332
Get only the elements which are not hidden.. Jquery
<p>I need to get only the show() element in jquery foreach loop</p> <p>In the below code i am getting all the element with class test (i.e) both hidden and shown... but need only shown and not hidden one... how to filter and get that in this line itself????? </p> <pre><code>$('.element').find('.test').each(function(index, loopelement) { } </code></pre>
javascript jquery
[3, 5]
4,623,263
4,623,264
how to read character behind some text
<p>this one a code for read two character behind text "KD-R411ED"</p> <pre><code>var code = data[0].substr(data[0].length - 2); </code></pre> <p>how to read ED character if text like KD-R411H2EDT? i want a new code can combine with code above..please help!!</p> <p>look this:</p> <pre><code> &lt;script type="text/javascript"&gt; $("#tags1").change(function() { var barcode; barCode=$("#tags1").val(); var data=barCode.split(" "); $("#tags1").val(data[0]); $("#tags2").val(data[1]); var code = data[0].substr(data[0].length - 2); // suggested by Jan Willem B if (code == 'UD') { $('#check1').attr('checked','checked'); } else { if (code == 'ED') { $('#check2').attr('checked','checked'); } } &lt;/script&gt; </code></pre> <p>and this one</p> <pre><code>&lt;input id="check1" type="radio" class="check" name="check" onclick="addtext()" value="U" /&gt;U &lt;input id="check2" type="radio" class="check" name="check" onclick="addtext_1()" value="E" /&gt;E </code></pre>
javascript jquery
[3, 5]
301,468
301,469
Java to c# convertor
<p>looking for a java to c# converter. the project is about 100 classes. what is the best program for this?</p>
c# java
[0, 1]
4,371,302
4,371,303
jquery find textfield
<p>The following code works fine at finding the value of price, which is held in a label field. However I need quantity held in a text area, but it's not working.</p> <p>Any ideas?</p> <p>The Javascript:</p> <pre><code> var price = parseInt(ui.draggable.find(".price").html().replace("$ ", "")); var qty = parseInt(ui.draggable.find(".qty").html()); </code></pre> <p>The HTML:</p> <pre><code>&lt;label class="price"&gt;$ 100&lt;/label&gt; &lt;input name="qty_1" type="text" class="qty" id="qty_1" value="1" size="2" maxlength="2"&gt; </code></pre>
javascript jquery
[3, 5]
1,556,446
1,556,447
Dropdown selection navigation to different page with dropdown values; Asp.Net + Javascript
<p>I want to access drop down menu's variable in java script on change event, here is my code</p> <pre><code> &lt;asp:DropDownList ID="DropDownList1" runat="server" onchange="document.location.href = url_Lookbook;" &gt; &lt;asp:ListItem Value="0"&gt;hello&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="1"&gt;world&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt; </code></pre> <p>here is the script coding:</p> <pre><code>&lt;script type="text/javascript"&gt; var url_Lookbook = "http://microsoft.com"; &lt;/script&gt; </code></pre> <p>My question is how do I pass down value=0 or value = 1 to different page, any help is appreciated.</p>
asp.net javascript
[9, 3]
5,387,988
5,387,989
Strucuring a source code
<p>I'm rather new to developing overall and have been working on an android app for about a week. So far I've made pretty damn good progress, however I struggle with structuring my source code.</p> <p>So far I've written the vast majority into the MainActivity.java file, but with my app growing in size so did that specific file. My app will use only one activity most of the time, but I want to outsource most if not all of my subclasses into different java files, so dear SOF, help a newbie, a there any good guides out there on this very topic? I'm having some trouble structuring my app, especially in terms of when to use which public/static or whatever parameters to access classes from other classes. </p> <p>I wish I had specific questions on this but it's just so overwhelming. </p>
java android
[1, 4]
3,041,423
3,041,424
unable to set href inside click event of Jquery
<p>Hi I am trying to set href using Jquery inside click event of RadioButtonList but that doesnt work If I take the same code to document.ready event it works fine but not in click event. Please advice.</p> <pre><code>$(document).ready(function() { url = "Results.aspx?latitude=" +latitude + "&amp;Longitude=" + longitude; $("a[href='http://www.google.com/']").attr("href", url); // this works.. } $('.rbl input').click(function() { id = $(this).parent().children("input").val(); url = "Results.aspx?latitude=" + latitude + "&amp;Longitude=" + longitude + "&amp;ServiceCenterProductTypeId=" + id; //alert(url); $("a[href='http://www.google.com/']").attr("href", url); //this doesnt work.... }); }); </code></pre>
asp.net javascript jquery
[9, 3, 5]
4,110,676
4,110,677
If variable matches another variable
<pre><code>var test = "Example"; var another = "Example"; &lt;div id="whatever"&gt; Blah &lt;/div&gt; </code></pre> <p>How can I apply <code>$('#whatever').hide()</code> if <code>test</code> and <code>another</code> match, and <code>$('#whatever').css('color','red')</code> if they don't?</p>
javascript jquery
[3, 5]
3,052,788
3,052,789
HTML command-line-like text box
<p>I'm trying to make a text box that executes custom commands with custom syntax, it's for teaching children how to program, a simple example is that if the user wrote an ($) sign the program alerts a message (you are now writing a variable name), on the same text box if he added (!=) the alert says not equal, and so on.</p> <p>Right now I'm doing it using jqyery keyup event, by running several regex tests and on each test the alert box alerts, I want to ask if there's a better approach to do this. is there a better one?</p>
javascript jquery
[3, 5]
3,323,369
3,323,370
Problem with mixing Javascript the PHP
<p>I am trying to assign values in javascript assigned from PHP and the use document.write() to output them. The problem is when I do this, a complete blank screen shows up but no errors are ever thrown. But if I take the PHP out and put in a value such as 'ABC' it works. And example of my code can be this:</p> <pre><code>var comment_text="&lt;?php echo $value['comment_text'];?&gt;"; var bodyelement = document.getElementsByTagName('body')[0]; var newdiv = document.createElement('div'); newdiv.style.textAlign = 'center'; newdiv.style.zIndex = 10001; newdiv.style.left = (&lt;?php echo $comment_x;?&gt;+getPos('browserwindow',"Left")-23) + 'px'; newdiv.style.top = (&lt;?php echo $comment_y;?&gt;+getPos('browserwindow',"Top")-90) + 'px'; newdiv.style.position = 'absolute'; newdiv.innerHTML = comment_text; bodyelement.appendChild(newdiv); </code></pre> <p>I do have an PHP error log and no errors are beign thrown either. The values are retrieved from the database, the probem comes with outputting them. <strong><em>*</em></strong><em>UPDATE</em><strong><em>*</em></strong> Ok, I had this problem before.</p> <p>Basically a newline is created like this:</p> <pre><code>var comment_text="cool Beans </code></pre> <p>";</p> <p>I have tried to remove the newline with string replace but doesn't seem to work. Why would a new line like this cause this error?</p>
php javascript
[2, 3]
4,099,767
4,099,768
Call A Function On ScrollExtend - jQuery
<p>How to call a function on scrollExtend. I need the code like below but its not working fine. How to make it work?</p> <pre><code>$(document).ready( function() { $('#scrollBox').scrollExtend(function() { //alert('scroll extend working'); //functionCall(); }); } ); </code></pre> <p>But the actual code of scrollExtend is like below in which i dont know how to call a function on it,</p> <pre><code>jQuery('.scroll_container').scrollExtend({ 'target': 'div#scroll_items', 'url': 'more_content.html', 'newElementClass': 'list_item more_content' }); </code></pre>
javascript jquery
[3, 5]
1,832,733
1,832,734
Handle folder and subfolder with aspx .net
<p>I have questions about my site if I want to handle this link Abc.com/abc/ab/2 All handle with this page root folder Without I have abc folder Or any other folder </p>
c# asp.net
[0, 9]
5,464,128
5,464,129
How to change button text color programmically on press?
<p>I create button like this:</p> <pre><code>Button button = new Button(this); button.setText("2012"); button.setBackgroundColor(Color.TRANSPARENT); button.setOnClickListener(mCorkyListener); layout.addView(dateButton); </code></pre> <p>On click listiner i have this method. Here i want to change button text color. Bu View don't have this method</p> <pre><code> private OnClickListener mCorkyListener = new OnClickListener() { public void onClick(View v) { // do something when the button is clicked //v.setBackgroundColor(Color.RED); //so how to change pressed button text color ? //v.setTextColor(colors); } }; </code></pre> <p>There wouldn't be just one button. There would be many of those and i need to chnage text color when button pressed.</p>
java android
[1, 4]
5,809,282
5,809,283
Build js function within jQuery SDK
<p>i've created a new js function like this</p> <pre><code>Object.prototype.testFn = function(){ s=this; alert(s); } a='word'; a.testFn(); </code></pre> <p>i'ts working as well, but, when i use jQuery sdk, then i call jQuery live, my testFn function is called repeatedly. and sometimes, the whole script is not working...</p>
javascript jquery
[3, 5]
2,394,261
2,394,262
How to show errorMessage of RequiredFieldValidator in Javascript
<p>Good day!</p> <p>Say I have a code that will force to show the errorMessage of the RequiredFieldValidator. This validator is declared as follows.</p> <pre><code>&lt;asp:RequiredFieldValidator ID="valOrderNameRequired" ControlToValidate="OrderName" EnableClientScript="true" Enabled="False" runat="server" ErrorMessage="Order Name is required" meta:resourcekey="valOrderNameRequiredResource1" &gt;*&lt;/asp:RequiredFieldValidator&gt; </code></pre> <p>The code that will show the errorMessage is as follows:</p> <pre><code>if(Condition true/false){ ValidatorEnable(document.getElementById("valOrderNameRequired"), true); // code here, show the errorMessage }else{ } </code></pre> <p>But the code above will only going to display the '*'. I want to show as well the errorMessage itself "Order Name is required."</p> <p>How to do this?</p> <p>Thanks</p> <p>Jason</p>
javascript asp.net
[3, 9]
3,601,354
3,601,355
Large amount of constants in Java
<p>I need to include about 1 MByte of data in a Java application, for very fast and easy access in the rest of the source code. My main background is not Java, so my initial idea was to convert the data directly to Java source code, defining 1MByte of constant arrays, classes (instead of C++ struct) etc., something like this:</p> <pre><code>public final/immutable/const MyClass MyList[] = { { 23012, 22, "Hamburger"} , { 28375, 123, "Kieler"} }; </code></pre> <p>However, it seems that Java does not support such constructs. Is this correct? If yes, what is the best solution to this problem?</p> <p>NOTE: The data consists of 2 tables with each about 50000 records of data, which is to be searched in various ways. This may require some indexes later, with significant more records, maybe 1 million records, saved this way. I expect the application to start up very fast, without iterating through these records.</p>
java android
[1, 4]
5,447,537
5,447,538
How do I set the default state of a checkbox in ListView [Android]
<p>I am creating a list view as shown below. I want to set their states from a config file. How do I access the checkbox enabled property? I don't know how to get the checkbox object knowing only the text associated with it. I would like to loop through my configuration parameters and compare the config key to the items in the listview to obtain the index.</p> <pre><code> ArrayList&lt;String&gt; chansModem0 = getChannelList(); lv_arr = (String[]) chansModem0.toArray(new String[0]); lvModem0 = (ListView) findViewById(R.id.listViewModem0); lvModem0.setAdapter(new ArrayAdapter&lt;String&gt;(MainActivity.this,android.R.layout.simple_list_item_multiple_choice, lv_arr)); lvModem0.setItemsCanFocus(false); lvModem0.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); </code></pre>
java android
[1, 4]
5,036,306
5,036,307
Check values of all fields of a certain class
<p>In jQuery, how do I check the values of all option tags inside of a certain div.class to make sure they are set? </p>
javascript jquery
[3, 5]
754,878
754,879
AlertDialog - trying to understand this syntax
<p>This is code from the book sample:</p> <pre><code>new AlertDialog.Builder(this) .setTitle(getResources().getString(R.string.alert_label)) .setMessage(validationText.toString()) .setPositiveButton("Continue", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int arg1) { // in this case, don't need to do anything other than close alert } }) .show(); </code></pre> <p>I want to understand this code, please rewrite it in several statements, so that each statement makes exactly one operation. Thanks!</p>
java android
[1, 4]
5,079,679
5,079,680
Storing session variables in ASP.NET page?
<p>How can I put variables that have scope the whole session on ASP.NET Page (I mean in the class that stands behind the aspx page)? Is the only way to put the variable in the Session object?</p> <p>For example:</p> <pre><code>public partial class Test_ : System.Web.UI.Page { private int idx = 0; protected void Button1_Click(object sender, EventArgs e) { Button1.Text = (idx++).ToString(); } } </code></pre> <p>I want on every click on this button my index to go up. How can I do this without using the Session object?</p> <p>10x in advance, Danail</p>
c# asp.net
[0, 9]
810,848
810,849
javascript display different error message
<p>I have two page (page1.php and page2.php) that need to put the javascript coding. On the page1.php, there have two images link to page2.php.</p> <p>This is the code for page1.php:</p> <pre><code>&lt;a href="page2.php"&gt;&lt;img src="btn1.png" id="img1"&gt;&lt;/a&gt; &lt;a href="page2.php"&gt;&lt;img src="btn2.png" id="img2"&gt;&lt;/a&gt; </code></pre> <p>This is code for page2.php:</p> <pre><code>&lt;input id="t_c" type="checkbox" name="t_c" value="1"/&gt; &lt;input type="image" value="continue" src="images/btn_cont.png"/&gt; </code></pre> <p>If user click image1, it will go to page2.php. then if user didn't click the checkbox, there will display the error message.</p> <p>If user click image2, it will go to page2.php. then if user didn't click the checkbox, there will display different error message.</p>
php javascript
[2, 3]
2,587,212
2,587,213
How can I detect the browser with PHP or JavaScript?
<p>How can I detect if the user is not using any of the browsers Chrome, Firefox or Internet Explorer using JavaScript or PHP?</p>
php javascript
[2, 3]
3,905,734
3,905,735
How do I view a matrix in a datagridview?
<p>I've a matrix and I want to view it in a <code>datagridview</code> in <code>.NET</code>.</p> <p>How do I do this?</p> <p>Here's the code:</p> <pre><code> DataGridBox.Show() .SetAutoSizeColumns(DataGridViewAutoSizeColumnsMode.Fill) .SetAutoSizeRows(DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders) .SetDefaultFontSize(5) .WaitForClose(); </code></pre>
c# asp.net
[0, 9]
4,014,758
4,014,759
Execution count of installed applications
<p>I am interested in getting values of already installed packages in android. I am trying to find the value how many times were the already installed packages executed (closed and open). I am aware i can do that for my application from sharepreferences but how to do for packages that are already there? I already have the list of the packages installed using PackageManager.</p> <p>Thanks in advance</p>
java android
[1, 4]
1,339,612
1,339,613
What are the hardest specific parts of C++/C#/Java which show's you're an expert?
<p>Just wondered what are the features of the three main programming languages which show you are an 'expert'? Im using this as a benchmark to improve my employability.</p> <p>Am i right in saying for C++ the most difficult aspect to master is (smart) pointers?</p> <p>Java seems much easier as memory is handled for you. I'm not entirely sure on C# either?</p>
c# java c++
[0, 1, 6]
5,543,192
5,543,193
Converting C# app to Android - How to extend List<>
<p>I'm converting an app someone else wrote to Android.</p> <p>One of the classes is declared like so:</p> <pre><code>public class PowerList : List&lt;PowerEvent&gt; </code></pre> <p>How would I do this in Java for Android? If I do this:</p> <pre><code>public class PowerList extends List&lt;PowerEvent&gt; </code></pre> <p>I get errors - </p> <pre class="lang-java prettyprint-override"><code>"The type List&lt;PowerEvent&gt; cannot be the superclass of PowerList; a superclass must be a class" </code></pre>
c# java
[0, 1]
5,411,091
5,411,092
If was not alert go to url else do not go
<p>I want make validation jquery <strong>without using from plugin</strong>, problem is here that after click on button and get alert(if field is empty) it go to url <code>#</code> that there is in <code>&lt;form action="#"...</code>. </p> <p>I want if get alert(mean if field is empty) 'input is empty' not go to url that there is in <code>...action="#"...</code>, if filed has value it go to url. i can not use from <code>ajax call</code> or <code>preventDefault</code> or <code>window.location</code>(Because one from field is <code>input:file</code>).</p> <p><strong>Example:</strong> <a href="http://jsfiddle.net/gb7nh/1/" rel="nofollow">http://jsfiddle.net/gb7nh/1/</a></p> <p>How can fix it?</p> <pre><code>&lt;form action="#" method="POST"&gt; &lt;input type="text" name="name"&gt; &lt;button id="cli"&gt;Submit&lt;/button&gt; &lt;/form&gt; $('#cli').live('click',function(e){ //e.preventDefault(); if($('input[type="text"]').val()=='')alert('input is empty') }) </code></pre>
javascript jquery
[3, 5]
902,185
902,186
Autoscroll page down in jquery with animation
<p>How can I add this functionality like auto scroll down using jquery or any other plugin?</p> <p><a href="http://www.nextbigsound.com/premier/beta" rel="nofollow">http://www.nextbigsound.com/premier/beta</a></p>
javascript jquery
[3, 5]
2,734,522
2,734,523
Restrict users from my website to redirect to another website
<p>I would like to restrict users from my website to stop redirection to another website. For example my website is www.paktutorial.com and there is a link to website www.google.com. but i want that user do not navigate to google.com ( I want that link over there but do not the redirection).</p> <p>Thanks in advance.</p>
php javascript jquery
[2, 3, 5]
1,730,948
1,730,949
valuechange events in javascript?
<p>I'm wondering how to attach an event listener to a variable... I know that sounds super weird so here's what I'm working with.</p> <pre><code>B.viewController = function() { var view = 'large'; var update = function() { if($(window).width() &gt;= 481) { var new-view = 'large'; return view == new-view } else { var new-view = 'mobile'; return view == new-view; } } update(); $(window).resize(function() { update(); }); }; </code></pre> <p>now i'd like to expand this so that I can attach it as an event listener so for example I could use this to do something like coolImage.bind('B.viewController', callback) So that if the view changes the callback is called without having to attach a resize listener to the window...</p>
javascript jquery
[3, 5]
1,811,039
1,811,040
How to Call this JavaScript Method which is Wrapped in a jQuery Function
<p>I am studying a JavaScript file and saw in it that some of the methods are wrapped inside a jQuery function. Can Anyone help me how to invoke the following method? And may I know what is the advantage or why the method is wrapped in a function? Below is my sample JavaScript code.</p> <p><strong>JQuery/JavaScript</strong></p> <pre><code>$(document).ready(function () { //How to invoke "testMethod" method? $(function () { function testMethod() { alert("this is a test method"); } }); }); </code></pre>
javascript jquery
[3, 5]
1,858,355
1,858,356
Javascript, check multiple arrays for number
<p>I'm looking for the best solution here, i've got an idea but thinking it could be done prettier.</p> <p>I'm making an simple weather application. And i'm using Yahoo Weather api were they have got codes for weather conditions.</p> <p>Depending on the condition i'm giving a code. Now, there are 50 codes and i've categorised them into 5 categories. In my case ex. my categori Snow contains 15 of Yahoo's condition codes.</p> <p>Well, if you got a better idea (which i bet there is) be free to suggest.</p> <p>My thought is to return the matching value from a set of arrays, but not shure how to do it.</p> <p>My code now looks like this:</p> <pre><code>function getCondition(code) { var snow = [1, 2, 3], sun = [4, 5, 6]; } </code></pre> <p>What i need is the variable name that contains the matching number of the code?</p> <p>I've made a JS-Fiddle <a href="http://jsfiddle.net/BH8r6/" rel="nofollow">http://jsfiddle.net/BH8r6/</a></p>
javascript jquery
[3, 5]
1,705,460
1,705,461
How to check a input IP fall in a specific IP range
<p>If we let users input a couple of ip ranges, e.g., 172.16.11.5 - 100, how could I write a fucntion to check if a IP (172.16.11.50) falls in the ranges?</p> <p>Is there any existing library in .NET to leverage?</p>
c# asp.net
[0, 9]
1,557,526
1,557,527
jquery - happy clicker - looking for callback on bound event
<p>I'm binding some slightly complex functionality to a click event</p> <pre><code>$(someSelector)).bind('click', someFunction(a,b,c)); function somefunction(a,b,c) { return function() { // some logic $(anotherSelector).each(function() { // fade out with call back... $(this).fadeOut("fast", function() { // TODO: add callback here??? $(contentSelector).fadeIn("fast"); }) }) } } </code></pre> <p>The problem is that a series of fast clicks results in inconsistent fadeOut / fadeIn behaviour. I'm assuming that new click events are processed before the current fadeIn is complete. </p> <p>I think I'm looking for some callback mechanism that ensures that new clicks are processed after current clicks are finished. I could add a callback to fadeIn, but I don't see what I kind of logic would help me there...</p> <p>I also read about unbinding components for as long as a click is processed (and later rebinding them), but again - I'm not sure on top of which logic I would put that.</p> <p>Thanks for advice :)</p>
javascript jquery
[3, 5]
3,327,257
3,327,258
Change jquery variable for each instance it's used on a page
<p>I am setting up a page that has multiple links to different documents. Since the names of the links match the documents they are linked to, I thought I would write a script that takes the inner html of anything underlined and generates a link tag around it and inputs each particular link name in the link.</p> <p>The script I wrote runs fine except it only runs once and updates all links with one identical link for each. Is there a way I can make it take each instance and change them individually?</p> <p>Sorry if I've butchered my explaination!</p> <p>Here is my current code:</p> <pre><code>&lt;u&gt;Link1&lt;/u&gt; &lt;u&gt;Link2&lt;/u&gt; &lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt; innerU = $("u").html(); $("u").html("&lt;a href=mywebsite.com/" + innerU + ".pdf&gt;" + innerU + "&lt;/a&gt;"); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
2,513,469
2,513,470
JQuery Syntax Problem?
<p>I am using JQuery to insert divs into a page but i cant seem to get the quotation marks correctly setup.</p> <p>For example the code below works fine: </p> <pre><code>var newDiv_1 = '&lt;div id="event_1"&gt;&lt;b&gt;Hello World 01&lt;/b&gt;&lt;/div&gt;'; $('#mon_Events').append(newDiv_1); </code></pre> <p>But when i try to use variable in place of the normal text, i doesnt seem to work:</p> <pre><code>var eventname = 1; var newDiv_1 = '&lt;div id="event_' . eventName . '"&gt;&lt;b&gt;Hello World 01&lt;/b&gt;&lt;/div&gt;'; $('#mon_Events').append(newDiv_1); </code></pre> <p>How do i use variable inside this statement?</p>
javascript jquery
[3, 5]