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
5,186,222
5,186,223
What was the first available version of a Java IDE
<p>A bit of a strange question, I have done quite a bit of research on this (about 5 hours now) and can't seem to come up with an answer: What was the first available Java IDE (as in an IDE for Java, not an IDE made with Java).</p> <p>If anyone happens to know the same information for one for Javascript (ECMAScript) that would be great.</p> <p>If they also happen to have references, even better!</p> <p>Thanks in advance.</p>
java javascript
[1, 3]
810,930
810,931
how to set focus to first editable input element in form
<p>Dynamically created form contains input elements. First elements may be disabled or readonly. I tired code below to set focus to first elemnt which accepts data to enable fast data enttry form keyboard. However if form fist element is disable or readonly, focus is not set. How to set focus to first element which accepts data ?</p> <pre><code> &lt;form style='margin: 30px' id="Form" class='form-fields' method='post' target='_blank' action='Report/Render'&gt; ... &lt;input id='_submit' type='submit' value='Show report' class='button blue bigrounded' /&gt; &lt;/form&gt; &lt;script type="text/javascript"&gt; $(function () { var elements = $('#Form').find(':text,:radio,:checkbox,select,textarea'); elements[0].focus(); elements[0].select(); }); &lt;/script&gt; </code></pre> <p><strong>Update</strong></p> <p>There are also hidden input fields, sorry. Answers provided set focus to hidden element. Answr containing function does not find any element.ˇ</p> <p>Here is the update testcase:</p> <pre><code>$(function () { $("#form :input:not([readonly='readonly']):not([disabled='disabled'])").first() .focus(); }); </code></pre> <p>How to set focus to vist visible, enabled and not readonly element ?</p> <p>Update 3 </p> <p>I tried Row W code where input element was added. Now it sets focus to second element. Testcase is shown at <a href="http://stackoverflow.com/revisions/8023512/5">Revision 5 of Rob W's answer</a></p>
javascript jquery
[3, 5]
3,312,051
3,312,052
manipulate 'temporary dom' at background
<p>This is bit tough question. I"m using third party library that will insert result into DOM. </p> <p>Example: </p> <pre><code>$('#puthere').thirdpartyplugin(); </code></pre> <p>this will call <code>thirdpartyplugin</code> and manipulate result of HTML element <code>#puthere</code>. </p> <p>My question is, how to output result to JavaScript variable rather than DOM element?</p> <pre><code>var plainOutput = $.thirdpartyplugin(); alert(plainOutput); </code></pre> <p>I do not want to manipulate HTML element that is visible to users. I just want to call <code>alert(plainOutput)</code> the result.</p>
javascript jquery
[3, 5]
3,656,136
3,656,137
Including and Excluding Libs at Run Time
<p>In my new Android app, I'm required to use a library when Android Version in 1.6 and 1.5 and include some other library when the version is more than 1.6. I know how to get the Android SDK version, but I'm stuck at inclusion of specific library at run time. Any Help ??</p>
java android
[1, 4]
1,971,679
1,971,680
JavaScript confirm from C# codebehind
<p>I use following code-behind for javascript pop up for conforming, it works well but it does redirect the user to TestPage.aspx always regardless of user selection whether Yes or No.</p> <pre><code>lblMsg.InnerHtml = @" &lt;script type='text/javascript'&gt; confirm('Do you want to continue?'); window.location='TestPage.aspx?ID=" + Request.QueryString["ID"].ToString() + "&amp;txtTest=" + Server.UrlEncode(txtTest.Text) + strSomeString + "' &lt;/script&gt;"; </code></pre> <p>Any idea?</p> <p>And I use this, this time there is no pop up even.</p> <pre><code>lblMsg.InnerHtml = @" &lt;script type='text/javascript'&gt; confirm('Do you want to continue?'); window.location='TestPage.aspx?ID=" + Request.QueryString["ID"].ToString() + "&amp;txtTest=" + Server.UrlEncode(txtTest.Text) + strSomeString + "'; return false; &lt;/script&gt;"; </code></pre>
c# javascript asp.net
[0, 3, 9]
5,032,918
5,032,919
Program Logic to show two customized dialogs with in one onCreateDialog()?
<pre><code>public class HomeScreen extends Activity { static final int DIALOG_ID_X = 0; static final int DIALOG_ID_Y = 1; button1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub showDialog(DIALOG_ID_X); } }); button2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub showDialog(DIALOG_ID_Y); } }); </code></pre> <p>}</p> <p>Above is my main activity class and trying to open two customize dialogs upon clicking the two buttons (b1,b2). So my problem is b1 is working fine(Dialog opens correctly) but b2 is not working. Any idea how to let the b2 work?</p> <p>Any help will be appreciated.</p> <p>mrana...</p>
java android
[1, 4]
3,470,806
3,470,807
Find item by key in Javascript
<p>Quick rookie question please.</p> <p>Suppose I have a javsacript object like so: </p> <pre><code>var meh=[["cars",27], ["bikes",85], ["skates",4]]; </code></pre> <p>To go through each data object here, I can do this: </p> <pre><code>$.each(meh, function(index,value){ console.log(value) //returns ["cars",27] etc.. }); </code></pre> <p>And considering I know the place of, say, cars, I can do this to access it: </p> <pre><code>console.log(meh[0][0]) //shows "Cars" </code></pre> <p>and of course, if I want the value of cars, I need to do this: </p> <pre><code>console.log(meh[0][1]) //Shows 27 </code></pre> <p>Now, I have the string - Keys, like <code>cars</code>, <code>bikes</code> or <code>skates</code></p> <p>But I cant figure out this: How do I access their respective values? </p> <p><code>meh["cars"]</code> is returning undefined, since, as I understand, it cant find a description outside each object.</p> <p>I can do <code>meh[0]["cars"]</code> but it defeats the point as the position of cars might change.</p> <p>How do I access a value of something with their key please?</p> <p>thanks.</p>
javascript jquery
[3, 5]
4,838,507
4,838,508
jquery add element if not present
<p>I'm reading a book on jQuery and it has some simple tasks and examples.</p> <p>I'm trying out the adding of an element to a table, but only if the item is not yet present.</p> <p>The table is this:</p> <pre><code>&lt;table border="1" cellspacing="0"&gt; &lt;tr&gt; &lt;td&gt;Spaghetti&lt;/td&gt; &lt;td&gt;Karl&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Pasta&lt;/td&gt; &lt;td&gt;David&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>The problem is: we're not allowed to add any classes or id's.</p> <p>The idea is to add a caption. And of course, if the button is pressed 2 times, no second caption is added.</p> <p>I tried this:</p> <pre><code>if(!jQuery.contains('table','caption')) { $('table').append('&lt;caption&gt;Orders&lt;/caption&gt;'); } </code></pre> <p>And this</p> <pre><code>if(!($("table:contains('caption')"))) { $('table').append('&lt;caption&gt;Orders&lt;/caption&gt;'); } </code></pre> <p>But neither work. I've read the jQuery api on the functions and selectors, I thought these would work but they don't. What do I need to do?</p>
javascript jquery
[3, 5]
1,925
1,926
Catching PHP bracket style elements with jQuery
<p>I have a legacy PHP application which uses brackets in it's naming of form elements e.g.</p> <pre><code>&lt;select name="samplegroup[776]" id="samplegroup[776]"&gt; &lt;option value="1"&gt;1&lt;/option&gt; &lt;option value="2" selected &gt;2&lt;/option&gt; &lt;option value="3"&gt;3&lt;/option&gt; &lt;/select&gt; &lt;select name="samplegroup[883]" id="samplegroup[883]"&gt; &lt;option value="1"&gt;1&lt;/option&gt; &lt;option value="2" selected &gt;2&lt;/option&gt; &lt;option value="3"&gt;3&lt;/option&gt; &lt;/select&gt; </code></pre> <p>How can I match selects which have <code>samplegroup</code> followed by a number in brackets with jQuery? E.g. <code>$("what_do_i_write_here")</code>?</p>
php jquery
[2, 5]
1,257,397
1,257,398
anyway to get image file size using javascript(or jquery like)
<p>like:</p> <pre><code>&lt;img src="http://www.google.com/intl/en_ALL/images/srpr/logo1w.png"&gt; </code></pre> <p>i want get logo1w.png file size 7.3kb</p> <p>how to implement it?</p>
javascript jquery
[3, 5]
4,233,871
4,233,872
ASP.NET Page_Unload to stop user from leaving page
<blockquote> <p><strong>Possible Duplicate:</strong><br /> <a href="http://stackoverflow.com/questions/147636/best-way-to-detect-when-user-leaves-a-web-page">Best way to detect when user leaves a web page</a> </p> </blockquote> <p>I'm attemping to give a user the option to stay on the current page when they attempt to navigate away from it (if they have not saved changes to their progress). I'm unsure how to approach this as I have tried and failed JavaScript.</p> <p>I'm hoping there is a way inside the Page_Unload function in ASP.NET C# code.</p> <p>any help would be much appreciated.</p>
c# asp.net
[0, 9]
5,426,340
5,426,341
HighSlide zoom is not working
<p>I'm having trouble getting HighSlide to zoom on a div. It seems like it's partly working because I have the magnifying glass appearing when mousing over the pic in the browser, and when I click it says "Loading...", but it doesn't seem to magnify upon clicking. I'm simply trying to zoom/magnify the div dailyimg which contains an image that is rotated daily using a Javascript function that I wrote. I have included the HighSlide JS and CSS files in my header. Please see my HTML and JS code below. Any help would be greatly appreciated.</p> <pre><code>&lt;div id="features"&gt; &lt;h2&gt;Features&lt;/h2&gt; &lt;div id="emma2011_left"&gt; &lt;h2&gt;Image of the Day&lt;/h2&gt; &lt;div id="dImg"&gt; &lt;a id="inline" href="#dailyimg" class="highslide" rel="highslide"&gt; &lt;div id="dailyimg" class="feature" class="highslide-maincontent"&gt; &lt;/div&gt;&lt;/a&gt; &lt;div id="title" class="feature"&gt; &lt;/div&gt; &lt;br /&gt;&lt;br /&gt; &lt;div id="divlink" class="feature"&gt;&lt;br /&gt;&lt;center&gt;&lt;p&gt;Link to the digital object&lt;/p&gt;&lt;/center&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt; &lt;div id="caption" class="feature2"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>and in my JS file:</p> <pre><code> $("a#inline").click(function() { return hs.expand(this, options); }); </code></pre>
javascript jquery
[3, 5]
5,118,063
5,118,064
jQuery, multiple inputs and onBlur
<p>So I have 2 inputs. Both are for an "autocomplete". I also have 2 functions that do pretty much the same thing... Each input calls a different function onBlur. The problem is that the second upon selecting a "suggestion" for the second input, it populates the first. What can I do to make the second one populate the second?</p> <p>There's probably a better way of doing it but my jQuery/Javascript Knowledge is limited and I'm running out of time... Thanks!</p> <p>The code:</p> <pre><code>function fillLocation(thisValue) { $('#location-box').val(thisValue); setTimeout("$('#suggestionsLocation').fadeOut('fast');", 200); } function fillTerms(thisValue) { $('#terms-box').val(thisValue); setTimeout("$('#suggestionsTerms').fadeOut('fast');", 200); } &lt;input type="text" name="search_location" id="location-box" value="" onkeyup="suggestLocation(this.value);" onblur="fillLocation();" autocomplete="off" /&gt; &lt;input type="text" name="search_terms" id="terms-box" value="" onkeyup="suggestTerms(this.value);" onblur="fillTerms();" autocomplete="off" /&gt; </code></pre>
javascript jquery
[3, 5]
1,785,533
1,785,534
How to delay the changing of a value in jQuery?
<p>I'm making a map using Raphael and jQuery. I've got a search box - when the mouse enters a region, the search box displays the name of that region, and when the mouse exits it, the search box changes to a preset text (along the lines of "type here to search").</p> <p>However, when I move the mouse across the map, the search box's contents flicker quickly between region names and the preset text. I tried fixing it using <b>.delay()</b>, but it didn't work - only then did I read that delay() only works with effects.</p> <p>How do I delay a value change using <b>.val()</b>?</p>
javascript jquery
[3, 5]
5,920,525
5,920,526
How do I interpret. /glow.min.js?v=5
<p>Please tell me what does /glow.min.js?v=5 means How this is used? i.e How the versioning is done here as file is one.</p>
javascript jquery
[3, 5]
957,025
957,026
javascript or php array intersection and difference method
<p>I am looking for an error free code for getting unchanged, added, and removed items array by comparing two array.</p> <p><img src="http://i.stack.imgur.com/QG0ba.jpg" alt="enter image description here"> </p> <p>Is there any efficient method to obtain three arrays by using a single method ?</p> <p>both php or javascript can be used</p>
php javascript
[2, 3]
1,154,733
1,154,734
jQuery param dynamic object name
<p>why can't i have a variable in an object? I get an error like: </p> <pre><code>"Uncaught SyntaxError: Unexpected token this" </code></pre> <p>My code is like this.</p> <pre><code>$("#search_options input:checkbox").on('click', function() { var params = { $(this).attr('name') : $(this).val(), }; var str = jQuery.param(params); }); </code></pre> <p>I'm sure that $(this) is working because I tried to console.log it outside the params object then i is working.</p>
javascript jquery
[3, 5]
1,627,280
1,627,281
How to show/hide the same blocks inside similar blocks with JQuery
<p>Code as follows:</p> <pre><code>&lt;div class="mama"&gt; &lt;div class="son"&gt;Item 1&lt;/div&gt; &lt;/div&gt; &lt;div class="mama"&gt; &lt;div class="son"&gt;Item 2&lt;/div&gt; &lt;/div&gt; $(".mama").hover( function() { $(".son").show(); }, function() { $(".son").hide(); } ); </code></pre> <p>Forward to help. Thanks!</p>
javascript jquery
[3, 5]
2,757,099
2,757,100
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]
4,122,761
4,122,762
javascript error for the textbox
<pre><code>&lt;asp:Button ID="Button1" runat="server" Text="Button" OnClientClick ="toggletr();" /&gt; &lt;script type ="text/javascript" &gt; function toggletr() { debugger; var Inputs =$get("TextBox1"); } &lt;/script&gt; </code></pre> <p>i trying this i am getting error:</p> <blockquote> <p>Microsoft JScript runtime error: Object expected</p> </blockquote> <p>but in textbox it contains value</p> <pre><code>//var Inputs = document .getElementById ("TextBox1"); </code></pre> <p>if i do like this i am getting the value. can any one tell me how to solve this one in javscript using <code>$get()</code> or JQuery how to assign value</p> <p>thank you </p>
javascript jquery
[3, 5]
2,124,575
2,124,576
IPhone over Android and vice versa
<p>I develop applications on both <strong>IPhone</strong> and <strong>Android</strong>. As a part of my organization's <em>Technical Session</em> program I have myself delivering the next session on <strong>IPhone or Android</strong>. Getting the session made me start comparing both technologies, which believe me, is really a tough job. As a programmer in both technologies I often think how will the <em>Application</em> seem to be if I used the other one. Which further makes me list out pron and cons of both.<br> <strong>Android a ahead of IPhone</strong>:<br> There are couple of factors where <strong>Android</strong> steps ahead of <strong>IPhone</strong>. </p> <ul> <li><p>Multiple apps at same time </p></li> <li><p>Information visible on home screen </p></li> <li><p>Better notifications </p></li> <li><p>Hardware flexibility </p></li> </ul> <p><strong>IPhone ahead of Android</strong>:<br> Following are the factors: </p> <ul> <li><p>UI Smoothness and Consistency </p></li> <li><p>Language support </p></li> <li><p>Accessibility options </p></li> <li><p>Battery life </p></li> <li><p>Resource efficiency </p></li> <li><p>Hardware quality </p></li> <li><p>Better App Store </p></li> </ul> <p>However, as a programmer, I want my session to be more of <em>technical</em> rather than a being a general overview of both technologies. For which I need some help. For instance <strong>Android's</strong> memory management is way ahead of that of <strong>IPhone's</strong>. On the other hand <strong>IPhone's</strong> <em>UI</em> has no comparison at all.<br> What more points(technical) can I include in my session. Also, kindly correct me if I am wrong somewhere above. </p> <p>Nitish </p>
iphone android
[8, 4]
446,777
446,778
jQuery/JS - Count elements within element
<p>In jQuery or JS I need to count the amount of DIV elements inside my parent DIV called <code>cont</code>? I've seen similar questions here on StackOverflow and have tried the following.</p> <pre><code>&lt;div class="b-load" id="cont"&gt; &lt;div&gt; &lt;img src="page2.jpg" alt=""/&gt; &lt;/div&gt; &lt;div&gt; &lt;img src="page3.jpg" alt="" /&gt; &lt;/div&gt; &lt;div&gt; &lt;img src="page4.jpg" alt="" /&gt; &lt;/div&gt; &lt;div&gt; &lt;img src="page5.jpg" alt="" /&gt; &lt;/div&gt; &lt;/div&gt; function countPages() { var maindiv = document.getElementById('cont'); var count = maindiv.getElementsByTagName('div').length; alert(count); } </code></pre> <p>The child DIV's are dynamically produced, so I need to count them after the page has finished loading. The problem I have is the function I wrote counts 13 DIV's and in this example, there should only 4!! Any help gratefully received..</p>
javascript jquery
[3, 5]
59,336
59,337
How can I get date and time formats based on Culture Info?
<p>What I want is.. If culture is en-US then</p> <pre><code>string dateFormat="MM/dd/yyyy"; string timeFormat="24.00 hrs"; </code></pre> <p>If culture is en-GB then</p> <pre><code>string dateFormat="dd/mmyyyy"; string timeFormat="24.00 hrs"; </code></pre> <p>and so on for other countries..</p> <p>Now how do I get these date and time format values ? What are the standards? Like which all countries use similar date/time formats and which ones don't ?</p> <p><strong>ok I tried this :-</strong></p> <pre><code> DateTime myDate = new DateTime(); string us = myDate.ToString(new CultureInfo("en-US")); </code></pre> <p>string us gets value =1/1/0001 12:00:00 AM</p> <p>Now how do I extract "dd/mm/yyyy" and "24.00 hrs" out of this...in my Dateformat column in my Table... I want to store STRINGS such as dd/mm/yyyy or mm/dd/yyyy NOT dates..In my TimeFormat column in the table, the values to be stores are STRINGS too, like I need to store either "24:00hrs" or "12:00hrs"</p> <p>How do I do this now ?</p> <p>**using ShorTimePattern returns these values as </p> <pre><code>h:mm tt and HH:mm </code></pre> <p>If I want to store the values in my DB exactly as "24:00hrs" and "12:00hrs", how do I use these values..h:mm tt and HH:mm which one is for 24 hr format and which for 12 hr format ?**</p> <p><strong>ok now there's another problem too...I want the information about Decimal Separator and Thousand Separator too based on the CultureInfo...whats the property for that ?</strong> </p>
c# asp.net
[0, 9]
2,819,022
2,819,023
is it possible to change key layout inside android application?
<p>Can I change the layout of a bluetooth keyboard just inside my application? Or in other words rebind the keys? For example: pressing "a" enters "s" and pressing "s" enters "a"</p>
java android
[1, 4]
2,152,806
2,152,807
Get the pasted content on document on paste event
<p>As mentioned in the Question how can I get the pasted content on document.As of now I am creating a text area and dblclick to get the focus into textarea and then on paste event of the textarea I am collecting the data. I dont think this is a good approach. My code is below </p> <pre><code>$('body').dblclick(function() { $('#textare').focus(); }); Then $('#textare').keyup(function() { alert( $(this).val() ); }); </code></pre> <p>Please suggest me a alternative process.<br> I am looking for alternative like </p> <pre><code>$(document).paste(function() { // Get the pasted content }); </code></pre> <p>I am using google chrome browser. I dont want to use textarea to catch the text.</p>
javascript jquery
[3, 5]
1,038,584
1,038,585
jquery check field with confirm
<p>Here is my snippet jquery code. Pratically i would check if field are empty on submit form, then if the username exist show confirm dialog.</p> <pre><code>&lt;script type="text/javascript"&gt; jQuery(function(){ $("#form").submit(function(){ var isFormValid = true; if ($.trim($("#telephone").val()).length == 0){ isFormValid = false; alert("Empty telephone!"); } elseif(check_field() == 1){ if(confirm('Delete?')){ isFormValid = true; }else{ isFormValid = false; } return isFormValid; }); function check_field(){ var field = $('#field').val(); $.post("check_field.php", { field: field }, function(result){ //if the result is 1 if(result == 1){ return 1; }else{ return 0; } }); } }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
3,089,262
3,089,263
How to use the JS variable in CodeBehind(aspx.cs) file?
<p>How can I use the variable of the Javascript method in my codebehind(aspx.cs) file??</p>
c# javascript
[0, 3]
703,506
703,507
jQuery function calling
<p>I'm trying to have a callback call a function inside $(document).ready(..)</p> <p>How do I call a function from outside this?</p> <p>Like for example:</p> <pre><code>$(document).ready( function(foo) { var bar = function() { ... }; }); // How do I call bar() from here? </code></pre>
javascript jquery
[3, 5]
5,835,272
5,835,273
How Can I Know If An Input Is Checked If I Only Know His Value?
<p>I have a dynamic input in my php code like this one:</p> <pre><code>&lt;input type="checkbox" id="advantage[]" name="advantage[]" value="Special Option" /&gt; </code></pre> <p>And I need to know if it's checked... I can have multiple checks in the same format in the code, my brain hurts because i can't find a solution!</p> <p>Thanks 4 the help!</p>
php javascript jquery
[2, 3, 5]
3,354,664
3,354,665
How to get value of a selected radio button?
<p>I have a <code>&lt;div&gt;</code> with radioboxes:</p> <pre><code>&lt;div id='RB-01'&gt; &lt;span&gt;Item_1&lt;/span&gt;&lt;input type='radio' name='RB01' value='1'&gt;&lt;br /&gt; &lt;span&gt;Item_2&lt;/span&gt;&lt;input type='radio' name='RB01' value='2'&gt;&lt;br /&gt; &lt;span&gt;Item_3&lt;/span&gt;&lt;input type='radio' name='RB01' value='3'&gt;&lt;br /&gt; &lt;/div&gt; </code></pre> <p>Then with <code>jQuery</code> I want to get number on an account a radiobox that was checked:</p> <pre><code>var obj; var tempId = "RB-01"; if ($('div[id=' + tempId + ']')) { $('div[id=' + tempId + '] input').each(function() { ...here I need save in the variable obj the number on an account input that was checked... }); } </code></pre>
javascript jquery
[3, 5]
701,468
701,469
jQuery Index of Hovered Button
<p>I'm not sure why I'm not figuring this out... I do this all the time. Must be having a "Monday Moment." But, basically, here's what I have:</p> <pre><code>$('#nav ul li a').hover(hoverOn, hoverOff); function hoverOn (evt) { //how do I get the index of which button was hovered (from the jQuery group)? } </code></pre> <p>My code looks like this:</p> <pre><code>&lt;div id="nav"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#" id="index"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" id="about"&gt;About Us&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" id="services"&gt;Services&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" id="resources"&gt;Resources&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" id="contact"&gt;Contact&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
2,644,405
2,644,406
How can I add a number to a variable to which I assigned a number in Javascript?
<p>I have the following:</p> <pre><code>var offset; offset = localStorage.getItem('test.MenuList.Offset.' + examID + "." + level) || 0; offset += 100; </code></pre> <p>When I use the debugger this offset now has 0100. I want it to add like a number not a string. How can I do this?</p> <p><strong>Please note</strong> I changed the question slightly because I realized I was getting the value from local storage. I assume this returns a string. But I am still not sure how to solve this.</p>
javascript jquery
[3, 5]
2,619,804
2,619,805
How to get values from dynamically added (using javascript) elements?
<p>On my aspx page I dynamically create html controls on client side using javascript. For example, after page load you can click button in a browser, by clicking button html <em>input</em> and <em>select</em> elements appear. You may click once again, and this elements (<em>input</em> and <em>select</em>) will added again. So, you can create so many inputs and selects as you want (all this using javascript, no postbacks)</p> <p>After user created some inputs and selects and entered some information in it, he posted form. I want on server side to find all this dynamically added elements and perform some actions depends on values in this controls. </p> <p>How can I find dynamically added elements, and what is the best and elegant way to achieve this?</p> <p>Thanks in advance.</p>
javascript asp.net
[3, 9]
836,516
836,517
Microsoft JScript runtime error: 'Sys.Extended.UI' is null or not an object
<p>i have a problem when on my page when its open its display error message on my page</p> <p><strong>Microsoft JScript runtime error: 'Sys.Extended.UI' is null or not an object</strong></p> <pre><code>&lt;ajax:ToolkitScriptManager ID="tsm" runat="server" CombineScripts="false" &gt; &lt;/ajax:ToolkitScriptManager&gt; </code></pre> <p>and display error </p> <pre><code>$create(Sys.Extended.UI.ModalPopupBehavior, {"BackgroundCssClass":"modalBackground1","DropShadow":true,"PopupControlID":"ctl00_ContentPlaceHolder1_panelPopupAddDefaultAddress","PopupDragHandleControlID":"ctl00_ContentPlaceHolder1_panelPopupAddDefaultAddressDragHandle","dynamicServicePath":"/SJM.Framework.Website/Order/ActiveOrders.aspx","id":"ctl00_ContentPlaceHolder1_modalPopupAddDefaultAddress"}, null, null, $get("ctl00_ContentPlaceHolder1_hiddenTargetControlForModalPopup")); </code></pre> <p>anyone can say me what is the problem i try much but not find </p>
c# asp.net
[0, 9]
5,439,551
5,439,552
how to retrieve RTF content from ClipBoard using javascript/JQuery methods
<p>I want to retrieve the RTF content from the Clipboard(Orginating from MSWord). Is it possible to retrieve it using javascript / JQuery methods?</p>
javascript jquery
[3, 5]
5,270,342
5,270,343
How do I see the output of data sent by JQuery to php?
<p>I have this JQuery piece of code. I want to see wht php outputs. How do I print that. </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;script&gt; $.ajax({ url: "script.php", type: "POST", data: { name : "John Doe" }, dataType: 'json', success: function(msg){ alert(msg); } }); &lt;/script&gt; &lt;HTML&gt; </code></pre> <p>script.php</p> <pre><code>&lt;?php $name = $_POST['name']; echo $name; ?&gt; </code></pre>
php jquery
[2, 5]
3,431,119
3,431,120
findViewById won't work in InputMethodService, what do i do?
<p>I'm trying to create an android keyboard, this code works fine so far</p> <pre><code>package keyboard.rob.com; import... public class xyz extends InputMethodService implements KeyboardView.OnKeyboardActionListener { private LinearLayout mInputView; @Override public View onCreateInputView() { mInputView = (LinearLayout) getLayoutInflater().inflate(R.layout.main, null); return mInputView; } ... </code></pre> <p>but later on when I'm trying to make </p> <pre><code>LinearLayout LinLayBg = (LinearLayout)findViewById(R.id.LL_total); </code></pre> <p>to populate it with buttons, it show</p> <p>"*The method findViewById(int) is undefined for the type zyz *"</p> <p>Any ideas? Thanks!</p>
java android
[1, 4]
1,121,703
1,121,704
ASP.Net - How do I programatically edit external config files at runtime
<p>By external config files, I mean .config files other than web.config. I've seen all the examples on how to edit web.config at runtime, but I want to edit a config file referenced by a configSource for appSettings. I want to modify only the external file and I will handle the app recycle.</p> <p>Ideally I would like to use a built-in class to deal with the edits, but if the only option is a manual File open/parse, etc, then sobeit.</p> <p>The general idea behind all this being a Settings page that is viewed at app startup, user sets their particulars and then saves the changes, then the real app starts up. quick and easy install app/configure page, so I'd like to leverage .config if at all possible.</p> <p>Thanks!</p> <p>FOLLOWUP - Quick Snippet to use XmlDocument to change an appSetting key value:</p> <pre><code>string path = Server.MapPath("~/my.config"); XmlDocument doc = new XmlDocument(); doc.Load(path); XmlNode node = doc.SelectSingleNode("/appSettings/add[@key='myKey']"); node.Attributes[1].Value = "myVal"; XmlTextWriter writer = new XmlTextWriter(path, null); writer.Formatting = Formatting.Indented; doc.WriteTo(writer); writer.Flush(); writer.Close(); </code></pre>
c# asp.net
[0, 9]
2,815,954
2,815,955
How to prompt user if page is idle from last 5 minuts
<p>What is the best approach to prompt user, if he is idle on webpage from last 5 minuts. i mean how to know that use is idle on web page from last 5 minuts.</p>
c# javascript asp.net
[0, 3, 9]
2,399,841
2,399,842
How to split the header of an image?
<p>I have designed a website which users upload some images and I store them in a folder.but anyone else can access the uploaded file via URL. However I want to split the header of Uploaded images and insert the header in the database and store the rest of file in the folders. How can I split the header of image? If I convert the image to the array of binary how to distinguish the header part?</p>
c# asp.net
[0, 9]
4,801,668
4,801,669
declaring vars inside object gives me error
<p>I am trying to create variables inside object as follows but it is giving me error. Here is <a href="http://jsfiddle.net/wnFUn/" rel="nofollow">DEMO</a></p> <p>And same code is below</p> <pre><code>var One = { var var1, var2; init: function () { var1 = 'some1'; var2 = 'some2'; } } One.init(); </code></pre> <p>​</p>
javascript jquery
[3, 5]
3,956,182
3,956,183
Get Date() object with specific time
<p>I want to get week Start Date of a week. I am able to get the date, its just that the date returned has time wrt to the current system time. For example, if its 19:20 hours right now, I am getting the week start date as <strong>Date {Mon Mar 26 2012 19:20:16 GMT+0530 (IST)}</strong></p> <p>For accurate calculations, I need the time to be 00:00:00 GMT. </p> <p>How can I achieve that? </p> <p>My current code looks like this: </p> <pre><code>var tDate = new Date(); var wDate = new Date(); this.chosenDayIndex = this.currentDayIndex = tDate.getDay(); if (this.currentDate == '') { this.currentDate = new Date(); var today = formatDate(tDate); var diff = tDate.getDate() - this.currentDayIndex + (this.currentDayIndex == 0 ? -6:1); this.weekStartDate = this.weekMonDate = new Date(wDate.setDate(diff)); this.weekEndDate = new Date(this.weekStartDate.getFullYear(),this.weekStartDate.getMonth(), this.weekStartDate.getDate()+6); this.weekMonday = formatDate(this.weekMonDate); } </code></pre> <p>this.weekStartDate is currently handing out the false start date with the current timestamp.</p>
javascript jquery
[3, 5]
635,910
635,911
Android development toggling TextView visibility
<p>Im having some trouble with setting textview to invisible/visible.</p> <p>basicly i want this to happen when an on/off button has been clicked.</p> <p>what i did is kind of like</p> <pre><code>textview.setVisibility(TextView.VISIBLE); textview.setVisibility(TextView.INVISIBLE); </code></pre> <p>when i try executing this the emultor says that the app has stopped unexcpetedly</p>
java android
[1, 4]
2,393,519
2,393,520
How to enable and disable the css applied for linkbutton
<p>I got 4 link button where i need to change the color of onclicked</p> <p>Example :A B C D </p> <p>By default apply css to A if B is clicked Apply it to B.css applied for the A Button should disable. I need the solution in server side or in client side.</p> <p>I need the solution in the server side as i got updated panel and i am calling the linkbutton text in code behind </p>
jquery asp.net
[5, 9]
1,572,854
1,572,855
Getting a specific item value in a ListBox
<p>I'm trying to get to specific item in a ListBox (asp.net, C#) and check if it's null or not:</p> <pre><code>if (ListBox.Items[0] == null ) { if (HowMany.Text == arrOfWords[0]) { ListBox.Items.Add(arrOfWords[0]); ErrorMessege.Text = "Good!"; } } </code></pre> <p>it's returning that : Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index</p> <p>Why is that? Thanks!</p>
c# asp.net
[0, 9]
2,369,849
2,369,850
Need to initialize a byte[] array with ascii blank (i.e. 0x20 OR " ")
<p>Hello all Ol' Guy Newbie here ... I've defined a string=> final static String Blank = " " ; and a byte array static byte[] LU62_Partner = new byte[8] ;</p> <p>Further down in my logic I want to initialize the byte[] array with blanks</p> <pre><code> // Prep LU6.2 Session for ( ndx=0 ; ndx &lt; 8 ; ++ndx) { LU62_Partner[ndx] = Blank.getBytes() ; // initialize the the LU6.2 partner name byte array w/blanks } LU62_Partner = APPC_Partner.getBytes() ; // convert string array to byte array // if the appc-partner name &lt; 8 bytes, rightmost bytes // will be padded with blanks </code></pre> <p>However upon compilation I get the following error src\LU62XnsCvr.java:199: incompatible types found : byte[] required: byte LU62_Partner[ndx] = Blank.getBytes() ; </p> <p>Again I'm confused... I was under the impression that the method getBytes() would convert a string into a byte. Thanks very much again </p> <p>Guy </p>
java android
[1, 4]
5,571,957
5,571,958
Remove class on click anywhere, unless a certain textbox is clicked on
<p>I am trying to improve the following script a little:</p> <pre><code>$(document).click(function(event) { $('.home.active').click(); $('.home').removeClass("active"); }); </code></pre> <p>This works, but it works when I don't want it to work. For example, I have a textbox. If that textbox gets focus, the class should not be removed, but if anything else on the page is clicked, the class should be removed. So I tried the following, which does not work:</p> <pre><code>$(document).click(function(event) { if( $('#txtHomeSearch').focus() ) { // don't remove class } else { $('.home.active').click(); $('.home').removeClass("active"); } }); </code></pre> <p>This stops the class being remove altogether, no matter where I click, and the textbox always has focus.</p>
javascript jquery
[3, 5]
3,180,235
3,180,236
How to get right path files in android
<p>My code is following::</p> <pre><code>Scanner sc = null; try { sc = new Scanner(new File("assets/mainmenu/readSourceFile.txt")); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block System.out.println(e1.toString()); e1.printStackTrace(); } </code></pre> <p>Then, logcat show exception <code>java.io.FileNotFoundException</code></p> <p>How can I find my file? I tried </p> <p><code>sc = new Scanner(new File("mainmenu/readSourceFile.txt"));</code></p> <p>However, it's still throw <code>FilenotFoundException</code></p> <p>My file is in folder assets/mainmenu/readSourceFile.txt</p> <p>and I've try this::</p> <pre><code>private InputStream is; try { is = this.getResources().getAssets().open("mainmenu/readSourceFile.txt"); } catch (IOException e) { e.toString(); } </code></pre> <p>I use getAssets to access assets file in android. However, how can I suppose to read text file if I use <code>InputStream</code></p>
java android
[1, 4]
315,920
315,921
Reindex javascript array / object after removing a key
<p>For example:</p> <pre><code>var Cars = { 1: { "Make": "Honda", "Model": "Accord", "Color": "Red" }, 2: { "Make": "Honda", "Model": "Civic", "Color": "Silver" }, 3: { "Make": "Honda", "Model": "Jazz", "Color": "Yellow" } </code></pre> <p>If I do a <code>delete.Cars[2];</code> I will be left with Cars[1] and Cars[3].</p> <p>I need a way (JS or jQuery) so that when I delete a key, the object reindexes. So, in the example above, I'm left with Cars[1] and Cars[2] (which was Cars[3]).</p>
javascript jquery
[3, 5]
3,418,749
3,418,750
This JQuery works in Chrome and Safari, Not FF?
<p>I have a bunch of code that will open and close a div using the slidetoggle/toggleclass method</p> <p>Now while the DIv is opened, I added in this little bit to allow the window to close if someone clicks outside of the now opened div.</p> <pre><code>$("body").live("click", function() { if($(event.target).parents().index($('.subpanel')) == -1) { if($('.subpanel').is(":visible")) { $(".alerts").toggleClass("notiftitleactive"); $(".alerts").toggleClass("active").next().slideToggle(50); $("body").die("click"); } } }); </code></pre> <p>This works perfectly well in google chome and safari. But in firefox, clicking outside of the div does nothing (does not trigger the .alerts to toggleclass/slidetoggle).</p> <p>Any idea why this wouldnt work in FF ?</p> <p>Thanks!</p>
php jquery
[2, 5]
4,074,321
4,074,322
Can you define jquery's $(function(){...}) twice on a page?
<p>I am working on a web page that pulls an external javascript file that has all of my functions in it. I'll call that file "functions.js".</p> <p>functions.js has a jQuery has a <code>$(function(){...});</code> to do my operations when the page is ready. My question is, is it possible to also write another <code>$(function(){...}</code> on the body of the same page that calls functions.js, so that whatever I do in both of the domReady functions happens on the page? For example, if functions.js is:</p> <pre><code>$(function(){ $('div').css('color','green'); } </code></pre> <p>and I put this code in tags on the page which calls functions.js:</p> <pre><code>$(function(){ $('div').css('background-color','red'); } </code></pre> <p>will the page end up making my divs have both green text AND red backgrounds, or will one override the other, or will neither work?</p> <p>I hope this makes sense!</p>
javascript jquery
[3, 5]
4,960,846
4,960,847
deal with multiple arrays being sent to jquery from php?
<p>This is kind of an odd question, but i'll try to explain it as possible. I have this PHP script which fetches data from MySQL. It gets the userID, Username, Email for each user and puts it in an array: </p> <pre><code>phpoutput = Array ( [id] =&gt; 2 [name] =&gt; John [lastname] =&gt; sena ) Array ( [id] =&gt; 3 [name] =&gt; human [lastname] =&gt; man ) </code></pre> <p>and so on for as many records as there are. The problem is that i want to send this data to jQuery in order to manipulate it with jquery. I know how to send and get data with jQuery, but how can i deal with multiple arrays?</p> <p>Note : I have already used <code>json_encode()</code> to encode the arrays.</p>
php jquery
[2, 5]
4,393,613
4,393,614
Jquery's same function for different events
<p>MY code is like this</p> <pre><code> $(document).ready(function(){ nodeClick(elm = ''); }); function nodeClick() { if(elm != ''){ var obj = ''; }else{ obj = $('.hitarea') } obj.live('click',function(){ $(this).addClass('something'); $(this).attr('something',1); //lots of this reference are here }); } </code></pre> <p>if elm variable is empty i need to call the click function automatically ie with out click.how can i trigger that function with out click</p>
javascript jquery
[3, 5]
709,990
709,991
How uncheck items in AlertDialog (setMultiChoiceItems)?
<p>I'd like to clear selected items when the total came to three items selected, I am doing as follows but is not working ...</p> <pre><code> AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getResources().getText(R.string.escolhaArquivosBaixados)); builder.setMultiChoiceItems(items, selected, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { // int count = 0; for(int i = 1; i &lt; selected.length; i++){ // if (selected[i]){ count++; } if (count == 3){ //enter here but nothing happens ((AlertDialog) dialog).getListView().setItemChecked(which, false); break; } } } }); </code></pre>
java android
[1, 4]
1,587,183
1,587,184
simple java script job
<p>I need a very simple Javascript on a html page, that will do the following..</p> <p>Display a text like:</p> <pre><code>This is a string of text and can be long </code></pre> <p>then if you mark some of the text with your mouse, the selected text should be inserted and automatically updated into a text field</p> <p>How can i do it?</p>
javascript jquery
[3, 5]
2,905,813
2,905,814
Triggering anchor click within a table using jquery
<p>I am using the below code to trigger the anchor click within the table <code>compareTable</code>, but it does not seem to take any effect. Can any1 point out the solution?</p> <pre><code>$('#compareTable a').click(function() { alert("hi"); }); </code></pre> <p>Here is the <a href="http://jsfiddle.net/LSh4M/16/" rel="nofollow">demo</a></p>
javascript jquery
[3, 5]
592,128
592,129
how to pass object by reference in android to make changes in orignal object?
<p>friends,</p> <p>i have code </p> <pre><code> DalCategories selected_object= new DalCategories(); for (DalCategories cat : DalCategories.EditPostCategory) { if(cat.getCategory_Id().equals(root_id)) { selected_object = cat; // add to list if(selected_object.getSub_Category() != null) { for (DalCategories t : selected_object.getSub_Category()) { if(t.getSub_Category() != null) { // MakeChangesInThisObject(t.getSub_Category()); adapter.addSection(t.getTitle(), new EfficientAdapter(this,t.getSub_Category(),selected_object.getSub_Category().get(0).getSub_Category())); } } } // add to list break; } } </code></pre> <p>DalCategories.EditPostCategory has three levels i want to change third level object values and want this change should be done to DalCategories.EditPostCategory by reference and using MakeChangesInThisObject</p> <p>any one guide me how to achieve this?</p>
java android
[1, 4]
5,903,747
5,903,748
HttpContext.Current.Session is null
<p>I have a WebSite with a custom Cache object inside a class library. All of the projects are running .NET 3.5. I would like to convert this class to use Session state instead of cache, in order to preserve state in a stateserver when my application recycles. However this code throws an exception with "HttpContext.Current.Session is null" when I visit the methods from my Global.asax file. I call the class like this:</p> <pre><code>Customer customer = CustomerCache.Instance.GetCustomer(authTicket.UserData); </code></pre> <p>Why is the object allways null?</p> <pre><code>public class CustomerCache: System.Web.SessionState.IRequiresSessionState { private static CustomerCache m_instance; private static Cache m_cache = HttpContext.Current.Cache; private CustomerCache() { } public static CustomerCache Instance { get { if ( m_instance == null ) m_instance = new CustomerCache(); return m_instance; } } public void AddCustomer( string key, Customer customer ) { HttpContext.Current.Session[key] = customer; m_cache.Insert( key, customer, null, Cache.NoAbsoluteExpiration, new TimeSpan( 0, 20, 0 ), CacheItemPriority.NotRemovable, null ); } public Customer GetCustomer( string key ) { object test = HttpContext.Current.Session[ key ]; return m_cache[ key ] as Customer; } } </code></pre> <p>As you can see I've tried to add IRequiresSessionState to the class but that doesn't make a difference.</p> <p>Cheers Jens</p>
c# asp.net
[0, 9]
2,134,057
2,134,058
Using PHP to Match a Javascript Timestamp
<p>Alright when I do the code:</p> <pre><code>&lt;script type = "text/javascript" &gt; document.write((new Date).getTime()); &lt;/script&gt; </code></pre> <p>You get the Unix timestamp in miliseconds. I need something that will match this in PHP. I need a variable to be set to that, NOT necessarily printed. The variable needs to be a string OR number without any formatting (decimals, commas, etc).</p> <p>The numbers don't have to match exactly, but have to be close. I tried doing time()*1000 but it turns it into scientific notation and I couldn't format it out without messing up the string.</p> <p>Thanks so much for any help</p>
php javascript
[2, 3]
5,107,069
5,107,070
How to know the reason of blur?
<p>How can I know which event caused a blur event in jQuery?</p> <p>Blur event triggered using <code>click or tab</code> etc. How can I know this blur event is due to click or tab?</p>
javascript jquery
[3, 5]
962,295
962,296
Javascript getting ignored because of Response.Redirect()
<p>I am currently working on asp.net using C# and I need to show a message box and confirm the input from user and redirect to another page, my code is something like this: </p> <pre><code>protected void Button1_Click(object sender, EventArgs e) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("&lt;script language='javascript'&gt;"); sb.Append("if (confirm('YES OR NO?')){ /*some javascript code*/ }"); sb.Append("&lt;/script&gt;"); Page.RegisterStartupScript("FocusScript", sb.ToString()); Response.Redirect("Default.aspx"); } </code></pre> <p>here the problem is directly getting redirected to next page without showing message box. if i remove <code>Response.Redirect("Default.aspx");</code> it shows message box successfully. I think the here may be is <code>Response.Redirect()</code> has higher precedence compared to <code>javascript</code></p> <p>I tried using </p> <pre><code>sb.Append("if (confirm('YES OR NO?')){ window.location.href = \"Default.aspx"; }\"); </code></pre> <p>instead of using <code>Response.Redirect()</code> but page didn't got redirected, what should I do to resolve this problem?</p>
c# javascript asp.net
[0, 3, 9]
2,072,313
2,072,314
Access datas based on user role in asp.net
<p>How to access datas based on user roles in asp.net ?</p> <p>For example : i have two admins (admin1, admin2) .</p> <p>In the frontend ,admin1 has full access to datas(view,add,edit,delete all datas) </p> <p>while admin2 has limited access to datas(view,add,edit,delete certain datas alone and not all datas)</p> <p>thank you</p>
c# asp.net
[0, 9]
1,310,803
1,310,804
Page Reload - Keeping Variables
<p>How do I go about when page is reloaded that I make sure the variables I have declared at the top o my class do not get reset. IE I have a counter that is originally set at 0 if I use a postback control it resets that variable how do i go about not having this happen in C#?</p>
c# asp.net
[0, 9]
4,335,508
4,335,509
How can I check whether my radio button is checked within ONE div among many others?
<p>I have many div's called "each_item", one behind another. I am trying to check whether a radio has been checked WITHIN this very div.</p> <p>My problem is that with my jquery code (see below), all radio buttons of all "each_item" div's are tested. I probably need to use <code>$(this)</code>, but I don't know how to use it in the selector I used below ( that is <code>$('input:radio[name=gender]:checked')</code>)</p> <pre><code>&lt;div class='each_item'&gt; &lt;input type='radio' name='gender' value='m'&gt; &lt;input type='radio' name='gender' value='f'&gt; &lt;input type='button' id='btn'&gt; &lt;/div&gt; </code></pre> <p>The jquery i tried is this:</p> <pre><code>$('#btn').click(function(){ if ($('input:radio[name=gender]:checked').length &lt; 1) alert('nothing was checked'); }); </code></pre> <p>Thanks a lot if you could help me out.</p>
javascript jquery
[3, 5]
1,718,002
1,718,003
switch asp.net listview to edit mode without reload all data
<p>How can edit one row in listview without reload all data (i.e:reload all data in page 3)?<br/> When i click on the edit link, every lable in each column convert to textbox (or dropdownlist or ...) without need to reload all data.<br/> After that i click save link, and flush all change in database (with ajax).<br/><br/> In the other words, what is the low cost solution to edit one row in listview asp.net control?</p>
c# asp.net
[0, 9]
5,986,405
5,986,406
jQuery reset refreshing browser as well as resetting form
<p>I am trying to issue a form reset to clear the contents back to there initial state. What is happening however, is that the form clears but also the browser refreshes. I have also tried putting the code inside a document ready but still the same. Can someone explain to me why this is happening. Thanks</p> <pre><code>&lt;button id="AUSR_reset" class="resetbutton icon-right ui-state-default2 ui-corner-all"&gt;&lt;span class="ui-icon ui-icon-circle-plus"&gt;&lt;/span&gt;Reset&lt;/button&gt; &lt;script language="javascript" type="text/javascript"&gt; $("#AUSR_reset").click(function() { $("#AUSR_adduser").get(0).reset(); }); </code></pre> <p></p>
javascript jquery
[3, 5]
3,315,441
3,315,442
How to remove identical items from List<string>?
<p>I have a List in which I select users from db each time a sql query runs with certain value and selects one user in the time thus I cannot limit identical users in sql.</p> <p>I have list with:</p> <pre><code>list[0] = "jerry" list[1] = "tom" list[2] = "jerry" </code></pre> <p>I want any (first or last doesn't matter in my case) to be removed from the list.</p> <p>Thanks</p>
c# asp.net
[0, 9]
529,001
529,002
use php array in javascript?
<p>my php code looks like this:</p> <pre><code>$result['firstName']['lastName']='johan'; echo json_encode($result); </code></pre> <p>how should i type to use this array in javascript with jquery?</p> <pre><code>...function(data) { alert(data.firstName.lastName); }); </code></pre> <p>or</p> <pre><code>...function(data) { alert(data.firstName['lastName']); }); </code></pre>
php javascript jquery
[2, 3, 5]
2,790,265
2,790,266
Android record exists() in database?
<p>I am looking to the fastest and the correct way to check if a record exists in the database:</p> <pre><code>public boolean Exists(String _id) { Cursor c=db.query(TABLENAME(), new String[] {"1"}, "_ID="+_id, null, null, null, null); if (!c.equals(null)) return c.moveToFirst(); return false; } </code></pre> <p>Do you see any problem with it?</p>
java android
[1, 4]
4,881,913
4,881,914
Affix element if scroll reaches to its end
<p>Here is my HTML</p> <pre><code>&lt;div class="container"&gt; &lt;div style="float::left" class="left affix-form"&gt;&lt;/div&gt; &lt;div style="float::left" class="right"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>Now problem is initially left section and right section both doesn't fit to window view port. I mean I need to scroll down to see the end of both sections. But I want to affix left section when scroll reaches to its end and after that right section should keep scrolling. Here is my java script</p> <pre><code>$(window).scroll(function () { isScrolledIntoView($('.affix-form')); }); function isScrolledIntoView(elem) { var docViewTop = $(window).scrollTop(); var docViewBottom = docViewTop + $(window).height(); var elemTop = elem.offset().top; var elemBottom = elemTop + elem.height(); if ((elemBottom &lt;= docViewBottom) ) { elem.addClass('affix-bottom'); } else { elem.removeClass('affix-bottom'); } </code></pre> <p>above script adds affix-bottom class but doesn't remove affix-bottom if I scroll to the top. I am not sure what am i doing wrong?</p>
javascript jquery
[3, 5]
3,499,237
3,499,238
Don't want to submit form elements that I hide by hiding parent li
<p>I have form inputs placed in li element, and am hiding some of them by clicking a button. They get submitted even though they are hidden, so I was wondering what the alternative way would be to hide these element in a way that they will not be submitted?</p>
javascript jquery
[3, 5]
637,457
637,458
Clicking hyperlink doesn't work if there is a colon in the link. How can I solve this
<p>In my application , users can post messages, a title and body. The message is then accessed by a user clicking the hyperlink of the title to read the message. However, if a colon is entered by the user the hyperlink is not clickable. I'm looking for the quickest, easiest way of resolving this</p> <p>The hyperlink is in a GridView so the issue might be related to a colon in the hyperlink, when in a gridview is not clickable</p>
c# asp.net
[0, 9]
1,616,207
1,616,208
How to read excel 2007 in c#
<p>My server does't have any Microsoft Office and I dont want to install Microsoft office. </p> <p>When I use this code for reading an Excel 2007 file</p> <pre><code>Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myOldExcelFile.xls; Extended Properties="Excel 8.0;HDR=YES"; </code></pre> <p>It cannot read the Excel file. Does anyone know what is wrong?</p>
c# asp.net
[0, 9]
4,463,387
4,463,388
On every click text should add in page
<p>I want to add value on every click on my function.</p> <p>for example i click on then value is coming but i want to click again and another value should come without replacing the existing value</p> <pre><code> &lt;script&gt; function dearq(selected){ var value = $(".textvaluenonw").val(); $("#dearname").html(value); } &lt;/script&gt; </code></pre> <p>here is the fiddle </p> <p><a href="http://jsfiddle.net/r7P3w/12/" rel="nofollow">http://jsfiddle.net/r7P3w/12/</a></p>
javascript jquery
[3, 5]
2,561,488
2,561,489
Can the parent view be notified when a child is created
<p>In android UI can be created dynamically so is there a way to know if a child was created to a parent ?</p> <p>For example, if i have a linear layout as a parent and i dynamically create a child button. Is there away to notify the parent ? </p>
java android
[1, 4]
5,981,547
5,981,548
How to iterate through Java collection in Javascript
<p>I'm trying to do scripting with Javascript in a Java program. I haven't found a way to iterate through a Java collection in Javascript. If I call the iterator() method for the collection, I get the method names instead of the elements.</p> <p>Here's a sample code:</p> <pre><code>function getValue(row, components) { var apartment = components.get(0); var rooms = apartment.getRooms(); for (var room in rooms.iterator()) { println(room); } return rooms.toString(); } </code></pre> <p>The apartment.getRooms() returns a collection of rooms. When I study the value returned by this function, I know that its content are correct, but the values that get printed are the method names.</p> <p>I invoke the Javascript from my Java program like this:</p> <pre><code>getInvocable().invokeFunction("getValue", row, components); </code></pre>
java javascript
[1, 3]
1,778,323
1,778,324
Self-executing function syntax and callback sytnax explained
<p>bit of a silly question perhaps.</p> <p>But I want to understand why the syntax on the self-executing function and the callback it has is so different to all the other JS syntax..</p> <pre><code>(function () { })() </code></pre> <p>I just need to understand why its valid to encapsulate it with <code>()</code> I wouldn't have guessed that to be valid, and then the extra <code>()</code> afterwards for the callback, (which just sits directly after it, I also wouldn't have expected that to be valid. </p> <p>Is anyone able to explain this to me?</p>
javascript jquery
[3, 5]
251,070
251,071
Multiple autosuggest fields, filters depending on previous results
<p>I'm trying to figure out a method to see if it is possible to have one text field value (the result of a mysql query of an autosuggest field) be used as a filter for another mysql query for another autosuggest field. As in first field autosuggests a country, and the second field would autosuggest a city based in that country, reading from the mysql results.</p> <p>I've been using nodstrum's tutorial for the autosuggester, <a href="http://www.nodstrum.com/2007/09/19/autocompleter/" rel="nofollow">http://www.nodstrum.com/2007/09/19/autocompleter/</a>, and everything seems to be working, but the only method for multiple fields I can think of is having several "rpc.php" files that have different queries within. Any suggestions?</p>
php javascript
[2, 3]
3,443,092
3,443,093
Adding javascript inside TinyBox2
<p>I am trying to add the following script inside the TinyBox2 ( <a href="http://www.scriptiny.com/2011/03/javascript-modal-windows/" rel="nofollow">http://www.scriptiny.com/2011/03/javascript-modal-windows/</a>) pop-up:</p> <pre><code>&lt;script type="text/javascript" src="http://www.addpoll.com/poll-88331.js" charset="utf-8" id="adpEmbed88331"&gt;&lt;/script&gt;&lt;noscript&gt;&lt;a href="http://www.addpoll.com/luisp/poll/88331"&gt;Best theme&lt;/a&gt;&lt;/noscript&gt; </code></pre> <p>I am using the 'Ajax - Advanced Functions" TinyBox2. I added text before and after this script in advanced.html and the text shows up in the pop-up as those the "Best theme" link, but the contents of the script (a poll) do not. What can I do?</p> <p>This is how I make the call: </p> <pre><code>&lt;li onclick="TINY.box.show({url:'advanced.html',width:300,height:150})"&gt;Vote&lt;/li&gt; </code></pre> <p>Advanced.html contains:</p> <pre><code>&lt;p&gt;Hi 1&lt;/p&gt; &lt;script type="text/javascript" src="http://www.addpoll.com/poll-88331.js" charset="utf-8" id="adpEmbed88331"&gt;&lt;/script&gt;&lt;noscript&gt;&lt;a href="http://www.addpoll.com/luisp/poll/88331"&gt;Best article&lt;/a&gt;&lt;/noscript&gt; &lt;p&gt;Hi 2&lt;/p&gt; </code></pre> <p>I posted this on their support site but never heard back.</p> <p>Thanks,</p>
javascript jquery
[3, 5]
5,767,018
5,767,019
How can i improve my webpage performance?
<p>I am currently working on a very heavy web page which contains a popup &amp; this popup contains multiple tabs. each tab has multiple buttons on it. Click on a button opens a new popup which in turn opens a new popup. I am using RadWindow to open a nested popup. But, I am experiencing really bad performance. Is there any better way available to achieve this with or without using radwindow to disply popups. </p>
c# asp.net
[0, 9]
1,231,198
1,231,199
javascript If statement no working
<p>This is driving me crazy - basically this if statement is not working. The code keeps jumping into the else statement, I have hovered over the buttonText and everything seems alrite until it hits the conditions.</p> <pre><code>function DesignCodeViewClick(el) { $("div.divdesigncodeviewbuttonsselected").attr("class", "divdesigncodeviewbuttons"); $(el).attr("class", "divdesigncodeviewbuttonsselected"); var buttonText = el.innerText; if (buttonText.toLowerCase() == "design") { $("#iframecms").css("display", "none"); $("textarea.divhtmleditor").css("display", "none"); } else if (buttonText.toLowerCase() == "browse") { $("#iframecms").css("display", "block"); $("textarea.divhtmleditor").css("display", "none"); } else { $("textarea.divhtmleditor").css("display", "block"); $("#iframecms").css("display", "none"); WebForm_DoCallback('SEOCMSControl1', 'getcode~http://www.triksportfolio.com', GetCodeServerResponse, null, null, true); } } </code></pre>
javascript jquery
[3, 5]
985,246
985,247
Run a javascript on postback in c#
<p>I used the below manner to run a JavaScript upon postback and it worked fine for me.</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (this.IsPostBack) { Page.ClientScript.RegisterStartupScript(this.GetType(),"PostbackKey","&lt;script type='text/javascript'&gt;document.getElementById('apDiv1').style.visibility = 'hidden';&lt;/script&gt;"); Page.ClientScript.RegisterStartupScript(this.GetType(),"PostbackKey","&lt;script type='text/javascript'&gt;function show()&lt;/script&gt;"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(),"PostbackKey","&lt;script type='text/javascript'&gt;document.getElementById('apDiv1').style.visibility = 'visible';&lt;/script&gt;"); } } </code></pre> <p>The above code worked fine and now I want to try something like below.</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (this.IsPostBack) { Page.ClientScript.RegisterStartupScript(this.GetType(),"verify","&lt;script type='text/javascript'&gt;verify1();&lt;/script&gt;"); } else { } } </code></pre> <p>in the above code <code>verify1()</code> is a JavaScript linked externally to ASPX page. I am unable to execute <code>verify1()</code> function using this code. And <code>verify1()</code> function works fine when placed as <code>&lt;body onload="verify1();"&gt;</code> Is there any syntax error(s) in my above code?</p>
c# javascript asp.net
[0, 3, 9]
3,485,704
3,485,705
Is element before or after another element in DOM
<p>Is there a means of detecting whether an element appears before or after another element in markup? This is <em>regardless</em> of position in DOM. It could be a child, a sibling, a parent or a parent's parent. This is a general question, so no markup to share.</p> <p>To clarify - this is in regards to the element's position in markup, not its display position. Now that I think about it my question is a bit strange because if you have element X and element Y then you can have these scenarios.</p> <pre><code>//in regards to y &lt;x /&gt; &lt;y /&gt; //:after &lt;y /&gt; //:before &lt;x /&gt; &lt;x&gt;&lt;y /&gt;&lt;/x&gt; //not really before or after is it? </code></pre>
javascript jquery
[3, 5]
3,505,953
3,505,954
highlite text parts with jquery, best practice
<p>i have a list of items containig names. then i have a eventlistener, which ckecks for keypress event. if the user types i.g. an A all names starting with an A should be viewed with the A bold. so all starting As should be bold.</p> <p>what is the best way using jquery to highlite only a part of a string?</p> <p>thanks for your help</p>
javascript jquery
[3, 5]
2,427,255
2,427,256
System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly
<p>I'm am writing a .Net application which is supposed to post data to another .Net application. I use the following code to request the login page</p> <pre><code>WebProxy proxy = new WebProxy("http://proxy:80/", true); HttpWebRequest webRequest = WebRequest.Create(LOGIN_URL) as HttpWebRequest; //proxy.Credentials = new NetworkCredential("myusername", "mypassword", "domain"); // webRequest.Proxy = proxy; webRequest.Proxy = WebRequest.DefaultWebProxy; StreamReader responseReader = new StreamReader(webRequest.GetResponse().GetResponseStream()); string responseData = responseReader.ReadToEnd(); </code></pre> <p>but it fails on this line with the error message :</p> <blockquote> <p>System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.</p> </blockquote> <pre><code>StreamReader responseReader = new StreamReader(webRequest.GetResponse().GetResponseStream()); </code></pre> <p>with the error</p>
c# asp.net
[0, 9]
649,336
649,337
Fire off JavaScript function when textbox is populated and focus is still set in jQuery?
<p>How do I execute an JavaScript function right when an ASP.NET text box control is populated and focus is still set? The <code>onChange</code> event will not work because I need to programmatically move focus to the next form element after the JavaScript function has executed.</p> <p>Is is very similar to this <a href="http://stackoverflow.com/questions/2002209/execute-a-javascript-function-when-textbox-is-populated-in-jquery">question</a>. The marked answer is correct for the context on the question, but after some more testing it did not exactly solve my current issue.</p> <p>Pseudo code:</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; function MyFunction() { //execute this function when MyTxtBox is populated and focus is still set //once core function is completed, move focus to MyTxtBox1 } &lt;/script&gt; &lt;style type="text/css"&gt; .USBBox { position: absolute; left: -999em; overflow: hidden; } &lt;/style&gt; &lt;asp:TextBox id="MyTxtBox" runat="server" CssClass="USBBox" /&gt; &lt;asp:TextBox id="MyTxtBox1" runat="server" /&gt; </code></pre>
asp.net javascript jquery
[9, 3, 5]
458,128
458,129
Creating ascx dynamically and adding controls to it
<p>I am a beginner in asp.net(C#) and stuck in an important point.</p> <p>I have a dropdown list on my homepage which users select a category. After selecting the category, user will fill a form which has related controls to that category in it.</p> <p>As I have many categories, I just want to have single ascx page and adding controls to it dynamically according to the user choice.</p> <p>For example: One chose Telephone category, he will face a form having drop down lists asking, what brand? what color? And one chose, book category, he will face drop down lists asking which type? howmany pages?</p> <p>So 1 ascx must do my work at runtime done as I have alot of categories.</p> <p>I am going to take these criterias from a database table which has CategoryID and Criteria colomns.</p> <p>And if I can do that, will it be possible to add field validators to these dynamically created controls.</p> <p>Nearly all controls are drop down list, if this helps.</p> <p>Any help would be highly appreciated..</p> <p>Thanks alot</p>
c# asp.net
[0, 9]
5,314,833
5,314,834
Jquery get the actual control that fired the event.
<p>I have a following html:-</p> <pre><code>&lt;button type="button" class="btn-add"&gt; &lt;i class="some-icon"&gt;&lt;/i&gt; &lt;/button&gt; </code></pre> <p>which creates a nice fancy button with an icon</p> <p>I bound an event on the button click:-</p> <pre><code>function (e) { console.log($(e.target)); } </code></pre> <p>now when i click on the center of the button the output of the above javascript is <code>&lt;i&gt;</code> element because of e.target. Is there any other way to get the actual control that fired this event, in this case the <code>&lt;button&gt;</code> ?</p>
javascript jquery
[3, 5]
5,119,015
5,119,016
jQuery Select list, selected text value rather than the value
<p>building on my last question <a href="http://stackoverflow.com/questions/9191278/jquery-getting-values-from-multiple-selects-together">jQuery getting values from multiple selects together</a> </p> <p>I have the select list like:</p> <pre><code> &lt;select name="access" class="change" id="staff_off" runat="server"&gt; &lt;option value="8192"&gt;Off&lt;/option&gt; &lt;option value="8192"&gt;On&lt;/option&gt; &lt;/select&gt; </code></pre> <p>And I basically want to add or subtract the value of the options if it's off, subtract if it's on add it. It's going to be stored in a cookie (it uses bitwise)</p> <p>The jquery I have is:</p> <pre><code>&lt;script&gt; $(document).ready(function(){ var currentAccess = $.cookie("access"); }) $("select").change(function () { var currentText = $(this).text() var value = $(this).val() $.cookie("access", value, { expires: 24 }); alert(currentText); alert( $.cookie("access") ); }) &lt;/script&gt; </code></pre> <p>I'll do the addition in the change function. The thing I can't work out is how to get the text of the select to do an if statement (so if it's yes, add the value, if it's no, subtract the value)</p> <p>Tom</p>
javascript jquery asp.net
[3, 5, 9]
91,100
91,101
javascript escaped string is not getting unescaped with c# regex.Unescape()
<p>I am sending an escaped string from javascript to c# controller and now i want it to unescaped in c#. I used regex.Unescape() in c# but its not working. Now how i will Unescaped it in c#?</p>
c# javascript
[0, 3]
197,447
197,448
jquery remote validation, what would be the php code?
<p>I am using bassistance validation plugin and I need to check if the email already exists in my database, can someone please provide a sample php code for the serverside portion of this? i don't simply want to echo true or false, i want the json solution with the message option too...</p>
php jquery
[2, 5]
5,782,501
5,782,502
jQuery highlight clickable areas
<p>I wanted to ask you if there is a way of highlighting clickable items within a basic HTML page, ideally by pressing a keyboard key. When I build functional prototypes, to save time only some of the functionality is actually developed to show the flow. I want to somehow show which items are clickable, so users don't need to hover every single item to find out what can be clicked.</p> <p>Ideally what I want to achieve is when a user presses a predefined key, a box appears on top of every link (text or image or map coordinates), and this should be achieved automatically via a script, so that I don't have to set it up manually for every prototype I build.</p> <p>Is that possible to achieve? Thank you in advance for your suggestions!</p>
javascript jquery
[3, 5]
2,098,037
2,098,038
Combining jQuery/JavaScript functions
<p>Is there any way to combine all of this to reduce the amount of javascript?</p> <pre><code> $(document).ready(function() { $(".individualImagebox img").bind("click", function() { var src = $(this).attr("src"); if (src.search(/Red\.jpg$/) &gt;= 0) return; // Removes the red overlay from the images folder $('.individualImagebox img').attr( "src", function () { var thisSRC = $(this).attr( "src"); return thisSRC.replace(/Red\.jpg$/, ".jpg"); }); // Adds the red overlay from the images folder $(this).attr( "src", src.replace(/\.jpg$/, "Red.jpg") ); }); }); function ShowHide(index) { var itemSelector = ".name:eq(" + index + ")"; $(".name .bio").fadeOut(); $(".name").not(itemSelector).fadeOut(); $(itemSelector).animate({"height": "show"}, { duration: 500 }); $(itemSelector + " .bio").animate({"height": "show"}, { duration: 500 }); } </code></pre>
javascript jquery
[3, 5]
5,179,316
5,179,317
Using javascript variable in php
<p>I have a list of events displayed in a div using php . These events are fetched from the database. But I need to display the events that are near the entered city.So I used the Google distance javascript api to find the distance between the entered city and city of each event. But Iam not able to load the needed events because the evenmts is in php and distance is in javascript .Can anyone help me to fetch the events that are near the entered city?</p> <p>The main problem is that I have an array of events in php. To display the events nearest to the city, I have to calculate the distance in javascript and check if it is below some value and if yes,display it and then move to the next element in the array.So Can anyone help me?</p>
php javascript
[2, 3]
1,029,735
1,029,736
How enable a click event of a button?
<p>I disable a jQuery click event with:</p> <pre><code>$("#button").click( function () { return false;} </code></pre> <p>How can I enable it? The intention is avoid double clicks and run multiple times the function that triggers. I want to restore the event when other button was pushed.</p>
javascript jquery
[3, 5]
5,871,468
5,871,469
javascript:variable value passing from javascript to php
<p>I have a <code>javascript</code> file <code>pet.js</code>. I want to pass a value of variable in <code>test.php</code>. But i can't.</p> <p>my <code>pet.js</code> is like</p> <pre><code>$('#pmWorkOrderDetailsPage').live('pageshow', function(event) { var id = getUrlVars()["id"]; $.get("test.php", { test1: id } ); $.getJSON('pmworkorderdetails.php?id='+id, displaypmWODetails); }); function displaypmWODetails(data) { ..............code.......... } </code></pre> <p>My <code>test.php</code> is like</p> <pre><code>&lt;?php $ms = $_GET["test1"]; echo $ms; ?&gt; </code></pre> <p>But it is not working. I tried with <code>Ajax</code> and <code>post</code> method. </p> <p>It will be best if I can store the variable value on the session in test.php.</p> <p>Thanks in advance for any help.</p>
php javascript
[2, 3]
4,611,185
4,611,186
jquery- info/docs about list of attributes applicable to different types of input elements in a form
<p>I am working with input elements in a form using jquery...I am trying to obtain the name of a form parameter in a web page, as well as its value (or multiple values in case its something like a drop down box)</p> <p>I want to do some operations on these form elements... Is there some place you can point me to where a list of attributes available for (and applicable to) different types of form elements is provided? For eg, I need to work with drop down box, list box, radio button, check box, text box and text area. Specifically I require the name of each input element, its value(or set of values) and in case of list box, whether multiple selections can be made within that list box or not.</p> <p>Update- The jquery 'val' expression retrieves the currently selected value in a radio button/list box etc... I want to obtain all the possible values for input elements that have multiple values as options...</p>
javascript jquery
[3, 5]
5,920,161
5,920,162
unescape after server.urlencode
<p>I am trying to send "get" request to third party (api).</p> <p>this api using javascript function "unescape" to get the url parametrs.</p> <p>from my server side I am using this code</p> <pre><code> string apiGetRequest = String.Format("someUrl?name={0}&amp;city={1}&amp;CREATEBY=test", HttpContext.Current.Server.UrlEncode(name), HttpContext.Current.Server.UrlEncode(city)); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(apiGetRequest); req.GetResponse(); </code></pre> <p>as you can see I am using Server.UrlEncode to encode the parameters(I tried also htmlencode) but it seems that unscape can't decode the original parameters</p> <p>I test it with javascript function "encodeuri" and it's working just fine.</p> <p>as I said before the "unescape" is used by third party and I can't change it to "encodeuri"</p> <p>How can I send from server side encoding that the unescape will be able to decode?</p> <p>thanks for any help</p>
javascript asp.net
[3, 9]
2,124,965
2,124,966
How to display an object stored in a database using jQuery and ASP.Net
<p>I have documents (images, Word documents, PDF's, etc) stored in an SQL Server database table. On my form, I display the names of these documents and need for the user to be able to click a document title and have the contents retrieved from the database and then opened in the default viewer; Word for example for a Word document. </p> <p>I'm not sure about the best way to approach this. I tried using an $.ajax call to a web service that queries the database and then write the bytes out to the current context but this doesn't seem to work. </p> <p>Any tips would be greatly appreciated.</p>
jquery asp.net
[5, 9]
3,771,919
3,771,920
Android loading animation
<p>I am searching for some info on how to create loading animation in android. Is it possible to create this animation that i could call this animation in one thread and end in other ?</p> <p>I seeking for this:</p> <p><img src="http://i.stack.imgur.com/87ssF.png" alt="enter image description here"></p>
java android
[1, 4]