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
3,513,245
3,513,246
Shared Preferences Between Activities
<p>Still fairly new to android, wondered if anyone can help...</p> <p>I have an App that has multiple activities. Each Activity has a shared preferences file to save strings for that activity. Each preference has its own name.</p> <p>However, i want any activity to be able to read all preferences....</p> <p>Am i right in thinking that if i rename them all to the same preference name, that preference will be accessible from any activity within my App?</p> <p>Or do i need to create a seperate class to handle all preferences?</p> <p>Many thanks</p>
java android
[1, 4]
2,191,574
2,191,575
using php within setTimeout in javascript
<p>I have an issue using my php code within the javascript function setTimeout. The code is in a php file, but instead of acting like it should and waiting the five minutes to send the user to the index page of my website, it just does it instantly. Any ideas?</p> <p>Here's the code:</p> <pre><code>&lt;script&gt; setTimeout(function() { &lt;?php header( 'Location: /index.html' ); ?&gt; }, 300000); &lt;/script&gt; </code></pre>
php javascript
[2, 3]
1,277,123
1,277,124
unterminated string constant javascript error when opening tiny box
<p>I am opening a url using tiny box by following code</p> <pre><code> function openAddBranchPopup(siteurl) { TINY.box.show(siteurl+'/pages/dept.php',1,780,'',1); } </code></pre> <p>but in internet explorer 8 and 9, i am getting "unterminated string constant" error. Please help.</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,655,619
3,655,620
how to get file without as it is
<p>Hi I am trying to read a html file and store its content but when I am converting it I am Getting all the special characters are converted to Question mark.</p> <p>I am using stream reader to read the file and stream writer to write the content of that file to another file after storing the content in the Database.</p>
c# asp.net
[0, 9]
1,679,585
1,679,586
Is there a free website to store code (php, javascript, css) online?
<p>I am looking for website to store my code and then reused if may I need it. Would be great something like Delicious but for coding or something like Snippely.</p> <p>Thanks. </p>
php javascript jquery
[2, 3, 5]
4,983,677
4,983,678
Print content of div as png image without any prompt
<p>I am writing a script in jquery and supporting languages for a special purpose and after completing it i will make it live with GPL licencing. i have wrote around thousand of line. till now the script is working fine, i required some technique to print content of div with the background image and every thing inside the div as a png image which can be saved without any prompt, this helps me to complete the script.</p>
javascript jquery
[3, 5]
4,231,330
4,231,331
convert number from 12 to 12.00
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5648205/in-php-how-to-print-a-number-with-2-decimals-but-only-if-there-are-decimals-al">In PHP, how to print a number with 2 decimals, but only if there are decimals already?</a> </p> </blockquote> <p>Brothers I want to convert me any way I entered into a text field automatically turns 12 to 12.00</p> <p>How possible work by php and javascript</p> <p>Thanks</p>
php javascript
[2, 3]
5,853,653
5,853,654
condition if two checkboxes are checked doesn't work in jquery
<p>I have two radio groups. I wish to put a condition where if pRange is checked (val=pRange) and periodType value is 'one', 'two' or 'three', it displays a div called message. but my js code below doesn't seem to work. Any help is much appreciated.</p> <pre><code>$("input[name$='periodType']").change(function() { var grpname = $(this).val(); var pname = $("input:radio[name='mainPeriod']:checked").val(); if (((grpname == "one") || (grpname == "two") || (grpname == "three")) &amp;&amp; (pname=="pRange")) { alert( pname + ' gname= ' + 'yes'); $('.message').show; } else { alert( pname + ' gname= ' + 'no'); } }); </code></pre> <p>GROUP 1</p> <pre><code>&lt;input type="radio" name="mainPeriod" id="pRange" val="pRange" /&gt; &lt;input type="radio" name="mainPeriod" id="pHour" val="pHour" /&gt; &lt;input type="radio" name="mainPeriod" id="pDay" val="pDay" /&gt; &lt;input type="radio" name="mainPeriod" id="pWeek" val="pWeek" /&gt; &lt;input type="radio" name="mainPeriod" id="pMonth" val="pMonth" /&gt; </code></pre> <p>GROUP 2</p> <pre><code>&lt;input type="radio" name="periodType" val="one" /&gt; &lt;input type="radio" name="periodType" val="two" /&gt; &lt;input type="radio" name="periodType" val="three" /&gt; &lt;input type="radio" name="periodType" val="four" /&gt; &lt;input type="radio" name="periodType" val="five" /&gt; &lt;div class="message" style="display:none;"&gt;Message&lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
3,359,266
3,359,267
Pass variable between functions
<p>I have the following line of code that is executed inside the <code>$(document).ready</code>:</p> <pre><code>$('#sliding_menu_area').toggle(effect, reAlign); </code></pre> <p><code>reAlign</code> is a function that is declared outside of the <code>$(document).ready</code> main function in my <code>.js</code> file.</p> <p>I have a variable called <code>tag</code> that is declared also inside the <code>$(document).ready</code> and I need to pass the variable to the <code>reAlign</code> function. I tried </p> <pre><code>$('#sliding_menu_area').toggle(effect, reAlign(tag)); </code></pre> <p>but it didn't work. Can I declare the <code>tag</code> variable as a global so functions declared outside of <code>$(document).ready</code> to be able to access it? So far the functions declared inside the <code>$(document).ready</code> can access it just fine.</p> <p>Any ideas?</p>
javascript jquery
[3, 5]
1,402,363
1,402,364
How to return variable datatypes from a method
<p>I have a method whose callers require different datatypes. I could repeat the requisite conversions a dozen times by putting them in each of the callers, but it seems much more efficient to do it once in the called method.</p> <pre><code>public String myMethod(String myArg) { return DoSomething(myArg); } public Int32 myMethod(String myArg) { return Convert.ToInt32(DoSomething(myArg)); } private String DoSomething(key) { return SomeList[key]; } </code></pre> <p>If I have multiple methods that pull data from SomeList and have to utilize different data types then in each I have to do a type conversion. Examples might be session variables or query or form requests or any other number of things. </p> <p>In VB I could say</p> <pre><code>Function myMethod(myArg as String) as Variant myMethod=DoSomething(myArg) End Function </code></pre> <p>Sorry if the original post was not very clear. I hope this makes more sense.</p> <p>Thanks</p>
c# asp.net
[0, 9]
2,156,722
2,156,723
onchange event is not fire on asp checkbox in chrome only
<p>This doesn't work for me in chrome</p> <pre><code>&lt;asp:CheckBox ID="chkFullReIndex" runat="server" ClientIDMode="Static" onchange="funCalled();" /&gt; &lt;script&gt; function funCalled() { if ($('#chkFullReIndex')[0].checked) { alert('check box checked') } else { alert('check box not checked') } } &lt;/script&gt; </code></pre> <p>This is working perfectly fine in Firefox(21.0) but not working in chrome(Version 27.0.1453.94 m)am not getting any console error for the same</p> <p>any thought on the same</p>
javascript jquery asp.net
[3, 5, 9]
2,368,737
2,368,738
Java Mobile Application
<p>Can any one tell me the book which can help me developing the application for Android ( java based), Please tell me about the IDE as well so that I can read and try myself.</p>
java android
[1, 4]
37,476
37,477
How do I select string after a specific symbol in javascript/Jquery?
<p>Let says I have a string that says <code>and the cow went @moo</code>, and I want to only select moo... how would I go about that?</p>
javascript jquery
[3, 5]
3,010,699
3,010,700
How to show image using onmouseover in javascript
<p>I have lots of pets. what i want to achive is that when ever i hover, it will display the image of particular pet in nearby div.</p> <p>for example</p> <pre><code>&lt;code&gt; &lt;select name="pet" id="pet"&gt; &lt;option value="1"&gt;Dog&lt;/option&gt; &lt;option value="2"&gt;Cat&lt;/option&gt; &lt;option value="3"&gt;Rat&lt;/option&gt; &lt;/select&gt; &lt;div id="petimage"&gt;&lt;/div&gt; &lt;/code&gt; </code></pre> <p>Earlier i was using onmousehover in option then with the help of ajax i was albe to get the particular pet image but now i realized onmousehover event not working in IE.</p> <p>Can anyone tell me the alternative?</p> <p>Thanks navi</p>
php jquery
[2, 5]
4,043,354
4,043,355
Variable from JavaScript to PHP
<p>Here is the code:</p> <pre><code> $('#sousmenu a').click (function (){ startSlideshow(&lt;?php echo json_encode(glob("photos-" .$_GET["folder"]. "/*.jpg"));?&gt;); return false; }); </code></pre> <p>The question is I like the HREF to change and get caught by PHP, now it doesn't do anything, but writing the <code>?folder=portraits</code> works.</p> <p><a href="http://www.studioteknik.com/html2/photo-portfolio.php" rel="nofollow">Here is the page</a>.</p> <p><em><strong></em> Simpler <em>*</em></strong> Maybe I am not clear, it happens sometimes!</p> <p>I want the link href to be send to this PHP function,</p> <pre><code>&lt;?php echo json_encode(glob("photos-" .(i what the href link). "/*.jpg"));?&gt; </code></pre> <p>so clicking on the link <code>animaux</code> will send <code>animaux</code> to the <code>glob()</code> PHP function and will get all the .jpg files in the <code>photos-animaux</code> folder.</p> <p>Clicking on the portraits will send the photo-portraits, etc.</p>
php javascript jquery
[2, 3, 5]
3,639,597
3,639,598
jQuery remove all list items from an unordered list
<p>Quick question -- i forgot the jQuery command that will clear all list elements from a list. I did a bit of searching, done it a bunch of times before, but just simply forgot the command.</p> <pre><code>$("ul").clear() $("ul").empty() </code></pre> <p>both didn't seem to accomplish this.. which command is it again?</p> <p>Thanks!</p> <p>UPDATE: Thanks guys, i must have some syntax error on my selector..</p>
javascript jquery
[3, 5]
1,978,874
1,978,875
jQuery: Get reference to click event and trigger it later?
<p>I want to wrap an existing click event in some extra code.</p> <p>Basically I have a multi part form in an accordion and I want to trigger validation on the accordion header click. The accordion code is used elsewhere and I don't want to change it.</p> <p>Here's what I've tried:</p> <pre><code> //Take the click events off the accordion elements and wrap them to trigger validation $('.accordion h1').each(function (index, value) { var currentAccordion = $(value); //Get reference to original click var originalClick = currentAccordion.click; //unbind original click currentAccordion.unbind('click'); //bind new event currentAccordion.click(function () { //Trigger validation if ($('#aspnetForm').valid()) { current = parseInt($(this).next().find('.calculate-step').attr('data-step')); //Call original click. originalClick(); } }); }); </code></pre> <p>jQuery throws an error because it's trying to do <code>this.trigger</code> inside the <code>originalClick</code> function and I don't think <code>this</code> is what jQuery expects it to be.</p> <p><strong>EDIT: Updated code. This works but it is a bit ugly!</strong></p> <pre><code> //Take the click events off the accordion elements and wrap them to trigger validation $('.accordion h1').each(function (index, value) { var currentAccordion = $(value); var originalClick = currentAccordion.data("events")['click'][0].handler; currentAccordion.unbind('click'); currentAccordion.click(function (e) { if ($('#aspnetForm').valid()) { current = parseInt($(this).next().find('.calculate-step').attr('data-step')); $.proxy(originalClick, currentAccordion)(e); } }); }); </code></pre>
javascript jquery
[3, 5]
5,311,468
5,311,469
jQuery onclick change parent background
<p>I downloaded the script from emposha.com/javascript/fcbklistselection-like-facebook-friends-selector.html and made a few modifications, as the source wasn't working as required (When submitting the form, all of the values were being sent to the php handler, not just the checked ones). </p> <p>My working example is in this <a href="http://www.arongalabuzi.co.uk/stuff/fb/index.html" rel="nofollow">Demo</a>. </p> <p>My issue is this: how can I check a group of <code>&lt;lis&gt;</code> so that I could have a 'Select All' button?</p>
javascript jquery
[3, 5]
1,676,670
1,676,671
Build a multi-user collaboration android app
<p>Greetings to all SO developers!</p> <p>I was searching for a way to allow collaboration on one activity of an android app. My problem is as follows: Lets say I have a simple android application having a EditText field in it. All users who have this app installed, are stored in my database. One user opens the app on his phone.</p> <p><strong>What I want is: That he can add another user to his own screen(activity) and they both can write in the EditText field together in real-time.</strong></p> <p>Edit: Also, what if I want the users to be on the same android canvas(like in a drawing app)?</p> <p>So, for one, how do I implement this functionality of adding another user(say User2) to User1's activity, and for two, they should be able to write in the editText field together. </p> <p>Any help/samples/resources would be appreciated, as I did search over the internet and on StackOverflow too, but didn't exactly found what I was looking for. </p>
java android
[1, 4]
5,495,490
5,495,491
Adding new methods and values to an object while avoiding repetition
<p>I'm struggling to learn object oriented javascript. I have an object constructor that looks like this:</p> <pre><code>//generic object function myObject(value1, value2, value3){ this.value1 = value1; this.value2 = value2; this.value3 = value3; this.method1 =method1; } function method1(){ alert('hello'); } function method2(){ alert('hello again'); } </code></pre> <p>I'm creating new instances of this object like this:</p> <pre><code>instance1 = new myObject( 1, //value1 2, //value2 3 //value3 ) </code></pre> <p>My problem is this: On a few instances of myObject I need custom values and methods. I would like to add them at the point of creation. But I can't figure out how to do it without writing the instance name again, which I'm trying to avoid since it would significantly slow down the process of adding new objects.</p> <p>Is there some way to replace this code..</p> <pre><code> instance1 = new myObject( 1, //value1 2, //value2 3 //value3 ) instance1.method2 =method2; instance1.value4 =4; </code></pre> <p>..with something that doesn't require repeating the name "instance1"?</p>
javascript jquery
[3, 5]
4,759,339
4,759,340
Keypress function in native javascript
<p>Below is my code:</p> <pre><code>$(document).keypress(function(e){ var s = String.fromCharCode(e.which); if ( s === "f"){ alert ("its f"); } else if ( s === "r"){ alert ("its r"); } }); </code></pre> <p>I wanna do this in JavaScript...........!!</p> <p>How can i do this ?</p>
javascript jquery
[3, 5]
5,733,053
5,733,054
add a textbox onclick dropdown value other in jquery?
<p>I am facing a problem with jquery.</p> <p>I have a div with 4 drop down list and I have an "add more" button.</p> <p>When I click on "add more" button, another instance of the same div is created just above the "add more" button. I did it via jQuery <code>append()</code> method and it is successfully working, but my problem is that the requirement says that when i select "Other" from the drop down a text box should open where I will fill the name which is not in the list.</p> <p>I can do this but when i click on "add more" and another instance is created, When I select "other" from the dynamically created listbox the text box is not created because their id becomes same and I know that id can not be same.</p> <p>Similarly, in rest of the dropdown happens. If i do it by class name then creates all the text box at a time. I do not want this. I hope you understood my problem. Please help me and give me a solution how to manage it.</p> <p>Thanks everybody and thanks stackoverflow.com</p> <p><strong>Update:</strong></p> <pre><code>$(document).ready(function() { alert('here'); var content=$("#course").html(); var content1=$("#emp").html(); alert(content); $("#add").click(function(){ var n=$("#course .count").length; if(n!=3){ $("#course").append(content); } if(n==2){ $("#add").hide(); } }); }); </code></pre> <p>my html is like</p> dropdown1 dropdown1 dropdown1 dropdown1 <p>add more button</p> <p>when i select dynamically generated dropdown by append()...the textbox for 'other' not appears means unable to handle event on dynamically generated div thanks </p>
php jquery
[2, 5]
284,690
284,691
Insert variables into $.post within a function
<p>i'm writing a function to send $.post show please how to correctly insert variables into object depending if they are set. here is what i'm trying to do:</p> <pre><code>function SendCommand(Command, QuestionId, Attr) { $.post('/survey/admin/command', { 'Command': Command, if (QuestionId) 'QuestionId' : QuestionId, if (Attr) 'Attribute' : Attr } ); } </code></pre> <p>Thanks!</p>
javascript jquery
[3, 5]
2,865,867
2,865,868
Add external javascript to user control... but put the file reference at the bottom of the page
<p>I need to be able to add an external js file for a user control (using</p> <pre><code> this.Page.ClientScript.RegisterClientScriptInclude("SuggestionSearch", "~/Secure/Shared/SuggestionSearch.js"); </code></pre> <p>syntax)</p> <p>But it puts the javascript file on the page too early... is there a way to put the file at the bottom of the page?</p>
javascript asp.net
[3, 9]
1,758,307
1,758,308
Issue while enabling hyperlinks in master page from content page
<p>I had written code to Enable and disable hyperlinks on master page from the content page. Every thing is working fine and the hyperlinks are getting disabled also after calling the <code>DisableHyperlinkInMasterPage</code> Method. When i am calling the <code>EnableHyperlinkInMasterPage</code> method still the hyperlinks are not working. If we are leaving that page , then i found that the hyperlinks starts working. My issue is after calling the <code>EnableHyperlinkInMasterPage</code> method , without leaving the page the hyperlinks are still disabled and not working and after leaving the page it getting enabled . Please help me that how i fix this issue.I debug the code and not found any error on <code>EnableHyperlinkInMasterPage</code> method.</p> <pre><code>private void DisableHyperlinkInMasterPage() { AssociateMaster mymaster = (AssociateMaster)Page.Master; HyperLink home = (HyperLink)mymaster.FindControl("Home"); home.Enabled = false; HyperLink profile = (HyperLink)mymaster.FindControl("ProfileLink"); profile.Enabled = false; HyperLink report = (HyperLink)mymaster.FindControl("Report"); report.Enabled = false; HyperLink signout = (HyperLink)mymaster.FindControl("SignOut"); signout.Enabled = false; } private void EnableHyperlinkInMasterPage() { AssociateMaster mymaster = (AssociateMaster)Page.Master; HyperLink home = (HyperLink)mymaster.FindControl("Home"); home.Enabled = true; HyperLink profile = (HyperLink)mymaster.FindControl("ProfileLink"); profile.Enabled = true; HyperLink report = (HyperLink)mymaster.FindControl("Report"); report.Enabled = true; HyperLink signout = (HyperLink)mymaster.FindControl("SignOut"); signout.Enabled = true; } </code></pre>
c# asp.net
[0, 9]
5,664,746
5,664,747
why does my usercontrol keep resetting it's visible property to false?
<p>Ok, I have a usercontrol on my page.</p> <p>On the page, the visible property is set to false.</p> <p>On the OnPreRender event, I set the visible property to true.</p> <p>It runs the line of code, but does not actually change anything. (so visible remains at false)</p> <p>This exact same method works across every other control, and there is nothing special about this control.</p> <p>Any ideas??</p>
c# asp.net
[0, 9]
3,137,619
3,137,620
how do i use a class without instantiating it?
<p>I have class:</p> <pre><code>static class GetRole { public static string OfUser(string username) { string result="None"; foreach (string key in WebConfigurationManager.AppSettings) { if (WebConfigurationManager.AppSettings[key].Contains(username)) { result = WebConfigurationManager.AppSettings[key]; break; } } return result; } } </code></pre> <p>i would like to use it lik ethis</p> <pre><code>string role = GetRole.OfUser(username); </code></pre> <p>or like this even better:</p> <pre><code>string role = GetRole(username); </code></pre> <p>how do i do this?</p>
c# asp.net
[0, 9]
2,057,016
2,057,017
Something with callback
<p>Already for 15 minutes I can not understand</p> <pre><code>if(send == true){ $.getScript('index.php?get_names_from_ajax=true', function(data){ $('#firstnames').remove(); $('#lastnames').remove(); $('#content').prepand('&lt;div class="block" id="firstnames"&gt;'+firstnames+'&lt;/div&gt;'); $('#firstnames').after('&lt;div class="block" id="lastnames"&gt;'+lastnames+'&lt;/div&gt;'); send = false; }); alert(send); } </code></pre> <p>getScript works fine, but callback gives no results. </p> <p><strong>EDIT</strong></p> <p>As i said, all callback is off, nothing removes or adds, just no moving, like there is no callback. </p>
javascript jquery
[3, 5]
3,973,235
3,973,236
highlight text in html with javascript jQuery
<p>I want to highlight all the keywords (case insensitive) within a p tag programatically</p> <p>if the keywords are</p> <pre><code>var keywords = "hello,thanks, goodbye" // this should be an array &lt;p&gt;hello world&lt;/p&gt; </code></pre> <p>hello should be highlighted in blue</p>
javascript jquery
[3, 5]
2,978,613
2,978,614
Android DefaultHttpClient connection reuse
<p>I am using DefaultHttpClient for connection. What I would like to do is "keep checking if it's alive" and when timeed out, reconnect. How can I do that ? I tried that entity is not null the consumeContent. Is it not working for me.</p>
java android
[1, 4]
5,553,935
5,553,936
How can I populate a message box when mouse cursor enters in a text box?
<p>I am using 3 text boxes. When I click on 2nd text box I want to show 1st text box value in message box (if 1st text box passed the validations). Same procedure when i click on 3rd textbox I want to show 1st text box value and 2nd text box value in message box(if 1st text box,2nd text box passed the validations).</p> <p>Regards, NSJ</p>
javascript asp.net
[3, 9]
2,714,758
2,714,759
get selected option of $(this)
<p>if i am looping through some jquery objects that are <code>select</code> dropdowns, how can I get the class of the selected option using jquery's <code>$(this)</code>?</p> <pre><code>elems.each(function(idx, elem) { if ($(this).is('select')){ console.log($(this, "option:selected")) } }); </code></pre> <p>does not seem to work.</p>
javascript jquery
[3, 5]
1,172,291
1,172,292
JS Replace fuction is not working as expected
<p>I have a backend CGI script that returns me below text in case of issues via an AJAX call:</p> <pre><code>&lt;p&gt;A problem occurred in a Python script. &lt;p&gt; /bin/cgi-bin/LOGS/tmpslM4pu.txt contains the description of this error. </code></pre> <p>I am trying to display it like below:</p> <pre><code>$.ajax({ type: "POST", url: "runcgi.py", data: { 'my_data' : 'test' }, success: function(html) { if(..test for success..) { } else { var StrippedString = $(html).toString().replace(/(&lt;([^&gt;]+)&gt;)/ig,""); var StrippedString = $(html).toString().replace(/(&lt;([^&gt;]+)&gt;)/ig,""); $("p").html(StrippedString); } }); </code></pre> <p>And below is my HTML code:</p> <pre><code>&lt;body&gt; &lt;p&gt;&lt;/p&gt; &lt;/body&gt; </code></pre> <p>But I see the below output in my browser:</p> <pre><code>[object Object] </code></pre> <p>How can I solve this?</p>
javascript jquery
[3, 5]
2,971,233
2,971,234
<option> tag, display:none and jquery
<p>I have a <code>div</code> that is being used as a dialog with jQuery's <code>.dialog()</code>. This div has a select box with options. The options the user has already selected are displayed on the main page. They can remove options from the main page and can open the dialog multiple times to add more options.</p> <p>I populate the select box with all possible options on page load, but then when I open the dialog box I use jQuery's <code>hide()</code> to hide the options that the user has already selected and are displayed on the main page. This adds the CSS <code>display:none;</code> to the element in question, which IE ignores on <code>&lt;option&gt;</code> tags and displays anyway.</p> <p>I can easily enough call <code>remove()</code> instead and remove it from the DOM. However, if the user selects some options, them removes them on the main page, then opens the dialog again to select more options, the options are no longer in alphabetical order, the options that were removed from the DOM and put back in it are now at the bottom since I used <code>.append()</code>.</p> <p>Is there any way to get IE to hide <code>&lt;option&gt;</code> tags? Or is there a better way to do this? Or is there a way to insert in alphabetical order simply?</p>
javascript jquery
[3, 5]
5,836,839
5,836,840
How to convert Binary data from database to String(text)
<p>I have uploaded my MS word file in Database in binary format. I am able to retrive it back. But I am planning to open up the word file in read only mode. I have done much operations on the file which I have stored in databse like trackrevisions,protection etc. Now I just want only one thing to happen. I want to convert the binary data efficiently back to text(string) which was origianlly stored in the database. Here are some ways I am trying to get text back from binary but all of them return symbols(format not supported) rather than text.</p> <pre><code>string str1 = System.Text.ASCIIEncoding.ASCII.GetString(bytes); string x = Encoding.ASCII.GetString(bytes).ToLower(); </code></pre> <p>Any suggestions</p>
c# asp.net
[0, 9]
3,208,137
3,208,138
ASP.net web application data integrity issue
<p>Let say...</p> <p>If we ASP.net banking application. When user press a button then it will debit $100 from his account.</p> <p>Issue: What happened if user two or three times click on this button without waiting for first inform or it press F5/refresh page.</p> <p>How we can prevent or get data integrity.</p>
c# asp.net
[0, 9]
947,799
947,800
event for when dialog is fully loaded
<p>I am trying to add a jscrollpane to a dialog once the dialog is loaded. I tried using the <code>dialogopen</code> and <code>dialogfocus</code> events but it seems these trigger too early. Is there an event I can subscribe to that tells me the dialog is fully loaded and displayed and its safe to call jscrollpane? Right now i'm just adding a half second timeout but that seems hacky and shows the user a broken dialog for a half second. </p> <p>Any other solutions would also be welcome. </p> <pre><code>$("#diagBox").load($(this).attr('href'), function() { $dialog.imagesLoaded(function() { $dialog.dialog('open'); $dialog.dialog("option", "position", "center"); setTimeout(function(){ $('input, textarea').placeholder(); $('.scroller').jScrollPane(); positionElements(); },500); }); }); </code></pre>
javascript jquery
[3, 5]
3,801,228
3,801,229
Hide child in expandablelistview based on childposition
<p>I need to hide certain children of certain groups based on the groupPosition and the childPosition in an ExpandableListView. But on expanding the group multiple times (especially when the expanded group is not in focus), the value of childPosition that i get is not the same as before. So a different row gets hidden. Any idea how do i capture the right child everytime?</p> <p>Right now I setting a different layout with height 0dp because if I setVisibility to View.GONE, it displays the row as blank.</p> <pre><code>if (convertView == null) { if (((m_Budget.budget_planTypeid.equals("budget_single")) || (m_Budget.budget_planTypeid.equals("budget_double")) // hide // pets || (m_Budget.budget_planTypeid.equals("budget_singlefamily")) || (m_Budget.budget_planTypeid.equals("budget_doublefamily"))) &amp;&amp; (groupPosition == 4) &amp;&amp; (childPosition == 5)) { convertView = inflater.inflate(R.layout.blankrow, parent, false); } else if (((m_Budget.budget_planTypeid.equals("budget_single")) || (m_Budget.budget_planTypeid.equals("budget_double")) // hide // child // care || (m_Budget.budget_planTypeid.equals("budget_singlepet")) || (m_Budget.budget_planTypeid.equals("budget_doublepet"))) &amp;&amp; (groupPosition == 3) &amp;&amp; (childPosition == 6)) { **convertView = inflater.inflate(R.layout.blankrow, parent, false);** } else { convertView = inflater.inflate(R.layout.budget_list_rowitem, parent, false); } </code></pre> <p>In bold is the layout of the blank row. else I set a usual layout</p>
java android
[1, 4]
2,872,194
2,872,195
How does android run java applications if it doesnt have a JVM
<p>How does android run java programs if it doesnt have a JVM, i know theres a delvik vm but what does it do ? and how does it run java applications? </p>
java android
[1, 4]
4,120,393
4,120,394
jquery: can you do an ajax request in $(window).unload()?
<p>I am absolutely terrible at logging my hours.</p> <p>So my idea is to have a browser shortcut that i open when i am starting work.</p> <p>Then when i am finished close it.</p> <p>This will then to an ajax request to a php script that will update my hours for me.</p> <p>To do this.</p> <p>Can i do an ajax request in <code>$(window).unload()</code>? or will the browser close before this completes? and, will the php script on the other end run?</p>
php jquery
[2, 5]
3,579,851
3,579,852
Building a :selection selector
<p>Can I query (in a jQuery sense) the DOM elements - <em>not</em> just text nodes - completely selected by the mouse?</p>
javascript jquery
[3, 5]
6,007,644
6,007,645
How to place scrollview inside the relative layout
<p>But am using many layouts like absolute layout and 6 relative layout.For each relative layout i need to use scrollview separately both horizontal and vertical when am adding many buttons inside the layout.</p>
java android
[1, 4]
3,076,254
3,076,255
Duplicated countdown timer after click event
<p>I have this function:</p> <pre><code>var secondsRemaining = 45; function countdown(secondsRemaining) { var seconds = secondsRemaining; if (secondsRemaining &gt; 0) { $('.timer &gt; div').html(seconds); secondsRemaining--; } else { if (secondsRemaining == 0) { // Times up .... } } setInterval(function() { countdown(secondsRemaining); }, 1000); } </code></pre> <p>I am running the function in the Document ready function with: </p> <pre><code> countdown(secondsRemaining); </code></pre> <p>and also I run it again after I clicked for answer. the problem is that I have 2 countdown timer now running simultaneously, new one that start from 45 seconds and the old one that continue from where it was.</p>
javascript jquery
[3, 5]
891,948
891,949
Create new div arround anchor link when clicked
<p>How can I achieve this behaviors onclick with jquery :</p> <p><strong>default state:</strong></p> <pre><code>&lt;a href="something.html"&gt;Anchor&lt;/a&gt; </code></pre> <p><strong>click state</strong></p> <pre><code>&lt;div class="highlight"&gt; &lt;a href="something.html"&gt;Anchor&lt;/a&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
1,935,614
1,935,615
What's the benefit of inline function calls?
<p>I saw this code (explicly it's in jQuery, with modification)</p> <pre><code>(function(window,undefined){ var jQuery=(function(){ var jQuery=something; jQuery.xxx=xxx; //... return jQuery; })(); //... window.jQuery=window.$=jQuery; })(window); </code></pre> <p>While I understand wrapping code in a inline function call can clearly define the variable scope, I don't understand the benefits of</p> <ol> <li>passing <code>window</code> with a parameter instead of using it directly,</li> <li>getting an instance of <code>undefined</code> by a undefined parameter, and also</li> <li>defining <code>jQuery</code> by the return value of another inline function call. Can somebody explain a bit?</li> </ol> <hr> <p><strong>EDIT</strong> write #3 more clearly:</p> <p>What I understand is that the code defines <code>jQuery</code> inside another function then return it.</p> <pre><code>//(function(window,undefined){ var jQuery=(function(){ // Inside this function defines jQuery and return it? var jQuery=function(selector,context){ return new jQuery(selector,context); //simplified }; jQuery.xxx=xxx; //... return jQuery; })(); // This executes the inline function and assign `jQuery` with the return value??? //... })(window); </code></pre> <p>This is more like the following:</p> <pre><code>function define_jQuery(){ // Inside this function defines jQuery and return it? var jQuery=function(selector,context){ return new jQuery(selector,context); //simplified }; jQuery.xxx=xxx; //... return jQuery; } //(function(window,undefined){ var jQuery=define_jQuery(); // This executes the inline function and assign `jQuery` with the return value??? //... })(window); </code></pre> <p>Wouldn't it be more simpler to do:</p> <pre><code>//(function(window,undefined){ var jQuery=function(selector,context){ return new jQuery(selector,context); //simplified }; jQuery.xxx=xxx; //... //... })(window); </code></pre>
javascript jquery
[3, 5]
2,185,186
2,185,187
Disabling a textbox when the other textbox have a value HTML
<p>im sorry for this question but how can i disable a textbox if another textbox have a value?? I already try this code but its not working,, sorry for the noob question T_T</p> <pre><code>function disable(downpayment,full_payment) { if ( downpayment.value.length &gt;= 1 ) document.getElementById(full_payment).disabled = true; else document.getElementById(full_payment).disabled = false; } &lt;/script&gt; &lt;input name="downpayment" id="downpayment" type="text" onselect="function disable(downpayment,full_payment);" style="width:250px" /&gt; &lt;/p&gt; &lt;p&gt; &lt;input name="full_payment" id="full_payment" type="text" style="width:250px" /&gt; </code></pre>
javascript jquery
[3, 5]
559,279
559,280
Fastest Java-based Javascript Engine
<p>I'm currently using the javax.script package for interpreting and executing Javascript code on the fly. Incidentally, this is the same engine used by Mozilla's Rhino JS interpreter. </p> <p>Question: is there any Java-based Javascript Engine that is faster than Rhino?</p>
java javascript
[1, 3]
1,792,346
1,792,347
Hiding a div with esc key, and off click? In Jquery
<p>if I have a div I've shown thanks to a click event - what are some easy was to make it close if someone clicks anywhere outside the div, or hits the esc key?</p>
javascript jquery
[3, 5]
3,219,701
3,219,702
Asynchronous jQuery request timing issue
<p>As a learning exercise I've hacked together a script for an SO <a href="http://meta.stackoverflow.com/questions/13847/display-statistics-have-subject-badges-for-accepted-answers/16062#16062">feature request</a> (for the purposes of this question please ignore the merits or otherwise of that request). In the script I've encountered a technical issue that my limited javascript knowledge can't get past and I'd appreciate suggestions on how to resolve it.</p> <p>To avoid spamming the server I use some search hacks to determine the number of answers and accepted answers for a tag. This involves using window.setTimeout() to callback to a function that sends a get request for each tag, increasing the timeout on each call to stagger the requests.</p> <p>To get the results in a single request involves appending &amp;pagesize=1 to the end of the url in the get request, so that the number of pages in the results gives you the total number of results without having to make any further requests. </p> <p>A side affect of this approach is that subsequent page views use &amp;pagesize=1 and I only see a single entry. I attempt to resolve this by firing another query with &amp;pagesize=30 to reset it afterwards, but as it is all asynchronous the timing of the last query can result in the pagesize either being 1 or 30, depending on which request completes first. I've tried adding a further timeout and callback for this "reset" query but it hasn't really helped.</p> <p>Is there a means to monitor the queries, waiting until all have been completed, then once they have all completed send the reset request? Or is there another approach that I could take?</p>
javascript jquery
[3, 5]
4,714,524
4,714,525
Filtering inputs by value
<p>I have HTML construction like this </p> <pre><code>&lt;div class="qn-block"&gt; &lt;a href="#" class="remove"&gt;&lt;/a&gt; &lt;input type="text" class="quantity-number" name="quantity-number" value="2" /&gt; &lt;a href="#" class="add"&gt;&lt;/a&gt; &lt;a href="#" class="refresh-q"&gt;Refresh&lt;/a&gt; &lt;/div&gt; </code></pre> <p>For inputs with value > 1 i have to disable ".refresh-q". For inputs with value = 1 disable ".refresh-q" and ".remove". How can I achieve this? </p>
javascript jquery
[3, 5]
5,954,024
5,954,025
issue of race condition b/w direct code and jquery handlers in client side JS
<p>Is this code valid/correct</p> <pre><code>var items = $(".items"); // when would items be properly populated, at dom.ready()?? var itemsHrefs = []; // direct JS code prepareItemsList(); **// direct JS code** **// could be the case that items array is not populated yet ???** function prepareItemsList() { for ( var i = 0; i &lt; items.length; i++ ) { var plElement = items.eq(i); itemsHrefs.push (plElement.attr('href')); } } </code></pre> <p>Questions:</p> <ol> <li>When would items variable be properly created. I assume dom.ready()??</li> <li>Should I put execution of prepareItemsList() inside a document.ready handler to be correct?</li> </ol> <p>NOTE: When I tried doing 2. above, I ran into different issues</p>
javascript jquery
[3, 5]
493,115
493,116
How to open one single popup window for multiple onclick event of anchor tag?
<p>I have one aspx page with 1000 anchor tag. </p> <p>I want to open single popup onclick of anchor tag &amp; display data in popup window from database dynamically. </p> <p>I want to use only one popup in my page.</p> <p>For 1000 anchor tag inner data of popup will change with respect to anchor click change.</p> <p>plz give me solution for it.</p> <p>Plz help me. its very urgent.</p> <p>Thanks in advance.</p> <pre><code>&lt;h5&gt;&lt;a href="#" runat="server" &gt;Advertise &amp; Media&lt;/a&gt; &lt;em&gt; 2 entries &lt;/em&gt; &lt;/h5&gt; &lt;ol&gt; &lt;li&gt;&lt;a id="advMedia1" runat="server" href="#" onclick="advMedia1_onclick"&gt;Advertise Agency&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a runat="server" runat="server" href="#"&gt;Magazine&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a runat="server" runat="server" href="#"&gt;Press&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a runat="server" runat="server" href="#"&gt;Weekly&lt;/a&gt;&lt;/li&gt; &lt;/ol&gt; </code></pre>
c# asp.net
[0, 9]
5,530,104
5,530,105
JQuery Countdown timer inside Gridview that is placed inside Update Panel Issue
<p>I have A gridview inside an updatepanel that is showing deals info with expiry date. for the expiry date i am showing it using jquery Countdown timer.i am adding this timer inside RowDataBoundEvent. When page is first load and the jquery count down timer works fine. </p> <p>now i have a list of checkboxes that shows categories. when a category is checked there is asynchronus post back and new records added to the gridview but these records does not loading the timer.</p> <p>Can anybody tell me what is the issue actually? thanks</p> <p>here my databount code:</p> <pre><code>protected void gdvDeals_DataBound1(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lbl = (Label)e.Row.FindControl("lblID"); Label lblExp = (Label)e.Row.FindControl("lblExp"); string scr = @"&lt;script type='text/javascript'&gt; Sys.Application.add_load(init); function init() {$(function() { var austDay = new Date('" + lblExp.Text + "'); $('#timer').countdown({ until: austDay }); $('#year').text(austDay.getFullYear());"; scr += @" });}&lt;/script&gt; &lt;div runat='server' id='timer' class='worth_Border2'&gt;&lt;/div&gt;"; Literal lt = (Literal)e.Row.FindControl("ltTimerDiv"); lt.Text = scr; } } </code></pre>
jquery asp.net
[5, 9]
1,892,370
1,892,371
Sound Effects/Manipulation?
<p>I am creating an android app that basically records an applies an "Effect" on the audio track then plays it back. I got my app to record an play back but I am stuck an not sure where do go from here. I have been Googling for days now trying to find a open source audio library or some way to change the audio after I record it. I currently have it setup to play back using SoundPool an I't lets me speed up an slow down the audio. I would like to do things like change pitch an add echo etc. I will appreciate any responses because I am totally stumped right now.</p> <p>Thanks Adam</p>
java android
[1, 4]
5,040,649
5,040,650
Dynamically change style of panels through javascript
<p>I am trying to display a new panel after the user clicks an add button, for some reason this is not working (it refreshes the page as well, even though my button has a return true) I have tried different ways, but nothing seems to work that well.</p> <pre><code>&lt;asp:Button ID="btnAdd" runat="server" Text="Add Property" CssClass="btn" OnClientClick="addProperty(); return false;" /&gt; &lt;script type="text/javascript"&gt; var num = 1; function addProperty() { num++; var panelName = "&lt;%=pnlProperty" + num.toString() + ".ClientID%&gt;"; alert(panelName); document.getElementById(panelName).style.display="inline"; } &lt;/script&gt; </code></pre> <p>Any helps would be great!</p>
c# javascript asp.net
[0, 3, 9]
5,289,899
5,289,900
Event on a click everywhere on the page outside of the specific div
<p>I'd like to hide a div when user click anywhere on the page outside of that div. How can I do that using raw javascript or jQuery?</p>
javascript jquery
[3, 5]
115,647
115,648
Jquery - Load an XML file based on drop-down menu selection
<p>I am a noob who is trying to create a q&amp;a application. At the moment, I have been experimenting with the apparent simplicity of Jquery. I need a Jquery or Javascript function that (1) allows the user to select a Q&amp;A category from a drop-down box and (2) tells the Jquery code which XML file to select based on the user's selection. What is done with the XML file after it is selected is another matter.</p> <p>I was successful in creating a function with a pre-defined XML file variable - </p> <pre><code>$("#target").click(function() { var a = 'TestFile2.xml'; var b = 'TestFile3.xml'; var c = 'TestFile4.xml'; $.ajax({ url: c, type: 'GET', dataType: 'xml', success: parseXML }); }) </code></pre> <p>But I have been unsuccessful in creating a function that connects the XML file to be used to a drop-down menu. This is the Javascript function I have been trying to make work - </p> <pre><code>&lt;div id="target"&gt; Click here &lt;/div&gt; &lt;script type="text/javascript"&gt; function (selFile() { var p = document.LoadCategory.Load.value; if (p == "testFile2") {var x = "TestFile2.xml"} if (p == "testFile3") {var x = "TestFile3.xml"} if (p == "testFile4") {var x = "TestFile4.xml"} }) $("#target").click(function() { $.ajax({ url: x, type: 'GET', dataType: 'xml', success: parseXML }); }) </code></pre> <p>I have tried many variations on the above but to no avail. I have a feeling that I am doing something really simple really wrong. I'd be really grateful for any tips or suggestions.</p>
javascript jquery
[3, 5]
1,244,098
1,244,099
Using url with parameters to download image from internet for Android?
<p>Using <strong>URL with parameters</strong> to download image from internet for Android???</p> <p>This code is work,but I don't want that,I want to use a URL with parameters to download image.(ex:<strong>URL=<a href="http://yahoo.com/record?ProductID=1" rel="nofollow">http://yahoo.com/record?ProductID=1</a></strong>)</p> <p>How to change this code?please.</p> <pre><code>bmp = this.GetNetBitmap("http://avatar.csdn.net/B/D/5/1_redoffice.jpg"); public Bitmap GetNetBitmap(String url){ URL imageUrl = null; Bitmap bitmap = null; try{ imageUrl = new URL(url); } catch(MalformedURLException e){ Log.e("DownloadTimerTask", e.getMessage()); } try{ HttpURLConnection conn = (HttpURLConnection)imageUrl.openConnection(); conn.setDoInput(true); conn.connect(); InputStream is = conn.getInputStream(); bitmap = BitmapFactory.decodeStream(is); is.close(); } catch(IOException e){ Log.e("DownloadTimerTask", e.getMessage()); } return bitmap; } </code></pre>
java android
[1, 4]
3,749,163
3,749,164
Is there any MIT licenced jquery pagination plugin?
<p>The famous <a href="http://archive.plugins.jquery.com/project/pagination" rel="nofollow">jQuery pagination plugin</a> is of GPL licence. If I am not wrong to use a GPL licenced software in a product the product must be GPL licenced too. So I am looking for a pagination plugin which is MIT licenced. Any suggestions? </p>
javascript jquery
[3, 5]
5,130,471
5,130,472
FindControl does not work in GridView
<p>void GridView1_RowCreated(Object sender, GridViewRowEventArgs e) {</p> <pre><code> if (e.Row.RowType == DataControlRowType.DataRow) { (e.Row.FindControl("linkDocs") as HyperLink).Visible = false; } } </code></pre> <p>I can't get that code sample to work. I need to access a hyperlink control on my page. </p> <p>I have a master page setup.</p>
c# asp.net
[0, 9]
1,683,460
1,683,461
How to indent particular row in datagridview
<p>I have a gridview and and I am creating it dynamically, I get parent and child tables records and binding the data to a single data grid view. I need to indent the row which is from child table a bit to the right so that i can differentiate the record from parent record.</p> <pre><code>private void CreateDynamicGridView(DataTable tables, GridView gv) { try { DataTable _dtSearchList = tables; strColumnCount = _dtSearchList.Columns.Count.ToString(); foreach (DataColumn col in _dtSearchList.Columns) { BoundField bfield = new BoundField(); bfield.DataField = col.ColumnName; bfield.HeaderText = col.ColumnName; gv.Columns.Add(bfield); } gv.DataSource = _dtSearchList; gv.DataBind(); } catch (Exception ex) { } } </code></pre>
c# asp.net
[0, 9]
3,688,919
3,688,920
find Absolute path of "Desktop" location using PHP
<p>How I get Absolute path of "Desktop" location using PHP? </p>
php javascript
[2, 3]
3,335,431
3,335,432
Submit Javascript variable PLUS form data to ASP.NET
<p>I have this code:</p> <pre><code>var myArray = new Array(); var counter = 0; function addElementToForm(value){ counter ++; if (counter &lt; 10) { $("#cheese").append(value + '&lt;input type="number" value="0"&gt;&lt;br /&gt;'); myArray.push(counter + value); } }; </code></pre> <p>I have an ASP.NET form on the same page, in the same action of the sumbit button for the form, I want to be able to access myArray from the codefile as well!!</p>
c# javascript asp.net
[0, 3, 9]
1,571,134
1,571,135
if statement on images
<p>I have an image that is a tick. At the moment i know how to set visibilty using GONE/VISIBLE.</p> <pre><code> tick.setVisibility(View.VISIBLE); </code></pre> <p>I want to be able to detect whether an image is visible using an if statement.</p> <pre><code>if (tick is visible){ i++ } </code></pre> <p>Thanks</p>
java android
[1, 4]
674,478
674,479
how to Read Javascript cookie with PHP
<p>I'm making a php script that would work like API on site that dosn't provide one. I'm using curl for it and the site is posting cookies with javascritpt, so i can't read them.</p> <p>Is there a php class or php module that would read javascript, store the cookie and let me resubmit it with curl to the mentioned page?</p> <p>I Red somehwer that its possible to read php from Java, so maybe there is a similiar way for JS/PHP?</p>
php javascript
[2, 3]
107,784
107,785
using jquery when passing arguments to function
<p>I have a link which triggers js function. To the link I have attached data-attribute on html which I want to pass to the function.</p> <pre><code>$(".trigger").awesomeFunction({ oneArgument: "secretSauce", secondArgument: $(this).data("address") }); </code></pre> <p>Now that second argument ends up null instead of the data-address attribute. Is it because $(this) is not in right scope inside the function arguments list and if so how could I refer to the originating link?</p>
javascript jquery
[3, 5]
1,659,398
1,659,399
Calling C# Method Using Javascript
<p>I am trying to access a method in my code behind called "Button1_Click" using Javascript, I think there is something wrong in my code below because currently I have to click twice in order for the method to trigger, one click doesn't trigger the method.</p> <p><strong>My Test Code:</strong></p> <pre><code>// Javascript &lt;script type="text/javascript"&gt; function CallMe() { document.getElementById('&lt;%= ButtonHidden.ClientID %&gt;').click(); } &lt;/script&gt; // Markup &lt;asp:Button ID="ButtonVisible" runat="server" Text="Test Button" OnClientClick="CallMe();"/&gt; &lt;asp:Button ID="Button1" runat="server" style="display:none;" Text="Click" OnClick="Button1_Click"/&gt; // Code Behind Method protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("http://google.com"); } </code></pre> <p>Am I missing something?</p>
c# javascript
[0, 3]
2,374,226
2,374,227
How can I use jQuery to follow the cursor with a div?
<p>I have a div in the shape of a circle that follows your mouse using Javascript, but I want it to stop when it hits the edge of a container div. How would I do that? Here is the Javascript im using:</p> <pre><code>var mouseX = 0, mouseY = 0; $(document).mousemove(function(e){ mouseX = e.pageX; mouseY = e.pageY; }); // cache the selector var follower = $("#follower"); var xp = 0, yp = 0; var loop = setInterval(function(){ // change 12 to alter damping higher is slower xp += (mouseX - xp) / 12; yp += (mouseY - yp) / 12; follower.css({left:xp, top:yp}); }, 30); </code></pre> <p>and here is everything else I have so far: <a href="http://jsfiddle.net/t_man/JUknN/9/" rel="nofollow">jsFiddle</a></p> <p>Please help, and thanks!</p>
javascript jquery
[3, 5]
1,343,201
1,343,202
how to redirect to email login page based on email address domain
<p>i have a registration page there i am capturing user email address, once the registration is completed user has to activate an account.. this process is working fine.. now what i am looking here is</p> <p>i would like to give "Go to my Inbox" button when the user click on this button it should automatically redirect to email login page</p> <p>ex: when user enter yahoo email id at the time of registration in the next step it should redirect to yahoo login page..</p> <p>ex: when user enter gmail email id at the time of registration in the next step it should redirect to gmail login page..</p> <p>ex: hotmail ex: aol...ect</p> <p>can any one give me some suggestion on this</p>
javascript jquery asp.net
[3, 5, 9]
745,368
745,369
Javascript how to store predefined function (with arguments)
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1451009/javascript-infamous-loop-problem">Javascript infamous Loop problem?</a> </p> </blockquote> <p>I have the following:</p> <pre><code>function test(a,b,c){ console.log(a+b+c); } for (var i=0; i &lt; array.length; i++){ steps.push( funtion(){ test(array[i].something, array[i].wow, i);} ); </code></pre> <p>I want to store functions with several parameters, and bind them to buttons later when the DOM is loaded</p> <pre><code>for (var i=0; i&lt;steps.length; i++){ $('#mydiv li a').eq(i).click(steps[i]); } </code></pre> <p>It's not really working since steps[i] contains do(array[i].something, array[i].wow, i); instead of do('bob', 'john', 1) for example</p> <p>I have tried using the .apply javascript function but it will execute in the loop, instead of storing them</p>
javascript jquery
[3, 5]
5,683,345
5,683,346
I get an undefine error in iframe
<p>I have an iframe below:</p> <pre><code>&lt;iframe class='upload_target' name='upload_target' src='#' style='width:0;height:0;border:0px;solid;#fff;'&gt;&lt;/iframe&gt; </code></pre> <p>I am trying to stop a command below but I keep getting an undefined error: </p> <pre><code>$('.upload_target').contentwindow is undefined </code></pre> <p>How can I fix this undefined error?</p> <p>Below is code:</p> <pre><code> $(".uploadbutton").click(function() { $(".upload_target").contentWindow.stop(); //for anything but IE $(".upload_target").contentWindow.document.execCommand("Stop"); // for IE return stopImageUpload(); </code></pre> <p>});</p>
javascript jquery
[3, 5]
2,010,302
2,010,303
How to specify TreeNodes ordering? Error using WebControls.TreeNodeCollection.AddAt()
<p>I'm trying to add nodes to a TreeView object and I've got the following code that's reading the data from a MySqlDataReader object:</p> <pre><code>while (no_child_rdr.Read()) { TreeNode parentNode; int position = no_child_rdr.GetInt16("position"); // See if the node for this category already exists try { parentNode = DocumentsTree.Nodes[position]; } catch (Exception ex) { string category = no_child_rdr.GetString("cat_name"); parentNode = new TreeNode(category, category); DocumentsTree.Nodes.AddAt(position, parentNode); &gt;&gt; This is where my error occurs } } no_child_rdr.Close(); </code></pre> <p>The error I end up with is:</p> <pre><code>Index must be within the bounds of the List. Parameter name: index </code></pre> <p>I'm obviously laboring under the false assumption that I can stick a new <code>TreeNode</code> at any arbitrary place in the <code>TreeNodeCollection</code> using <code>Nodes.AddAt()</code>. Seeing as these objects have a position defined in the database, how should I go about building the <code>TreeNodeCollection</code> such that my nodes are properly ordered?</p>
c# asp.net
[0, 9]
637,902
637,903
Set storage limit to a directory and delete file(s) on FIFO basis
<p>How to set storage limit to a folder and keep deleting file(s) on FIFO basis once it reaches the already set limit in android?</p> <p>Thanks, DK</p>
java android
[1, 4]
5,990,782
5,990,783
calling java methods in javascript code
<p>i created a java class content method return a String, my question is how to call this function in my javascript code to use the returned value from the java method. I want to call client-side Java code embedded in browser.</p> <p>here is an exemple of what im talking about:</p> <p>in my webpage i have a javascript code, here is some of it:</p> <pre><code> function createChartControl(htmlDiv1) { // Initialize Gantt data structures //project 1 var parentTask1 = new GanttTaskInfo(1, "Old code review", new Date(2010, 5, 11), 208, 50, ""); ...................... </code></pre> <p>i want to create a java class content methods to provide data to this javascript function "GanttTaskInfo". for exemple function to get name, get id and date. well i think this time im clear :D i searched a way to call java methods in javascript, and i found applets as you said, but i think its not usefull to me. thanks again</p>
java javascript
[1, 3]
4,512,948
4,512,949
User based pop up?
<p>Basically, I'm looking to find out a way to create a pop up window that prompt a user a question, and in the window I'd like to have a checkbox saying "Don't display this message again". I'm not quite sure how to go about this, I've done a bit of research but I've found nothing, I'd love to be able to find out how so I can help the community with the result!</p> <p>So to sum up, I want a pop up window that checks if the user has "checked" do not display, then it will not perform the function, the function and jquery is fine I can do all that, but as for the "per user" request, I've got no idea :( </p> <p>I'd love the help guys!</p> <p>Kind regards, Shannon</p>
javascript jquery
[3, 5]
1,276,001
1,276,002
con.getInputStream() throw exception in Android project, how to fix?
<p><br> con.getInputStream() throw exception, when the code running on android, but when copy the code to regular java project it is working,<br> The thrown object e contain "detailMessage = Permission denied". my code::</p> <pre><code> public static HttpData get(String sUrl) { HttpData ret = new HttpData(); String str; StringBuffer buff = new StringBuffer(); try { URL url = new URL(sUrl); URLConnection con = url.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); while ((str = in.readLine()) != null) { buff.append(str); } ret.content = buff.toString(); //get headers Map&lt;String, List&lt;String&gt;&gt; headers = con.getHeaderFields(); Set&lt;Entry&lt;String, List&lt;String&gt;&gt;&gt; hKeys = headers.entrySet(); for (Iterator&lt;Entry&lt;String, List&lt;String&gt;&gt;&gt; i = hKeys.iterator(); i.hasNext();) { Entry&lt;String, List&lt;String&gt;&gt; m = i.next(); Log.w("HEADER_KEY", m.getKey() + ""); ret.headers.put(m.getKey(), m.getValue().toString()); if (m.getKey().equals("set-cookie")) ret.cookies.put(m.getKey(), m.getValue().toString()); } } catch (Exception e) { Log.e("HttpRequest", e.toString()); } return ret; } </code></pre> <p><img src="http://i.stack.imgur.com/Ms6yG.jpg" alt="con object while debug"></p>
java android
[1, 4]
5,551,204
5,551,205
Create subdomain for each registered user?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/278668/is-it-possible-to-make-an-asp-net-mvc-route-based-on-a-subdomain">Is it possible to make an ASP.NET MVC route based on a subdomain?</a><br> <a href="http://stackoverflow.com/questions/1437277/how-to-create-subdomain-with-username-using-c-sharp-and-asp-net">How to create subdomain with username using C# and asp.net?</a> </p> </blockquote> <p>How can I create a sub-domain for each user who is registering in my application?</p> <p>For eg. my application is hosted at <code>www.xyz.com</code> If a user with name "bsoft" registers in my app, I need to create a url for the user as <code>bsoft.xyz.com</code>.</p>
c# asp.net
[0, 9]
3,683,740
3,683,741
how to take Value From java Scrpit File and send it to php File?:(
<p>Can U tell me how to take Value From java Scrpit File and send it to php File .</p> <p>code :</p> <pre><code>var year = (year != null) ? year : '".$this-&gt;arrToday["year"]."'; var month = (month != null) ? month : '".$this-&gt;ConvertToDecimal($this&gt;arrToday["mon"])."'; var day = (day != null) ? day : '".$this-&gt;arrToday["mday"]."'; my_window= window.open ('Event.php','mywindow1','status=1,width=350,height=150'); \\ </code></pre> <p>and I wont to send these varible (year,Month,day) to Event.php . </p> <p>can U tell me How ?</p>
php javascript
[2, 3]
5,830,835
5,830,836
How to page refresh, if $_POST variable exists?
<p>I have some post form. On click submit button, turn to another page. I need refresh page once time, if some $_POST variable exists.</p>
php javascript jquery
[2, 3, 5]
416,650
416,651
Device Specific Javascript, preferably JQuery
<p>I have a pretty Jquery-heavy site in the rollout. However, since it uses fullscreen backgrounds ... which are pretty useless on mobile devices I would love to deactivate the Jquery plugin on mobile devices... </p> <p>I tried to research this problem but did not came up with a simple solutions... </p> <p>Media queries won't really do... since there's too much reliance upon Javascript... media Queries are CSS-only right (I am more a designer than a programmer.... )</p>
javascript jquery iphone
[3, 5, 8]
4,379,408
4,379,409
Instructions arent following the sequence jQuery
<p>Here is the code that i have been working on. Apparently the #layout call is executed first for some reason and it gives undefined as the value. </p> <pre><code>$(function() { $(".left").load("PartsList.php", function() { alert("success"); }); $(".right").load("Custom.php", function() { alert("success"); }); $("#layout").children().on({ click: function() { alert($(this).attr('id')); } }); });​ </code></pre> <p>Thank you for your time :).</p>
php jquery
[2, 5]
3,914,262
3,914,263
empty jquery element
<p>Is there an elegant way to create an empty jquery element (versus null) ?</p> <pre><code>$myEmptyElement = $("#ThisIdDoesNotExist234343"); </code></pre> <p>The rational is not checking later on for null.</p> <p>Later we do :</p> <pre><code>$myEmptyElement.destroy(); </code></pre>
javascript jquery
[3, 5]
4,647,554
4,647,555
javascript / jquery : problem calling a function inside an object (function undefined)
<p>I'm getting an error of "buildXML is not defined" when I run this code:</p> <pre><code>var c = { updateConsumer:function (cid,aid,sid,survey){ var surveyXML = buildSurveyXML(survey); }, buildSurveyXML: function(survey) { var surveyResults = survey.split("|"); var surveyXML = ''; for (var i=0;i&lt;surveyResults.length;i++){ ... } return surveyXML; } } </code></pre> <p>And the html that includes this JS and calls the updateConsumer function:</p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;title&gt;Web Service Test&lt;/title&gt; &lt;meta charset="utf-8"&gt; &lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="../../shared/js/consumerSoap.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { c.insertConsumer("First","Last","55555","[email protected]","76:1139"); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript jquery
[3, 5]
4,727,820
4,727,821
jQuery event binding with accessibility in mind - click and keypress
<p>Just a quick question, I seem to do this a lot:</p> <pre><code>$saveBtn.bind("click keypress", function(e) { if (e.type != "keypress" || e.keyCode == 13) { // Do something... return false; } }); </code></pre> <p>Is there a quicker way to bind an 'action' listener to a button? I want to always ensure my buttons with event listeners fire on both clicks and the enter key...this seems like it'd be a fairly common thing to want to do but found nothing on google. Any thoughts?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
490,133
490,134
Disable animate when condition is met jQuery
<p>This may be an easy question and perhaps I am missing something here. </p> <p>The desired effect would be when a user clicks on the <code>.left</code> or <code>.right</code> href tags, the <code>.tabs</code> scroller will scroll left or right by <code>105px</code> every time. This part is working.</p> <p>Where I am running into a road block is how to disable the animate effect when the <code>.tabs</code> div's css is at <code>0px</code> or at the end of the div. This seems like it could easily be accomplished with <code>offset</code> or <code>position</code> but both of these are giving me a different value. I believe it's because the <code>.tabs</code> div is actually centered using <code>magin: 0 auto</code>.</p> <p>Trying to retrieve the <code>css("left")</code> and writing a conditional <code>if == 0</code> statement is also a bust.</p> <p>Am I missing something here? Should I not be trying to disable the <code>left</code> button based on position? Is there an easier way to do this?</p> <pre><code>$(".right").click(function () {     $(".tabs").animate({         left: '-=105'     }, 500);     return false; }); $(".left").click(function () {     $(".tabs").animate({         left: '+=105'     }, 500);     return false; }); </code></pre>
javascript jquery
[3, 5]
2,832,348
2,832,349
How can capture Click event if element is iframe?
<p>I have appended a iframe with youtube embed url in a div which id is div1. I want to do something when click happened on iframe.</p> <p>i am using this jquery code but it is not working.</p> <pre><code>$('#div1 iframe').bind('click', function(){ alert('clicked on iframe'); }); </code></pre>
javascript jquery
[3, 5]
4,521,709
4,521,710
Select All Elements that do not have a binding to a given function?
<p>If I assign a function to a variable <em>foo</em>, is there a way to select all elements that do not have a binding to <em>foo</em> given that they are assigned via a structure like <code>$('.elementsWithClass').click(foo)</code>?</p> <p>My motivation here is we have ajax requests replacing parts of the DOM, and I need an easy way to rebind event handlers that is not based on .live/.on as we are controlling event bubbling in some parts of the application.</p>
javascript jquery
[3, 5]
511,310
511,311
View.OnClickListener, method or class?
<p>sorry if this question is stupid, but I can't wrap my head around Java syntax..I learnt C/C++<br/> I know View is a class which is good..but I don't understand if View.OnClickListener() is a method.<br/> I doubt it unless it returns an object? <br/> I think View is a class which has a static OnClickListener member object..again that doesn't make sense to me..<br/> Can some explain what is happening with this line of code?</p> <pre><code>button1 = (Button) findByView(R.id.button1) ; button1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { } } </code></pre> <p>So what is happening with this code?</p> <p><code>Button1</code> is a reference to the button1 object in the xml file.</p> <p><code>button1</code> object has a member object <code>setOnClickListener</code> which I from its name I assume initializes an event to the button or something. But it receives <code>View.OnClicListener()</code> object. </p> <p>I am confused by that..onClick receives a View object so <code>onClickListener</code> is not an object returns a View object?? I don't get it at all. </p> <p>Can someone explain what happens in that line <code>View.onClickListener()</code> is it another way of saying <code>new this</code>?</p>
java android
[1, 4]
5,902,459
5,902,460
jquery.inArray() function not working
<p>I am having a array as follows</p> <pre><code> var nameIDHashMap = []; nameIDHashMap.push({ key: name, value: xmlLength }); startToEnd.push({ key: $(this).attr("startFrom"), value: $(this).attr("endTo") }); </code></pre> <p>I m trying to use the inArray() function like shown below</p> <pre><code> var variablestart = startToEnd[0].key; alert("The variable Start is :"+variablestart); var toEnd; if(jQuery.inArray(variablestart,nameIDHashMap) &gt; -1) { alert('found'); } if ($.inArray(variablestart, nameIDHashMap) != -1) { alert("Found"); // toEnd = startToEnd[connectWindow].value } else alert("Fail"); </code></pre> <p>I dont know why always the else loop is called. None of the if loop is getting called. Both of the array has that same key present. Please let me know where I am doing wrong.Thanks!</p>
javascript jquery
[3, 5]
2,325,137
2,325,138
meta send vs. reload() | Server executed vs. client executed
<p>Progam control is at the server and I need to do a relaod. I can use a php command:</p> <pre><code>echo '&lt;meta http-equiv="refresh" content="0"&gt;' </code></pre> <p>or I can pass control back to the client with a reload flag set and use a javascript command</p> <pre><code>window.location.reload(); </code></pre> <p>Which is best practice or better to use, in terms of speed?</p> <p>My guess it that the PHP version would be a bit faster because there is no logic on the client side, the browser receives the header and reloads.</p> <p>I'm not concerned with disabled javascript.</p>
php javascript
[2, 3]
3,813,748
3,813,749
android: generate random number without repetition
<p>can anybody help me in making a method to generate random number without repetition in Android? The maximum number is: <code>prjcts.size();</code> it's my JSON Array. And the return value should be in integer. </p> <p>What I've already had is: <code>int i = (int)(prjcts.size() * Math.random());</code> I casted the method 3 times, because I need 3 random generated numbers. It works, but I don't know how to make it without repetition. So those 3 numbers won't be the same between each other.</p> <p>Thank you</p>
java android
[1, 4]
3,558,977
3,558,978
how to generalize a click function in jquery
<p>I have 13 small pictures and 13 big pictures,if any of the small pictures are clicked it'll show the related big picture, I was just wondering if it was possible to generalize the click function so I don't have to repeat the dame code 13 times, thanks</p> <pre><code>&lt;div id="press_images"&gt; &lt;img id="s1" class="small" src="images/press/small/1.png" /&gt; &lt;img id="s2" class="small" src="images/press/small/2.png" /&gt; &lt;img id="s3" class="small" src="images/press/small/3.png" /&gt; &lt;img id="s4" class="small" src="images/press/small/4.png" /&gt; ..... &lt;img id="s13" class="small" src="images/press/small/13.png" /&gt; &lt;/div&gt; &lt;div class="big"&gt; &lt;a id="close"&gt;X&lt;/a&gt; &lt;img id="b1" src="images/press/big/1.jpg" /&gt; ...... &lt;img id="b13" src="images/press/big/13.jpg" /&gt; &lt;/div&gt; $("#s1").click(function(){ $('#b1').show(); $('.big').show(300); return false; }); </code></pre> <p>so I was wondering if I could change the $("#s1").click(function() so I don't have to repeat it 13 times.</p> <p>thanks</p>
javascript jquery
[3, 5]
2,316,852
2,316,853
jQuery: Check if an element is assigned to a var
<p>I'm trying to create a simple button manager to select and eventually unselect allready checked <code>img</code> elements which contains CSS class <code>.my_class</code>, why this doesn't work?</p> <pre><code>var last_selected; $("img.my_class").click ( function () { if (last_selected != null) alert ($(this) == last_selected); // returns false everytime last_selected = $(this); }); </code></pre>
javascript jquery
[3, 5]
2,429,448
2,429,449
Release the memory
<p>This code loads two parameters from a PHP file and prints them on the screen every second, but does that not use too much cpu/memory power to run it? How can that be avoided? I want to free/release or autorelease the memory it's using, while it's updating, but I don't know how... Please help me out guys.</p> <pre><code>function updateStats(stat) { var stat = ["NAME","ID"]; var url = "USERS.php"; $.each(stat, function(i, key){ $.post(url, {stats: key}, function(data) { // stats to stat $("#" + key).html(data); }); }); } setInterval(function(){ updateStats("updateStats"); }, 1000); </code></pre>
javascript jquery
[3, 5]
4,718,312
4,718,313
Don't get value when refreshing the page in jquery
<p>When I click on link the value displayed correctly.But when I refresh the page i don't get this value.</p> <p>I have written below code</p> <pre><code>$j("#add_to_cart_action").click(function(e) { $j.em.cart.addSelectedTitle(); }); $j.em.cart.addSelectedTitle = function() { var addcartitemindx = $j("body").data("selected_title").product_id; var indx = $j("body").data("selected_title").cindex; var addcartitemtitle = $j("body").data("selected_title").ctitle; if ($j('input#chkout_'+addcartitemindx).length &gt; 0) { alert('Shopping Cart Notification:\n "'+addcartitemtitle+'" is already added.'); return false; } $j('#checkout_form ul').prepend('&lt;li&gt;&lt;input checked="true" type="checkbox" id="chkout_'+addcartitemindx+'" name="product[]" class="added-item" value="'+addcartitemindx+'"/&gt;&lt;a href="javascript:$j.em.cart.TriggerCartItem('+indx+');"&gt;'+addcartitemtitle+'&lt;/a&gt;&lt;/li&gt;'); $j.em.cart.setCartDisplay(); }; </code></pre> <p>I want to store addcartitemtitle in cookie so that i can restore so please give me the syntax to write it in jquery.</p>
php jquery
[2, 5]
4,654,348
4,654,349
Sort Checkbox List on the basis of checked property
<p>I have a check-box-List which I bind to a master dataTable(DTA)... I have another dataTable (DTB) which has the values that needs to checked in the check-box-List... So I loop through all items in the check-box-list to see if it exists in the DTB and set checked = true for those items that exists.</p> <p>Now I want to show the checked items first in the Check-box-list box and the unchecked items below that.</p> <p>Is there any way I can do it... A similar solution for List-Box could also be helpful. A Javascript hint is welcome too.</p> <p>Thanks - Raja</p>
c# asp.net javascript
[0, 9, 3]
4,548,833
4,548,834
Do I require a from to submit input type=image for a jQuery type form submission
<p>I have two images, that I am using their value to insert into a db table. Do I Require a form or can I do without one.</p> <pre><code>&lt;form name="form1" id="form1" method="post" action="save.php"&gt;&lt;input type="image" src="images/test.png" border="0" id="star_image" value="&lt;? echo $some_value; ?&gt;" /&gt;&lt;/form&gt; &lt;form name="form2" id="form2" method="post" action="save.php"&gt;&lt;input type="image" src="images/test1.png" border="0" id="star_image1" value="&lt;? echo $some_value1; ?&gt;1" /&gt;&lt;/form </code></pre> <p>Would the above trigger the below jQuery code</p> <pre><code>$(document).ready(function(){ $('#form1').ajaxForm({}); $('#form2').ajaxForm({}); }); </code></pre> <p>-----------------------------save.php--</p> <pre><code>insert into table (field) values('value') . . . . </code></pre> <p>And I want to submit the form using jQuery <strong>only</strong></p> <p>Thanks Jean</p>
php jquery
[2, 5]
2,806,483
2,806,484
jquery : dynamic events how to achieve
<p>What is the best way to do this dynamic events linking between divs in jquery.</p> <p>my HTML page:</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;div id="parent1"&gt;&lt;/div&gt; &lt;div id="parent2"&gt;&lt;/div&gt; &lt;div id="parent3"&gt;&lt;/div&gt; &lt;div id="child1"&gt;&lt;/div&gt; &lt;div id="child2"&gt;&lt;/div&gt; &lt;div id="child3"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>for each clicked parent i want to .toggle its child </p> <blockquote> <p>Example :: if parent2 clicked, .toggle will be applied on child2 only</p> </blockquote> <p>my parents and childs divs are dynamically created so their number is not static, i think .live should be used here, but i have no idea how to achieve that.</p> <p>Thanks </p>
javascript jquery
[3, 5]
3,761,249
3,761,250
limiting of strings or numbers in text boxes Java android
<p>How to limit or restrict the words or numbers in the EditText boxes in android Java?</p>
java android
[1, 4]
3,866,378
3,866,379
How to get the actual code (not inside content) of an iframe element?
<p>Have a look at this code:</p> <p><a href="http://jsfiddle.net/NTYcA/1/" rel="nofollow">http://jsfiddle.net/NTYcA/1/</a></p> <pre><code>var foo = '&lt;iframe width="560" height="315" src="http://www.youtube.com/embed/A175-KHvfy4" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;'; foo = $(foo); // turned into jquery object alert( foo.html() ); // alerts nothing alert( foo[0] ); // alerts [Object HTMLIFRAMELEMENT] but how can I get the actual iframe code as a string? </code></pre> <p>So how can I get the iframe code from the jquery object?</p> <p>I literally want this:</p> <pre><code>&lt;iframe width="560" height="315" src="http://www.youtube.com/embed/A175-KHvfy4" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt; </code></pre> <p>without accessing the original var.</p>
javascript jquery
[3, 5]