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,096,927
2,096,928
Creating methods and updating strings
<p>I am relatively new to Android development but I do have a pretty good understanding of Java and xml etc. so excuse me if this is an easy question and I just can't put two and two together.</p> <p>Anyway, I am trying to have a user input a few characters into an EditText field. When they press a Button, it will call a method that will output a String. I then want this String to be displayed on the same activity as the EditText field and Button.</p> <p><strong>How do I go about taking the String variable that is the result of the method and putting into a String in the strings.xml file?</strong></p>
java android
[1, 4]
981,423
981,424
Find and remove text in div
<p>I have a rss-feed where every post ends with a link wrapped in a paragraph. I want it deleted.</p> <p>Example: </p> <pre><code>&lt;p&gt;I want to keep this&lt;/p&gt; &lt;p&gt;I want to &lt;strong&gt;find&lt;/strong&gt; and &lt;a href="#"&gt;remove&lt;/a&gt; this string&lt;/p&gt; </code></pre>
php javascript jquery
[2, 3, 5]
2,017,756
2,017,757
JQuery - Select menu - OnChange Reevaluate Value
<p>I have a select menu with a list of country names. I'm using jquery to get the value of the currently selected option. I'm appending this to the url of the remote source file that I am using to populate the autocomplete field. </p> <p>I need to update the value of the select menu within the function onchange of the country select menu. Currently it uses the value of the select menu when the page is first loaded. </p> <p>I'm trying to have it reevaluate the value onchange as to alter the results of the mysql query I am trying to run on the remote page.</p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { $('#from_country').val(""); $("#city").autocomplete({ source: "json-list.php?country=" + $( "#from_country" ).val(), minLength: 3, select: function(event, ui) { $('#from_zip').val(ui.item.postal_code); } }); }); &lt;/script&gt; &lt;select name="from_country" id="from_country" &gt; &lt;option value='US'&gt;United States&lt;/option&gt; &lt;option value='AU'&gt;Australia&lt;/option&gt; &lt;/select&gt; </code></pre>
javascript jquery
[3, 5]
4,100,637
4,100,638
Trigger function on $(window).resize and $("#foo").scroll
<p>Would like to trigger the same function on $(window).resize and on $("#foo").scroll.</p> <p><a href="http://jsfiddle.net/ySukf/1/" rel="nofollow">http://jsfiddle.net/ySukf/1/</a></p> <p>Need <code>#stick</code> to stick to the top of <code>#foo</code>. The problem is that the position of <code>#stick</code> gets a bit jumpy when scrolling and when resizing the window. Any help?</p>
javascript jquery
[3, 5]
5,958,889
5,958,890
Change label across pages
<p>I'm working on an application that connects to a serial port. I have experience in C#, but not so much in asp.net.</p> <p>I have a Label on an aspx page which displays the status of the connection. When I click a button, a new page opens which let's you select the serial port you want to use. When you press the OK button on that page, it will send you back to the original page with the label.</p> <p>Initially, the label says: "Status: Not connected". I'm saving this string in a globaldata class so I can access the string. I want that when you click the OK button on the new page, it will change the label to "Status: Connected", so when the original page loads the label will be changed.</p> <p>So in the OK button I added <code>onclick="butOK_Click"</code> and then in the event I change the string in the globaldata class. However, I don't know how to get back to the page. Adding a <code>PostBackUrl="Home/Index"</code> (where Home/Index is the begin page with the label) does return to the begin page, but doesn't execute the code that changes the string.</p> <p>How can I achieve what I want?</p> <p>EDIT: now that I think about it, I only want to change the label after executing a function that actually connects to the serial port. I already have this function, it just needs to let the page know that it is connected.</p>
c# asp.net
[0, 9]
2,944,637
2,944,638
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]
3,446,985
3,446,986
Jquery chat how track user session
<p>We have implemented a Jquery chat in our company for internal communications.it is working fine. We are saving user status on data base, when a user logged in save his status on DB, when he logged out change status as log out.</p> <p>Issue is that if any user does not click the logged out button and close the window or shut down his PC, he still logged in our chat system.How we can track a each user is logged in, tracking user session is possible?</p> <p>Help is highly appreciated, Thanks, VKS</p>
php jquery
[2, 5]
3,978,613
3,978,614
How to set an interval, but then stop it after 20 minutes
<p>Currently on my webpage I have a timer that runs a function every 30 seconds:</p> <pre><code>setInterval("someFunction(userId)", 30000); </code></pre> <p>This works fine, but the problem is if 100's of users leave their browser open (say when they go for lunch), it will poll our system and increase the load on our servers for no reason.</p> <p>How can I stop this timer from running after say 20 minutes?</p>
javascript jquery
[3, 5]
3,844,166
3,844,167
Local Storage using Javascript / Jquery (Without using HTML5)
<p>I want to replicate Local Storage concept (similar to HTML5) in javascript or jquery.</p> <p>But unfortunately I don't have idea, how to start this.</p> <p>Can any one suggest how to implement local storage using javascript or jquery (Without using HTML5)?</p>
javascript jquery
[3, 5]
5,804,420
5,804,421
Adding and Removing Multiple Classes
<p>I want to add/remove three css classes plus a default classes. Example: When I click on the first anchor it adds a new class called style1 and removes the default style, when I click on the second anchor it removes style1 and adds style2, and the same for anchor3.</p> <p>The problem is if I start by clicking on anchor3, nothing happens, I cannot reverse the action.</p> <p>How can I make this work so that the add/remove classes works regardless of which link I click first? I need to use the three styles but also need a default style.</p> <p>Here is the code on JFiddle: <a href="http://jsfiddle.net/VadUE/2/" rel="nofollow">http://jsfiddle.net/VadUE/2/</a></p> <p>It works in the browser but not on JFiddle.</p> <p>Code:</p> <pre><code>$(document).ready(function() { $('.anchor1').click(function() { $('p').addClass('style1').removeClass('default'); $('.anchor2').click(function() { $('p').addClass('style2').removeClass('style1'); $('.anchor3').click(function() { $('p').addClass('style3').removeClass('style2'); }); }); }); }); &lt;style type="text/css"&gt; .style1{ color: #FF8000; } .style2{ color: #F36; } .style3{ color: #00F; } .default{ color: #0C0; } &lt;/style&gt; &lt;a class="anchor1" href="#/"&gt;Link1&lt;/a&gt; &lt;a class="anchor2" href="#/"&gt;Link2&lt;/a&gt; &lt;a class="anchor3" href="#/"&gt;Link3&lt;/a&gt; &lt;p class="default"&gt;This is a sequence into a sound&lt;/p&gt; </code></pre>
javascript jquery
[3, 5]
1,808,568
1,808,569
Hyperlink a column in gridview
<p>I'm using boundfield to display columns:</p> <pre><code>&lt;Columns&gt; &lt;asp:BoundField DataField=”AccountCode” HeaderText=”Account Code”&gt; &lt;ItemStyle Font-Size=”Large” /&gt; &lt;/asp:BoundField&gt; &lt;asp:BoundField DataField=”AccountName” HeaderText=”Account Name” FooterText=”Enter Footer Text”&gt; &lt;FooterStyle CssClass=”FooterStyle” /&gt; &lt;/asp:BoundField &gt; &lt;asp:BoundField DataField=”Type” HeaderText=”Account Type” /&gt; </code></pre> <p></p> <p>I have 4 types of accounts (a, b, c , or d). I would like to hyperlink the account type column based on the 4 different account types. Basically, I would like to link to one of the 4 different webpages depending on which type of account was selected. I'm using C# in Visual Studio 2010. Any help would be greatly appreciated.</p>
c# asp.net
[0, 9]
5,677,344
5,677,345
ASP.NET Session Problem
<p>1st Query...... I have a session variable cityId through which i find all the record. When i leave my application unattended for sometime then session expires &amp; it does get the value for city &amp; then throws exception. How I can redirect to a error page when session expires like this.</p> <p>2nd Query</p> <p>When I click some page(myprofile.aspx), then i checks if the user is loged in or not, if user is not loged in then redirect to the login page &amp; if loged in then show the page If I give the user login if user not logined to view the myprofile.aspx then when the use logs in the it should directly go the myprofile.aspx page rather than whatever i provided after login.</p> <p>Help Me Out.</p>
c# asp.net
[0, 9]
2,054,351
2,054,352
How to check if an item exists in more than one listbox? ASP.NET/C#
<p>I have three sets of listboxes, I move items from lb1 to lb2, from lb3 to lb4 and from lb5 to lb6. The listboxes on the left contains the same items and I don't want the user to be able to submit the page if one or more items from the left listboxes is added to more than one listbox to the right. For example, item A in lb1, lb3 and lb5 can only be saved in either lb2, lb4 or lb6, not in two or three of them.</p> <p>I want to perform this check before submitting the page (and later on I will add validation with javascript) and I wonder what is the most efficient way to do this. </p> <p>Add all items to a list and check if there are any duplicates?</p> <p>Thanks in advance.</p> <p>Edit: something like this:</p> <pre><code> List&lt;string&gt; groupList = new List&lt;string&gt;(); foreach (ListItem item in lbFullAccess.Items) { groupList.Add(item.Value.ToString()); } foreach (ListItem item in lbContributor.Items) { groupList.Add(item.Value.ToString()); } foreach (ListItem item in lblReadOnly.Items) { groupList.Add(item.Value.ToString()); } </code></pre>
c# javascript asp.net
[0, 3, 9]
5,065,505
5,065,506
Want to pass php variable as argument in javascript function?
<p><br> i want to pass my php variable in one javascript function.<br> i know it seems simple but i don't know where am i missing something?</p> <pre><code> &lt;?php while($gg=mysql_fetch_array($lg)) { ?&gt; &lt;td id="add_td"&gt; &lt;?php $id = $gg['p_id']; echo "&lt;a onclick=cnf('Are you sure you want to delete that?',$id)&gt;"; ?&gt;Delete&lt;/a&gt; &lt;/td&gt; &lt;?php } ?&gt; </code></pre> <p>and in my javascript function</p> <pre><code>function cnf(msg,id) { cnf = confirm(msg); if(cnf) { parent.location.href = 'p_update.php?d=' + id; } } </code></pre> <p>so i need to know on which id that user had clicked so that i will only delete that id from database.<br> if i try this thing then it showing error on "cnf" function and its saying like "unterminated string literal"?<br></p>
php javascript
[2, 3]
4,301,271
4,301,272
Caching asp.net pages
<p>I am bulding an app and I tried YSlow and got Grade F on most of my practices. I have loads of jscript that am working on reducing. I want to be able to cache some of these because the pages get called many times.</p> <p>I have one master age and I wanted to cache the scripts and css files.</p> <p>How do I achieve this? Are there any recommended best practices? Are there any other performance improvements that I can make?</p>
c# asp.net
[0, 9]
873,393
873,394
Disable click if class ="X", jQuery
<p>Im trying to build a tabbed content box, and im wondering if its possible that i can disable 1 link with a specific class, such as 'disabled' </p> <p>I read somewhere about a function called preventDefault, would this work?</p> <p><a href="http://jsfiddle.net/Ssr5W/" rel="nofollow">http://jsfiddle.net/Ssr5W/</a></p>
javascript jquery
[3, 5]
5,128,213
5,128,214
How to get location.href on either secure or non-secure http request
<p>I have the following statement to get the href location of my iframe window...</p> <pre><code>var mbackwindow = document.getElementById("mframe").contentWindow.location.href; </code></pre> <p>depending on how I load the initial page, the console.log(mbackwindow) will show me either <code>http://something/page/stuff.html</code>, or <code>https://something/page/stuff.html</code></p> <p>From my variable <code>mbackwindow,</code> I want to get the "/page/stuff.html", no matter if the location is coming from http or https. How I collect that via javascript / jquery?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
4,925,977
4,925,978
Backwards Compatible Android/Java Code
<p>I'm writing some code that is going to be used by some partners that maintain SDKs. The SDKs are used by developers on Android 1.5 through 2.3.7. My code uses features that are only available on 2.2 and later. How can I write my code so developers using the partner SDKs don't get compile errors on Android &lt; 2.2?</p> <p>I tried using reflection and avoiding imports / declarations that used classes that weren't available before 2.2, but the code didn't work post 2.2 due to failure to dispatch to methods where I had changed the desired class type to Object.</p>
java android
[1, 4]
2,806,339
2,806,340
How do I pass a JSONObject from Android application to a PHP file?
<p>I want to send a simple JSON object to PHP server,but when i try to retrieve that object on the server side,there is nothing i mean my $_POST variable is empty. The server side is PHP 5.2 and I'm using android emulator 10...Could someone have a look on my code and tell me what is going wrong? Thanks a lot</p> <pre>public void uploadJSon() throws ClientProtocolException, IOException, JSONException{ HttpClient httpclient = new DefaultHttpClient(); String url = "http://so-dev-deb.niv2.com/suivi_activite/test.php"; HttpPost httppost = new HttpPost(url); JSONObject json = new JSONObject(); json.put("username", "bob"); json.put("email", "[email protected]"); List nvps = new ArrayList (); nvps.add(new BasicNameValuePair("value", json.toString())); httppost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8)); URL test_url = new URL(url); URLConnection connection = test_url.openConnection(); connection.setDoOutput(true); HttpResponse response; response = httpclient.execute(httppost); Log.i("NVPS",nvps.get(0).toString()); Log.i("JSON",json.toString()); Log.i("response", response.getEntity().getContent().toString()); Log.i("response status",response.getStatusLine().toString()); BufferedReader in = new BufferedReader( new InputStreamReader( connection.getInputStream())); String decodedString; while ((decodedString = in.readLine()) != null) { //System.out.println(decodedString); Log.i("info 10",decodedString); } in.close(); } </pre> <p>The server side test.php is : </p> <pre><code>&lt;?php $tmp = json_decode($_POST['value']); var_dump($tmp); ?&gt; </code></pre>
java php android
[1, 2, 4]
3,153,395
3,153,396
call method in code behind from JQuery
<p>I am trying to execute a method in ASP.NET from Jquery</p> <pre><code>$.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "MyMessages.aspx?id=66&amp;epslanguage=sv/test", data: "{}", dataType: "json", error: function(xhr, err) { alert("readyState: " + xhr.readyState + "\nstatus: " + xhr.status); alert("responseText: " + xhr.responseText); }, success: function() { alert("it works" ); } }) </code></pre> <p>code behind:</p> <pre><code> [WebMethod] protected void test() { test.Text = "works"; } </code></pre> <p>I get errormessage redayState: 4 and status 200 when I do this. I don't understand the problem. I am vey new at this. :)</p>
c# asp.net jquery
[0, 9, 5]
4,116,224
4,116,225
ASP.net user control doesn't call a javascript function
<p>I am developing asp.net web application, I have a repeater that call a registered user control, I have in the user control a button that I want to call a javascript function that make Ajax call to do some action on server. this button doesn't call the javascript method, I don't know why? and when I view source I found the javascript function is repeated for every item in the repeater, how to eliminate this repetition specially that I read server items inside the function, and why the function is not called?</p> <p>Thanks a lot!</p> <pre><code>sercontrol.ascx &lt;div id="divBtnEvent" runat="server"&gt; &lt;input type="button" id="btnAddEvent" class="ok-green" onclick="saveEvent();" /&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; function saveEvent() { var eventText = document.getElementById('&lt;%=txtEventDescription.ClientID%&gt;').value; // make ajax call } </code></pre>
c# javascript asp.net
[0, 3, 9]
5,915,285
5,915,286
Declare a reference that extends a class and implement other
<p>I'm implementing a game and I have some clases like:</p> <pre><code>GameObject (Abstract) CircularGameObject RectangularGameObject </code></pre> <p>They basically store the position (x,y) and the different shapes for checking collisions.</p> <p>Now I want to implement the classes <strong>Wall</strong> (Rectangular) and <strong>Bomb</strong> (Circular). Both can be enabled or disabled so I declare </p> <pre><code> public interface Activable { public void setEnabled(boolean status); public boolean isEnabled(); } </code></pre> <p>And I have one List for storing a reference to the items that kills the player on the collisions (Walls and Bombs). How can I declare an ArrayList of objects that extends GameObject and implements Activable?</p> <p>I tried declaring a class:</p> <pre><code> public class ActivableGameObject extends GameObject implements Activable{}; </code></pre> <p>but the compiler doesn't allow to assign to that reference a Bomb for example (Because is a CircularGameObject)</p>
java android
[1, 4]
473,261
473,262
javascript-php var post get
<p>That code work:</p> <pre><code>startSlideshow(&lt;?php echo json_encode(glob("photos-animaux/*.jpg"))?&gt;); </code></pre> <p>that code dont : </p> <pre><code>$.post("",{'folder':'animaux'}); startSlideshow(&lt;?php echo json_encode(glob("photos-".$_GET["folder"]."/*.jpg"))?&gt;); </code></pre> <p>WHY ?, what i am doing wrong ?, help ! why the stupid php fonction just dont make the string right !! ahhhh!</p> <p>---new infos---- that line work : </p> <pre><code>startSlideshow(&lt;?php echo json_encode(glob("photos-".$_GET["folder"]."/*.jpg")) ?&gt;); </code></pre> <p>because if i MANUALLY enter in the address bar ?folder=animaux...bam! work</p> <p>so the problem shoul be there : $.get("photo-portfolio.php",{folder:"animaux"});</p> <p>still dont know where !</p>
php javascript
[2, 3]
1,096,564
1,096,565
Web for open in new tab with closing button dynamically using jQuery
<pre><code>&lt;script type="text/javascript"&gt; $(function() { var total_tabs = 0; // initialize first tab total_tabs++; addtab(total_tabs); $("#addtab, #litab").click(function() { total_tabs++; $("#tabcontent p").hide(); addtab(total_tabs); return false; }); function addtab(count) { var closetab = '&lt;a href="" id="close'+count+'" class="close"&gt;&amp;times;&lt;/a&gt;'; $("#tabul").append('&lt;li id="t'+count+'" class="ntabs"&gt;Tab '+count+'&amp;nbsp;&amp;nbsp;'+closetab+'&lt;/li&gt;'); $("#tabcontent").append('&lt;p id="c'+count+'"&gt;Tab Content '+count+'&lt;/p&gt;'); $("#tabul li").removeClass("ctab"); $("#t"+count).addClass("ctab"); $("#t"+count).bind("click", function() { $("#tabul li").removeClass("ctab"); $("#t"+count).addClass("ctab"); $("#tabcontent p").hide(); $("#c"+count).fadeIn('slow'); }); $("#close"+count).bind("click", function() { // activate the previous tab $("#tabul li").removeClass("ctab"); $("#tabcontent p").hide(); $(this).parent().prev().addClass("ctab"); $("#c"+count).prev().fadeIn('slow'); $(this).parent().remove(); $("#c"+count).remove(); return false; }); } }); &lt;/script&gt; </code></pre> <blockquote> <p>Web for open in new tab with closing button dynamically using jQuery. Here new tab open but web form not open in new tab. I want that web form open in new tab with closing button using jQuery. Would you suggest what should i do.</p> </blockquote>
c# asp.net
[0, 9]
3,567,982
3,567,983
applying same function to many elements (in order)
<p>any better way to do that (assuming I have 10 <code>a</code> elements, for instance)?</p> <pre><code>$('#id &gt; a:nth-child(1)').click(function() { changeP(1); return false; }); $('#id &gt; a:nth-child(2)').click(function() { changeP(2); return false; }); $('#id &gt; a:nth-child(3)').click(function() { changeP(3); return false; }); </code></pre> <p>I know 2 possibilities, but I don't particularly like them:</p> <ol> <li>using <code>.bind()</code> with parameter instead of <code>.click()</code></li> <li>using <code>.map(return $(this))</code> and then iterating over the array with an index var</li> </ol>
javascript jquery
[3, 5]
5,704,044
5,704,045
How can a servlet receieve a web request and send a response back?
<p>A servlet that is able to receive a web request containing some values and respond with some other values. Eg. It should be able to receive a web request containing a value “HELLO” and respond with “GOOD DAY”.</p>
java android
[1, 4]
1,360,742
1,360,743
How to show credit card number as star (*) while user is inputting the number?
<p>I want to show all the input as stars when the user types in the credit card field except the last four digits which I want to show as numbers. I used jQuery masking but it is not giving me desired result.</p>
javascript jquery
[3, 5]
5,435,246
5,435,247
FileUpload .net control
<p>I want to make various actions on the uploaded file once it is on the server, question is how do I catch the event the upload is done? Currently when I try to access the file I get an error that it does not exists, I assume because the upload has not finished. (I tested the upload seperately and it worked)</p> <p>Thanks!</p> <p>Wes</p>
c# asp.net
[0, 9]
341,392
341,393
MaxLength property for textbox in code behind?
<p>I am trying to use MaxLength function for the textbox in code behind.</p> <p>How is it possible for textbox txttabname here, which is created dynamically. Any idea? Thanks a lot in advance!!</p> <pre><code>for (int i = 0; i &lt; additionalPageCount; i++) { if (i == 0) { this.pnlProfilePages.Controls.Add(new LiteralControl("&lt;tr&gt;&lt;td colspan=\"4\" style=\"width:100px;font-size:11px; padding-bottom: 10px;\"&gt;&lt;h3&gt;Page Tabs&lt;/h3&gt;&lt;/td&gt;&lt;/tr&gt;")); } this.pnlProfilePages.Controls.Add(new LiteralControl("&lt;tr&gt;&lt;td style=\"font-size:11px; padding-left:6px;\"&gt;Tab Name :&lt;/td&gt;&lt;td style=\"padding-right:10px;font-size:11px;MaxLength:20\"&gt;")); string txtTabControlID = "txtTabName" + i.ToString(); TextBox txtTab = new TextBox(); txtTab.ID = txtTabControlID; txtTab.Width = 100; txtTab.TabIndex = lastTabIndex++; } } </code></pre>
c# asp.net
[0, 9]
5,284,549
5,284,550
JS/jQuery: Get depth of element?
<p>What's the easiest way to get the depth of an element in pure JavaScript or jQuery? By "depth" I mean how many elements deep is it nested, or how many ancestors does it have.</p>
javascript jquery
[3, 5]
5,690,401
5,690,402
Indentation vs alignment in code formatting
<p>I was reading this thread <a href="http://stackoverflow.com/questions/268538/tab-versus-space-indentation-in-c-sharp">Tab versus space indentation in C#</a> reagrding Tab versus space indentation. The moral of the thread leads to "Tabs for indentation, spaces for alignment." Can you explain me with some code example what does indentation means and what does spaces means wrt code? I am just confused with the two things in the context of code?</p>
c# java php asp.net
[0, 1, 2, 9]
4,023,867
4,023,868
Anatomy of an Android Run Loop
<p>I can't seem to find any documentation on the details of an Activity's run loop for Android.</p> <p>Apple documents the "<a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/Multithreading/RunLoopManagement/RunLoopManagement.html#//apple_ref/doc/uid/10000057i-CH16-SW20" rel="nofollow">anatomy of a run loop</a>", and that's pretty much what I'm looking for. The Android documentation just says "<a href="http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle" rel="nofollow">Activity Is Running</a>" in its life cycle state diagram. Obviously that's backed up by some sort of run loop.</p> <p>Anyone have some insight (aka Documentation) into the internals of an Activity's run loop?</p> <p>edit - I should clarify that I presume the run loop is actually owned and run by the main UI thread. The current Activity's functionality is likely injected into this runloop at a certain point. I'm interested in the overall UI thread run loop, as well as what role the Activity takes in it.</p>
java android
[1, 4]
4,335,492
4,335,493
Setting screen resoltion in ASP.NET
<p>I am new to ASP and I am creating a web application and I want to set web page's layout [of entire website] to 1024x768.</p> <p>Is there a way to achieve this using C# or JavaScript? </p>
c# javascript asp.net
[0, 3, 9]
4,494,715
4,494,716
Elegant way of retrieving query string parameter
<p>I am retrieving one query string parameter, and for that my code is </p> <pre><code> &lt;a href="Default2.aspx?Id=1&amp;status=pending&amp;year=2010"&gt;Click me&lt;/a&gt; </code></pre> <p>Now I want to retrieve "status=pending" and for that I am doing </p> <pre><code> var qString = window.location.search.substring(1); var Keys = qString .split('&amp;'); alert(Keys[1]); </code></pre> <p>This works fine, but I am hard-coding [1] here. is there any elegent way of doing this without hard-coding?</p>
javascript jquery
[3, 5]
4,267,245
4,267,246
I draw diagrams, but I see old image on the new page
<p>I am developing a C# web project. I run it on the local web server. I draw. I show image as follows:</p> <pre><code>bitmap.Save(Server.MapPath("diagram.jpg"), ImageFormat.Jpeg); Image1.ImageUrl = ResolveUrl("diagram.jpg"); </code></pre> <p>I don't see new image. Only old one, which I had after changing image name (Say, I change diagram.jpg to diagram2.jpg). Browser is Firefox. The design page in C# is simple. Just Image and few TextBoxes on the page. No UpdatePanel and such. Something with caching... But how to fight with that...</p>
c# asp.net
[0, 9]
2,547,388
2,547,389
Jquery: stylize elements, which loads after some actions
<p>I have a form-configurator. When I choose some element from a dropdown, the page loads other elements of the form via AJAX. jQuery can't stylize those new elements. For example:</p> <pre><code>$('select').selectmenu({style: 'dropdown'}); </code></pre> <p>It would be nice to use the "ready" or "load" events for these elements:</p> <pre><code>$('select').live('ready', function(){ $(this).selectmenu({style: 'dropdown'}); }) </code></pre> <p>Are there any alternatives?</p>
javascript jquery
[3, 5]
2,305,374
2,305,375
Inputing results to inArray from .html (or innerHtml) and making it work
<pre><code>$("form").submit(function () { if ($.inArray($("input:first").val().toUpperCase(), ["UNITED STATES", "USA", "AMERICA"]) &gt; -1) { //function here }); &lt;div class="answers"&gt;"UNITED STATES", "USA", "AMERICA"&lt;/div&gt; $("form").submit(function () { if ($.inArray($("input:first").val().toUpperCase(), [$(".answers").html()]) &gt; -1) { //function here }); </code></pre> <p>Within the div with the class answers I have the results I need to validate. When I use jquery function .html the results print out fine, but when it validates it needs to validate the whole sentence : "UNITED STATES", "USA", "AMERICA" not every answer on its own like it does on the first function. How can I make this work?</p>
javascript jquery
[3, 5]
2,006,033
2,006,034
Android Load image on ImageView using arraylist
<p>This might be a problem that I might overlooked again but if you could help me solve it, I will be very thankful. Using this code to get images from drawable and sending it to Imageview.setImageResource (in which my Imageview is inside a gridview);everything works well</p> <pre><code>private Integer[] imageIDs = { //R.drawable.image1, R.drawable.image2, R.drawable.image3, R.drawable.image4, R.drawable.image5, R.drawable.image6, R.drawable.Image7, }; //Here is my another code to call imageIDs as ImageResource ImageView iv = (ImageView)v.findViewById(R.id.grid_item_picture); iv.setImageResource(imageIDs[position]); //position is a default value of gridview starting from 0 </code></pre> <p>Now what I trying to accomplish is to delete that array and convert it to arraylist simply because need these inside data to be dynamic. And so ive created these new code</p> <pre><code>ArrayList&lt;String&gt; array_image = new ArrayList&lt;String&gt;(); array_image.add("R.drawable.image6"); array_image.add("R.drawable.image1"); </code></pre> <p>and set the ImageView ImageResource to this code</p> <pre><code>iv.setImageResource(array_image .get(position)); </code></pre> <p>I am getting an error saying: </p> <blockquote> <p>The method setImageResource(int) in the type ImageView is not applicable for the arguments (Object) Can you help me fix/figure it out?</p> </blockquote>
java android
[1, 4]
1,318,213
1,318,214
javascript: how i can define is object jQuery object or something else object?
<p>So, i have two objects:</p> <pre><code>var object1 = $('div'); var object2 = {}; </code></pre> <p>How i can define is this jQuery object, or not?</p> <p>for javascript version &lt; 1.4</p>
javascript jquery
[3, 5]
1,315,116
1,315,117
When to use a webservice, page Method?
<p>Just starting with JQuery. I have a couple of questions</p> <ol> <li><p>When to use webmethods ,webservices , page methods , ashx files in an ASP.NET 2.0 website ? </p></li> <li><p>If I were designing an application where I'd use the webmethods on multiple pages should I replace them with a webservice ?</p></li> <li><p>I suppose they all do the same thing but when to use which approach?</p></li> </ol> <p>Thanks, Damien.</p>
asp.net jquery
[9, 5]
2,222,410
2,222,411
Jquery Map function with TD and Input
<p>I am trying to combine the words in td and input text entered in the textbox. </p> <pre><code>&lt;table width="100%"&gt; &lt;tr&gt; &lt;td class="CommentWords" width="25%"&gt;jsakldjs &lt;/td&gt; &lt;td class="Label" width="85%"&gt; &lt;input class="Textcomment" id="txtCommentWords_3" type="text" width="550px"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr class="NormalItem"&gt; &lt;td class="CommentWords" width="25%"&gt;klsajdksajd &lt;/td&gt; &lt;td class="Label" width="85%"&gt; &lt;input class="Textcomment" id="txtCommentWords_4" type="text" width="550px"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>as i need to select all words from "commentWords" and "TextComment class", with associated values. <a href="http://jsfiddle.net/23hgy/1/" rel="nofollow">Fiddler link. </a></p> <p>for eg: </p> <p><strong>output will be</strong> </p> <blockquote> <p>jsakldjs Å InputTextvalue ¶ // Å will be Field separator, ¶ will be Row Seperator</p> </blockquote> <p>this what i tried, but as of now it wil return either textbox value or td value. i need to get all td value with corrsponding text values with field and row separator </p> <pre><code>var list = $(".CommentWords, .Textcomment", this).map(function() { return $(this).val(); }); </code></pre>
javascript jquery
[3, 5]
5,068,466
5,068,467
script reference causes conflict
<p>I have code 1 which executes with this in the head:</p> <pre><code>&lt;link class="jsbin" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" /&gt; &lt;script class="jsbin" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"&gt;&lt;/script&gt; </code></pre> <p>Then I have code 2 which goes by:</p> <pre><code>&lt;script src="http://code.jquery.com/jquery-1.4.3.min.js"&gt;&lt;/script&gt; &lt;script src="livesearch.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>The problem is that when I put the last reference (code 2) the first doesn't work anymore.. What am I doing wrong?</p> <p>( for some reason code 2 doesnt react on jquery 1.7 )</p>
javascript jquery
[3, 5]
535,084
535,085
Any idea why using jquery-ajax some img src are preppended with '%20'?
<p>After a .load() call some content (with images) some of the user's profile image path get broken...</p> <p>And i am not sure if is a coincidence but it will only happen with the opengraph's ones:</p> <p>one example;</p> <p>Iam trying to recive <code>&lt;div class="user"&gt;&lt;img src="https://graph.facebook.com/652286316/picture" /&gt;&lt;/div&gt;</code></p> <p>But i get <code>&lt;div class="user"&gt;&lt;img src="%20https://graph.facebook.com/652286316/picture" /&gt;&lt;/div&gt;</code></p> <p>Any idea why could this happen?</p>
php jquery
[2, 5]
1,363,951
1,363,952
SqlDataSource used with ListView
<p>I am a newbie and I have spent well over 100 hours trying to find a solution to my question:</p> <p>I have a Recipes db which is displayed in Recipes ListView that gives 13 rows of data. The Recipes db loads into Recipes ListView just fine and the Recipes db has a relational db named RecipesDirections. Each db has a primary key of "Category" and the RecipesDirections has a foreign keu to Recipes db which is "Category". "Category 1", etc., is the same recipe(s) in both db. The Recipes ListView shows the first ten names of recipes from the Recipes db. I would like to click on the 1st name in the Recipes ListView and have a page open (I'm using DetailPage.aspx as this page) showing the same recipe (which has ingredients and directions) from the RecipesDirections db. </p> <p>DetailPage.aspx does show the ingredients and directions, for 10 recipes, in a ListView from the RecipesDirections db if opened in a browser.</p> <p>My goal is to be able to click on recipe #1 or recipe #2, or recipe #10 on the Recipes ListView and have that recipe with ingredients and directions open in the DetailPage.aspx. Right now, regardless of the link I click (1 through 10) on the Recipes List View, the DetailPage.aspx opens and displays only the 1st recipe of the RecipesDirections db.</p> <p>Any help would be greatly appreciated.</p>
c# asp.net
[0, 9]
5,117,806
5,117,807
ASP.NET|Process Class- Runing And Stoping Process
<p>few days ago, my freind asked me to build him a proagram that start and stop process.</p> <p>so, as easy as it is. i did the next code:</p> <pre><code>(using System.Diagnostics) Process process; process = Process.start("SOMEONE.exe"); Process.Kill(); </code></pre> <p>Now, thats it the easy part. everything works. but. when i do the same code in asp.net, its strat the process, but when you kill the process, nothing happnd. no matter what i did, any one have any solion to the next problem :(?</p>
c# asp.net
[0, 9]
329,448
329,449
Javascript variable not working in a different file
<p>I have this script in <strong>index.php</strong> file:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ $('#ads').load('output.php').fadeIn('slow'); }); &lt;/script&gt; </code></pre> <p>And the <strong>output.php</strong> file contains a hidden input by which I pass a php variable and retrieve it succesfully:</p> <pre><code>&lt;script type="text/javascript"&gt; num = document.getElementById('number').value; &lt;/script&gt; </code></pre> <p>And if I put, say, an <code>alert(num);</code> in the <strong>output.php</strong> file, everything works. Though when I do the same in the <strong>index.php</strong> file, javascript doesn't seem to see that <code>num</code> variable.</p>
php javascript
[2, 3]
2,313,587
2,313,588
Android Account Sync Provider
<p>I'm trying to add a Sync Provider account and all was going well until i click the account within the account settings. I'm getting the following error below in the LogCat.</p> <p><img src="http://i.stack.imgur.com/vD2iI.png" alt="LogCat"></p> <p>As you can see it is trying to get a 'resource' but what though? I have gone through my code many times and i cant find any faults any where...</p> <p>This happens when i click the 'iSyncCRM' account in the image below.</p> <p><img src="http://i.stack.imgur.com/hVfSB.png" alt="Account Settings"></p> <p>If you need any code please feel free to ask in the comments and i will update the question.. Thank you :)</p>
java android
[1, 4]
1,016,415
1,016,416
Set cookie domain with Javascript variable
<p>Im taking the domain from the HTML of the page using jQuery:</p> <pre><code>domainUrl = $("p.domain").text(); </code></pre> <p>for the purposes of testing:</p> <pre><code>&lt;p class="domain"&gt;.vl3.co.uk&lt;/p&gt; </code></pre> <p>Which is also the domain Im testing the script on.</p> <p>This then give an alert containing the correct domain:</p> <pre><code>alert(domainUrl); </code></pre> <p>I want to the use that variable to set the domain in a cookie:</p> <pre><code>set_cookie('visible', 'no', 2020, 1, 1, '/', '+domainUrl+'); </code></pre> <p>Here is the set cookie function:</p> <pre><code>function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure ) { var cookie_string = name + "=" + escape ( value ); if ( exp_y ) { var expires = new Date ( exp_y, exp_m, exp_d ); cookie_string += "; expires=" + expires.toGMTString(); } if ( path ) cookie_string += "; path=" + escape ( path ); if ( domain ) cookie_string += "; domain=" + escape ( domain ); if ( secure ) cookie_string += "; secure"; document.cookie = cookie_string; } </code></pre> <p>Why doesnt the cookie domain get set? </p> <p>I think the problem is how im using the domainUrl variable when setting the cookie?</p>
javascript jquery
[3, 5]
608,344
608,345
How to hide a DIV that is produced by an AJAX call?
<p>I have a simple script that closes a DIV. An example is here: <a href="http://jsfiddle.net/22fTm/3/" rel="nofollow">http://jsfiddle.net/22fTm/3/</a></p> <p>My problem however, is that the DIV "box" is only produced after an ajax call, which is part of a search php script. </p> <p>Any idea what I need to make this work? Similar question: <a href="http://stackoverflow.com/questions/5116200/how-to-hide-an-element-on-an-ajax-call">How to hide an element on an AJAX call?</a></p>
javascript jquery
[3, 5]
2,081,465
2,081,466
Remove/change Internal styles sheet styles with JavaScript/jQuery
<p>I want to be able to remove/change the internal style sheets values through JavasScript. It has to be through JS because I cannot edit the html since I am using an application that does not allow me to, but I can use JS. How can I change the value for the background or remove it completely? Or is there another way to accomplish this? </p> <pre><code>&lt;body&gt; &lt;head&gt; &lt;style type="text/css"&gt; #company-header{background:#000 !important;} &lt;/style&gt; &lt;/head&gt; &lt;div id="company-header"&gt;&lt;/div&gt; &lt;/body&gt; </code></pre>
javascript jquery
[3, 5]
3,488,882
3,488,883
java.lang.NoClassDefFoundError on Android after changing a class file
<p>I have a jar library. I used Java Class File Editor (CE) to modify one class in this library. In this class, I changed a variable from "private static final" to "public static." Afterwards, I put the newly modified class file into same jar library using WinRAR.</p> <p>However, running the app on Android produces the NoClassDefFoundError.</p> <p>How do I resolve NoClassDefFoundError?</p> <p>Please help.</p>
java android
[1, 4]
4,077,335
4,077,336
jQuery rich text editor with word counter
<p>I need a rich text editor like this one used on this site, with a word counter on it, i will love to restrict the total work count like on twitter, preferrably written with jQuery, please any tip, i will greatly appreciate it.</p>
javascript jquery
[3, 5]
1,407,908
1,407,909
i want to show message once every fields has value using jquery
<p>my html:</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;input type="text" id="name" name="name" placeholder="First Name" /&gt; &lt;label for="name"&gt;First Name &lt;/label&gt; &lt;button id="submit" src="images/button.png" width="100" &gt;Submit&lt;/button&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>my script is:</p> <pre><code>&lt;script type="text/javascript" src="jquery-1.5.2.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $('#submit').click(function() { var emptyTextBoxes = $('input[type=text],[type=password]').filter(function() { return this.value == ""; }); emptyTextBoxes.each(function() { $(emptyTextBoxes).nextAll('label').css({'display':'inline','color':'#F00'}); }); }); </code></pre> <p>here once i entered values in the textfield i want to show message(form submitting) how can put that alert message here </p>
javascript jquery
[3, 5]
4,185,899
4,185,900
Execute particular code on confirmation of user but confirm box must be activate during the php code not onsubmit form
<p>After validating user data from database I want to update some values in the Database using php code.</p> <p>I have tried </p> <pre><code>var answer = confirm("Do you want to Checkout?"); if(answer==true) { &lt;?php MY UPDATE COMMAND ?&gt; } </code></pre> <p>but update command execute even if answer==false</p> <p>Please help me in solving my problem.</p> <p>Thanks</p>
php javascript
[2, 3]
2,607,694
2,607,695
Best Books that shows how to use jQuery with ASP.NET
<p>I have searched the stackoverflow site to find if someone has recommended any good books that show how jQuery can be used with asp.net. All the threads lead to only good jQuery books. </p> <p>Can anyone recommend me a good book that shows how to use jquery with asp.net? Any upcoming books are also ok</p>
asp.net jquery
[9, 5]
4,314,236
4,314,237
jQuery buggy setTimeout animation
<p>I'm experiencing a bug with animated elements. When you <code>right-click</code> on a group its name-field expands downwards so that it is revealed along with 2 other groups on the line. And then a animation puts it on the default state triggered with <code>setTimeout()</code> after a few seconds. However if you start clicking randomly and intensively on groups on the line without waiting the current animation to finish it breaks becomes buggy and executes much faster then the given timings!</p> <p>Here's the key part of the code:</p> <pre><code>var t = window.setTimeout(function() { for (var i = highFrontier; i &gt; lowFrontier - 1; i--) { jQuery(groupBoxes[i]).animate({ height: '76px' }, 400, 'linear', function() {}); } }, 3300); </code></pre> <p>And here's the entire application: <a href="http://jsfiddle.net/TTGr7/20/" rel="nofollow">http://jsfiddle.net/TTGr7/20/</a></p> <p>10x for your kind help, BR</p>
javascript jquery
[3, 5]
4,114,201
4,114,202
Is ASP.NET HttpPostedFile.SaveAs a blocking call?
<p>I was wondering whether <code>HttpPostedFile.SaveAs</code> function in ASP.NET C# is a blocking call.</p>
c# asp.net
[0, 9]
5,098,369
5,098,370
The best way to write a jQuery plugin - If there is such a way?
<p>There are quite a few ways to write plugins i.e. <a href="http://stackoverflow.com/questions/2352077/writing-a-better-jquery-plugin/2352112#2352112">here's a nice example</a> and what I've seen quite a lot of lately is the following code pattern and it's used by Doug Neiner <a href="http://starter.pixelgraphics.us/" rel="nofollow">here</a>;</p> <pre><code>(function($){ $.formatLink = function(el, options){ var base = this; base.$el = $(el); base.el = el; base.$el.data("formatLink", base); base.init = function(){ base.options = $.extend({}, $.formatLink.defaultOptions, options); //code here } base.init(); }; $.formatLink.defaultOptions = { }; $.fn.formatLink = function(options){ return this.each(function(){ (new $.formatLink(this, options)); }); }; })(jQuery); </code></pre> <p>So, can anyone tell me the benefits of using the pattern above rather than the one below. I can't see the point in calling the $.extend function for every element in the jQuery stack (above), where the example below only does this once and then works on the stack. </p> <p>To test it I created two plugins, using both patterns, which applied styles to about 5000 li elements and the code below took about 1 second whereas the pattern above took about 1.3 seconds. </p> <pre><code>(function($){ $.fn.formatLink = function(options){ var options = $.extend({}, $.fn.formatLink.defaultOptions, options || {}); return this.each(function(){ //code here }); }); $.fn.formatLink.defaultOptions ={} })(jQuery); </code></pre>
javascript jquery
[3, 5]
2,447,133
2,447,134
drag & drop w/ reordering - reordering 2 side-by-side elements at once
<p>I have had no luck figuring out how to do this. I was originally using jQuery UI sortable, but I am not sure it will work with this workflow:</p> <p>I have a table with multiple columns. I want to be able to drag an element in column A AND the element next to it in column B at once and drop them into a different position. After the drop, the element from column A &amp; B will still be side-by-side but not at their original Y coordinate. The key is dragging them at once &amp; allowing other elements that cross their paths to "move out of the way". </p> <p>I was able to achieve this with 1 element using jquery UI sortable, but am not sure how to make this work with two side-by-side elements. Any suggestions any help is more than welcome. Thanks in advance.</p>
javascript jquery
[3, 5]
2,230,300
2,230,301
Possibility to switch over to java from .net
<p>Today I am going to ask one off bit question. Sorry for that. Right now I am an MCA fresher and will be working on dot net for next few month(almost 10-12 months). After that I want to switch over to java. How is the possibility that I can switch over to it. What type of preparation I am supposed to do. I am also planning to appear for SCJP but don't have any knowledge how to get registered an registration fees. Please also guide me what is company's approach towards the candidates switching their technologies. What are the things that companies look for??</p> <p>Thanks in advance.</p>
java asp.net
[1, 9]
2,647,638
2,647,639
Client-side validation Javascript or Server Side validation PHP
<p>I have a form which submits data which is entered in the database. Is is recommended to perform both client side and server side validation ?</p>
php javascript
[2, 3]
488,785
488,786
Why won't jQuery's load event fire on dynamically inserted script elements?
<p>I'm dynamically inserting a script element using jQuery. The script loads as expected, but the load event does not fire.</p> <pre><code>jQuery('&lt;script/&gt;').attr({ type : 'text/javascript', src : 'http://platform.twitter.com/widgets.js' }).appendTo('body').load(function(){ /* This alert does not fire: */ alert('I just loaded!'); }); </code></pre> <p>If I use regular JavaScript to insert the element, the load event does fire and can be caught with jQuery.</p> <pre><code>var e = document.createElement('script'); e.type = 'text/javascript'; e.src = 'http://platform.twitter.com/widgets.js'; document.body.appendChild(e); jQuery(e).load(function(){ /* This alert does fire: */ alert('I just loaded!'); }); </code></pre> <p>What am I doing wrong?</p>
javascript jquery
[3, 5]
2,205,602
2,205,603
converting integer to float with precision 2 using Javascript or Jquery
<p>I want to convert the integer to floating number with precision 2. ie. - </p> <p>11 => 11.00</p> <p>45 => 45.00</p> <p>Please help me.</p> <p>Thank you.</p>
javascript jquery
[3, 5]
4,051,679
4,051,680
Create a unique ID for a page in an ASP.Net Application
<p>I have an ASP.Net app with a lot of pages in it. My problem is to uniquely identify every page in my app. now the app might have pages with just the page name eg: home.aspx and can have pages with query strings eg: testPage.aspx?q1=1&amp;q2=2. </p> <p>what i have been thinking is since every URL in my app is unique I could use the page name + all query string params concatenated(key and value) to identify the page uniquely. eg : home.asp -> home</p> <p>testPage.aspx?q1=1&amp;q2=2 -> testpageq11q22</p> <p>Is this the correct way to go or is there a better way to do it. </p> <p>The reason I want to do this is I need to add at run time some meta data information from a database for each of the pages. The PageID then becomes my unique ID which I can then map all my meta data info in the db to.</p> <p>EDIT:</p> <p>the position of the query strings in the url is not important. so </p> <p>testPage.aspx?q1=1&amp;q2=2</p> <p>testPage.aspx?q2=2&amp;q1=1</p> <p>are the same </p> <p>Also there may be some cases where there is a optional query string (does not happen a lot) so something like </p> <p>testPage.aspx?q1=1&amp;q2=2</p> <p>testPage.aspx?q1=1&amp;q2=2&amp;opt1=1</p> <p>would potentially point to the same page (where the optional param gives me some kind of meta information thats is not being used to generate the content on the page)</p>
c# asp.net
[0, 9]
4,503,240
4,503,241
how to disappaer radio button on item slect from spinner
<pre><code>rb1=(RadioButton)findViewById(R.id.radioButton1); rb2=(RadioButton)findViewById(R.id.radioButton2); rb3=(RadioButton)findViewById(R.id.radioButton3); rb4=(RadioButton)findViewById(R.id.radioButton4); rb5=(RadioButton)findViewById(R.id.radioButton5); spiner1=(Spinner)findViewById(R.id.spinner1); spiner2=(Spinner)findViewById(R.id.spinner1); spiner1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { } @Override public void onNothingSelected(AdapterView&lt;?&gt; arg0) { // TODO Auto-generated method stub } }); </code></pre> <p>This is my code there are 5 value in my spiiner if i select first one then rb1,rb2,rb3,rb5 shud display and rest disapper if i select 2,3,4,5 value from spinner then it hud display 1st,4,5 plz tell me how to write code for this i m new in android try to implement some apps. i need code where and how to apply logic for this.</p>
java android
[1, 4]
2,039,188
2,039,189
How to use JavaScript to print the contents on a div?
<p>I would like to use the print() function to print the contents of a <code>&lt;div class="pagecontent"&gt;&lt;/div&gt;</code></p> <p>I know you can do something like <code>onClick="window.print()"</code> but this prints the entire window...I only want the contents of <code>.pagecontent</code> to be printed.</p> <p>What's the easiest way I can go about doing this using JavaScript or jQuery? </p>
javascript jquery
[3, 5]
4,215,135
4,215,136
Clone a div and then clone again from the child
<p>I have the following simple code, where I double click a div (with class <strong>container</strong>) and it's simply clones itself inside another div (with id <strong>containment-wrapper</strong>):</p> <p><strong>html</strong></p> <pre><code>&lt;span class="container"&gt;div one&lt;/span&gt; &lt;div id="containment-wrapper"&gt; &lt;/div&gt; </code></pre> <p><strong>Jquery</strong></p> <pre><code>$(".container").dblclick(function() { $(this).clone().appendTo('#containment-wrapper'); }); </code></pre> <p>When I double click the original div, it clones itself and puts a div inside the containment-wrapper but when I double click a cloned div, it doesn't do anything even though it has class=container, why is this happening? I tried many different ways to clone it but nothing worked.</p>
javascript jquery
[3, 5]
1,236,719
1,236,720
How to write unit test methods for aspx.cs files in VS 2008?
<p>How to write unit test methods for VS 2008? - On Submission of User Name and Password, i have called the method which is .aspx.cs file.I need to write the unit test for the methods which are defined in .aspx.cs file. -From .aspx.cs file, i have called the methods which is in separate file. - So i need to cover the code which is in .aspx.cs file and also in .cs file. So my question is, can we write test methods .aspx.cs file?</p>
c# asp.net
[0, 9]
4,248,798
4,248,799
on click get all <area> elements mouse is within based on coords
<p>I'm using the jquery maphilight plugin and have a large number (hundreds) of overlapping elements on my image map. I've noticed that when hovering over the image map, maphilight will highlight the first element it finds for those coordinates, so overlapping can become an issue.</p> <p>I'm looking to be able to click the image map somewhere and have maphilight (or an external function) return me an array of all the elements not just the first one.</p> <p>Open to any ideas on how to go about this.</p> <p><strong>EDIT:</strong> To simplify, when I click a point I'm looking for maphilight to get the area (as it already does), but then add that to an array and continue looking for other areas from the same coordinates. Not just return me the first area it finds and stop.</p>
javascript jquery
[3, 5]
695,530
695,531
Access asp:lable value which set using jquery?
<p>I am making web application in asp.net, I have one label control in my .aspx page. I have to set label text value using jquery. want to access this value in my .cs file.</p> <pre><code>&lt;asp:Label ID="lbltext" runat="server" Text=""&gt;&lt;/asp:Label&gt; </code></pre> <p>By using this am able to change label text :</p> <pre><code>$('#&lt;%= lbltext.ClientID %&gt;').text("Test"); </code></pre> <p>I want to access label text value in code behind page</p> <p>Thanks in advance..</p>
c# javascript jquery asp.net
[0, 3, 5, 9]
1,186,267
1,186,268
How to assign Textbox value to the other textbox using jquery
<p>I have two textboxes in my view,</p> <p>My requirement is when I enter some text in the first textbox automatically that value should be assigned to second text box when I leave first textbox. using jquery or javascript.</p> <p>thanks for your help</p> <p>EDIT:</p> <p>For Some reason this code is not inserting the value into seconed textbox.</p> <pre><code>http://jsfiddle.net/9tEV2/4/ </code></pre>
javascript jquery
[3, 5]
4,488,531
4,488,532
Select div text next to clicked button within table row
<p>Here is a sample table. </p> <pre><code>&lt;table class="table table-bordered"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;tr&gt; &lt;td&gt;Stuff&lt;div id="ParentID" style="display:none"&gt;145689&lt;/div&gt;&lt;/td&gt; &lt;td&gt;&lt;button class="btn btn-small"&gt;Send&lt;/button&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>I want to select the text within the div tag where id=ParentID that is closest to that button clicked. I will have multiple row in the future so it has to be unique to that row.</p> <p>I have right now </p> <pre><code>var qry = $(this).closest('#ParentID').text(); </code></pre> <p>Doesn't work obviously</p>
javascript jquery
[3, 5]
2,554,548
2,554,549
Number of folder inside a directory
<p>How do i know the number of folder inside a directory?</p> <p>I try using <code>System.IO.Directory</code> but no luck!!</p> <p>thanks, Pedro</p>
c# asp.net
[0, 9]
4,382,963
4,382,964
javascript setTimeout function does not work
<p>I am trying to update a variable every one second. For that reason I am using setTimeout. But it does not update the variable. It logs out 0 just once. Here is my code</p> <pre><code>var yes=0; setTimeout(function () { console.log(yes); yes++; }, 1000);​ </code></pre>
javascript jquery
[3, 5]
4,983,822
4,983,823
javascript send one way message to php
<p>How can I use javascript to send a one way message to php? I would like to get the browser information from javascript and just send it to php in the background. I know I can get some of this from php, but I'd rather use javascript. Is there a way to do this without a framework like jquery?</p>
php javascript
[2, 3]
5,603,452
5,603,453
external link icon
<p>Using a script, that works great. It pops in a external link icon next to external links. Whoopydoo... and also adds a target="_blank" attribute.</p> <p>The issue I have is, I dont want it to work on IMAGES.</p> <p>Only on text links , so any sugestions.</p> <p>The jquery is:</p> <pre><code>(function(a){ a.fn.link_external_icon=function(p){ var p=p||{}; var icon_path=p&amp;&amp;p.icon_path?p.icon_path:"link_external.png"; var n=a(this); n.find("a[target='_blank']").css("padding-right","13px").css("background-image","url("+icon_path+")").css("background-repeat","no-repeat").css("background-position","center right"); } </code></pre> <p>})(jQuery);</p> <p>The Script is:</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; $(function() { $("body").link_external_icon({ icon_path:"../images/link_external.png" }); }); &lt;/script&gt; </code></pre> <p>Image is: <img src="http://i.stack.imgur.com/ikX0m.png" alt="enter image description here"></p> <p>Any help appreciated.</p> <p>Original code is: <a href="http://htmldrive.net/items/show/161/Link-external-icon-jQuery-plugin-for-show-external-linktarget_blank-icon.html" rel="nofollow">http://htmldrive.net/items/show/161/Link-external-icon-jQuery-plugin-for-show-external-linktarget_blank-icon.html</a></p>
javascript jquery
[3, 5]
4,002,024
4,002,025
Target individual class function instead of the whole class group
<p>I have a script that shows more info when clicked and when clicked again it hides the info. The problem is that when clicked it shows and hides information of all the div's with the same class name instead of only the one that was clicked. I was looking around and I would think that I need to add "this" somewhere in it so that it only affects the clicked object. Could someone explain what I am doing wrong and how to achieve this effect?</p> <p>Javascript</p> <pre><code> &lt;script type="text/javascript"&gt; this$(document).ready(function(){ $(".toggle").click(function(){ $(".hiddenDiv").slideToggle("slow"); }); }); &lt;/script&gt; </code></pre> <p>HTML</p> <pre><code> &lt;span class="toggle" onClick='return false'&gt; &lt;h4 class='arrow'&gt;Group Health Insurance&lt;/h4&gt; &lt;/span&gt; &lt;div class='hiddenDiv'&gt; &lt;p&gt;&lt;img src="../images/group.jpg" border="0" alt="Group Insurance" align="left" hspace="5" /&gt;Group health insurance coverage is a policy that is purchased by an employer and is offered to eligible employees of the company blah blah blah&lt;/p&gt; &lt;/div&gt; &lt;hr /&gt; &lt;span class="toggle" onClick='return false'&gt; &lt;h4 class='arrow'&gt;Insurance&lt;/h4&gt; &lt;/span&gt; &lt;div class='hiddenDiv'&gt; &lt;p&gt;&lt;img src="../images/group.jpg" border="0" alt="Group Insurance" align="left" hspace="5" /&gt;More info about other types of insurance blah blah blah&lt;/p&gt; &lt;/div&gt; &lt;hr /&gt; </code></pre> <p>Thanks for your help in advance!</p>
javascript jquery
[3, 5]
1,342,822
1,342,823
C++ Serve PHP documents?
<p>I am writing a small web server, nothing fancy, I basically just want to be able to show some files. I would like to use PHP though, and im wondering if just putting the php code inside of the html will be fine, or if I need to actually use some type of PHP library?</p> <p><a href="http://www.adp-gmbh.ch/win/misc/webserver.html" rel="nofollow">http://www.adp-gmbh.ch/win/misc/webserver.html</a></p> <p>I just downloaded that and I am going to use that to work off of. Basically I am writing a serverside game plugin that will allow game server owners to access a web control panel for their server. Some features would be possible with PHP so this is my goal. Any help would be appreciated, thanks!</p>
php c++
[2, 6]
365,485
365,486
JavaScript engine development book or article
<p>im looking for a book to learn more about the development of a JavaScript engine (if that exist), i would appreciate any info about this topic, thanks beforehand.</p> <p>- Or any articles about Javascript Engine development! :)</p>
javascript c++
[3, 6]
3,258,760
3,258,761
jquery check if string starts with 1234
<p>Thanks for taking the time to answer my question.</p> <p>I want to check if a string has exactly 7 characters and starts with "1234". How do I do that?</p> <p>I know of string.substring but am not sure if I shouold use regex or are there any other alternative. Thanks in advance!</p>
javascript jquery
[3, 5]
2,976,080
2,976,081
converting 2012-07-04T17:30:52+00:00 to 2012-07-04T17:30:52Z
<p>as far as I know both<br> <code>2012-07-04T17:30:52+00:00</code> and<br> <code>2012-07-04T17:30:52Z</code> are dates in <strong>iso8601</strong> format with time zone UTC.</p> <p>I am using prettyDate jquery plugin. It accepts date only in the format <code>2012-07-04T17:30:52Z</code></p> <p>i am getting dates in the format <code>2012-07-04T17:30:52+00:00</code> as a response from json</p> <p>so how can i convert <code>2012-07-04T17:30:52+00:00</code> to <code>2012-07-04T17:30:52Z</code> using javascript or jquery.</p>
javascript jquery
[3, 5]
4,605,214
4,605,215
ASP.NET: Custom SetFocusOnError behavior for RequiredValidators
<p>Is there a way I can override the default scrolling using when SetFocusOnError = true? Right now it pops the user up the page so that the top of the control is at (0,0). The problem is that our labels are above the controls, so the user can't see the label without scrolling up a little more. I'd like to make it center the control vertically instead, and ideally even do a nice smooth jQuery slide up. </p> <p>I tried like this but it didn't work (never gets fired):</p> <pre><code>function WebForm_AutoFocus(obj) { elem = document.getElementById(obj).scrollTop() - 200; //Go to 200px above where the element is $('html, body').animate({ scrollTop: elem }, 350) </code></pre> <p>}</p>
asp.net jquery
[9, 5]
2,635,462
2,635,463
Jquery: help to get values from data attributes
<p>I have the following markup</p> <pre><code>&lt;a href='#' id="remove_user_from_group" data-user-id="a9a4ae36-c6cd-11e1-9565-910084adb773" data-group-id="e4d66f80-d046-11e1-89b6-16f96811a1bd"&gt;x&lt;/a&gt; </code></pre> <p>And I want to get the data from <code>user-id</code> and <code>group-id</code>.</p> <p>For now, I have tried:</p> <pre><code>$this = $(this); $("#remove_user_from_group").live('click', function() { var userid = $this.data('user-id'); var groupid = $this.data('group-id'); alert(userid); alert(groupid); }); </code></pre> <p>which pops me 2 alerts with <code>undefined</code> values.</p> <p>What am I missing here?</p>
javascript jquery
[3, 5]
3,870,369
3,870,370
problem with checked all checkbox?
<p>When someone clicks on first <code>input:checkbox</code>, I want my code to check all checkboxes, but my code doesn't work correctly: <p></p> <p><strong>EXAMPLE:</strong> <a href="http://jsfiddle.net/cQYVE/" rel="nofollow">http://jsfiddle.net/cQYVE/</a></p> <pre><code>$('.table_show tr input:first').live('click',function(){ var isChecked = $(this).prop('checked'); $(".table_show tr input[name=checked[]]").each(function(){ if (!$(this).prop('checked') == isChecked) { $(this).parent().click(); } }); }); </code></pre> <p>What is the cause of the problem?</p>
javascript jquery
[3, 5]
3,357,374
3,357,375
If jquery.html() doesn't work in xhtml because innerHTML is messy and not a good practice, why do jquery.prepend() etc work?
<p>Wouldn't allowing users to input xhtml manually create the exact problem removing <code>innerHTML</code> was supposed to solve?</p>
javascript jquery
[3, 5]
1,043,588
1,043,589
window.showModalDialog is not working
<p>I have the following code to showModalDialog popup:---</p> <p>.aspx code is:-</p> <pre><code>function ShowPopup(path) { window.showModalDialog(path, '', 'dialogWidth:700px; dialogHeight:530px; Center:yes'); } </code></pre> <p>My aspx.cs code is:--</p> <pre><code>switch (e.CommandName.ToLower()) { case "sendenquiry": string path = string.Format("/BusinessBazaarAspx/PopUps/Enquiry.aspx?c={0}", id); ScriptManager.RegisterClientScriptBlock(gvLatestCompanies, GetType(), "mykey2", string.Format("ShowPopup('{0}')", path), true); break; </code></pre> <p>But my Modal Popup is not visible...</p> <p>Help me to get rid of this problem.</p> <p>Thankx</p>
javascript asp.net
[3, 9]
4,209,984
4,209,985
Dump facility in C++ like var_dump() in PHP?
<p>When I was in college i did some C/C++, but in near future i was working in PHP, and now I wish to put more time in learning C/C++.</p> <p>In PHP i was using print_r() or var_dump() in order to display datas from structures or arrays. Do I have such a default functionality in C, in order to see what do i have in a struct or array?</p>
php c++
[2, 6]
4,910,865
4,910,866
Render Rtf text stored in database as bytes using Microsoft.Office.Interop.Word dll to word
<p>I am storing Rtf text from Windows RichTextBox control as Bytes into Database.</p> <p>I want to Render that Rtf data stored in the database to Word using Microsoft.Office.Interop.Word dll.</p> <p>How to render Rtf data into work document.</p>
c# asp.net
[0, 9]
1,332,289
1,332,290
if input field has a value found in array, do this (jQuery/Javascript)
<p>I've got a page with a handful of input fields.</p> <p>I need to find the fields with an array of values, and if so, <code>.remove()</code> the <code>closest('tr')</code></p> <p>The markup is similar to this</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;input type="text" value="this"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;input type="text" value="that"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;input type="text" value="them"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>I need to find "this" and "that", and if they are there, remove their <code>&lt;tr&gt;</code> container (and themselves) so I'd end up with:</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;input type="text" value="them"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>I've tried this:</p> <pre><code>jQuery(document).ready(function($){ var badfields = ['this', 'that']; var fieldvalue = $('input[type="text"]').val(); if($.inArray(fieldvalue, badfields) &gt; -1){ $(this).closest('tr').remove(); } }); </code></pre> <p>but it doesn't seem to want to work?</p>
javascript jquery
[3, 5]
5,479,909
5,479,910
Capturing Ctrl-Alt-Del in JavaScript/jQuery
<p>While just playing with jQuery/JavaScript I ran across this problem. I could capture <kbd>Alt</kbd> and <kbd>Ctrl</kbd> keys but NOT <kbd>Del</kbd> and certainly not all of them together.</p> <pre><code>$(document).ready(function() { $("#target").keydown(function(event) { if (event.ctrlKey &amp;&amp; event.altKey &amp;&amp; event.keyCode == '46') { alter("Ctrl-Alt-Del combination"); } }); }); </code></pre> <p>Is it possible to capture all these three keys together?</p>
javascript jquery
[3, 5]
1,184,750
1,184,751
How to retrieve a number (ID) inside a image path using js/jquery?
<p>Here is the sample path, assuming the format is fixed</p> <p>For the 4th image, the path is '<code>demo/medium/Web081112_P004_medium.jpg</code>' </p> <p>so if the image is the 100 th ,then </p> <p>'<code>demo/medium/Web081112_P100_medium.jpg</code> '</p> <p>Is there any way to get the number in this format, I have thought about using reg exp? But it may cause a problem because I may retrieve 004 instead of 4, how to fix this? Thanks</p>
javascript jquery
[3, 5]
2,463,647
2,463,648
JQuery .GET call/function
<p>Ok so trying to get a page together that needs to connect to our SQL database. So on the javascript page I have functions that will autocomplete a textbox with data out of our mysql DB and then I need to send it to other functions and classes so that it will then look in our SQL DB and return some data. The problem I have is trying to get the .GET call to call in the php page, with the function that calls the class in which I need to get into for the SQL call. I have it setup somewhat but trying to figure out how to send the data through with it as well as just get clarification on how to work the .GET function.</p> <p>Javascript page:</p> <pre><code>$.get("dsl_validate.php", calldsl(job)); </code></pre> <p>Php Page</p> <pre><code>function calldsl($job){ var $dsljob = $job hasfunctioncode($dsljob); } </code></pre> <p>The hasfunctioncode function is in my DSL class page that will return the info I need. Any help on if I am in the right direction or not?</p>
php javascript jquery
[2, 3, 5]
3,648,599
3,648,600
JQuery: How to determine if Slide event is up or down?
<p>I have the following code:</p> <pre><code>$('a.btn-slide').toggle(function() { $("#DivToSlide").slideUp("fast"); // ... }, function() { $("#DivToSlide").slideDown("fast"); // ... }); </code></pre> <p>Later in my code, I want to find out if <code>#DivToSlide</code> is in either the <strong>up</strong> or <strong>down</strong> position. </p> <p>How do I do that?</p>
javascript jquery
[3, 5]
4,120,535
4,120,536
System.Web.HttpException was unhandled by user code
<p>I have been using </p> <pre><code>protected void Application_Error(Object sender, EventArgs e) { HttpException ex = Server.GetLastError() as HttpException; Exception ex_T = ex; Session["Ex"] = ex; Session["Ex_T"] = ex_T; Response.Redirect("~/errorPage.aspx" ); } </code></pre> <p>function for exception handling.</p> <p>Here when i login to the application " sometime" </p> <p>an exception occurs which details as</p> <pre><code>System.Web.HttpException was unhandled by user code Message="Session state is not available in this context." Source="System.Web" ErrorCode=-2147467259 StackTrace: at System.Web.HttpApplication.get_Session() at Tools.Global.Application_Error(Object sender, EventArgs e) in C:\Myproject\Tools\Global.asax.cs:line 67 at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.HttpApplication.RaiseOnError() InnerException: </code></pre> <p>i cannot track the reason</p> <p>Can any one help me out</p> <p>Thanks in advance</p>
c# asp.net
[0, 9]
5,930,294
5,930,295
Append data to css class - jQuery string operation
<p>Please take a look at the following html. EDIT: UPDATED THE HTML PART</p> <pre><code>&lt;div id="html_editor"&gt; &lt;head&gt; &lt;style type="text/css" &gt; .blog { border:2px solid grey; width:auto; } &lt;style&gt;{customcss}&lt;/style&gt; &lt;/style&gt; &lt;/head&gt; &lt;/html&gt; &lt;/div&gt; </code></pre> <p>Please take a look at the Css Class 'blog',i want to add some other values to that class through js/jQuery. Actually it is a HTML editor ,on the body tag user selecting a the 'blog' element,so that time i want to give the user to set CSS for the blog,user changing the CSS on a text area,after that i want to append/rewrite the data to that 'blog' class.</p> <p>Ex : user setting the class like the following</p> <pre><code>width:250px; background:red; key:value..etc.. </code></pre> <p>so after that i want to change that 'blog' css class to </p> <pre><code>.blog { width:250px; background:red; key:value..etc.. } </code></pre> <p>How can i achieve this ? is there any way by using jQuery ??</p> <p>UPDATE : Please check this image.</p> <p><img src="http://i.stack.imgur.com/RinCV.jpg" alt="http://imgur.com/10JuB"></p> <p>Thank you.</p>
javascript jquery
[3, 5]
4,425,706
4,425,707
jQuery popeye don't want to work
<p>Hello guys I can't provide the code but you can see it on the web. <a href="http://bestinvest.ge/en/?transaction=3&amp;minrooms=1&amp;maxrooms=100&amp;minprice=&amp;maxprice=" rel="nofollow">Here is the Link</a></p> <p>All scripts work correctly on the web but I can't configure the popeye and find the problem... Can anyone check it out? </p> <p>When I check with google errors it marks the following code in jquery 1.7.2. </p> <pre><code>return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ) </code></pre> <p>Popeye's website <a href="http://dev.herr-schuessler.de/jquery/popeye/demo.html" rel="nofollow">is here</a></p>
javascript jquery
[3, 5]
4,902,305
4,902,306
Reading a text file with jQuery
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1981815/jquery-read-a-text-file">jquery - Read a text file?</a> </p> </blockquote> <p>I want to read a local text file, using jQuery. So I try this:</p> <pre><code>$.get('file_to_read.txt', function(data) { do_something_with(data) }); </code></pre> <p>However, jQuery interprets "file_to_read.txt" as an html file and I get a Javascript error because it's not properly formatted and "do_something_with" does not have its desired effect, since data is not a string.</p> <p>the jQuery doc says I need to specify the datatype. However, they only list html, xml, json and script as the possible data files; what should I do with a plain txt file I want to load directly into a string?</p>
javascript jquery
[3, 5]
4,933,635
4,933,636
Webview doesn't download files
<p>I'm trying to navigate to a download url with the webview, and it doesn't download the file... I tried other links, and the problem is the same... I tried something like 20 direct link... nothing works... Does someone knows what might be the problem?</p>
java android
[1, 4]
550,925
550,926
Open Element on Click
<p>I apologise in advance for the poor quality of this question but here goes:</p> <p>I simply want an element to slide open on mouse click! That's it!</p> <p>Specifically, i want a single menu item which, when clicked, will slide open to reveal a form. </p> <p>What i'm after is almost exactly like an accordion menu in jQuery BUT they all rely on two or more elements to click on and open, whereas i only have one button whose default will be in 'closed' state.</p> <p>I am a complete Javascript novice (even less than novice), so editing existing JS code can prove quite tricky and error prone to me, but it seems what i'm after is 'fairly' simple and everything i have found online is for multiple elements in a menu, so i thought i'd see if anyone could help.</p> <p>I would have ideally asked this in the Javascript chat room but its empty at the mo.</p> <p>I hope someone can help</p>
javascript jquery
[3, 5]
4,584,582
4,584,583
trying to add variable for div id. is it possible?
<p>i am trying to use variable inside body. just see below sample code</p> <pre><code>&lt;body&gt; &lt;div class="demo"&gt; &lt;script&gt; var count = 4; for(i=1;i&lt;=count;i++){ var varSlid = "A"+i; $('.demo').append('&lt;div id= varSlid &gt;&lt;/div&gt;&lt;/br&gt;'); } &lt;/script&gt; &lt;/div&gt; &lt;/body&gt; </code></pre> <p>but it is throwing errors. please check and tell me where the error is?</p>
javascript jquery
[3, 5]