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
2,881,566
2,881,567
How to enable a function only on clicking a particular condition
<p>Hi there i have 3 buttons called 1.ADD , 2.EDIT , 3.DELETE.....and a map with id=comp_map... and I am using Open Street Maps....</p> <pre><code>function addComp() { $("#comp_map").click(function() { if (event.type !== 'mousemove') { var containerPoint = comp_map.mouseEventToContainerPoint(event), layerPoint = comp_map.containerPointToLayerPoint(containerPoint), latlng = comp_map.layerPointToLatLng(layerPoint) alert("Marker Location: "+latlng); } }); } function editComp() { // disable the map click } function delComp() { // disable the map click } </code></pre> <p>My question is i want <code>$("#comp_map").click</code> to work only when add button is clicked... but when the other buttons like edit , delete are clicked this function should not work... is this the right way to do this or if my approach is wrong please correct me... Thank You...!</p>
javascript jquery
[3, 5]
3,332,741
3,332,742
What is this syntax? ; (function ($, undefined)
<pre><code>; (function ($, undefined) { // all the variables and functions of the js document })(jQuery); </code></pre> <p>I've seen this twice now in the jquery/javascript files for a zoom script. I don't understand what this is exactly. I can't seem to google it, I don't remember coming across this on tizag or w3schools while recently learning jquery and js.</p> <p>There's nothing before or after this code (other than some comments). So I'm utterly lost as to what <code>(function())(jQuery);</code> is or does.</p>
javascript jquery
[3, 5]
4,596,771
4,596,772
.attr selector wont work in a each loop?
<p>Here's the code:</p> <pre><code> $.ajax({ url: 'AEWService.asmx/previewAsset', type: "GET", contentType: "application/json; charset=utf-8", data: json, success: function (json) { var prevObj = jQuery.parseJSON(json.d); setInterval(function () { var pId = $('#previewIframe').contents().find('[preview-id]'); $.each(prevObj, function (i, item) { pId.each(function () { var pElem = this.attr("preview-id"); if (pElem == item.Id) { $(this).html(item.Value); } }); }); }, 3000); } }); </code></pre>
javascript jquery
[3, 5]
581,188
581,189
how to use alert in php and js combined
<p>have a need to alert through php,<br> I have the code below. Problem is that it works as long as I dont use header redirect. But as soon as I use it..I loose alert.</p> <pre><code>echo "I will do some functions here in php"; if($value == 1){ alert('ok working'); } header(location: 'someOtherpagethanthis.php'); </code></pre>
php javascript
[2, 3]
1,747,776
1,747,777
Best Practice: Initialize class fields in constructor or at declaration?
<p>I've been programming in C# and Java recently and I am curious what people would consider the best practice concerning when you should initialize your classes fields?</p> <p>Should you do it at declaration?:</p> <pre><code>public class Die { private int topFace = 1; private Random myRand = new Random(); public void Roll() { // .... } } </code></pre> <p>or in a constructor..</p> <pre><code>public class Die { private int topFace; private Random myRand; public Die() { topFace = 1; myRand = new Random(); } public void Roll() { // ... } } </code></pre> <p>I'm really curious what some of you veterans think is the best practice.. I want to be consistent and stick to one approach.</p>
c# java
[0, 1]
4,739,155
4,739,156
Specifying a new source for the image tag at runtime in Javascript , jQuery
<p>Is it possible to change the src of a image at runtime using jQuery. I have created a fiddle. I am trying to load the image specified in the variable $newsrc when the button is clicked. I am not sure as to what should be specified an argument function changeImage(). I do not want to use anonymous function. </p> <p><a href="http://jsfiddle.net/bobbyfrancisjoseph/KMFj2/5/" rel="nofollow">http://jsfiddle.net/bobbyfrancisjoseph/KMFj2/5/</a></p>
javascript jquery
[3, 5]
5,026,916
5,026,917
Loading jquery after inserting the jquery tag
<p>I insert the jquery tag</p> <pre><code> var newScript = document.createElement("script"); newScript.id = "grazit_jq"; newScript.type = "text/javascript" newScript.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"; script.parentNode.appendChild(newScript); </code></pre> <p>And after that I want to check if jquery exists.</p> <p>I do so in a few ways.One way is like this:</p> <pre><code> var checkJquery=function(){ if(typeof(jQuery) === 'undefined') { console.log('jQuery doesnt exist'); window.setTimeout(arguments.callee,1000); return; } else{ sprk_lib=new sprk(); sprk_lib.load(jQuery); } }; sprk.prototype.load=function($){ console.log($); </code></pre> <p>}; <strong>UPDATE</strong> Now i updated the code. It will call the function as soon as the jQuery object is availeable.</p> <p>In that function I will execute my jquery code. Do you think that there will be problems? is it okay to do it that way? </p> <blockquote> <p>original</p> </blockquote> <p>I wait there. problem is that in the console log , it returns null and the prints jQuery exists. How can I stop the script till the jquery is loaded,, and then continue executing the script?</p>
javascript jquery
[3, 5]
5,799,312
5,799,313
Why do I see confirmation box twice when I write Javascript only once in my document
<pre><code>$("a.sure").click(function () { var choice = confirm("Are you Sure"); }); </code></pre> <p>I see confirm twice when I write this and click. When I track from Firebug then the confirm dialogue box only appears once.</p>
javascript jquery
[3, 5]
3,747,369
3,747,370
paging of datacontrol in jquery dialog
<p>I'm using Jquery dialogs in my Asp.net web application for all my messages. Now I've tried to fill a listview with customers inside a dialog and its working, but I want to allow the user to use paging in the listview for choosing his customer out of the list. When I press the button to move up 1 page, it ain't working...</p> <p>Maybe it's just not possible? Or does someone have an example of paging a datacontrol in a Jquery dialog?</p> <p>Greetz, Ben</p>
c# asp.net jquery
[0, 9, 5]
116,983
116,984
I want the user to be able to download a page
<p>I am using the code,</p> <pre><code> string loadFile = HttpContext.Current.Request.Url.AbsoluteUri; // this.Response.ClearContent(); // this.Response.ClearHeaders(); this.Response.AppendHeader("content-disposition", "attachment; filename " + filename); this.Response.ContentType ="application/html"; this.Response.WriteFile("C:\\Users\\Desktop\\Jobspoint Website\\jobpoint3.0\\print.aspx"); this.Response.Flush(); this.Response.Close(); this.Response.End(); </code></pre> <p>to download an aspx page in asp.net C#.. But its only showing the html tags and static values... How can I save the entire page without html tags and with the values that retrieved from the database?<br> Thanks...<br> Leema</p>
c# asp.net
[0, 9]
1,773,000
1,773,001
hide a label after some time automatically after a buttonclick
<p>I am Working in ASP.NET and C#.</p> <p>In my Application i have a registration form in which there is a label which shows the <strong>success</strong> and <strong>failure</strong> of the registration.The text for that label is from codebehind based on the condition.Now what i need is to hide the label after sometime (say 5sec) on clicking the submit button.I have tried this using javascript but its not working properly.please let me know whats the mistake or give ur sugessions.</p> <p><strong>Script</strong>:</p> <pre><code> function HideLabel() { document.getElementById('&lt;%= lbl1.ClientID %&gt;').style.display = "none"; } setTimeout("HideLabel();", 5000); </code></pre>
javascript asp.net
[3, 9]
3,574,664
3,574,665
why do I get htmlfile: Unknown runtime error JScript error
<p>I get this error thrown in line:</p> <pre><code>displayElement.innerHTML = executor.get_responseData(); </code></pre> <p>I try to update the inner html of a div, with the data received from java. executor.get_responseData(); works well. how should I debug from here?</p> <p>Edit: I use this functions for updating the data:</p> <pre><code>function GetWebRequest(getPage, HTMLtarget) { displayElement = $get(HTMLtarget); var wRequest = new Sys.Net.WebRequest(); wRequest.set_url(getPage); wRequest.set_httpVerb("GET"); wRequest.set_userContext("user's context"); wRequest.add_completed(OnWebRequestCompleted) wRequest.invoke(); </code></pre> <p>}</p> <pre><code>function OnWebRequestCompleted(executor, eventArgs) { if (executor.get_responseAvailable()) { displayElement.innerHTML = ""; if (document.all) { displayElement.innerHTML = executor.get_responseData(); } else // Firefox { displayElement.textContent += executor.get_responseData(); } } else { if (executor.get_timedOut()) { alert("Timed Out"); } else { if (executor.get_aborted()) alert("Aborted"); } } </code></pre> <p>}</p> <p>I ude the functions above like:</p> <pre><code> function pageLoad() { var name= document.getElementById("&lt;%= SearchName.ClientID %&gt;").value; var target = 'OnrcWebPart.aspx?SearchName=' + name; GetWebRequest(target, 'PeopleContent'); //I update the content inside div with PeopleContent id } </code></pre> <p>I have this functions from th tutorial <a href="http://www.asp.net/ajax/videos/how-do-i-implement-the-incremental-page-display-pattern-using-http-get-and-post" rel="nofollow">http://www.asp.net/ajax/videos/how-do-i-implement-the-incremental-page-display-pattern-using-http-get-and-post</a></p> <p>In the sample works well, but in my application it doesn't. Could it be because I use Masterpages?</p>
javascript asp.net
[3, 9]
2,845,969
2,845,970
Jquery plugin hovercard not work in dynamically generated content
<p>Jquery plugin Hovercard works well in simple HTML code but does not work when i used it in javascript code (dynamically creating html code through javascript). Maybe this is also a general problem, how can jquery plugin work in js code generated content? </p>
javascript jquery
[3, 5]
4,337,882
4,337,883
More efficient way of searching window.location.href for a string?
<p>Is there a more efficient way of searching the window.location.href?</p> <p>window.location.href: <code>http://www.example.com/6CATA/folder/file.html</code></p> <p>The current code I have is:</p> <pre><code>var searchWinHref = window.location.href; if(searchWinHref.indexOf("/6CATA/") &gt; -1) { alert('6CATA is in the window.location.href'); } </code></pre> <p>Which works just fine, but I'm trying to learn ways to optimise code where possible and if I need to do this a couple of times on a page, I'm curious to know if there's a more efficient way to do it?</p> <p>EDIT:</p> <p>To clarify, I need to occasionally search the URL for different variations, e.g: 6CATA &amp; 6CATB etc.</p>
javascript jquery
[3, 5]
5,286,321
5,286,322
Whats a good argument for/against using inline javascript within the html body tag?
<p>One of my co-workers is thinking that it is simpler to just include the document.ready() calls (MULTIPLE) for jquery anywhere in an html document, rather than trying to have them all in the head, foot or in an external js file. Can you give me your thoughts about this?</p> <p>The document.ready stuff is loaded by modules that are included in a main template. I think this is messy. But I need a good argument point. </p>
javascript jquery
[3, 5]
6,005,745
6,005,746
waiting until two values have changed in jquery
<p>I have two form fields and would like to post those values using jquery only when both have a value. I have tried this but there must be a better way. I think this way could lead to errors</p> <pre><code>$('#RFID').change(function(e){ if($(this).val() != '' &amp;&amp; $('#STATION_ID').val() != ''){ } }); </code></pre>
javascript jquery
[3, 5]
3,773,198
3,773,199
Send a message later
<p>If you have ever been to a sms messaging site, you probably have seen that users can decide they want to schedule the sending of their sms message at a later time. So a user logs on to the site (a real life example is at <a href="http://www.smslive247.com" rel="nofollow">http://www.smslive247.com</a> or <a href="http://routesms.com" rel="nofollow">http://routesms.com</a>), composes the sms and clicks on "send message at a later time" radiobox. This gives users a datetime field that you can then pick what date and time you want the message to be dispatched (as well as ability to change the timezone). Basically, users can schedule the sending of sms.</p> <p>I'm also designing a similar site and wondering if anyone can tell me how this is done.</p> <p>Thanks. </p>
php asp.net
[2, 9]
4,670,794
4,670,795
How can I close a tab of browser after getting confirmation from user?
<p>I want to close a tab after getting confirmation from user. It can be done as follow-</p> <pre><code>window.onbeforeunload = function() { return "Are you sure?"; } </code></pre> <p>But the problem with this code is that it shows some message that I am not expecting. I want to do this task using javascript's confirm() popup. can anyone help me to do this.</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
2,508,567
2,508,568
JQuery change class by given id's
<p>I have a number of tables, for example:</p> <pre><code>&lt;table class="onion" id="12"&gt; </code></pre> <p>When a div named "Mark_Pre_Val" gets clicked i want tables with the id's 4, 6, 12 &amp; 21 to change their class to "onionClick", and if one of them is already "onionClick" then don't change the class.</p> <p>Here is the click event:</p> <pre><code> $(".Mark_Pre_Val").click(function(){ }); </code></pre> <p>Can someone point me to the right direction how to approach this?</p>
javascript jquery
[3, 5]
4,421,403
4,421,404
How can i delete the first word from a line with javascript or jquery?
<pre><code>Mon 25-Jul-2011 </code></pre> <p>I want to delete the first word "Mon" with javascript jQuery. How can i do this ?</p>
javascript jquery
[3, 5]
3,409,039
3,409,040
Shilft + Enter without inserting new line
<p>I want to send a textarea's data when user presses <kbd>shift</kbd> + <kbd>enter</kbd>, but without inserting a new line.</p> <p>This doesn't work:</p> <pre><code> $( 'form textarea' ).keydown(function (event) { if (event.keyCode == 13 &amp;&amp; event.shiftKey) { send_data(); event.preventDefault(); return false; } }); </code></pre> <p>I'm using Google Chrome.</p>
javascript jquery
[3, 5]
4,120,909
4,120,910
Can I use ASP.NET 2.0 to create a picture scroller?
<p>I am trying to create a picture scroller. In it, I would have a large picture and several thumbnails at the bottom. If a user haover or clicks the thumbnail, it then is displayed in te large box. My plan was to create this in ASP.NET but now I'm drawling a blank on how to implement this? I know ASP.NET and some JavaScript. Any opinions on how to get started?</p> <p>I should mention my images are stored in the database so I get them as byte arrays.</p>
asp.net javascript
[9, 3]
5,119,156
5,119,157
Can I make jQuery point to an XML document rather than the DOM?
<p>I'm trying to retrofit a page to read from XML rather than the DOM, and I'd rather not use $(xml).find('blah') for every single call, and I was wondering if there was a way to point jQuery at xml, rather than the DOM.</p> <p>For instance, I'd like to be able to navigate my xhtml with the jQuery method as such: $('blah').whatever</p> <p>Is this possible?</p>
javascript jquery
[3, 5]
5,002,288
5,002,289
jquery files conflicts how to detect?
<p>Q:i have a general problem ,when i wanna to do some thing and i find the jquery file which can do exactly what i wanna to do . after a while i need another case and i find that another jquery file serve me and fix my problem .after i add set of jquery files i find conflicts among those files and some features does not work or work in awkward manner ..and when i try to find which file exactly the source for those problems i find myself in closed circle cannot modify this file or cannot delete this file or cannot find that file itself at all.sometimes the file like this:</p> <p><code>&lt;script src="http://jqueryjs.googlecode.com/files/jquery-1.3.js" type="text/javascript"&gt;&lt;/script&gt;</code></p> <p>cannot modify it.</p> <p>the problem has many faces,and i cannot really know how to handle the whole matter from the beginning.</p> <p>can any one give me instructions ,advices,notes, or explanation to prevent the problem from the beginning and how to fix it if it was happened.</p>
javascript jquery
[3, 5]
1,879,871
1,879,872
gallery that shows various number of items
<p>I am looking for an example or jquery script, but I am getting nothing probably because I don't know what to call it. </p> <p>I am trying to create an item gallery that has the option to display various amount of items. Similar concept to a gmail account....I can select to view 20, 50 or 100 messages, but I was wondering if there is some sort of script where I could do this without refreshing the page.</p> <p>I want to use this to display a little more information if a smaller item view is selected and the user has the option to choose how many items to see. Does anyone have an example? </p> <p><img src="http://i.stack.imgur.com/tLD5T.png" alt="this is what I am trying to create"> </p>
php javascript jquery
[2, 3, 5]
3,174,233
3,174,234
call javascript function in a jquery chain
<pre><code>function jsFunc() { alert('i am js!'); } $('#node').slideDown().call(jsFunc()); </code></pre> <p>Of course, the function isn't called 'call'. Any help?</p> <p>** solution (thx Reigel) **</p> <p><a href="http://jsfiddle.net/gx2mJ/1/" rel="nofollow">http://jsfiddle.net/gx2mJ/1/</a></p> <p>OR</p> <p>html:</p> <pre><code>&lt;div id="content"&gt; &lt;p class="article"&gt; this is an article &lt;/p&gt; &lt;/div&gt; </code></pre> <p>javascript:</p> <pre><code>function callBack() { $("#content .article").html("the callback has been called"); } $(document).ready(function() { $("#content .article").slideUp(0); $("#content .article").each(function(i) { $(this).delay(i*250).slideDown(function(){ //if ($("#content .article:animated").length &lt; 1) { callBack(); //} }); }); }); </code></pre>
javascript jquery
[3, 5]
2,103,582
2,103,583
Starting service from intent in another service gets a run time error
<p>I'm getting an error when trying to start a service with an intent from another service in an Android 2.3.3 project. The error is: Unable to start service with Intent{ act=(class name) cmp=(class name)/.(android name) }: java.lang.IllegalArgumentException:provider==null</p> <p>Method Call:</p> <pre><code>private void startLocationService(){ intent = new Intent("com.example.Android.LocationService"); intent.setClass(MainService.this.getApplicationContext(), LocationService.class); startService(intent); } </code></pre> <p>Manifest:</p> <pre><code>&lt;service android:name=".LocationService"&gt; &lt;intent-filter&gt; &lt;action android:name="com.example.Android.LocationService"/&gt; &lt;/intent-filter&gt; &lt;/service&gt; &lt;/application&gt; </code></pre>
java android
[1, 4]
632,026
632,027
How to get this work Div addClass
<p>I try to make this work but not luck yet, why the DIV does not highlight(Flashing) when the figures updated in stats.php? </p> <p>In stats.php</p> <pre><code>&lt;div id="student_today"&gt;&lt;b&gt;$&lt;?php print getTodayStats($collageid); ?&gt;&lt;/b&gt;&lt;/div&gt; Month: &lt;div id="student_month"&gt;&lt;b&gt;$&lt;?php print getMonthStats($collageid); ?&gt;&lt;/b&gt;&lt;/div&gt; </code></pre> <p>Below style for div:</p> <pre><code>.stats_highlight{ background: #03B1EE; border-top-color: #03B1EE; z-index: 10; color: #fff; </code></pre> <p>In main.php :</p> <pre><code> &lt;tr class="live"&gt; &lt;td width="267"&gt; &lt;p align="left"&gt;Today's Students:&lt;/p&gt;&lt;/td&gt; &lt;td width="201"&gt; &lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;&lt;/td&gt; &lt;td width="220"&gt; &lt;span value="value" id="student_today"&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="live"&gt; &lt;td width="267"&gt; &lt;p align="left"&gt;Month's students:&lt;/p&gt;&lt;/td&gt; &lt;td width="201"&gt; &lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;&lt;/td&gt; &lt;td width="220"&gt; &lt;span class="value" id="student_month"&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>I need someone who can guide me solve this question. Really appreciate.</p>
php javascript
[2, 3]
3,336,883
3,336,884
Passing textbox as an instance in jQuery
<pre><code>var ctrl = $("&lt;input /&gt;").decimalControl(AllowedDecimalValues).ControlContainer(); $.fn.decimalControl = function (Decimalvalues) { var settings = { 'maxLength': '25', 'defaultvalue': '00.00', 'name': 'decimalcontrol', 'type': 'number' }; settings.MaxDecVal = Decimalvalues; return $(this).ControlBuilder(settings); }; $.fn.ControlBuilder = function (settings) { return this.val(settings.defaultvalue) .attr('name', settings.name) .attr('value', settings.defaultvalue) .attr('type', settings.type) .attr('size', settings.maxLength); }; </code></pre> <p>The first line of the above code throws an error:</p> <pre><code>Object doesn't support property or method 'decimalControl'. </code></pre> <p>Please provide help or a alternate solution.</p>
javascript jquery
[3, 5]
3,305,874
3,305,875
Sending HTML in an e-mail message's body
<p>I'm trying to send an e-mail containing HTML, but the HTML shows up literally. How can I send an HTML link? Here's my current code:</p> <pre><code>Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("text/html"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {"[EMAIL PROTECTED]"}); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject"); <b>emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "&lt;html>&lt;body>Example&lt;/body>&lt;/html>");</b> context.startActivity(Intent.createChooser(emailIntent, "Send mail..."));</code></pre>
java android
[1, 4]
1,605,210
1,605,211
How to compile Java from C#?
<p>I'm trying to use the following C# code to compile Java using javac:</p> <pre><code>Process p = new Process(); p.StartInfo.FileName = "javac"; Directory.CreateDirectory(Application.StartupPath + @"/TempJava"); p.StartInfo.Arguments = "-d "Application.StartupPath + @"/TempJava" + files; p.Start(); </code></pre> <p>"files" represents a string variable containing the name(s) of the <code>*.java</code> files. </p> <p>All in all, I want to create a new folder, and then take the Java files (from where ever they may be located) and compile it into a class file(s) in TempJava.</p> <p>For some reason, the code doesn't work, no errors, no warnings, but when I run it and check TempJava, there's no files in it.</p>
c# java
[0, 1]
1,336,236
1,336,237
How to execute code everytime url changes
<p>I'm making an ajax site. How would I go about executing some javascript every time the url changes. Say when "/#page/aboutus/" changes to "/#page/news/".</p> <p>I want users to be able to bookmark ajax-pages.</p>
javascript jquery
[3, 5]
2,539,650
2,539,651
Process elements with a certain class "whenever they are added to page"
<p>I want to process elements with a certain class whenever they are added to the page during the initial page load or after ajax updates to the page. How can I run a method whenever such element(with that particular class) is added to the page ?</p> <hr> <p>Using jQuery for Javascript.</p> <h1>Edit:</h1> <p>HTML:</p> <p><code>&lt;span data-timestmp="543654364" class="dateTime" /&gt;</code></p> <p>JavaScript code to execute whenever element with class <code>dateTime</code> is added to page:</p> <pre><code>function prepareDateTime(){ $('.dateTime').each(function(index, element){ var date = new Date(parseInt($(element).attr('data-timestmp'))/1000); $(element).html(date.toUTCString()); }); } </code></pre>
javascript jquery
[3, 5]
5,810,562
5,810,563
post a link from jquery to call a ASHX asp.net
<p>I have this function:</p> <pre><code>function exportdata(ID) { $.ajax({ type: "POST", url: "export.ashx?ID=" + ID, data: "{}", /*contentType: "application/json; charset=utf-8",*/ dataType: "json" }); } </code></pre> <p>It works fine but when I open the Developer Tools of Chrome in the Console tab, I see some errors:</p> <pre><code>POST http://localhost:1111/export.ashx?ID=1 undefined (undefined) POST http://localhost:1111/abc.aspx undefined (undefined) </code></pre> <p>How can I solve this problem?</p> <p>thanks in dvance.</p>
jquery asp.net
[5, 9]
5,794,565
5,794,566
Javascript + Differentiate user clicks and clicks sent from function
<p>I have an Accordion function like this:</p> <pre><code>$("#notaccordion").addClass("ui-accordion ui-widget ui-helper-reset") .find("h3") .addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom") .prepend('&lt;span class="ui-icon ui-icon-triangle-1-e"/&gt;') .click(function () { $(this).toggleClass("ui-accordion-header-active").toggleClass("ui-state-active") .toggleClass("ui-state-default").toggleClass("ui-corner-bottom") .find("&gt; .ui-icon").toggleClass("ui-icon-triangle-1-e").toggleClass("ui-icon-triangle-1-s"); if ($(this).next().is(':hidden') == true) { ; $(this).addClass('active'); $(this).next().slideDown('normal'); } else { $(this).removeClass('active'); $(this).next().slideUp('normal'); } //.end().next().slideUp('normal'); return false; }) .next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").hide(); </code></pre> <p>and a click all panels function to expand all panels at once:</p> <pre><code>function clickAllPanels() { var elm = document.getElementsByTagName('table'); var i = elm.length; while (i--) { clickItem(elm[i]); } } function clickItem(divObj) { if (divObj.click) { divObj.click(); } else if (document.createEvent) { var evt = document.createEvent("MouseEvents"); evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); var allowDefault = divObj.dispatchEvent(evt); } } </code></pre> <p>How can I let the accordion <code>.click(function ()</code> function know that it's <code>clickAllPanels</code> that is sending the 'clicks' instead of a user's physical click. I need to do this because I want to change the slide up and down logic if it's from <code>clickAllPanels</code>.</p>
javascript jquery
[3, 5]
1,138,177
1,138,178
ArrayList<SensorEvent>.add(...) begins overwriting values
<p>I am writing an app that needs to keep the values that come from the accelerometer. I am doing this by using an ArrayList and then when onAccelerationChanged(...) gets called I simply add those values to the list. The problem is that after so many values (never consistent) get pushed into the list it starts overwriting the values with the value I am adding. I figured I was doing something stupid so I took the 'Accelerometer Play Sample' and modified onSensorChanged(...) to do the same. Doing this replicates the issue.</p> <p>variable added to class:</p> <pre><code>private ArrayList&lt;SensorEvent&gt; _accelData = new ArrayList&lt;SensorEvent&gt;(); </code></pre> <p>onSensorChanged:</p> <pre><code>@Override public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() != Sensor.TYPE_ACCELEROMETER) return; Log.e("Event to Add", event.timestamp + ", " + event.accuracy + ", " + event.values[0] + ", " + event.values[1] + ", " + event.values[2]); _accelData.add(event); if (_accelData.size() &gt; 25) { for (SensorEvent tmp_event : _accelData) { Log.e("Events in list", tmp_event.timestamp + ", " + tmp_event.accuracy + ", " + tmp_event.values[0] + ", " + tmp_event.values[1] + ", " + tmp_event.values[2]); } _accelData.clear(); } } </code></pre> <p>On the left is each event that was supposed to be added and on the right is the list printed out after 26 adds were performed. As you can tell the values that were supposed to be added don't match the list itself and there is a ton of repetition of the last and second to last value in the list. </p> <p><img src="http://i.stack.imgur.com/I7kNu.png" alt="enter image description here"></p> <p>I fixed this by making a new class that takes in an event and copies those values. Then I make the ArrayList take that class instead. It works but I don't understand why and was hoping someone could educate me since I am new to Java and Android.</p>
java android
[1, 4]
1,043,236
1,043,237
Does Java System Class shared between processes?
<p>I have a question regarding the Java language: in android</p> <p>i tried changing a System.property X inside process A, then activating process B</p> <p>(i thought maybe it's initializing all the System.properties again) </p> <p>(process B didn't see the changed System.property X as expected), </p> <p>then i resumed the first process and saw that the changed System.property is still there. </p> <p>I know that the System class can't be instantiated. since this is the case,</p> <p>i thought that it will be shared among all the processes.</p> <p>yet this is not the case. </p> <p>i understand why we want this to happen, but how can this be if System class is not instantiated? what mechanism in Java causes this behavior?</p> <p>thanks for the help</p>
java android
[1, 4]
3,731,457
3,731,458
Write to file when cache expires
<p>How to write to a file the content of cache when Cache expires.</p>
c# asp.net
[0, 9]
505,345
505,346
Loop Through Multivalue Array
<p>First of all sorry if I have the terminology wrong, if so could you please correct me?</p> <p>I am trying to loop through the following javascript array.</p> <pre><code> var pieData2 = [ { label: 'wow', value: 30, color:"#F38630" }, { label: 'wow2', value : 10, color : "#E0E4CC" }, { label: 'wow3', value : 100, color : "#69D2E7" } ]; </code></pre> <p>I am trying to write the label and color into separate divs. I have tried the following concept, but have got no where.</p> <pre><code> $.each( pieData2[0], function( key, value ) { alert( key + ": " + value ); }); </code></pre>
javascript jquery
[3, 5]
4,576,527
4,576,528
call a function every X minute
<p>I have a background service running and inside this I wanted to call a function every X minute. What is the simplest solution to do this in Android?</p>
java android
[1, 4]
3,631,726
3,631,727
Changing the value of String.xml
<p>This Might be a stupid question but please forgive me as I am only a learner.</p> <p>Is it possible to change the value of player in a method from class if so, please tell me how.</p> <p><strong>This is part of my R.java</strong></p> <pre><code> public static final class string { public static final int player=0x7f060003; </code></pre> <p><strong>This is part of my string.xml from values file</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;string name="player"&gt;player&lt;/string&gt; &lt;/resources&gt; </code></pre>
java android
[1, 4]
5,036,424
5,036,425
select specific text on page and remove it
<p>Is is possible to select specific text string on the page directly without a id, class, etc...</p> <p>I have this text string "ERROR: AffiliateID invalid" that I would like to remove from the page.</p> <p>Is it possible?</p>
javascript jquery
[3, 5]
2,851,238
2,851,239
jquery multipart form submission prevention
<p>jquery form submission prevention using <code>e.preventDefault()</code> is not working in multipart form submission ( when im using ajax to submit ). Is there any way to solve it ?</p> <p>Code </p> <pre><code>$('.imgChange').submit( function(e){ load('do_upload.php',$(this).serialize()); e.preventDefault(); </code></pre> <p>});</p>
javascript jquery
[3, 5]
54,598
54,599
How can a javascript variable that I just displayed immediately error out as undefined?
<p>I have some simple javascript code that looks like this:</p> <pre><code>var divLink = $(this).attr("href"); alert(divLink); if ($(divlink).is(":visible")) $(divLink).hide("blind", { direction: "vertical" }, 1000); </code></pre> <p>It throws this error on line 3:</p> <pre><code>Uncaught ReferenceError: divlink is not defined </code></pre> <p>I put in line two just to see what was in the variable divLink. It returns:</p> <pre><code>The page at mysite.com says: #categories_settings </code></pre> <p>Once I click "OK" on the dialog box, it throws the error. How can this be?</p>
javascript jquery
[3, 5]
209,725
209,726
Android - can't access strings with R.string
<p>I am have trouble accessing a string I stored in strings.xml and don't know why.</p> <p><strong>res/values/strings.xml</strong></p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;string name="FileBrowser"&gt;FileBrowser&lt;/string&gt; &lt;string name="menu_settings"&gt;Settings&lt;/string&gt; &lt;string name="up_one_level"&gt;..&lt;/string&gt; &lt;string name="current_dir"&gt;.&lt;/string&gt; &lt;/resources&gt; </code></pre> <p><strong>Code</strong></p> <pre><code>this.directoryEntries.add(getString(R.string.current_dir)); //current_dir is not being seen </code></pre>
java android
[1, 4]
4,843,336
4,843,337
.prev(selector) not working
<p>Here's the problem (<a href="http://jsfiddle.net/vWafe/1/" rel="nofollow">live copy </a>):</p> <p>CSS:</p> <pre><code>div { border: 1px solid black; } </code></pre> <p>HTML:</p> <pre><code>&lt;div&gt;.&lt;/div&gt;&lt;br&gt; &lt;div&gt;.&lt;/div&gt;&lt;br&gt; &lt;div class="test"&gt;Should have a blue border&lt;/div&gt;&lt;br&gt; &lt;div&gt;.&lt;/div&gt;&lt;br&gt; &lt;div&gt;.&lt;/div&gt;&lt;br&gt; &lt;div&gt;.&lt;/div&gt;&lt;br&gt; &lt;div&gt;.&lt;/div&gt;&lt;br&gt; &lt;div&gt;.&lt;/div&gt;&lt;br&gt; &lt;div&gt;.&lt;/div&gt;&lt;br&gt; &lt;div&gt;.&lt;/div&gt;&lt;br&gt; </code></pre> <p>JavaScript:</p> <pre><code>$('div:last').css('border', '1px solid red') .prev('.test').css('border', '1px solid blue'); </code></pre> <p>It seems that when I do <code>$(selector).prev(.className)</code> or <code>$(selector).prev(tag.className)</code> I get an empty set. What's wrong with this?</p>
javascript jquery
[3, 5]
3,260,715
3,260,716
Using jQuery to fade in a new image
<p>Below is the image element that is acting as the background. The position is absolute and it also has a low z-index so it stays behind the rest of the content.</p> <pre><code>&lt;img src="day-sky.jpg" id="background" /&gt; </code></pre> <p>The secs below just refers to seconds in a minute. This is just for test purposes, but I'd like to have one background image if the seconds is &lt; 30 and a different one if it's greater that 30. If possible the transition would be a nice fade to the next image.</p> <p>I've been searching around for ways to do this but haven't come up with a good way to do it. Any thoughts?</p> <pre><code>function changeBackground() { if (secs &gt; 30) { //have one background } else { //have a different background } } </code></pre>
javascript jquery
[3, 5]
543,636
543,637
Asp.net Empty Web Application or MCV 2/3 : Differences,which one is better
<p>I'm developing a administration site for a database.</p> <p>After I'll finish my code I would like to public the site on a domain .</p> <p>I'm working on a empty web application, and want to make a page design for the site after I finish the coding part. But I need to know: </p> <pre><code>What differences are between empty web app or mcv/2/3 and which one is better to use! </code></pre> <p>Thanks</p>
c# asp.net
[0, 9]
2,738,791
2,738,792
is it possible to run simple python games on android os
<p>I started learning programming recently using python and have always had a keen interest in the android os and hope to do more with it when I get more experienced.</p> <p>I have SL4A and python installed on my tablet. I have spent a lot of time trying to figure out how run simple games written in python on my tablet.</p> <p>For instance, I made a simple hangman game as an assignment: is it possible to run that on my tablet, and if so what do I need to do? </p> <p>I have seen a lot of python and android related stuff online but I find it hard to get a simple example about how exactly to use python with android. Furthermore, what exactly are the limitations/best uses for python in relation to android devices? Any help or pointers in the right direction would be appreciated. Thanks.</p>
android python
[4, 7]
2,787,223
2,787,224
Selection does not contain a main type. Eclipse error
<p>I've made an AVD (android virtual device). But when i try to run my application, this shows up:</p> <p>Your project contains error(s), please fix them before running your application.</p> <p>The error log shows the following: NUMBER 1: res\drawable-mdpi\testbackg.png:0: error: Resource entry testbackg is already defined. NUMBER 2: res\drawable-mdpi\testbackg.jpg:0: Originally defined here. NUMBER 3: C:\Users\Svein Inge\Android Eclipse\Test 1\res\layout\main.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/testbackg.png').</p> <p>Here's my code (main.xml)</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/testbackg.png" android:orientation="vertical" &gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/open" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>help</p>
java android
[1, 4]
51,858
51,859
Automated WebForm Generation
<p>I have a bunch of C# functions with string, int and bool arguments that serve as data entry interfaces. I'd like to be able to create a webform for each method; a textbox for each string/int and a checkbox for each bool. </p> <p>Is there a way to automate this process?</p>
c# asp.net
[0, 9]
4,395,530
4,395,531
reading content of .aspx using javascript
<p>i am using javascript to read the content of .aspx page. but i am not able to read it. i am using javascript as:</p> <pre><code>function edit(headtext,totext, bodytext, footertext){ alert('lll'); //var xmlDoc=new ActiveXObject("MSXML.DOMDocument"); xmlDoc.async="false"; xmlDoc.load("theme3ex.aspx"); var students = xmlDoc.documentElement; alert('0000'); var student = students.childNodes(0); document.getElementById('txtareahead').innerHTML = headtext; document.getElementById('txtareato').innerHTML = totext; document.getElementById('txtareabody').innerHTML = bodytext; document.getElementById('txtareafooter').innerHTML = footertext; location.href = "MailSender.aspx"; } </code></pre> <p>is there any problem eith my javascript..</p>
javascript asp.net
[3, 9]
2,751,850
2,751,851
When element is not on screen anymore?
<p>In my website, there is a floating cloud(element) that scrolls rightwards, and I wanna be able to tell when it's not visible anymore on screen.</p> <p>How can I do it?</p> <pre><code>setInterval(function(){ if(!jQuery('.sa_cloud_l').is(':visible')){ alert('not visible anymore'); }else{ c1.css('left', '+=21'); } },100); </code></pre>
javascript jquery
[3, 5]
4,418,696
4,418,697
Getting object values from a LinkedHashMap
<p>So for my local data structure I have the following</p> <pre><code>DataStructure ds = new DataStructure(); //Examples to put in the Data Structure "ds" ds.menu_item.put("Pizza", new DescItems("A Pizza",2.50,4)); ds.menu_item.put("Hot Dog", new DescItems("A yummy hot dog",3.50, 3)); ds.menu_item.put("Corn Dog", new DescItems("A corny dog",3.00)); ds.menu_item.put("Unknown Dish", new DescItems(3.25)); </code></pre> <p>The DataStructure class has a LinkedHashMap implementation such that</p> <pre><code>LinkedHashMap&lt;String, DescItems&gt; menu_item = new LinkedHashMap&lt;String, DescItems&gt;(); </code></pre> <p>And finally the DescItems class is</p> <pre><code>public final String itemDescription; public final double itemPrice; public final double itemRating; public DescItems(String itemDescription, double itemPrice, double itemRating){ this.itemDescription = itemDescription; this.itemPrice = itemPrice; this.itemRating = itemRating; } </code></pre> <p>There are other constructors to account for no itemDescription and/or itemRating</p> <p>I'm trying to apply a method to check to see if a value has itemRating other than 0 (0 indicating no rating)</p> <p>But specifically I came across this problem:</p> <pre><code>DescItems getC1 = (DescItems)ds.menu_item.get("Pizza"); System.out.println(getC1.toString()); </code></pre> <p>Only prints out reference information like DescItems@142D091</p> <p>What should I do to get a specific object variable instead of referencing the object?</p>
java android
[1, 4]
4,290,724
4,290,725
jquery date input plugin
<p>I would like to know if there is a date input plugin for jquery that work like this <a href="http://www.jqwidgets.com/jquery-widgets-demo/" rel="nofollow">plugin</a> epecifically the datetimeinput. This input check that the values are correct and only let the user to input the numbers not the <code>/</code> characters for the date.</p> <p>I know that there are some mask inputs plugins out there but I would like one that validates and only lets the user to input correct date.</p> <p>Regards</p>
javascript jquery
[3, 5]
1,378,692
1,378,693
how to zooming in when moving cursor to an image in asp.net 3.5
<p>I have a set of image buttons in an asp.net page. When I move the cursor to any part of the image the image should be zoomed in and when the cursor leaves the image it should zoomed out. I am new to asp.net 3.5 so I ask for a hint/ what to search for, too.</p>
c# asp.net
[0, 9]
2,651,374
2,651,375
Export to pdf AND generate a pdf file in asp.net
<p>I have to create PDF files in 2 ways:</p> <ul> <li><p>The first way is just to convert the html to PDF. It can be done in server-side or client-side (javascript?). In this case, I'd like to convert the html with all css styles. This is just to user save the page.</p></li> <li><p>The second ways is generate a PDF report file. I'm thinking if its better to generate it using a background desktop application and send the url later, or just do in client-side. This is for big reports.</p></li> </ul> <p>I've never done this before. What do you recommend me to do?</p>
c# asp.net
[0, 9]
1,864,793
1,864,794
jQuery click(function() not working but plain Javascript working just fine
<p>THIS IS THE FULL SCRIPT</p> <p><a href="http://goo.gl/HoCxk" rel="nofollow">http://goo.gl/HoCxk</a></p> <p>I have a problem with this function:</p> <pre><code> $('.message').click(function(){ alert("it works"); var clicked_msg=$(this); $('#current_message').html(clicked_msg.attr("id")); }); </code></pre> <p>If instead of the above I add an onclick="msgClicked()", and then do something like this:</p> <pre><code>function msgClicked(){ var x=document.getElementById("current_message");alert("it works");x.innerHTML("test");} </code></pre> <p>The jQuery library is obviously imported as literally everything else is done using the jQuery framework and all the other functions implemented on the messaging system are jQuery. Everything works perfect there but for some reason I can't figure out what is wrong with this one.</p> <p>If any of you are willing to help out and you need to see what is actually going on, please let me know and I will create an account for you on my website. Removing all the protection from the content would take a looong long time.</p>
javascript jquery
[3, 5]
5,989,145
5,989,146
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]
5,738,623
5,738,624
ASP.Net: Users are logged out when deploying a new file to the server
<p>Everytime I upload a file to my ASP.NET site, all users are logged out (aka, I guess their session become invalidated). </p> <p>Is there any way to "hotswap" the code in ASP.NET so that this doesn't happen? Compile before deploying etc. </p> <p>My deployment method is pretty simple through a SVN update. </p> <p>Thanks! /Niels</p>
c# asp.net
[0, 9]
5,914,424
5,914,425
Is it possible to redirect a domain that's referenced in code before it gets there?
<p>In code, we're referencing "athirdpartydomain.com"</p> <pre><code>Page.Response.Redirect("www.athirdpartydomain.com"); </code></pre> <p>However, the owners of "athirdpartydomain.com" have decided to change their domain. This will involved a fairly considerable amount of work for us eventually, and they're letting the domain go completely.</p> <p>We will of course change it in time, but I'm wondering if there's a quicker way to do this. Like changing something on the server to make sure all requests to "athirdpartydomain.com" all go to "theirnewdomain.com"</p>
c# asp.net
[0, 9]
4,140,308
4,140,309
Delay till ajax response like thread.sleep()
<p>I have button which post values of form to url but during post i want to capture that value into my database too. So on button click i made new thread of ajax and paused by while loop so user can not redirect due to post of form. </p> <p><strong>But problem is program not responding in while loop and not posting ajax call.</strong> </p> <pre><code>function btnSubmitId_Onclick() { window.setTimeout(function () { var FirstName = $(txtFirstNameId).val() var Email = $(txtEmailId).val() AJAXPost( //Url "Signup" , //Data {Ip: Ip, CustomerKey: CustomerKey, FirstName: FirstName, Email: Email } , //Success function (data) { response2 = true; } , //error function (xhr, textStatus, errorThrown) { } ); }, 0); var date = new Date(); var curDate = null; do { curDate = new Date(); } while (response2 == false) } var response2 = false; </code></pre>
javascript jquery
[3, 5]
1,862,144
1,862,145
JQuery: Update hover on mouse movement
<pre><code>$(document).ready(function() { $(".hoverimage").hover( function(e) { openQuicktip(this,e); }, function() { closeQuicktip(this); } ); $("area").hover( function(e) { openQuicktip(this,e); }, function() { closeQuicktip(this); } ); }); function openQuicktip(elem,e) { ar x = e.pageX; ar y = e.pageY; $('.helpbox').fadeIn('fast'); $('.helpbox').css('top', y).css('left', x); $('.helpbox .desc').html($(elem).attr('alt')); } function closeQuicktip($elem) { $('.helpbox').fadeOut('fast'); } </code></pre> <p>This is my jQuery, how do I make it "change" the coords each time i move the mouse?</p>
javascript jquery
[3, 5]
1,660,606
1,660,607
How do I chain multiple selectors with filters in jQuery?
<p>I'm trying to select multiple elements which do not have the attribute 'disabled' but I'm not sure if there's an easier way to type this:</p> <pre><code>$('input:not(:disabled), select:not(:disabled), textarea:not(:disabled)') </code></pre> <p>It seems a little wasteful to be typing multiple 'not(:disabled)'.</p>
javascript jquery
[3, 5]
2,410,750
2,410,751
How to remove all inner div's based on class
<p>In below markup i want to remove all div's with class as "select"</p> <pre><code>&lt;ul class="container"&gt; &lt;li&gt;10&lt;/li&gt; &lt;li&gt;10&lt;/li&gt; &lt;li&gt;10&lt;div class="select"&gt;&lt;/div&gt;&lt;/li&gt; &lt;li&gt;10&lt;/li&gt; &lt;li&gt;10&lt;div class="select"&gt;&lt;/div&gt;&lt;/li&gt; &lt;li&gt;10&lt;/li&gt; &lt;/ul&gt; </code></pre>
javascript jquery
[3, 5]
1,615,857
1,615,858
Convert String to Integer/Float/Double
<p>I am trying to convert a string to <code>Integer/Float/Double</code> but I got a <code>NumberFormatException</code>.</p> <p>My String is <code>37,78584</code>, Now I am converting this to any of them I got <code>NumberFormatException</code>.</p> <p>How can I convert this <code>string</code> to any of them.</p> <p>Please help me to get out of this problem.</p>
java android
[1, 4]
2,149,556
2,149,557
Access form element through javascript - what's the correct way?
<p>I am developing an asp.net application and i want to make it compatible with all 3 major browsers (Internet Explorer, Firefox, Chrome) at least.</p> <p>In some pages i need to access the form elements through javascript. What is the correct way to do this so that it works on all browsers? </p> <p>I have been doing something like this </p> <pre><code>document.forms[0].elements["nroErros"].value </code></pre> <p>to access my "nroErros" hidden field for instance and even though this works on IE, it doesn't seem to work correctly on Firefox. </p> <p>So, the question is, what is the correct way to make it work always?</p>
javascript asp.net
[3, 9]
2,565,878
2,565,879
Find element ID by its style
<p>I need to find an <code>a</code>-tag's <code>ID</code> by its style.</p> <p>My element have the class <code>.sort</code>.</p> <p>The element's style is programmatically added earlier in one of two get functions, and I have to find it in a third get function. </p>
javascript jquery
[3, 5]
766,243
766,244
loading default values of combobox?
<p>i am trying to develop a website in php and i am dynamically loading a page in using its id with the help of js and that loaded page has a combo box and i want as the page load in the first option of combo box should be displayed in text box on same page. i tried onload option but it is not working as page is not dynamically loading instead its output is loading by js in <code>&lt;div&gt;</code>.</p>
php javascript
[2, 3]
2,464,629
2,464,630
Javascript - How do i stop the execution
<p>Here is my link with embedded js</p> <pre><code>&lt;a style="padding: 5px;" onclick="confirm_message(); $('contact_693_').show(); $('errors_693_').hide(); this.hide(); $('dont_693_').show();; return false;" id="the_link_693_" href="#" class="add_someone_else"&gt;Check it out&lt;/a&gt; </code></pre> <p>And here is my function </p> <pre><code>function confirm_message(){ var response = confirm("Are you sure?"); if(response){ return false; }else{ return false; } } </code></pre> <p>Basically I dont want any of the other js to fire if the user clicks no in the confirm....but all the other javascript</p> <pre><code> $('contact_693_').show(); $('errors_693_').hide(); this.hide(); $('dont_693_').show();; return false;" </code></pre> <p>still fires whether the user clicks yes or no in the confirm...any ideas on how to fix this....</p> <p>Also this embedded js was not created by me and is built on the page with ruby...</p>
javascript jquery
[3, 5]
250,389
250,390
Div auto adjust according to screen resolution
<p>i have design similar to below given link. when i open this link and minimize or maximize the browser then it div box adjust their position accordingly. i am finding the same kind of jQuery or JavaScript. I tried to download it but it is not working in IE 7 and i also want to know name of this kind of jQuery</p> <pre><code>http://berndkammerer.com/ </code></pre>
javascript jquery
[3, 5]
1,342,561
1,342,562
How to move the rows of the table in java script based on the data
<p>I am new to javascript/jquery. I apologize if my question is very basic. I have a table in java script with headers like</p> <pre><code>Element price gain xyz 10 20 abc 29 10 </code></pre> <p>the value of the gain is coming from the back and it is keep on changing the value. Now my question is when ever the value changes then the table should automatically sorted. The rows of the table should move automatically Lets say in the above example the gain for the abc is "30" which came from the back end then the table should change automatically .The table should look like this now</p> <pre><code>Element price gain abc 29 30 xyz 10 20 </code></pre> <p>So here the rows shuffled based on the data. How can we achieve this thing in javascript /jquery</p> <p>I would really appreciate if some one can give any ides how to do.</p> <p>Thanks, Swati</p>
javascript jquery
[3, 5]
1,733,316
1,733,317
JavaScript form validation not working
<p>I have a very simple form with a very simple JavaScript validator. </p> <p>I want an alert to popup if the first nae isnt filled out only it doesnt seem to be alerting and still submits. </p> <p>I've uploaded a fiddle here <a href="http://jsfiddle.net/nvgMq/" rel="nofollow">http://jsfiddle.net/nvgMq/</a> </p>
javascript asp.net
[3, 9]
4,077,661
4,077,662
playin sound inside CountdownTimer doesnt stop
<p>i have this code for downtime counter :</p> <pre><code>CountDownTimer CountdownTimer = new CountDownTimer(30000, 1000) { public void onTick(long millisUntilFinished) { txttime.setText( millisUntilFinished / 1000); play_sound(); } public void onFinish(){ timeout_stage(); //call an activity } }.start(); </code></pre> <p>my problem is that when i call <code>CountdownTimer.cancel();</code> this two lines should stop:</p> <pre><code>txttime.setText( millisUntilFinished / 1000); play_sound(); </code></pre> <p>but now, setting text to txttime stops but playing sound not! why?</p> <p>this is my play_sound();</p> <pre><code> public void play_sound(){ MediaPlayer mp; mp = MediaPlayer.create(MainActivity.this, R.raw.success); mp.setOnCompletionListener(new OnCompletionListener() { public void onCompletion(MediaPlayer mp) { mp.release(); } }); mp.start(); } </code></pre>
java android
[1, 4]
5,246,917
5,246,918
php java bridge error in Java.inc: Cannot redeclare java_last_exception_get()
<p>5.2, Tomcat 5.5, jdk 1.5. php was working fine, I installed JavaBridge.war. And now, when I use "require_once(JavaBridge/java/Java.inc)" I am getting error like </p> <p>Fatal error: Cannot redeclare java_last_exception_get() in C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\JavaBridge\java\Java.inc on line 1584.</p> <p>Can anyone tell me how to resolve this? my php project folder is in "webapps/phptest/", Javabridge is on "Webapps/JavaBridge"</p>
java php
[1, 2]
3,522,590
3,522,591
Showing one text box value in another text box while user type the value to the text box
<p>Is there a way to get the value from one text box and add it to another using jQuery dynamically when user is typing the value to the text box? can someone please explain the method if there is any such thing?</p> <p>regrds, Rangana</p>
javascript jquery
[3, 5]
5,581,700
5,581,701
Get `this` from outside a function
<p>How, or is it even possible, to get the <code>this</code> value from a function? I've made this snippet which saves <code>defaultValue</code> on the function, but I would like to read this from outside the function, directly on the <code>dom</code> element. Is that possible??</p> <p><strong>I've made this, in jQuery:</strong></p> <pre><code>$("input").val(function() { var $label = $("label[for='" + $(this).attr("id") + "']"); this.defaultValue = $label.text(); $label.hide() return this.defaultValue }).click(function() { if ($(this).val() == this.defaultValue) { $(this).val(""); } }).bind("blur", function() { if ($(this).val() == "") { $(this).val(this.defaultValue); } }); </code></pre> <p>See it in action here: <a href="http://jsfiddle.net/ZUZ3L/g6dMA/" rel="nofollow">http://jsfiddle.net/ZUZ3L/g6dMA/</a></p>
javascript jquery
[3, 5]
629,540
629,541
jQuery UI Button on checkbox will not work if quickly clicked multiple times
<p>I have a page setup with some checkboxes, that UI.button applied to them. They each have a onclick event, that calls a function that will display a tab (if checked) or remove a tab (if unchecked).</p> <p>The problem is, if you click them quickly, you can end up with a tab displaying, and the checkbox showing as unchecked, or vice-versa.</p> <p>I've tried removing the onclick event, making it a dblclick event as well, and also disabling the checkbox via attr() and .button('option', 'disabled', true) with no luck in it solving the issue.</p> <p>My relevant code is below:</p> <p>PHP that creates the checkboxes:</p> <pre><code>$output .= '&lt;input onclick="toggleTab(\'' . $group['_id'] . '\', this);" type="checkbox" name="groups" value="'.$group['_id'].'" id="groups_'.$group['_id'].'" /&gt;&lt;label id="l_'.$group['_id'].'" for="groups_'.$group['_id'].'"&gt;'.$group['name'].'&lt;/label&gt;'; </code></pre> <p>javascript function called on click:</p> <pre><code>function toggleTab (id, elem) { if ($(elem).is(':checked')) { $('#tab_' + id ).show(); } else { var currentTab = $('#tabPricing .ui-tabs-panel:not(.ui-tabs-hide)'); tab = currentTab.prop("id"); if (tab == 'tab' + id) { $('#tabPricing .innerTabs').tabs('select', 'tabDefault'); } $('#tab_' + id ).hide(); } </code></pre> <p>}</p> <p>I know it's likely a JavaScript problem in general, I just can't seem to find a good way around it.</p>
php javascript jquery
[2, 3, 5]
1,459,685
1,459,686
how to get to page1 when i refresh my gridview?
<p>i have gridview in my webform.</p> <p>in my search i got to page 4 for example, now i need to refresh the gridview</p> <p>and go to page 1.</p> <p>how to to it ?</p> <p>thanks in advance</p>
c# asp.net
[0, 9]
5,101,783
5,101,784
Sorttable ul li get order
<p>My html is like this</p> <pre><code>&lt;ul&gt; &lt;li&gt;...&lt;/li&gt; &lt;li&gt; &lt;ul&gt; &lt;li&gt;...&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>This is just a example, a <code>ul</code> can contain many <code>li</code> but the max depth is <code>ul li ul</code> like in example</p> <p>I am using <a href="http://jqueryui.com/demos/sortable/" rel="nofollow">JqueryUI Sortable</a> to sort this <code>li</code> I want to get the sort order of the <code>li</code> to store it in database so that user dont have to sort each time.</p> <p>Thank You.</p>
javascript jquery
[3, 5]
4,862,719
4,862,720
how to attach/extend methods to dom element
<p>Having this html:</p> <pre><code>&lt;div id='hi1'&gt; aaa &lt;/div&gt; </code></pre> <p>When doing:</p> <pre><code>$('#hi1').sayHi(); </code></pre> <p>I would like to get an alert saying 'hi'</p> <p>anybody knows how this is done ?</p>
javascript jquery
[3, 5]
4,953,117
4,953,118
Close button to Facebox Jquery box closes master page, not popup
<p>I am using the Facebox jquery box to load a little form with a Submit Button and a Cancel Button.</p> <p>When I click Submit it closes the Main page that loaded the Facebox window instead of the Facebox window! It leaves the AddNote.aspx site open (which is loaded by Facebox) and closes my Main.aspx. </p> <p>Here is my code behind in AddNote.aspx (Which is rendered by the Facebox popup on Main.aspx):</p> <pre><code> protected void SubmitButtom_Click(object sender, EventArgs e) { string note = NotesTextBox.Text; //will need to add current user using (cmd = new SqlCommand("INSERT INTO notes (FID, note_date, note_text) VALUES (@FID, @note_date, @note_text)", con)) { con.Open(); cmd.Parameters.Add(new SqlParameter("FID", FID)); cmd.Parameters.Add(new SqlParameter("note_date", DateTime.Now.ToString())); cmd.Parameters.Add(new SqlParameter("note_text", note)); cmd.ExecuteNonQuery(); con.Close(); Page.ClientScript.RegisterOnSubmitStatement(typeof(Page), "closeModal", "$.facebox.close();"); //WHY DOES THIS CLOSE MAIN.ASPX INSTEAD OF FACEBOX WINDOW? } } </code></pre>
c# javascript jquery asp.net
[0, 3, 5, 9]
3,150,970
3,150,971
loading div on submit button to prevent double submit
<p>Background : my code uses master page which has frames inside and all the other navigation happens using frame and master page is used for menu purpose. On submit button click (on all screen) , want to disable page for any further user interference. For that master page has a div and on individual page following code is written</p> <pre><code>var loading = window.parent.document.getElementById('dvLoading'); $(loading).show(); </code></pre> <p>Problem: i have one frame which has couple ajax tab, on clicking on individual tab , i would like to call same div to prevent user interference while tab navigation. for which following code is written</p> <pre><code>$(".ajax__tab_inner").click(function() { var loading = window.parent.document.getElementById('dvLoading'); $(loading).show(); }); </code></pre> <p>This works fine untill user clicks on currently active tab, which does not remove the loading div and it remains loaded/hanging state. </p> <p>kindly suggest how to prevent div loading for active tab or any other way.</p>
jquery asp.net
[5, 9]
3,341,035
3,341,036
Find the coordinates of square at client side
<p>I have an image on my page which I can fetch via $('#myimage'); Now I want to find the coordinates of square which I will draw on image. These end points of square should be exactly such that radius of square should be 20px(the center of the square will be center of image). How can I get do the same with JavaScript or jQuery.</p>
javascript jquery asp.net
[3, 5, 9]
6,030,686
6,030,687
.click function in jquery always have to get a nameless function?
<p>Hallo all. I have a little problem.</p> <p>I have a function. Let’s call it :</p> <pre><code>function rowClick () { } </code></pre> <p>Anyway, the question is:</p> <p>How can I bind this function to a click event without it being called?</p> <p>What I mean is, if I do this:</p> <pre><code>$("#holder").click (function(){ rowClick(); }); </code></pre> <p>the <code>rowClick</code> function gets called while registering it to the click event.</p> <p>Anyway I understand why this happens. I just don’t understand how I can bind the function to the event in a way that it won’t be called.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
3,208,522
3,208,523
Tags function in jQuery not working even after adding jQuery library
<p>I am trying to add tabs to my website to navigate b/w two sub-menus. Essentially when you click 'Highlight' or 'News' a new set of elements appear in that section.</p> <p>I added the jquery library:</p> <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt; </code></pre> <p>but still when I check the console I get the message "Uncaught TypeError: Object [object Object has no method 'tabs'"is not defined. </p> <p>I added the library:</p> <pre><code>&lt;script src="public/scripts/applicat.js" type="text/javascript"&gt; &lt;/script&gt; </code></pre> <p>but when I check the console for '$("body") and it returns a 'null'. (The uploaded file on the website has this applicat.js file included) </p> <p>I have tried everything but can't seem to figure out how to add the tabs method and also not have a problem with the jQuery linking to my HTML.</p> <p>This is how the tabs function is called (right before the end of body):</p> <pre><code>&lt;script type="text/javascript" charset="utf-8"&gt; jQuery().ready(function() { jQuery("#discussion-sections &gt; nav ul").tabs("#discussion-sections &gt; section"); }); &lt;/script&gt; </code></pre> <p>// Bonus question Do you have any idea how I can expand the length of the tabs header so that the horizontal line goes across the page? I tried adding a border-bottom to the UL where the tabs are defined but in this case it adds a line even to the area underneath the selected tab.</p> <p>Thanks, Luis</p>
javascript jquery
[3, 5]
3,038,901
3,038,902
How to check current tag element in javascript?
<p>I've a GridView with three rows like this</p> <pre><code>&lt;tr&gt; &lt;th&gt;SlNo&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;1&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;2&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>I've the following code to traverse through the rows</p> <pre><code>var GridViewRow=GridView.getElementsByTagName('tr') </code></pre> <p>Here the row length is 3.</p> <p>I travese through the <code>GridViewRow</code> using for loop .Here how will i get the tag name of the current element ie (<code>th or td</code>).</p> <p>If the tagname is "<code>TH</code>" it should return and if it is "<code>TD</code>" it should take the value of TD.</p>
javascript asp.net
[3, 9]
5,838,448
5,838,449
Understanding the Google specification for crawlable ajax
<p>Im using dotnet c#, and jQuery plus webservices for ajax calls. My paginations works like twitter and facebook paginations. In the onload event, a ajax call fill a content area with 10 rows, and a click or a roll the page down event call the same ajax call, with a page parameter, that brings more 10 rows, and so on. I dont have a canonical pagination for non javascript users. I read the Google specification about crawlable ajax, but Im not sure how to convert my model to the google new model. </p> <p>First of all, I use jQuery ajax post, using json format. So its possible to create a aspx page that read a URL like <code>http://www.domain.com/search.aspx?_escaped_fragment_=somevalue</code> and use the _escaped_fragment_ value to return content. But, somehow I have to propagate this page link to the google crawler <code>http://www.domain.com/search.aspx#!somevalue</code>. Is this ok?</p> <p>Ok! But when the Google Crawler access my paginations, the crawler will not see any link to <a href="http://www.domain.com/search.aspx#!1" rel="nofollow">http://www.domain.com/search.aspx#!1</a>, unless I point it in the sitemap, and it makes no sense to me. Im in a big mess. Can someone give me a tip?</p>
c# asp.net
[0, 9]
126,432
126,433
What type of data storage should I use in Android?
<p>I want to download 90+ items from an RSS Feed and I want to display it using a Listview and a custom arrayadapter. What form of data storage should I use to store these deals? I could just pass an array of objects filled with strings and ints(the strings are long btw) but I don't know whether this is a proper design pattern in Android. </p>
java android
[1, 4]
2,809,840
2,809,841
Hide jQuery message div on page load (on asp.net 4.0 page)
<p>jQuery noob here: </p> <p>I have the following message div that shows a message on button click and fades after several seconds. This works fine. However, I would like the message div to hide on page load and display on button click. </p> <p>So far, I've tried adding the hideDiv class to the message div, but then messageDiv doesn't display at all (on load or on button click). I've also tried hiding/showing a parent wrapping Div (not shown here).</p> <p>Suggestions? </p> <pre><code>&lt;div id="messageDiv" runat="server" class="alert"&gt;Row Deleted&lt;/div&gt; </code></pre> <p>.</p> <pre><code>&lt;style type="text/css"&gt; .alert{display:block;width:100%;color:#900000;font-size: 1.4em;} .hideDiv{display:none;} &lt;/style&gt; </code></pre> <p>.</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $(document.getElementById('&lt;%= messageDiv.ClientID %&gt;')).addClass("alert"); setTimeout(function () { $(document.getElementById('&lt;%= messageDiv.ClientID %&gt;')).fadeOut("slow", function () { $(document.getElementById('&lt;%= messageDiv.ClientID %&gt;')).remove(); }); }, 4000); }); &lt;/script&gt; </code></pre> <p>.</p> <pre><code>&lt;asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /&gt; protected void Button1_Click(object sender, EventArgs e) {messageDiv.InnerText = "Row Action Completed";} </code></pre>
jquery asp.net
[5, 9]
3,467,415
3,467,416
Javascript widget inspired by iPhone UITableView?
<p>Cocoa Touch's UITableView allows a user to scroll through large numbers of data rows with good performance because it recycles table rows. Rather than create a GUI element for every single data row, a limited number of table rows is created, and simply updated with the relevant data as the user scrolls, giving the illusion of navigating up and down a very large number of table rows.</p> <p>Has anyone seen this done in javascript? Is there a plugin available anywhere that will do this for me?</p>
javascript iphone
[3, 8]
1,356,895
1,356,896
How to follow jQuery animated div across screen?
<p>I'm using <a href="https://github.com/MmmCurry/jquery.crSpline">jQuery.crSpline</a> to animate a graphic along a curved path. I'm pretty happy with the result.</p> <p>However, the full canvas size is intentionally pretty wide - definitely larger than most screens - so the graphic will run out of viewport space pretty quickly and animate off the screen.</p> <p>Instead, I'd like browser viewport to follow or centre on the image so that it stays 'in shot'.</p> <p>How would I go about this with jQuery? Is scrollTop an option?</p> <p>I've created a <a href="http://jsfiddle.net/gNdwD/">jsFiddle demo,</a> based on the <a href="http://ijin.net/crSpline/demo.html">crSpline demo source</a>, but with a wide minX setting.</p> <hr> <p><strong>NB</strong>: I did first attempt this with YUI3 and <a href="http://stackoverflow.com/users/322395/loktar">Loktar</a> offered a canvas based <a href="http://stackoverflow.com/questions/12392455/">solution</a>, however I'm not using YUI &amp; canvas any longer.</p>
javascript jquery
[3, 5]
4,833,429
4,833,430
Detecting input from bar code reader(and rfid) from javascript
<p>I have a bar code reader and RFID reader that act as a HID device and I got output from them as keyboard output, and after the data is red, enter key is pressed. Is there any way to efferent reading of this data so that it would be written in some specific input field? I was thinking about detecting the speed of reading... How can this be implemented in javascript, or jquery? thank you Dorijan </p>
javascript jquery
[3, 5]
4,144,225
4,144,226
Write quotation mark in aspx merged code
<p>Why this code doesn't work?</p> <pre><code>OnClientClick='&lt;%# String.Format("return confirm('¿Está seguro que desea eliminar el registro {0}?);'", Eval("data")) %&gt;' </code></pre> <p>The error is: </p> <blockquote> <p>The server tag is not well formed.</p> </blockquote> <p>How can I write this to make it work?</p>
c# asp.net
[0, 9]
245,031
245,032
How to implement internet radio using java
<p>How to implement internet radio using java? Is there any Java APIs for this?</p> <p>I want to make a internet radio using Android / java. But I am not getting any APIs how to connect or how to receive the channel information for streaming the audio.</p> <p>Please help me how to create that same and provide some code/API for that.</p>
java android
[1, 4]
2,360,948
2,360,949
Remove all characters from string javascript
<pre><code>$('.hourfield').focusout(function() { var h; var m; var timeStr = ""; var time = ""; var newFormat = ""; timeStr = $(this).val(); //Here I would like to remove all characters which isn't numbers timeStr = timeStr.replace("/[^0-9\.]+/g",""); if(timeStr &gt; 0) { h = timeStr.substr(0,2); m = timeStr.substr(2,2); newFormat = h+':'+m; //Add new values $(this).val(newFormat); } }); </code></pre> <p><a href="https://dl.dropbox.com/u/20082618/kalendarium-2/index.html" rel="nofollow">URL to website</a></p>
javascript jquery
[3, 5]
4,933,133
4,933,134
How to call c# server side method through javascript
<p>I need to call a c# server method through the javascript. I have a gridview in which i have a column with dropdown list. When i change the dropdown's value i need to call a server side method through javascript and change the value of another text box in the gridview.</p> <p>I am able to do this on the selected index change. but i am slightly worried about the performance. </p> <p>i am using asp.net c#.</p> <p>Please let me know how to do this.</p>
asp.net javascript
[9, 3]
51,576
51,577
check image has been loaded using jquery
<p>Problem- At run time I am changing/replacing src attribute of some images using jquery. These images are by default hidden. I want to display these images when these images are download and ready to display because it is also possible that some images can not be downloaded. </p> <pre><code> &lt;img id="pic_1" width="153" height="160" border="0" onmouseout="this.style.border='2px solid #FFFFFF';" onmouseover="this.style.border='2px solid #4585E7';" style="visibility: hidden;" src="**to be replaced at run time**""&gt; </code></pre> <p>Please let me know any solution how can i achieve this. </p>
javascript jquery
[3, 5]
145,694
145,695
jquery (js) string replace problem
<p>i want to highlight all digits in string, i try to cover matched digits with tag but cann't! Here is my code</p> <pre><code>regexp = /[1-9]/g; //$("#task").val() it's my input title = $("#task").val().replace(regexp,'&lt;span class="int"&gt;$1&lt;/span&gt;'); </code></pre> <p><strong>$1</strong> - i found in google some samples, where $1 must be first matched value, but it's dosn't work!</p>
javascript jquery
[3, 5]
5,921,942
5,921,943
random selection from array
<p>I have this block of code below which is to control questions which are to be displayed from the array. I am having problem with the the 3rd line of code, an i am not entirely sure what the problem is.</p> <p>rnd1, rnd2 are both double. Eclipse is telling me that rnd2 should be an int. however i was advised that the rnd's should be double for the ceiling function to work. ques is a text field. questions is the array.</p> <pre><code> rnd1 = Math.ceil(Math.random()*3); rnd2 = Math.ceil(Math.random()*questions.length)-1; ques.setText(questions[rnd2]); </code></pre> <hr> <p>Im basing this on action script which i used for a quiz application. It is used to pick out the question from the question array randomly.</p> <pre><code>rnd1=Math.ceil(Math.random()*3); rnd2=Math.ceil(Math.random()*questions.length)-1; q.text=questions[rnd2]; if(questions[rnd2]=="x") { change_question(); } questions[rnd2]="x"; enable_disable(1); </code></pre>
java android
[1, 4]