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
1,858,400
1,858,401
Let user know of long operation when initiating request to download file
<p>I have some routine code which downloads a file (as below). However, while this is processed (there is lag time between the request to download the file and the save dialog box coming up), I want to add some sort of JavaScript modal alert to let the user know of the pending operation. How could I easily do this from a user control?</p> <pre><code> System.Web.HttpResponse response = System.Web.HttpContext.Current.Response; response.ClearContent(); response.Clear(); response.ContentType = "text/plain"; response.AddHeader("Content-Disposition", "attachment; filename=" + zipFileName + ";"); response.TransmitFile(zipFilePath); response.Flush(); response.End(); </code></pre>
c# asp.net
[0, 9]
1,359,216
1,359,217
Why does my dynamic form submit not use the jQuery-replaced button label value?
<pre><code>&lt;button class="gocrazy" label="1"/&gt; &lt;button class="gocrazy" label="2"/&gt; &lt;button class="gocrazy" label="3"/&gt; &lt;form id="crazyform" method="POST" action="/crazyform"&gt; &lt;input type="hidden" id="crazyreplace" value="REPLACE WITH BUTTON LABEL ON CLICK"&gt; &lt;/form&gt; $(".gocrazy").button(); $(".gocrazy").click( function(event) { var gocrazy = $(this).attr("label"); $("#crazyreplace").val(gocrazy); $("form#crazyform").submit(); return false; }); </code></pre> <p>I want to submit this form with a value replaced from the button label (1, 2 or 3) into the hidden <code>crazyreplace</code> field using jQuery.</p> <p>But the form is submitted with the original text message (<code>REPLACE WITH BUTTON LABEL ON CLICK</code>).</p> <p>What is wrong here?</p>
javascript jquery
[3, 5]
2,138,446
2,138,447
does not close android app by pressing back button
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2354336/android-pressing-back-button-should-exit-the-app">android pressing back button should exit the app</a> </p> </blockquote> <p>I am trying to close an app using mobile's back button. Currently I am overriding <code>onKeyPressed</code> method and calling <code>moveTaskToBack(true);</code>. It does hides the app but does not close it. It still remains in the memory. How can I close the app by pressing the back button?</p> <p>Here is my code</p> <pre><code>@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { moveTaskToBack(true); return true; } return super.onKeyDown(keyCode, event); } </code></pre>
java android
[1, 4]
5,978,695
5,978,696
jQuery Slider/Carousel update content after DOM
<p>guys.</p> <p>I have searched for an jquery slider/carousel plugin where i can update your content after DOM-ready, with AJAX call or something like that. Anyone knows an plugin where this is possible? Add new jquery slide after her ready?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
5,292,885
5,292,886
How to access element id and other attributes using jQuery?
<p>I have JavaScript method which acts when a particular class (mcb) of forms are submitted:</p> <pre><code>function BindCloseMessage() { $(".mcb").submit(function(event) { alert("closing..."); //Here I want to get the id of form event.preventDefault(); }); } </code></pre> <p>In place of alert call, I need to access the id of form whose submit is called. How can I do it? Even better will be the tip for accessing any attribute...</p> <p>Thanks</p>
javascript jquery
[3, 5]
662,034
662,035
is there any function which can help escape all meta-characters contained in jquery‘s selector?
<p>Straight from jquery docs: </p> <p>If you wish to use any of the meta-characters (such as <code>!"#$%&amp;'()*+,./:;&lt;=&gt;?@[\]^&amp;a{|}~)</code> as a literal part of a name, you must escape the character with two backslashes: \. For example, if you have an element with <code>id="foo.bar"</code>, you can use the selector <code>$("#foo\\.bar")</code>.</p> <p>I want to know is there any function can help me to escape those meta-charcters?</p>
javascript jquery
[3, 5]
1,479,136
1,479,137
jQuery how to set a Binding Order
<p>is there a way to set a binding over, precedence? </p> <p>I have a link like so:</p> <pre><code>&lt;a href="" class="popItUp" data-track"stuff"&gt; &lt;/a&gt; </code></pre> <p>popItUp binds to take the url and open in a popup.</p> <p>data-track is another binding that is used to send event tracking data. </p> <p><strong>Problem:</strong> popItUp returns false, and the data-track binding is never fired. Is there a way to always make data-track run first by jQuery as it will always return true?</p> <p>Thanks</p> <p><strong>Code</strong></p> <pre><code>// Mixpanel Click Tracking $('[data-track]').live('click', function () { console.log('track it please'); }); $('.popItUp').popupWindow({height:300,width:600,centerBrowser:1}); </code></pre> <p>popUpWindow is a plugin: <a href="http://swip.codylindley.com/popupWindowDemo.html" rel="nofollow">http://swip.codylindley.com/popupWindowDemo.html</a></p>
javascript jquery
[3, 5]
2,855,353
2,855,354
drag and drop in php
<p>A <strong>drag and drop</strong> work in <strong>firefox</strong> but when see <strong>ie</strong>(internet explore) <strong>drag and drop</strong> is not work a code in php</p> <p>please help me.</p> <p>I use jquery ui librey ui.droppable.js but in some error</p> <p>$.ui is undefined [Break On This Error] </p> <p>_ui: function(c)</p>
php javascript
[2, 3]
4,007,933
4,007,934
How to invoke a function onChange of an atrribute value in Jquery
<p>I'm trying to invoke a function <code>onChange</code> of an attribute value. What I'm trying is, When the user clicks on one of below div</p> <pre><code> &lt;div id="selected" class="vblock"&gt; &lt;div class="vblock"&gt; &lt;div class="vblock"&gt; &lt;div class="vblock"&gt; &lt;div class="vblock"&gt; </code></pre> <p>The value of <code>src</code> attribute of <code>embed</code> tag will be changed.</p> <pre><code>&lt;embed id="vplayer" width="100%" height="100%" name="plugin" src="resources/videos/xyz21.mp4" type="video/mp4"&gt; </code></pre> <p>I need to invoke a function during the change of <code>src</code> value.</p> <p>or</p> <p>I need to invoke the function during the modification of <code>&lt;div class="vblock"&gt;</code> to <code>&lt;div id="selected" class="vblock"&gt;</code></p> <p>What I tried is :</p> <pre><code>$('embed[src=#]').change(function(e){ // code </code></pre> <p>Please anyone help me to do this stuff...Thanks.....</p>
javascript jquery
[3, 5]
2,776,935
2,776,936
Scoping to a DOM element
<p>I'm just trying to clean up some jQuery, and can't quite figure out what the call is to scope jQuery calls to a specific dom element. To give an example, I have the following code:</p> <pre><code>$('#outer-element .first-class').html('wanna'); $('#outer-element .second-class').html('scope'); $('#outer-element .third-class').html('better'); </code></pre> <p>I'm guessing calling each of those first/second/third-class calls to one common outer-element call is a more elegant approach, I'm just not sure what the syntax is to do that. I'm guessing something along the lines of</p> <pre><code>$('#outer-element').SOMETHINGGOESHERE(function() { $(this).find('.first-class').html('wanna'); $(this).find('.second-class').html('scope'); $(this).find('.third-class').html('better'); }); </code></pre> <p>Any ideas? Anything more elegant than what I've suggested above? In short - I know the above is ugly. I'm looking for a prettier approach to JavaScript like this.</p>
javascript jquery
[3, 5]
5,076,151
5,076,152
How to select all elements except the ones with a given class, using jQuery?
<p>I want to select all elements in my page except those with the class "searchBox".</p> <p>How can I do that?</p> <p>I want to disable text selection on all elements except input elements</p>
javascript jquery
[3, 5]
5,511,939
5,511,940
Setting a variable using the value of multiple selects, each time any of the selects is changed
<p>I have a list of items that I'm trying to "filter" with a set of 4 selects by matching the value of the select options to the classes I have applied to the list items. Right now, I have it working so that each time you choose a new option with any of the 4 selects, the entire list is reset, and only those items with a class that matches the value of the option you just selected is visible. I would like to have it work so that each time a new option is selected from any of the 4 selects, I could filter by the values of all 4 selects, not just the one that was just changed.</p> <p>Here's what I have right now - any help is appreciated!</p> <pre><code>$(".sort-options select").change(function() { var topics = $(this).val(); $(".list-schools li").hide().filter("." + topics).show(); }); </code></pre>
javascript jquery
[3, 5]
3,511,648
3,511,649
facebook login code
<p>In facebook..when u enter correct email address but incorrect passwd..they send u an email with an Instant login button..user can login using that instant login link only once..How did they implement this ? Where can i find its code? I mean how do they find out Instant Login link has been clicked only once ??</p> <p>Any similar code over internet?</p>
c# asp.net
[0, 9]
3,085,484
3,085,485
passing variable to PHP through javascript
<p>I'm kinda new to working with JS and PHP and stumbled upon a little problem. Im trying to pass the ID of a textbox I clicked through to PHP and then query a database with that ID. I tried the following code to check if the variable gets passed on, but nothing is alerted:</p> <pre><code>&lt;script type="text/javascript"&gt; function Like(ID) { &lt;?php $id = ID; print "alert('$id');"; ?&gt; } &lt;/script&gt; &lt;input type="text" id="1" onclick="Like(this.id)" &gt; </code></pre> <p>What I'm trying to accomplish:</p> <p>I've got a database of videos with a unique ID. I have 2 buttons next to each video for either liking or disliking. The 2 buttons will have an id based on the ID of the video. For example video number 2 has 2 buttons: like(id=L2) and dislike(id=D2). When the user clicks either one of those buttons, I want to update the videos table's "likes" column without the page reloading. Would that be possible?</p>
php javascript
[2, 3]
1,588,450
1,588,451
How to get the value of a CSS property using JQuery?
<p>I am trying to set a box A to jump to the same x-position as box B. How do I do this? I tried the following but it does not work (the second line):</p> <pre><code>$("#boxa").animate({ left: $("#boxb").left }, 1000, function() { }); }); </code></pre> <p>Thanks,</p> <p>Sam</p>
javascript jquery
[3, 5]
288,252
288,253
Porting C++ Project to Android
<p>I have a big C++ application developed on windows,I need to port it to Android to run it as galaxy tab application.</p> <p>I read many tutorials about NDK but it seems difficult to embed C++ files into Android.</p> <p>Can I develop "DLL" using NDK? and invoke DLL from DLL?</p> <p>any help would be highly appreciated .</p>
c++ android
[6, 4]
5,948,785
5,948,786
Add events in the background with jquery
<p>I have an html ul list of 10,000+ elements and want to add custom hover tooltip events and do some other processing to each one. To do this on document.ready takes 2-3 seconds and freezes the browser. How can I do this asynchronously so that the browser doesn't freeze?</p> <p>I've been reading about setTimeout, jQuery queue and deferred, but maybe I'm too dense to understand it all. This guy had interesting stuff <a href="http://erickrdch.com/2012/05/asynchronous-loop-with-jquery-deferred.html" rel="nofollow">http://erickrdch.com/2012/05/asynchronous-loop-with-jquery-deferred.html</a></p> <p>Here's my each() loop that adds the hover.</p> <pre><code>$('#biglist li').each(function(index) { $(this).hover(function(e){ ...do stuff... }); }); </code></pre> <p>Thanks for your help.</p>
javascript jquery
[3, 5]
4,587,654
4,587,655
Best way to group all your C# classes in 1 class
<p>What's the best way to have all your classes in 1 class, and accessing this 1 class can allow you to access all the other classes, so this</p> <pre><code>using Student.Classes.TextFileHandler; using Student.Scripts.Constants; using Student.Classes.Common; using Student.Classes.Enum; </code></pre> <p>would all be in 1 class, lets say the general class, and when I access the general class, I can access all of the other classes</p>
c# asp.net
[0, 9]
4,697,591
4,697,592
Reset the Value of a Select Box
<p>I'm trying to reset the value of two select fields, structured like this,</p> <pre><code>&lt;select&gt; &lt;option&gt;&lt;/option&gt; &lt;option&gt;&lt;/option&gt; &lt;option&gt;&lt;/option&gt; &lt;/select&gt; &lt;select&gt; &lt;option&gt;&lt;/option&gt; &lt;option&gt;&lt;/option&gt; &lt;option&gt;&lt;/option&gt; &lt;/select&gt; </code></pre> <p>jQuery,</p> <pre><code>$('select').each(function(idx, sel) { $(sel).find('option :eq(0)').attr('selected', true); }); </code></pre> <p>Unfortunately, no matter how many ways I try it, it just doesn't happen. Nothing in the console. I have no idea what's going on? I know there has to be a way to do this, you can do <strong>anything</strong> with JS</p> <p>EDIT: </p> <p>I figured out that the issue only occurs when I try to fire the code on the click of a dom element, however, I know that the code should be working, because when I have</p> <pre><code>$('p').click(function(){ console.log('test'); }); </code></pre> <p>It outputs 'test' to the console, but when I include the code in this function, nothing happens. Why is this?</p>
javascript jquery
[3, 5]
1,257,959
1,257,960
Is there an open source live support application
<p>I have 5-10 support reps who use Google Apps including Google Talk and Skype application</p> <p>I want to provide a "Live Support" option on my web site.</p> <p>When one or more employees log in to Google Apps the live support option should become available.</p> <p>Ideally the live support feature should simply enable a 1:1 chat session with a support rep with the ability to add additional support reps.</p> <p>and especially this open source provides API support for mobile devices such as android, iphone ...it can be written in PHP, Java...</p>
java php
[1, 2]
4,026,506
4,026,507
Trying to change a url on a page after a user enters specific text into a field
<p>I'm using jquery right now to change some text on my page when a user enters a specific word into a field on that page. I've changed text on the page by putting that text in a span and then using this code at the top of the page. This code is activated when the user enters the appropriate text in the field.</p> <pre><code>jQuery('#msg1').html('(after coupon code)'); </code></pre> <p>Essentially, this changes the text in the msg1 span. I would like to also change a url when a user enters the code into the field. I haven't been able to figure out how to do this. Any advice?</p>
javascript jquery
[3, 5]
4,192,278
4,192,279
FileInputStream to byte array in Android application
<p>I have a FileInputStream created using <code>Context.openFileInput()</code>. I now want to convert the file into a byte array. </p> <p>Unfortunately, I can't determine the size of the byte array required for <code>FileInputStream.read(byte[])</code>. The <code>available()</code> method doesn't work, and I can't create a File to check it's length using the specific pathname, probably because the path is inaccessible to non-root users.</p> <p>I read about <code>ByteArrayOutputStream</code>, and it seems to dynamically adjust the byte array size to fit, but I can't get how to read from the <code>FileInputStream</code> to write to the <code>ByteArrayOutputStream</code>. </p>
java android
[1, 4]
2,885,982
2,885,983
Embedding javascript object in dynamically created html
<p>I have a js function that recieves an array of items. The function itself creates html content dynamicly using a call to jquery html function. The problem is that I don't remember how to embed correctly the array inside the appended html. For example,</p> <pre><code>var ErrorsNotifier = { init: function(items) { var template = '&lt;div id="message"&gt;'; template += '&lt;div id="id"&gt;some message.&lt;br /&gt;&lt;br /&gt;'; template += '&lt;div class="errorsList"&gt;error desc&lt;/div&gt;&lt;/div&gt;'; template += '&lt;a href="#" class="goback" onclick="ErrorsNotifier.Back("+items+");"&gt;&lt;/a&gt;'; template += '&lt;a href="#" class="proceed" onclick="ErrorsNotifier.Next();"&gt;&lt;/a&gt;'; template += '&lt;input type="image" src="someimage" alt="" class="" onclick="window.open("someurl");"/&gt;&lt;/div&gt;'; $("#content").html(template); } } </code></pre> <p>After the html will be rendered to the body, clicking on the anchor tag return the following error - <code>Uncaught SyntaxError: Unexpected identifier</code> </p> <p>inspecting the anchor tag in the browser will show the following</p> <pre><code>a href="#" class="goback" onclick="ErrorsNotifier.Back([object Object]);" </code></pre>
javascript jquery
[3, 5]
5,917,425
5,917,426
Update page without trigger or event
<p>I'm implementing a twitter like news system on my website. It loads all news items on page load with an ajax call fine. But how do I show a new item without having a trigger like a page load or a click on something? So when a new item is added to the database, It should automatically be added to an open page, like an auto-update or something.</p>
php jquery
[2, 5]
4,040,163
4,040,164
get #var from url in php code error
<p>i want to get <code>#var</code> value from url like my url is <code>mydomain.com/index.php#1</code> so i want to get has(#) value from url which is <code>1</code> after some research i got this article <a href="http://www.stoimen.com/blog/2009/04/15/read-the-anchor-part-of-the-url-with-php/" rel="nofollow">http://www.stoimen.com/blog/2009/04/15/read-the-anchor-part-of-the-url-with-php/</a></p> <p>i use this code for get has(#) value, this is work fine in <code>JavaScript</code> but this is not work in <code>php</code> my code is :</p> <pre><code>&lt;script language="javascript"&gt; var query = location.href.split('#'); document.cookies = 'anchor=' + query[1]; alert(query[1]); &lt;/script&gt; &lt;?php echo $_COOKIE['anchor']; ?&gt; </code></pre> <p>this code give me <code>alert</code> value in <code>JavaScript</code> but not <code>echo</code> value. any solution for that ?</p>
php javascript
[2, 3]
5,415,175
5,415,176
How to pass all requests to handler using Visual Studio Development server?
<p>I've got an empty ASP.NET project with single HttpHandler, saved in Index.ashx. I want all requests to go through this, </p> <pre><code>public void ProcessRequest(HttpContext context) </code></pre> <p>I've modified my project project properties so that it loads that handler by default. However, if I type a different Url in the browser it won't be passed through that handler. How do I get it to do that?</p>
c# asp.net
[0, 9]
4,047,558
4,047,559
replace spaces with randam values
<p>I have a paragraph ..i want to spaces are replace with some randam values. for example</p> <p>$string="Kapa dim nen ma sibilol sebire rola lunie. Ifosamac rapieco him oku, vimeror eralerie puredus elacecos tusorop gobas oliw gepalar."</p> <p>and $result="Kapa[rand2]dim[mailingid]nen[rand2]ma[rand1]sibilol[rand1][mailingid]sebire [rand1]rola[rand2]lunie.Ifosamac[mailingid]rapieco[rand1]him[rand1][mailingid]oku,[rand1]vimeror[mailingid]eralerie[mailingid]puredus[hashx]elacecos[rand1]tusorop[rand1][mailingid]gobas[rand1]oliw[mailingid]gepalar."</p> <p>where Randam values are "[mailingid],[rand1],[rand2],[hashx]"</p> <p>please give me php code ....</p>
php javascript
[2, 3]
2,323,182
2,323,183
Ajax request cross domain json data and display?
<p>I have a function to get JSON data from another domain, but I don't know what is wrong with it. It never fires the success function and and no errors are returned.</p> <pre><code>$.ajax({ url: "http://other-domain.com/sample/Json.aspx", dataType: "jsonp", type: 'get', crossDomain: true, jsonp: 'jsonp_callback', success: function() { alert('abc'); //when success take json data string but i din get in here } }); </code></pre> <p>Does anyone know what's wrong here?</p>
javascript jquery
[3, 5]
3,693,400
3,693,401
Additional Emulator Command Line Options is not showing on my eclipse?
<p>Additional Emulator Command Line Options is not in my eclipse, why, and how can i add it? I need it for creating sd card for emulator in android.</p>
java android
[1, 4]
3,417,155
3,417,156
Handle the httpmodule in iis
<p>If you see the yahoo site, when you enter www.yahoo.com, the yahoo server gets your IP, and redirects you to the specific domain (yahoo.ca,yahoo.us,....)</p> <p>Now, I want do this,Not for special site, I want to get any request send to iis (www.1.com,www.2.com,www.3.com) and with the algorithm, redirect user to the new site for example:</p> <pre><code> Request: www.1.com GO To -&gt; www.yahoo.com Request: www.2.com GO To -&gt; www.google.com .... </code></pre> <p>I want handle IIS, no each webconfig's site. </p> <p>Can anybody help me?</p>
c# asp.net
[0, 9]
5,810,341
5,810,342
Detecting when the @ key is pressed
<p>I am trying to detect when a user pressed the @ key in a text box. I can use JQuery to handle the keyup event like so...</p> <pre><code>$('#target').keyup(function(event) { }); </code></pre> <p>But what do I do from here to test for the @ character? I know I can use <code>event.which</code> to get a key code. But in this instance I would need to also check for shift - technically this is not a problem, but I know the @ key can move around with different language settings and I am worried that this may prove to be inconsistent. Maybe I am worried wrongly, and I can rely on it always being <code>SHIFT + 192</code>?</p> <p>Ideally I would like something like the following to allow for easier configuration later on...</p> <pre><code>event.something == "@"; </code></pre> <p>Thanks for any help</p>
javascript jquery
[3, 5]
213,557
213,558
Best server side technology
<p>What is the best server side technology to learn ?</p>
php asp.net
[2, 9]
4,343,341
4,343,342
How to add alphanumeric check to jQuery validation plugin?
<p>This exact question was asked here:</p> <p><a href="http://stackoverflow.com/questions/1053618/using-the-jquery-validation-plugin-how-can-i-add-a-regex-validation-on-a-textbox">using the jquery validation plugin, how can I add a regex validation on a textbox?</a></p> <p>But unfortunately the solution posted isn't working for me. I am using the very popular jquery validation plugin, specifically this version:</p> <p><a href="http://jquery.bassistance.de/validate/jquery.validate.js" rel="nofollow">http://jquery.bassistance.de/validate/jquery.validate.js</a></p> <p>I tried adding the custom alphanumeric function (from the above stack overflow question) like so:</p> <pre><code>&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://jquery.bassistance.de/validate/jquery.validate.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function() { $.validator.addMethod("loginRegex", function(value, element) { return this.optional(element) || /^[a-z0-9\-]+$/i.test(value); }, "Username must contain only letters, numbers, or dashes."); $("#myForm").validate({ rules: { "login": { required: true, loginRegex: true, } }, messages: { "login": { required: "You must enter a login name", loginRegex: "Login format not valid" } } }); }); &lt;/script&gt; &lt;form method="post" id="myForm"&gt; &lt;input type="text" name="login" /&gt; &lt;input type="submit" value="Go" /&gt; &lt;/form&gt; </code></pre> <p>If you run this code you can see that it only validates for some type of input, it doesn't validate the input through the custom alphanumeric function. How can this be made to work?</p>
javascript jquery
[3, 5]
3,907,181
3,907,182
Searching through large list of ordered strings
<p>Right now as part of my android app I have a .csv file that contains aobut 15,000 lines stored on the sd card of the phone. Every time my app launches it reads in those 15,000 lines into two parallel arrays. I do this for 3 files so in total I have 6 arrays storing 15,000 elements each. I need to search through these items quickly while maintaining order.</p> <p>I'm worried if I keep the code the way it is I'm going to start running out of memory on phones and having the app crash. Would it be faster just to search through the csv file using <code>readline</code> instead of reading the entirety of each array into array lists so I don't run into memory issues? Is there a better way to do this while maintaining order?</p> <p>The content on the SD card is in the following form:</p> <pre><code>New York, test1 New Jersey, test2 Colorado, test3 Arkansas, test4 New York, test5 etc.. </code></pre>
java android
[1, 4]
4,653,255
4,653,256
How do I send a stream from a Java applet to an ASP .NET web site?
<p>I would like to be able to send a stream of binary data to an asp .net website from a java applet hosted in the same website.</p> <p>I found <a href="http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html" rel="nofollow">this link</a> which talks about this issue, but I am unsure how to actually receive the data on the website.</p> <p>The streams I will be sending will probably be in the order of 1mb-20mb in size and I will need to send additional information, such as a file name.</p> <p>I suspect I would implement an IHttpHandler to handle a POST, but I'm unsure how to approach this.</p> <p>Any ideas anyone?</p> <p>Thanks.</p>
c# java asp.net
[0, 1, 9]
1,846,181
1,846,182
jQuery: how to refresh javascript value on select event?
<p>I have such code:</p> <pre><code>var regions = [{'label': 'array', 'value': '1'}]; //default values $("#auto1").select({ regions = jQuery.parseJSON( //updating process $.ajax({ type: 'POST', url: '/ajax/place/', data: { country: value } }) ); return false; }); $("#auto2").some_func({ initialValues: regions, //here must be updated values, but it's not }); </code></pre> <p>I think it is understandable from above code: when page loaded, element #auto2 has default values, but when I select smth from #auto1 it must be updated, but it's not.</p> <p>How can I update the values corresponding to data value.</p> <p>Thanks!</p>
javascript jquery
[3, 5]
1,470,123
1,470,124
Remove items from the DOM that have been added with Javascript and jQuery?
<p>I am working on a JavaScript/jQuery project that adds a set of divs and input fields to a page when a button is clicked, there is another button that removes these items from a page when that button is clicked.</p> <p>My problem is it does not delete items from the page that have been added to the page after the page has loaded. So anything added to the page with Javascript is not removed with Javascript.</p> <p>Below is the code I am using the <code>.on</code> jQuery event but it does not do what I explained. </p> <p>How can I make the code below work on items that are added to the page with Javascript after the Dom has loaded?</p> <pre><code>// Remove "Deleted" Rows from View and mark as a Deleted item $(".delete").on('click',function() { $(this).parents(".dnsRecord").addClass("deleted").find("input.delete").val("true"); $(this).parents(".dnsRecord").find("span.undo").fadeIn('slow'); PanelDNS.unsavedChanges = true; }); </code></pre>
javascript jquery
[3, 5]
193,620
193,621
Retrieve value of cookie from another page in JavaScript or jquery
<p>I am working on a form <a href="http://evmyf.vzhgw.servertrust.com/Articles.asp?ID=257" rel="nofollow">http://evmyf.vzhgw.servertrust.com/Articles.asp?ID=257</a></p> <p>On the form I have a link called upload logo. It opens a window to upload an image. I have stored the image name that is uploaded in the window in a cookie. The cookie name is UploadFile. I want to retrieve the value of the cookie on the link I mentioned above. How can I do it? Please advise.</p> <p>On the upload logo page that is the new window, I have created the cookie and stored its value using following code in ASP.</p> <pre><code>Response.Cookies("UploadFile")=File.FileName fname=Request.Cookies("UploadFile") response.write("UploadFile=" &amp; fname) </code></pre>
javascript jquery
[3, 5]
1,663,650
1,663,651
Getting complex attribute value of object
<p>Given json like this :</p> <pre><code>{ "rss": { "page": 1, "results": [{ "type": "text", "$": 10 }], "text": [{ "content": "Lorem ipsum dolor sit amet.", "author": { "name": "Cesar", "email": "[email protected]" }, }, { "content": "Tema Tis rolod muspi merol.", "author": { "name": "Cleopatre", "email": "[email protected]" }, }] } </code></pre> <p>In javascript, I can retrieve value like this :</p> <pre><code>var json = JSON.parse(datajson); $.each(json.text, function(key, val) { // this one is ok var content = val['content']; // this one does not work var authorname = val['author.name']; }); </code></pre> <p>Is this a way, given the attribute name in a string format, to retrieve the value of a complex object, for instance <code>json.text[0].author.name</code>?</p> <p><strong>EDIT</strong> I would like to store the needed attributes in another object like :</p> <pre><code>[ { dt: "Text content", dd: "content" }, { dt: "Author name", dd: "author.name"} ] </code></pre>
javascript jquery
[3, 5]
1,484,030
1,484,031
AsyncSocket writeData issue
<p>I am connecting to a server socket using the following code:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; asyncSocket = [[AsyncSocket alloc] initWithDelegate:self]; NSError *err = nil; //[asyncSocket connectToHost:@"192.168.0.200" onPort:8000 error:&amp;err]; if(![asyncSocket connectToHost:@"192.168.0.78" onPort:2055 error:&amp;err]) { [asyncSocket connectToHost:@"192.168.0.78" onPort:2055 error:&amp;err]; } } </code></pre> <p>Then in the didConnectToHost delegate, i am writing few text:</p> <pre><code>- (void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port { NSLog(@"onSocket:%p didConnectToHost:%@ port:%hu", sock, host, port); for(int i=0;i&lt;5;i++){ NSString* str= [NSString stringWithFormat: @"Hello Server: %d",i]; NSData* data=[str dataUsingEncoding:NSUTF8StringEncoding]; [sock writeData:data withTimeout:-1 tag:1]; } } </code></pre> <p>When I connect to the socket, the connected message is displayed on the server side console. On the server side, the data is being read from the stream with streamReader. We are using TCPListener class on the server side(c# .Net). But when I write data from the client side socket, and try to read the data sent by client, streamReader object on the server is getting empty data. When we quit the client application, the streamReader object in the server side is getting the data which was sent by the client.</p> <p>We need to read the data at server side immediately after writing from the client side rather than quitting the application.</p> <p>Can anyone help me to solve this issue? </p>
c# iphone
[0, 8]
3,847,523
3,847,524
I want to learn C# and C++ and other such langurages...What is the best way?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/17988/how-to-learn-python">How to Learn Python</a> </p> </blockquote> <p>I have recently started a new job and knowing a few more programming languages would be VERY helpful! any ideas where/how to learn C#, C++, perl, python, etc... as quick as possible?</p>
c# c++
[0, 6]
3,995,918
3,995,919
Custom Map Shortest Path
<p>I have a custom map designed in Illustrator . I need to find shortest path beetween two places in Map and i should highlight the path.The Map is designed in such a way that Roads are represented by yellow lines,Houses by Red,Grass by green,water by blue. Map size is 2000 X 3000 pixels resolution.</p> <p>To find Shortest path I planned to implement A* Algorithm.</p> <p>The problem is how do i access my graphic map in my code ? Do i need take a array of size 2000x3000 metioning which pixels has road , water ,building.To represent them i thought assigning values road by 1 , water by 2 , houses by 3. But i think it is a complicated and long process.</p> <p>Is there any other solution ?</p>
c# java
[0, 1]
982,401
982,402
Android-Close Other Apps
<p>I have some code that will launch a different application using intents but what can I do to close or kill the other app?</p> <p>Here is the launch code (works great):</p> <pre><code>Intent i = new Intent(); i.setAction(Intent.ACTION_MAIN); i.addCategory(Intent.CATEGORY_LAUNCHER); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.setComponent( new ComponentName(resolveInfo.activityInfo.applicationInfo.packageName, resolveInfo.activityInfo.name)); </code></pre> <p>I tried to kill the background processes but no luck:</p> <pre><code>ActivityManager activityManager = (ActivityManager) context.getSystemService(context.ACTIVITY_SERVICE); activityManager.killBackgroundProcesses("com.pandora.android"); </code></pre> <p>I also tried this to kill it:</p> <pre><code>context.stopService(new Intent(context, Class.forName("com.bla.bla"))); </code></pre> <h3>Update:</h3> <p>I want to kill other applications because I launch other applications and users have requested this additional feature (auto kill is a natural extension of auto launch). Please answer the question of how to accomplish this in code. I know about Advanced Task Mgr so it is possible but how?</p>
java android
[1, 4]
1,729,789
1,729,790
Trying to get flattened data out of map()
<p>I'm currently trying to create an object to be used in a Json request, based on the controls on the page and their values.</p> <p>I'm using the jquery <code>map()</code> fuction to get the keys and values out of the controls like so</p> <pre><code>var data = $("fieldset &gt; div.section").map(function (i, e) { var result = {}; result[e.children[0].id.substring(3);] = e.children[1].value; return result; }).get(); </code></pre> <p>This gets the data I'm after, but I end up with nested objects rather than an array, this looks like so</p> <pre><code>[{"ClientId":"123456"},{"ClientIdType":"5"},{"City":"Brisbane"},{"Sex":"10"},{"PostCode":"4064"},{"State":"QLD"}] </code></pre> <p>But what I want is something like</p> <pre><code>{"ClientId":"123456","ClientIdType":"5","City":"Brisbane","Sex":"10","PostCode":"4064","State":"QLD"} </code></pre> <p>Is there a way to do this in one go, or should I just iterate over the array again to flatten it?</p>
javascript jquery
[3, 5]
3,706,058
3,706,059
Problem with removing child
<p>I have two drop down forms. When the first is "changed" the second is populated with some data via ajax.<br> It's work but the value of the second drop down is not cleared on every request (I'm using $('#second_drop_down').children().remove();)</p> <p>Here is sample code</p> <pre><code>$('#first_drop_down').live('change', function() { var x = "some ajax data recived via ajax"; $('#second_drop_down').children().remove(); $('#second_drop_down').append(f); }); </code></pre>
javascript jquery
[3, 5]
1,536,239
1,536,240
javascript in asp.net
<pre><code>&lt;asp:RadioButtonList ID="RdoBtnHasNotified" runat="server" RepeatDirection="Horizontal" AutoPostBack="True" OnSelectedIndexChanged="RdoBtnHasNotified_SelectedIndexChanged"&gt; &lt;asp:ListItem Value="1"&gt;Yes&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="0" Selected="True"&gt;No&lt;/asp:ListItem&gt; &lt;/asp:RadioButtonList&gt; &lt;asp:TextBox ID="TxtHowNotified" runat="server" TextMode="MultiLine" MaxLength="100"&gt;&lt;/asp:TextBox&gt; </code></pre> <p>i want to enable textbox by clicking on radiobuttonlist but i am not able to do so without making autopostback=true.how can i do it using javascript??</p>
asp.net javascript
[9, 3]
2,386,083
2,386,084
Inverted comma - php to javascript
<p>Consider this line of JavaScript</p> <pre><code>str += "onclick=runTest(" + field + "," + atom[0] + ",'" + atom[1] + "'); </code></pre> <p>In the browser, it renders as:</p> <pre><code>onclick="runTest(104,213,'Orsan" Miller'); </code></pre> <p>There is an inverted comma between Orsan and Miller although in fact there was not any inverted comma, it's causing a bug.</p> <pre><code>atom[1] = Orsan Miller </code></pre> <p>'Orsan Miller' comes from DB query in PHP.</p> <p>How can this be fixed?</p>
php javascript
[2, 3]
1,042,620
1,042,621
Onload click the link
<p>At the moment the following code will load only when the users clicks the link.</p> <p>I want on load of the page this to happen without the user having to click.</p> <pre><code>&lt;script&gt; $(document).ready(function() { // Support for AJAX loaded modal window $(document).on('click', '.btn-modal', function() { $.get($(this).attr('data-target'), function(data) { $('#modal').html(data); $('#modal').modal('show'); }, 'html'); }); });​ &lt;/script&gt; &lt;!-- Modal window to load dynamic content --&gt; &lt;div class="modal hide fade customDialog" id="modal"&gt;&lt;/div&gt; &lt;a class="btn btn-modal" data-target="page.html" &gt;Launch Modal&lt;/a&gt; </code></pre>
javascript jquery
[3, 5]
4,132,854
4,132,855
Leverage .Net to deal with 133 textBoxes?
<p>I have a 19 X 7 table with a textBox in each cell. Some textBoxes need to be read only, depending on the data that is loaded into them. On saving I have to examine each textbox and see if the value needs to be saved. Having to list 133 textboxes by hand takes a long while. I would be ecstatic to get it down to a row level, so I would only need to deal with 7 textBoxes and let .Net duplicate my effort 19 times. </p> <p>Is there better way to leverage .Net? </p> <p>The repeater looks promising, but I don't know how to reference a control that has been repeated, more over a group of controls.</p>
c# asp.net
[0, 9]
345,421
345,422
Associative style arrays in Javascript?
<p>I'm trying to assign an object in the style of an associate array in JS but it's failing, saying 'task.id' is undefined. Why is this?</p> <pre><code>var response = Object(); $('.task-list').each(function() { response[this.id][$('#' + this.id).sortable('toArray')]; }); </code></pre>
javascript jquery
[3, 5]
629,193
629,194
Comparing shared_ptr to managed language references
<p>Could someone explain to a C++ programmer most important differences between Java (and C# as well) references and shared_ptr (from Boost or from C++0x).</p> <p>I more or less aware how shared_ptr is implemented. I am curious about differences in the following ares:</p> <p>1) Performance. 2) Cycling. shared_ptr can be cycled (A and B hold pointers to each other). Is cycling possible in Java? 3) Anything else?</p> <p>Thank you.</p>
c# java c++
[0, 1, 6]
4,367,658
4,367,659
How to define distance in time in words in pure javascript?
<p>I would like to include very common feature in my web application. I would like the times/dates be written as the distance of time from now in words, for example (2 hours ago). </p> <p>Rails have excellent implementation of this functionality, but I need something like that written in pure javascript. The problem is, that lots of pages in my application are cached, and the only thing that would change is the actual time. </p> <p>Are there any extended libraries in JS which could translate a date to a distance of time in words? </p>
javascript jquery
[3, 5]
1,395,020
1,395,021
Calling javascript and C# on button/link click
<p>I currently have a Gridview with a itemTemplate which acts as a link which calls a javascript function:</p> <pre><code> &lt;ItemTemplate&gt; &lt;a href="javascript:;" onclick="simpleCart.add( 'name=&lt;%# Eval("Name") %&gt;' , 'price=&lt;%# Eval("Price") %&gt;' , 'quantity=1' );"&gt;Add To Cart&lt;/a&gt; &lt;/ItemTemplate&gt; </code></pre> <p>I need to add some functionality which I can only do in C#, so I was thinking of replacing the link with a button and when the button is clicked it calls both the C# function and the javascript function (they don't need to interact/share any data). Is this even possible?</p>
c# javascript asp.net
[0, 3, 9]
4,082,768
4,082,769
$.post not firing
<p>I have some script like this:</p> <pre><code>$("#button").click(function () { alert("before"); $.post("doAction.aspx?id=hotel", {}, function (response) { }); alert("after"); return false; }); </code></pre> <p>the <code>$.post</code> is not firing. I really don't know what the error is. I used the same script elsewhere and it worked fine. pls help out.</p>
jquery asp.net
[5, 9]
6,032,435
6,032,436
file Uploader plugins not working when master page linked?
<p>Hi i have jquery file upload plugin,it is working proper but when i link master page it is not working.below is code please help me ma aspx page</p> <pre><code>&lt;asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderForMainInfo" runat="server"&gt; &lt;script type="text/javascript" src="../Scripts/jquery-ui-1.8.21.custom.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="../Scripts/jquery.iframe-transport.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="../Scripts/jquery.fileupload.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { $('#fileupload').fileupload({ url: '&lt;%=ResolveUrl("AjaxFileHandler.ashx")%&gt;', replaceFileInput: false, dataType: 'json' }); }); &lt;/script&gt; &lt;input id="fileupload" runat="server" type="file" name="file"/&gt; &lt;/asp:Content&gt; </code></pre> <p>without master page means it is striking filehandler file,but when i use master page it wont please help me to solve this</p>
javascript jquery asp.net
[3, 5, 9]
271,347
271,348
jquery hint disappears when i click submit
<p>when user1 and user2 do not select anything from radio box the jquery validation triggers but removes the jquery hint from the 'fav food' textbox. how do i prevent this?</p> <p>working example: <a href="http://jsfiddle.net/NevcG/1/" rel="nofollow">http://jsfiddle.net/NevcG/1/</a></p>
javascript jquery
[3, 5]
3,178,091
3,178,092
using iPhone as android application development, testing phone
<p>Can i use my iPhone for android application development testing?</p>
iphone android
[8, 4]
1,746,631
1,746,632
How to reset select box using jquery
<p>i have two select boxes in html .I need to reset one select box when i select other</p> <pre><code>&lt;select id="name" &gt; &lt;option value=""&gt;select all&lt;/option&gt; &lt;option value="1"&gt;Text 1&lt;/option&gt; &lt;option value="2"&gt;Text 2&lt;/option&gt; &lt;option value="3"&gt;Text 3&lt;/option&gt; &lt;/select&gt; &lt;select id="name2" &gt; &lt;option value=""&gt;select all&lt;/option&gt; &lt;option value="1"&gt;Text 1&lt;/option&gt; &lt;option value="2"&gt;Text 2&lt;/option&gt; &lt;option value="3"&gt;Text 3&lt;/option&gt; &lt;/select&gt; </code></pre> <p>When i select an option of the first id ie name i need to reset the second options to all and viceversa. How can i do that</p>
javascript jquery
[3, 5]
5,701,693
5,701,694
Add a new linkbuton on gridview for viewing row details view
<p>I have a gridview and SqlDataSource to bind data to gridview!</p> <p>I need to add a link button called "Details" near the link buttons on the gridview : edit,select,delete and then it will bring the details view with the information for the row that where the Details button was clicked.</p> <p>For example: I have a gridview and I have to many columns to show on a page. and I want to show just few columns and then on selecting a button it will bring below in a details view all the columns that exists for that row.</p> <p>Can someone explain ? EDIT: the button was added I know how to execute the command when is clicked.</p> <p>Thanks</p>
c# asp.net
[0, 9]
5,190,020
5,190,021
Could you please explain this sort of JavaScript syntax from Jquery for me?
<p>As an example, here is a screenshot from jQuery1.8. <img src="http://i.stack.imgur.com/7BDkX.png" alt="enter image description here"></p> <p>Why can I do something like this from the perspective of jQuery source code ? Is <code>addClass</code> jquery's method? But what i saw was from <strong>jQuery.fn.extend</strong>.</p> <pre><code>$("xid").addClass("xxx"); </code></pre> <p>I am relatively new to JavaScript and wrote some pretty simple code like directly add a method in <strong>.html</strong>.</p> <pre><code> &lt;html&gt; &lt;script&gt; function m() { alert("simple"); } &lt;/script&gt; &lt;/html&gt; </code></pre> <p>I couldn't understand the complex syntax particularly in the JavaScript Framework like ExtJs,jQuery, although I have searched a number of relative documents about this, but I still don't have a clear understanding. Maybe I need to spend time seriously reading a special JavaScript book, but this moment I want to know the answer.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
5,825,931
5,825,932
how to grab uri values
<p>i had set a uri like this by java script</p> <pre><code>location.href="biling.php?itemsize="+value5+"&amp;"+value6; </code></pre> <p>and now i want to take this value5 and value6 into php. think </p> <pre><code>if value5 = 5 and value6=mg </code></pre> <p>then i want to take those values in to php variable as 5mg</p> <p>i tried to do this </p> <pre><code>$sizevalue=preg_replace('\'&amp;\'', '', $_GET['itemsize']); </code></pre> <p>but when i echo it it shows me only "5" how can i correct this? thank you.</p>
php javascript
[2, 3]
3,191,813
3,191,814
JQuery server side method call internal
<p>i often call my aspx server side method with the help of jquery....like</p> <pre><code>$.ajax({ type: "POST", url: "login.aspx/Authenticate", data: JSON.stringify(DTO), contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { sHtml = data.d; if (sHtml != "") { alert(sHtml); location.href = sHtml; } }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } }); </code></pre> <p>but the funny things is that i dont know how jquery call my static method from outside. i saw that when i call my server side method then page_load does not fire but in case of updatepanel partial postback page_load execute first.</p> <p>so i want to know the internal logic of jquery that how it can call server side method directly........looking for good explanation. thanks</p>
javascript jquery asp.net
[3, 5, 9]
2,758,550
2,758,551
How to render images in real-time
<p>I am looking for a solution\software that I can use in order to render buttons in real time. That is, I have an image and text, and I want them to be an image altogether in realtime.</p> <p>Thank you</p>
c# javascript
[0, 3]
4,569,447
4,569,448
how to use jquery .live()
<p>I've an input element with id newline. I'm using <code>$('#newline').elastic();</code> to make it elastic using a jquery plugin. The <code>input#newline</code> can also be appended through an ajax call in which case the code <code>$('#newline').elastic();</code> doesn't work and I've to use something like .live() to make it addressable in future also. </p> <p>So can anyone help me how to implement .live() in this case??</p>
javascript jquery
[3, 5]
4,311,404
4,311,405
display dropdownlist box option on jgrid
<p>I have a drop down list box where i display timezone with gmt hours.<br> Now I want to display this option in Jgrid. Is it possible?</p> <pre><code>for(..) { &lt;option value=&lt;%=tzone.getTimeZoneID() %&gt; &gt; &lt;%=tzone.getTimeZoneName() %&gt; &lt;/option&gt; } </code></pre> <p>In js file, i use </p> <pre><code> var timeZone = $("#backDropDownTimezone").val(); </code></pre> <p>hence only id is displayed but i want to display timezone name.</p>
java jquery
[1, 5]
3,380,778
3,380,779
How to know the element that triggered the event in hover jquery?
<p>is there a way to get the element? i.e:</p> <pre><code>$('#obj').hover(function() { },function() { /* here, i need to know the element that triggered this out event. */ }); </code></pre> <p>thanks.</p>
javascript jquery
[3, 5]
3,635,943
3,635,944
Create Email Account From C#
<p>Is there any web hosting email service that has an API for creating email account from code? </p>
c# asp.net
[0, 9]
1,988,874
1,988,875
How to check if checkbox is checked inside a particular form?
<p>I created a jQuery function to check if a checkbox is checked like so:</p> <pre><code>if ($('input:checkbox:checked').length &gt; 0){ } </code></pre> <p>I have two set of check boxes in two separate forms. When I use above code it checks for checkboxes in both forms. I want the <code>if</code> condition only for one form. How can I achieve it?</p>
javascript jquery
[3, 5]
1,924,188
1,924,189
Help changing content on the page using both php and javascript
<p>So I am trying to have a dynamic tabs kind of thing using both php and javascript. To make it much easier to understand, remember the two choices on facebook (Recent news and most recent) or something like that, when you click on one of them it just changes the content that you see in the middle without updating the page. i know how to delete the content in a div for example, but after deleting the content in the div (innerHTML = "") I want to populate it with the option chosen from the database.</p> <p>So let's say I have an option (all) and an option (only this) The default is all so when I run the page, I will just get all. However, if I click on only this, it will clear the div "my header" and will replace the content with the latest content from the database (database) and display it.</p> <p>For that I need both php and javascript, is there a sample or an easy way to do this before i start digging around.</p> <p>((Sorry if is not clear but the facebook example should be clear enough))</p>
php javascript
[2, 3]
3,149,491
3,149,492
Bug with Asp.Net 3.5? - Is it fixed in 4.0 or still need reporting?
<p>If I have a Request.PathInfo such as the url </p> <p><code>http://localhost/default.aspx/test</code> </p> <p>and a Button with no PostBackUrl set (aka it is "") and I click it, </p> <p>it changes the url to <code>http://localhost/default.aspx/default.aspx</code></p> <p>Is this a bug/feature and if it is a bug, was it fixed in 4.0?</p> <p>Edit: was a Button control not LinkButton</p> <p>Run this page, put in /test after the page name and click the button. The /test is removed and exchanged with the name of the page.</p> <pre><code>&lt;%@ Page Language="C#" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;script runat="server"&gt; &lt;/script&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:Button ID="Button1" runat="server" Text="Button" /&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
c# asp.net
[0, 9]
3,334,185
3,334,186
not set focus on element
<p>If to log out and press F5 several times focus don't set.</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { setTimeout(function() { var logonField = document.getElementById('UserName'); if (logonField) { logonField.focus(); logonField.click(); } }, 200); }); &lt;/script&gt; &lt;%= Html.TextBoxFor(m =&gt; m.UserName, new { @class = "logonField", style = "width:100px;"})%&gt;&lt;br/&gt; &lt;%= Html.ValidationMessageFor(m =&gt; m.UserName) %&gt; </code></pre>
javascript asp.net
[3, 9]
3,305,336
3,305,337
Convert.ToString not handling null
<p>I've read that Convert.ToString should handle null, but it doesn't work when it's passed a null object in my code</p> <p>In this case the object "Name" is null.</p> <pre><code>var name = Convert.ToString(Name.LastName); </code></pre> <p>I get Object reference not set to an instance of an object.</p>
c# asp.net
[0, 9]
870,434
870,435
Simply javascript jQuery code working in Chrome, not Firefox, Safari, IE
<p>I have a simple bit of jQuery code:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { // fade in content. $('.coming_soon').fadeIn(5000); }); &lt;/script&gt; </code></pre> <p>Website: <a href="http://test3.chuprinastudios.com" rel="nofollow">Classic Car Gallery Test</a></p> <p>It works quite nicely in Chrome with the "coming soon" image fading in nicely. Unfortunately this does not work in Firefox, Safari, and IE. What have I done wrong? Any input, advice or code snippets would be much appreciated.</p>
javascript jquery
[3, 5]
56,335
56,336
Byte type is weird
<p>I need to send some bytes over UDP Protocol the start squence is 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF</p> <p>When I define like this:</p> <pre><code>byte [] begin = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; </code></pre> <p>I get an error saying I need to cast those to byte type. Far as I know 0xFF doesn't exced the byte type so what is the problem ?</p> <p>If i write this it works :</p> <pre><code>byte [] begin = {(byte) 0xFF,(byte) 0xFF,(byte) 0xFF,(byte) 0xFF,(byte) 0xFF,(byte) 0xFF}; </code></pre>
java android
[1, 4]
4,908,118
4,908,119
Writing data to a file
<p>I want to create a folder from inside my app. Inside the folder, I want to create just one file (say <em>recents</em>) where the app will keep writing data line by line on each launch. </p> <pre><code>private void saveForRecents(String phoneNumber) { //Need to open File and write the phonenumbers that has been passed into it try{ File mydir = getDir("recents", 0); //Creating an internal dir; File fileWithinMyDir = new File(mydir, "recents"); //Getting a file within the dir. FileWriter fw = new FileWriter(fileWithinMyDir.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(phoneNumber); bw.newLine(); bw.flush(); bw.close(); }catch(Exception e){ Toast.makeText(getApplicationContext(), "Failed to write into the file", Toast.LENGTH_LONG).show(); } } </code></pre> <p>How do I access the contents of the <em>recents</em> file that is inside my directory <em>mydir</em>? And I want to access the data line by line as I'm writing data line by line. I would really appreciate if someone took their time to explain me how to do it because I need to learn it. Also please let me know if I am doing something wrong.</p>
java android
[1, 4]
2,810,034
2,810,035
Practical point of view: Why would I want to use Python with C++?
<p>I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python?</p> <p>I'd appreciate a simple example - Boost::Python will do</p>
c++ python
[6, 7]
3,079,817
3,079,818
making php response to remain visible when page refresh
<p>It is all working fine in my login-script. I get the right responses in my div (id=login_reply) and the session starts. But whenever I refresh the page, the login_reply is gone. How am I able to keep the login_reply? Thank you!</p> <p>Here is the php: </p> <pre><code>if (isset($_POST['username'], $_POST['password'])) { $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string(md5($_POST['password'])); $check = mysql_query("SELECT * FROM `userbase` WHERE `user_name` = '$username'"); if (mysql_num_rows($check) &gt; 0) { while ($row = mysql_fetch_assoc($check)) { $user_id = $row['user_id']; $user_name = $row['user_name']; $user_email = $row['user_email']; $user_password = $row['user_password']; if ($password == $user_password) { $_SESSION['user_id'] = $user_id; if (isset($_SESSION['user_id']) &amp;&amp; $_SESSION['user_id'] != '') echo "Welcome back '$user_name'!"; else { echo 'no'; } } else echo 'no'; } } else echo 'no'; } </code></pre> <p>Here is the jQuery</p> <pre><code>$(document).ready(function() { $('#login').click(function() { var username = $('#username').val(); var password = $('#password').val(); $.ajax( { type: 'POST', url: 'php/login.php', data: 'username=' +username + '&amp;password=' + password, success: function(data) { if (data != 'no') { $('#logform').slideUp(function() { $('#login_reply').html(data).css('color', 'white'); }); } else $('#login_reply').html('Invalid username or password').css('color', 'red'); } }); return false; }); }); </code></pre>
php jquery
[2, 5]
2,068,328
2,068,329
Is self.location clearing the session?
<p>There is a search form <code>search.php</code>. After clicking the <code>Search now</code> button I go to <code>search_result.php</code> page and the data brought through the POST value are set in the session.</p> <p>There is a button called <code>"Edit Ur search"</code> in the <code>search_result.php</code> page.When I click on it it should bring me back to <code>search.php</code> where the values set in the session must be displayed and the search form must be pre-filled with those session values.</p> <p>In <code>search_result.php</code> I call <code>edit_search()</code> on the click event on <code>"Edit Ur search"</code> button</p> <pre><code>function edit_search(){ var url = "hotels.php"; self.location = url; } </code></pre> <p>But when I return back to search.php I loss the session value. Is it due <code>self.location</code> clearing the session?</p> <p>Any other method to complete the requirement is appreciated.</p>
php javascript
[2, 3]
544,967
544,968
Why does my dynamic form submit not use the jQuery-replaced button label value?
<pre><code>&lt;button class="gocrazy" label="1"/&gt; &lt;button class="gocrazy" label="2"/&gt; &lt;button class="gocrazy" label="3"/&gt; &lt;form id="crazyform" method="POST" action="/crazyform"&gt; &lt;input type="hidden" id="crazyreplace" value="REPLACE WITH BUTTON LABEL ON CLICK"&gt; &lt;/form&gt; $(".gocrazy").button(); $(".gocrazy").click( function(event) { var gocrazy = $(this).attr("label"); $("#crazyreplace").val(gocrazy); $("form#crazyform").submit(); return false; }); </code></pre> <p>I want to submit this form with a value replaced from the button label (1, 2 or 3) into the hidden <code>crazyreplace</code> field using jQuery.</p> <p>But the form is submitted with the original text message (<code>REPLACE WITH BUTTON LABEL ON CLICK</code>).</p> <p>What is wrong here?</p>
javascript jquery
[3, 5]
2,134,443
2,134,444
Is there any way to keep information safe in an Android apk?
<p>AFAIK Android decompilation allows one to extract every bit of information from an apk. How can I store information like ftp passwords or other confidential strings in Java or any other XML file? Is there any way other than calling a service?</p> <p>EDIT Problem:</p> <pre><code>String uname = "mks"; String part1="pass"; String part2="my"; String part3="word"; </code></pre> <p>As per David answer i obfuscating a string but after dcompilation i able to see my password</p> <pre><code> String[] arrayOfString = new String[2]; arrayOfString[0] = "mks"; arrayOfString[1] = ("my" + "pass" + "word"); </code></pre>
java android
[1, 4]
2,800,622
2,800,623
hide various divs -jquery
<p>It is possible join this code, in something less redundant?</p> <pre><code>$('#x').hide(); $('#y').hide(); $('#z').hide(); </code></pre> <p>i already tried <code>$('#x', '#y', '#z').hide();</code> but didn't work.</p> <p>thanks</p>
javascript jquery
[3, 5]
241,228
241,229
Is it possible to add a JavaScript variable into JQuery .html() statement?
<p>bit of an odd question but is it possible to add a variable in the middle of a JQuery .html statement. </p> <p>IE can I do something like.</p> <pre><code>var x = 150; $("#sandbox").html("&lt;div id='toannimate" + x + "' style='width:100px;'&gt;&lt;/div&gt;"); </code></pre> <p>I want to create a div with a new name that I just created. So I would have a loop and each time it added .html the new div id would be toannimate1, toannimate2, toannimate3, etc. </p> <p>Or if I wanted to define the absolute position of that div could I set the x pos to a number from a variable?</p> <p>Thanks in advance. </p>
javascript jquery
[3, 5]
2,208,245
2,208,246
Why doesn't Jquery let me do this
<pre><code>document.getElementById("main").src = '02.jpg'; </code></pre> <p>works</p> <p>but</p> <pre><code>$('#main').src = '02.jpg'; </code></pre> <p>doesn't</p>
javascript jquery
[3, 5]
3,673,777
3,673,778
gridview_RowCommand firing two times
<p>I am performing database update call by clicking on a button which resides on a gridview. It works fine it updates the database properly but the problem is that when i refresh the page it again perform the same operation(db update) i.e again call the RowCommand Event of Gridview. </p> <p>Here is my short code view:</p> <pre><code>protected void gridview_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "lnkBtn1") { userDetails obj=new userDetails(); bool flag=obj.Updatuser(); if (flag) { lblSucess.Visible = true; //this will binds updated table to grid this.BindGrid(); } else { lblError.visible=true; } } } </code></pre>
c# asp.net
[0, 9]
4,638,993
4,638,994
Time controls in Android
<p>I'm building my <code>Main()</code> method for a game I am developing in Eclipse, and I wanted to know if there are any time related classes already created in the Android SDK. </p> <p>What I wanted to do was to make my <code>Main()</code> method loop through a <code>While</code> loop then wait 100 milliseconds, then loop again. I just need to know how I could make the loop wait.</p>
java android
[1, 4]
1,563,328
1,563,329
Add URL variables with Server.Transfer in asp.net
<p>I am currently trying to add a variable to the url using Server.Transfer. I need to use Server.Transfer as I need to keep form post data which is why I can't use Response.Redirect.</p> <p>I am using <code>Server.Transfer("add_account.aspx?error=userNotFound");</code> but the variable is not being added to the URL. </p> <p>Thanks for your help. </p>
c# asp.net
[0, 9]
4,760,498
4,760,499
FireFox - element referenced by id name in the global scope. use w3c standard.
<p>I am getting this message for this part of my code.</p> <pre><code>$(window).scroll(function () { if ($(window).scrollTop() + $(window).height() == $(document).height()) { } } </code></pre> <p>I cant seem to fix it. Can anybody help or shed some light?</p>
javascript jquery
[3, 5]
5,862,530
5,862,531
Need assistance in editing javascript to add options to a slider so it will loop
<p>I have slider content (images) within tags in html and need my js to loop through all the inner divs or basically return to the beginning when it hits the last one. I won't know how many total images there are but it should detect and do a continuous loop. Currently, the user clicks to advance and I'd like to keep it that way. Thanks for looking.</p> <p>JS</p> <pre><code>$('.slide_arrow').click(function(){ var hs = $('.main_slide').animate({left: '-=960'}, 1000); }); </code></pre> <p>HTML</p> <pre><code>&lt;div class="main_slide"&gt; &lt;div class="inner_slide"&gt; &lt;img src="/images/hero_box_placeholder.jpg" /&gt; &lt;/div&gt; &lt;div class="inner_slide"&gt; &lt;img src="/images/hero_box_placeholder2.jpg" /&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Perhaps something along the lines of: $('.inner_slide').continuous(true);</p> <p>-- using jquery/1.6.2/jquery.min.js</p>
javascript jquery
[3, 5]
1,124,004
1,124,005
Detect which child element is clicked
<p>I am trying to find out what values the users pick for my element.</p> <p>in my variable <code>var1</code>. it contains.</p> <pre><code>&lt;select&gt; &lt;option value='1'&gt;1&lt;/option&gt; &lt;option value='2'&gt;2&lt;/option&gt; &lt;option value='3'&gt;3&lt;/option&gt; &lt;/select&gt; &lt;input type='text'&gt; &lt;input type='text'&gt; &lt;input type='text'&gt; </code></pre> <p>I can just do <code>var1</code>.value to get the user selected value. </p> <p>However, I have another <code>var2</code> showing</p> <pre><code>&lt;div&gt; &lt;a href='#' id='1'&gt;test1&lt;/a&gt; &lt;a href='#' id='2'&gt;test2&lt;/a&gt; &lt;a href='#' id='3'&gt;test3&lt;/a&gt; &lt;/div&gt; </code></pre> <p>I want to get the selected <code>id</code> from the <code>&lt;a&gt;</code> I am not sure how to get it. </p> <p>Does anyone has an idea? Thanks a lot.</p>
javascript jquery
[3, 5]
5,506,355
5,506,356
PHP and JQuery Question
<p>Is there a way I can pass a PHP variable from a PHP page to a JQuery page and back to a PHP page?</p>
php jquery
[2, 5]
1,377,009
1,377,010
What is the equivalent of Master Page and Web User Control in PHP?
<p>Assume that I have some advertisments that I want to put in specific area of my pages. In ASP.NET I would use Web User Control for this pupose. What about in PHP? The same question for Master Page.</p>
php asp.net
[2, 9]
5,089,723
5,089,724
Setting DefaultValue to first and last date of current month
<p>How can I set the <code>DefaultValue</code>'s in the following code to the start date <em>(first ControlParameter)</em> and last date <em>(second ControlParameter)</em> of the current month?</p> <pre><code>&lt;SelectParameters&gt; &lt;asp:ControlParameter ControlID="txtFromDate" Name="ExpenseDate" PropertyName="Text" Type="String" DefaultValue="01-05-2013" ConvertEmptyStringToNull="true" /&gt; &lt;asp:ControlParameter ControlID="txtToDate" Name="ExpenseDate2" PropertyName="Text" Type="String" DefaultValue="30-05-2013" ConvertEmptyStringToNull="true" /&gt; &lt;/SelectParameters&gt; </code></pre>
c# asp.net
[0, 9]
5,675,973
5,675,974
"getElementById returns undefined" when accessing asp:HiddenField in JavaScript?
<p>I have MasterPage/ContentPage, where in <code>ContentPage.aspx</code> file i have <code>java-script</code> code. I want to move the java-script code out of <code>ContentPage.aspx</code> to a separate js file and do the following:</p> <p>//in ContentPage.aspx</p> <pre><code>&lt;script type="text/javascript" src='&lt;%= ResolveClientUrl("~/file1.js") %&gt;'&gt;&lt;/script&gt; </code></pre> <p>In file1.js i copy and paste all java-script code. On the java-script code, i have a cide line:</p> <p>//file1.js:</p> <pre><code>var hiddenvar1 = document.getElementById('&lt;%=hiddenvariable1.ClientID%&gt;'); </code></pre> <p>..then and i cannot get the value of that variable (hiddenvar1.value) because object hiddenvar1 is null. The javascript code was working when it was inside ContentPage.aspx. When i moved it to file1.js it's not working anymore. </p>
javascript asp.net
[3, 9]
3,028
3,029
passing value to another page using javascript
<p>Hello every I want to pass a message from php to JavaScript function and then redirecting to another page i want to show that message . Plz help me out . here is the sample code</p> <pre><code>Php if ($result){ $success = "New Page has been added successfully."; } else { $error = "Unable to process at this time."; } Java script &lt;script type="text/javascript"&gt; window.location="admin.php?page=add_user"; &lt;/script&gt; </code></pre> <p>i want this &amp;success message on another page by using this javascript function . i have tried in this way </p> <pre><code>window.location="admin.php?page=add_user&amp;&lt;?php echo $success?&gt; "; </code></pre>
php javascript
[2, 3]
1,933,821
1,933,822
Remove similar element in other class
<p>How can remove similar element(ul) in class <code>.makhzan</code> after click on one of <code>111</code> Or <code>222</code> Or <code>333</code> by jquery in html?</p> <p><strong>Demo:</strong> <a href="http://jsfiddle.net/nkNbc/" rel="nofollow">http://jsfiddle.net/nkNbc/</a></p> <p>My try:</p> <pre><code>$('.class_show .tooltip_hover').live('click change', function(){ $(this).closest('ul').remove(); var value_bet = $(this).text(); $(".makhzan .tooltip_hover li").filter(function () { var get = $(this).text() == value_bet; return get.closest('ul'); // This doesn't work for remove element ul }).remove(); }); </code></pre>
javascript jquery
[3, 5]
4,233,131
4,233,132
insert content to the first selector
<p>I created a checkbox which I want to insert before a cloned phrase and list.</p> <pre><code> $("p:contains('text'), ul:last",e).clone().prepend(myCheckbox);</code></pre> <p>My checkbox is now inserted before each phrase and each list. I just want to insert the checkbox before the phrase. Is that possible?</p> <p>Thank you.</p> <p>Edit: HTMl-Structure to clone:</p> <pre><code>&lt;p&gt;Text&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Listpoint&lt;/li&gt; &lt;li&gt;Listpoint&lt;/li&gt; &lt;li&gt;Listpoint&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>This is what it shoudl look like: <code>&lt;input type='checkbox'&gt; &lt;p&gt;Text&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Listpoint&lt;/li&gt; &lt;li&gt;Listpoint&lt;/li&gt; &lt;li&gt;Listpoint&lt;/li&gt; &lt;/ul&gt; </code></p> <p>But it looks like: <code>&lt;input type='checkbox'&gt; &lt;p&gt;Text&lt;/p&gt; &lt;input type='checkbox'&gt; &lt;ul&gt; &lt;li&gt;Listpoint&lt;/li&gt; &lt;li&gt;Listpoint&lt;/li&gt; &lt;li&gt;Listpoint&lt;/li&gt; &lt;/ul&gt; </code></p>
javascript jquery
[3, 5]
1,453,739
1,453,740
calculate height of container with absolutely positioned children
<p>How to calculate the height of a container which has children positioned absolutely? We can assume only direct children are positioned absolutely. Children have the same classes (no IDs) and are rotated, some are positioned using padding, like this:</p> <pre><code>&lt;div class=my-view style="position: relative";&gt; &lt;div class=my-child style="position: absolute; top: 5px; left: 10px; -webkit-transform: rotate(13deg);"&gt; &lt;div class=my-child style="position: absolute; padding-bottom: 5%; padding-left: 10%; -webkit-transform: rotate(-6deg);"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>(for other browsers the transform tag looks different of course)</p> <p>P.S. If it is necessary, children may have IDs</p> <p>[Update] Perhaps something like this code would work, but doesn't, because after the loop oTot.tot is zero ("tot" is like "total"):</p> <pre><code> var oTot = { tot: 0 }; $(".my-view .my-child").each(function() { var h = $(this).outerHeight(); var y = $(this).position().top + h; if (y &gt; oTot.tot) { oTot.tot = y; } }); </code></pre>
javascript jquery
[3, 5]
1,778,272
1,778,273
find control in panel in datalist
<p>I had Datalist and inside it panel and inside panel label and I want to find label inside panel inside datalist.I did my code but it didnot work well</p> <p> protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e) {</p> <pre><code> Label LblHead = e.Item.FindControl("Label1") as Label; string LanguageID = Globals.GetSuitableLanguage(Page); if (LanguageID == "ar") { LblHead.Attributes.Add("CssClass", "hed_logo2"); } } </code></pre>
c# asp.net
[0, 9]
4,588,223
4,588,224
Page losing formatting
<p>On my page a I have a few textboxes, AJAX tabpanel and a gridview. On Page_Load event, textboxes are filled in; gridview is populated and so on. My griedview has a button:</p> <pre><code>&lt;Columns&gt; &lt;ItemTemplate&gt; &lt;asp:Button ID="btnRedirect" Text="Click me" CommandArgument='&lt;%#Eval("BkId_ZW")%&gt;' OnClick="DoRedirect" runat="server" /&gt; &lt;/ItemTemplate&gt; ... &lt;/Columns&gt; </code></pre> <p>and the code behind it looks like:</p> <pre><code> protected void DoRedirect(object sender, EventArgs e) { Button theButton = sender as Button; string url ="http://../profile/" + theButton.CommandArgument; Response.Write("&lt;script&gt;window.open('" + url + "');&lt;/script&gt;"); } </code></pre> <p>After button is pressed a new window is open (everything works as expected) but the main page loose values and formatting of the textboxes. What is going on? How to fix it?</p>
c# asp.net
[0, 9]
2,949,608
2,949,609
JQuery and JS variables
<p>a little misunderstanding with JQuery and JS variables. Simple example:</p> <pre><code>function someFunc(){ var flag = true; $(function(){ $.post("/some/address/", {} ,function(data){ if( data == false){ flag = false; } }); }); if(flag == false){ return false; } } </code></pre> <p>The main problem is accessibility of variable flag in Jquery functions. I always get the same flag value equal to true. How to make this done ? How to make global variable to be visible for JS and JQuery ? </p>
jquery javascript
[5, 3]