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
395,742
395,743
Identifying the Form that is being Submitted using JQuery
<p>I have several forms on a page with different ids and I want to find out which is submitting and its id. How can I do this?</p> <pre><code>//stop all forms from submitting and submit the real (hidden) form#order $('form:not(#order)').submit(function(event) { event.preventDefault(); </code></pre> <p>The above stops all forms submitting and I would like put in a conditional saying if this form, then do this etc.</p> <p>Any help appreciated.</p> <p>Thanks all</p>
javascript jquery
[3, 5]
2,118,041
2,118,042
Kinda like dynamic function in java/android
<p>I am coming from PHP to Java and I have some questions about "dynamic" functions. </p> <p>Kinda like in php where you can do an <code>include(VARNAME.".php");</code> and if varname is <code>a</code> it'll include <code>a.php</code> if its <code>x</code> it'll include <code>x.php</code>. </p> <p>I wanna do that in Java but with functions.<br> Kinda like I have a varname and I want to include a function. So if varname is <code>Test</code> it'll include <code>test()</code> but I have a bunch of functions and its a nuisance to do </p> <pre><code>if(varname == "x"){ x(); }. </code></pre> <p>Is there any easy way to do it?</p>
java android
[1, 4]
5,167,237
5,167,238
How to call server side function using jQuery in ASP.Net
<p>I am beginner in jQuery. </p> <p>I want to know that as we can call server side method in ASP.Net by javascript using XMLHttpRequest object and GET verb, similarly can we call the same using jQuery $get() or we are able to do it by POST onley?</p> <p>Thanks.</p>
javascript jquery asp.net
[3, 5, 9]
4,226,627
4,226,628
Why does PHP not have an attribute 'const' like C++ does?
<p>Why does PHP not have the moral equivalent to the C++ <code>const</code>? I think that this is lacking in the PHP language. Is there a way to simulate the same properties as a <code>const</code> object or parameter?</p>
php c++
[2, 6]
2,611,352
2,611,353
web user control adding items problem
<p>On one web user control</p> <pre><code>public void displayFindingSection(int sectionsid,string text,string head) { SectionHeading.Text = head; DataSet totImgs; totImgs = objGetBaseCase.GetFindingsNewerImages(sectionsid); FindingViewerlist.DataSource = totImgs; DataBind(); SectionText.Text = text; } </code></pre> <p>On other web user control</p> <pre><code>public void DisplayFindingsViewer(CipCaseWorkflowItem2 item) { FindingViewerDisplay.Visible = true; ImageAndSimpleViewer.Visible = false; objGetBaseCase.GetFindingsImages((Convert.ToInt32(Session["CaseId"])), item.ItemId); FindingsViewerNew = objGetBaseCase.GetFindingViewerNewElementDetails(item.ItemId); for (int i = 0; i &lt; FindingsViewerNew.Count; i++) { FindingViwerDisplay uc = (FindingViwerDisplay)LoadControl("FindingViwerDisplay.ascx"); FindingPlaceholder.Controls.Add(uc); uc.displayFindingSection(Convert.ToInt32(FindingsViewerNew[i].Index), FindingsViewerNew[i].Text, FindingsViewerNew[i].Title); } } </code></pre> <p>I am adding the all the image in user control and displaying the image, but when i am using the above code, web user control is also adding every time and one image is showing in in control <strong>what i want is all images should show in only one user control</strong>.. sectionsid is getting the image id from the database. I think prob with for loop but i am unable to solve it.. help me it that</p>
c# asp.net
[0, 9]
4,714,614
4,714,615
Slideshow Background <body> tag
<p>When a user loads my page I want to let the background color be white then after 5 seconds fade away the color and fade in the picture. And after 5 seconds fade in another picture again so you can create sort of a slide show in the background behind my content. This is what I have now but it doesn't work, any help?</p> <pre><code>$(document).ready(function() { setTimout(function() { $('body').css("background-image","url('../img/background/1.jpg')").fadeIn(1000) },5000); function repeat() { $('body') .delay(5000).css("background-image","url('../img/background/2.jpg')").fadeIn(1000) .delay(5000).css("background-image","url('../img/background/3.jpg')").fadeIn(1000) .delay(5000).css("background-image","url('../img/background/1.jpg')").fadeIn(1000); } window.setInterval(repeat, 18000); }); </code></pre>
javascript jquery
[3, 5]
2,242,212
2,242,213
Need to show() or remove() an element depending on who's logged in
<pre><code>(function($){ $(document).ready(function() { $('.nlgchat').hide(); // or do it with CSS... var usernames = ['Mr.EasyBB','runawayhorses','BL@DE','SirChivas']; var nameslist=''; $('ul li a.mainmenu').each(function( i ){ var name = $(this).text().split(' ')[3]; nameslist += '||'+name; // ||dana||roko||john }); for(i=0;i&lt;usernames.length;i++){ if( nameslist.indexOf( '||'+usernames[i] ) &gt; -1 ){ $('.nlgchat').show(); return; }else{ $('.nlgchat').remove(); return; } } }); })(jQuery); </code></pre> <p>I use this code to make it so only some people can see the <code>.nlgchat</code> but the code only works for my name and not anyone else's in the list.</p> <p>I want the users listed above to be able to see it, everyone else <code>.remove</code></p> <p><a href="http://jsfiddle.net/z62Pf/" rel="nofollow">http://jsfiddle.net/z62Pf/</a></p>
javascript jquery
[3, 5]
217,105
217,106
How can I trouble shoot click events being triggered twice?
<ul> <li>I have a one page app. </li> <li>It uses backbone.js. </li> <li>Click events via mouse trigger once. </li> <li>Click events via touch device trigger twice. </li> <li>Unbinding the one click event stops both on touch devices.</li> </ul> <p>I can't figure out where to start looking.</p> <p>This is the JS:</p> <pre><code>$('.classy').on('click', 'button', function(){ console.log('clicked'); }) </code></pre> <p>I need some help figuring out how to trouble shoot this. I know I haven't given enough information to receive a real answer. The confusing part to me is that this only happens on touch devices. If I was accidentally binding two events or creating two instance of the same view it wouldn't it happen for mouse clicks too?</p> <p>Thank you.</p> <p><strong>EDIT: I tried using the tap event via jQuery Mobile. This had a strange reaction. It would fire the event once and looked like it was done, but the next time you touch anywhere on the screen it would fire the event again. ...weird, any ideas?</strong></p> <p>I finally found the problem. It was coming from layered iScrolls. I had to hack the lib at this point, probably a much better way to fix this but illustrates the point.</p> <pre><code>if (target.tagName != 'SELECT' &amp;&amp; target.tagName != 'INPUT' &amp;&amp; target.tagName != 'TEXTAREA' &amp;&amp; window.iScrollClickFIX != true) { window.iScrollClickFIX = true; setTimeout(function(){ window.iScrollClickFIX = false; }, 1) </code></pre> <p>Thanks for the help everyone.</p>
javascript jquery
[3, 5]
4,190,998
4,190,999
JQuery Validation results being placed outside of the cell
<p>I'm having trouble getting the validation function results "Required field" to fill the text input box of a table.</p> <p>The current code is placing the result to the right of the cell instead of inside. I'm fairly positive it's the $(this).parent().append portion but after trying several other variations I haven't achieved the expected results.</p> <p>*The code verifies that a value is currently in the cell by means of examining the class = requiredField attribute.</p> <p>Any tips are much appreciated. -Thank you.</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $('form#commentform').submit(function() { $('form#commentform .error').remove(); var hasError = false; $('.requiredField').each(function() { if(jQuery.trim($(this).val()) == '') { $(this).parent().append('&lt;span class="error"&gt;*Required field&lt;/span&gt;'); hasError = true; } }); if(!hasError) { alert('Validation Complete'); } return false; }); }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
4,134,413
4,134,414
Integration of external jar file in android application using adt 20
<p>I am trying to use external jar file in android application. The jar file is running well in another java application but when I am trying to use the Jar file with Android Application by BuildPath-> Add External Jars; it is showing following errors </p> <p>"could not find class referenced from method ".</p> <p>Please help me out from this.</p> <p>Thanks</p> <p>Shorav</p>
java android
[1, 4]
2,298,500
2,298,501
convert Javascript to jQuery
<pre><code> //Page A &lt;input type='text' id='tb'&gt; var returnedValue = showModalDialog('page2.aspx', window); //Page B &lt;input type='text' onkeypress='update(this);'&gt; function update(Sender) { var input = window.dialogArguments.document.getElementById("tb"); input.value = Sender.value; } </code></pre> <p>can any one please convert this javascript code to Jquery? I am good in javascript but not in jQuery. Javascript is not my requirement.</p>
javascript jquery
[3, 5]
3,264,484
3,264,485
javascript problem
<p>i have a javascript function </p> <pre><code> function alertMe(len) { var fu1 = document.getElementById("FileUpload1"); var fu2 = document.getElementById("FileUpload2"); var fu3 = document.getElementById("FileUpload3"); var fu4 = document.getElementById("FileUpload4"); var myCars=new Array(fu1,fu2,fu3,fu4) var l=0; for(var i=0;i&lt;myCars.length;i++) { if(myCars[i].value!=null) l++; } if(len&gt;6) { if(len==7 &amp;&amp; l&lt;=3) window.location="uploo.aspx"; else if(len==8 &amp;&amp; l&lt;=2) window.location="uploo.aspx"; else if(len==9 &amp;&amp; l&lt;=1) window.location="uploo.aspx"; else alert("you cant keep more than 10 files in your table,,delete some files first and then upload"); return false; } else window.location="uploo.aspx"; } </code></pre> <p>this function gets a value len and based on that checks some conditions,,in addition to that i m trying to retrieve the IDs of four file upload controls,,the purpose is to get the number of files browsed,,the function does not give any errors but is not working properly.. suppose if len=7 and l=3,then it should call uploo.aspx but rather it shows me the alert messages..i want to know, is their any error in retrieving the value of l..</p>
asp.net javascript
[9, 3]
5,685,791
5,685,792
Populate drop down from XML - code executing in wrong order
<p>I am trying to populate a drop down box from an XML file using jQuery. When the code is ran it appears to execute in order.</p> <p>jQuery:</p> <pre><code> $("#filterButton").click(function() { var dropdown = new Array(); $.get('../restaurants.xml', function (xmlFile) { $(xmlFile).find('restaurant').each(function () { var found = false; var $restaurant = $(this); var type = $restaurant.attr("type"); dropdown.forEach(function(arrayValue){ if(arrayValue == type){ found = true; } }); if(found == false){ dropdown.push(type); } }); }); $('#potentialRestaruants').append('&lt;select&gt;'); dropdown.forEach(function(arrayValue){ $('#potentialRestaruants').append('&lt;option value="' + arrayValue + '"&gt;' + arrayValue + '&lt;/option&gt;' ); }); $('#potentialRestaruants').append('&lt;/select&gt;'); }); </code></pre> <p>However the code is being run in this order:</p> <pre><code> $("#filterButton").click(function() { var dropdown = new Array(); </code></pre> <p>then</p> <pre><code>$('#potentialRestaruants').append('&lt;select&gt;'); dropdown.forEach(function(arrayValue){ $('#potentialRestaruants').append('&lt;option value="' + arrayValue + '"&gt;' + arrayValue + '&lt;/option&gt;' ); }); $('#potentialRestaruants').append('&lt;/select&gt;'); }); </code></pre> <p>then </p> <pre><code>$.get('../restaurants.xml', function (xmlFile) { $(xmlFile).find('restaurant').each(function () { var found = false; var $restaurant = $(this); var type = $restaurant.attr("type"); dropdown.forEach(function(arrayValue){ if(arrayValue == type){ found = true; } }); if(found == false){ dropdown.push(type); } }); }); </code></pre> <p>Why is the code being ran in this order and how can I get to run in the order I need?</p>
javascript jquery
[3, 5]
5,518,351
5,518,352
2 or more keys pressed at the same time
<p>Hi guys I have been working with android recently and it's fine until now.</p> <p>When I want to handle a key down event I just override the onKeyDown method in my activity. The same with the key up event.</p> <p>The problem is that this just works for a single key, if I press to keys at the same time just one is handle.</p> <p>For example:</p> <pre><code>@Override public boolean onKeyDown(int keyCode, KeyEvent event){ boolean returnValue = super.onKeyDown(keyCode, event); switch(keyCode){ case KeyEvent.KEYCODE_A: //Do something awesome here return true; case KeyEvent.KEYCODE_C: //Do something even more awesome here return true; } return returnValue; } </code></pre> <p>If I press 'A' and 'C' at the same time one is processed first.</p> <p>My first idea was to set flags with the onKeyDown event to keep the track of what keys are pressed and clear the flags with the onKeyUp event, but this failed when I switch between activities.</p> <p>Now what I want is something like the following:</p> <pre><code>@Override public boolean onKeyDown(int keyCode, KeyEvent event){ boolean returnValue = super.onKeyDown(keyCode, event); switch(keyCode){ case KeyEvent.KEYCODE_A: if(/* C is pressed */){ //Do something not so awesome here } else{ //Do something awesome here } return true; case KeyEvent.KEYCODE_C: if(/* A is pressed */){ //Do something not so awesome here } else{ //Do something even more awesome here } return true; } return returnValue; } </code></pre>
java android
[1, 4]
2,976,331
2,976,332
Empty Http Call but no error
<p>I'm trying to call a webservice with my application, but I get no error, the URL is the good one and return something (via the browser), but I get no content.</p> <pre><code>try { HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet(url); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); int lenght = (int) entity.getContentLength(); is = entity.getContent(); } catch (Exception e) { Log.e("log_tag", "Error in http connection" + e.toString()); } </code></pre> <p>lenght is equal to -1 due to the empty response he receives</p> <p>Does the response from the url need to be HTML ? Or anything I output can be grab by the HttpClient ?</p>
java android
[1, 4]
267,387
267,388
retrieve window.location.hash url in php
<p>I am using a jquery tabbed interface here <a href="http://www.imashdigital.com/#2" rel="nofollow">http://www.imashdigital.com/#2</a> and would like to return the tab number in php.</p> <p>Ideally I would like to run a javascript function (on a timer) that continually updates a global <strong>php variable</strong> with the current tab.</p> <p>Based on this php value, 1 through to 4, I will then load a different sidebar.</p> <p>I would be grateful for any help and some code examples as I am a novice.</p> <p>Kind regards</p> <p>Jonathan</p>
php javascript jquery
[2, 3, 5]
3,136,147
3,136,148
open text box which clicking on image
<p>I have an image on which "click to edit" is written now when i click that part i want to show edit box where "Type 1" is written.</p> <p>I have tried to put edit box but unable to get the click event ... </p> <p>here is the image</p> <p><a href="http://www.freeimagehosting.net/image.php?55dd1b316d.png" rel="nofollow">http://www.freeimagehosting.net/image.php?55dd1b316d.png</a></p>
javascript jquery
[3, 5]
3,320,203
3,320,204
JS/jQuery code flow - combine an animation with a click function
<p>I am trying to implement a page that has a simple div when the pointer is outside of it, which fades in to a different div, with different content, on hover.</p> <p>I want the simple div to not be a link, but the different div to be a link (the entire div).</p> <p>The following jsfiddle describes and demonstrates the issue that I'm having: <a href="http://jsfiddle.net/neigere/3sP3N/" rel="nofollow">http://jsfiddle.net/neigere/3sP3N/</a></p> <p>You can see the bug live here: <a href="http://tedneiger.com" rel="nofollow">http://tedneiger.com</a></p> <p>It seems like a code sequence execution issue that could be fixed by moving where I call the click function, but I've attempted several variations and haven't been able to successfully resolve it.</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
4,168,897
4,168,898
Tips for moving from C# to Java?
<p>So I'm going to a job interview next week at a Java place, and would like to not come across as clueless. I'm a pretty confident C#/.NET developer and am (clearly!) willing to consider jumping ship to Java - I'd like links to resources people would recommend for doing this. I'm interested in answers to questions like:</p> <ul> <li>Any guides that are a rough equivalent to <a href="http://www.codethinked.com/post/2008/07/21/Learning-Ruby-via-IronRuby-and-C-Part-1.aspx">Justin Etheridge's Ruby for C# developers</a>? That was really useful when I decided I wanted to learn Ruby's rake (and thus at least a little Ruby). There seem to be more pages for people going the other way, though...</li> <li>Which IDE to use? I've actually already bought my own IntelliJ because I love its HTML/CSS/JS, but haven't touched its actual raison d'etre of, well, "that Java stuff". I suspect the place I'm going to uses Eclipse, however. So - recommended resources to get up and running on a Mac or Windows (I'm not fussy)?</li> <li>It's probably going to be a TDD coding interview; I guess JUnit is the de facto choice to learn a little about here?</li> </ul> <p>Thanks in advance.</p>
c# java
[0, 1]
1,769,215
1,769,216
bind focus to a radio button
<p>I'm working in chrome 12, my code is below.</p> <p>HTML:</p> <pre><code>&lt;input type="radio" class="tooltip" title="test1" name="group" value="1"&gt; 1&lt;br&gt; &lt;input type="radio" class="tooltip" title="test2" name="group" value="2"&gt; 2&lt;br&gt; &lt;input type="radio" class="tooltip" title="test3" name="group" value="3" checked&gt; 3&lt;br&gt; &lt;input type="text" class="tooltip" value="4" title="test4"&gt;&lt;br&gt; &lt;div class="result"&gt; THIS SHOULD UPDATE WHEN YOU FOCUS ON ONE OF THE INPUTS &lt;/div&gt; </code></pre> <p>​ JavaScript:</p> <pre><code>$('.tooltip').bind('focus', function(ev) { $('.result').html( this.value ); }); </code></pre> <p>(<a href="http://jsfiddle.net/b9erh/3/" rel="nofollow">fiddle</a>) </p> <p>Is it possible to bind a focus event to a radio button? Can you offer an alternative? </p>
javascript jquery
[3, 5]
3,588,170
3,588,171
JS: Keeping user selection persistent across page reloads
<p>Lets say we have a side bar on a page. It has two tabs. When you click the unselected tab, the content below it in the sidebar instantly switches using jQuery. The old div is hidden, the new div is shown. Not a big deal. </p> <p>Now that you've selected that div however, when you click to the next page, the history of that selection is lost, and you're back to the first default selected div.</p> <p>How can I keep the action persistent?</p>
javascript jquery
[3, 5]
4,929,409
4,929,410
How to get the user control textbox value in aspx page?
<p>I have a User control ascx file with a textbox in it</p> <pre><code>&lt;asp:TextBox ID="textboxDate" runat="server" CssClass="FieldValue" MaxLength="10" Columns="12" autocomplete="off" Style="padding-right: 18px; border: 1px solid #567890;" /&gt; &lt;ajaxToolkit:CalendarExtender ID="calendarExtenderDate" runat="server" TargetControlID="textboxDate" PopupButtonID="textboxDate" /&gt; </code></pre> <p>I'm adding this user control in my aspx page </p> <pre><code> &lt;uc:DateControl ID="dateControlStart" runat="server" RequiredErrorMessage="please enter date" /&gt; </code></pre> <p>and i want the value of this textbox . How can i do this using javascript or Jquery.</p>
javascript jquery asp.net
[3, 5, 9]
4,191,161
4,191,162
View Pager has a mind of its own
<p>I have a set of five panning pages in view pager. All these pages have a list view, Since the data is too much, I pre-fetch the data from the server and populate the list at position+1 itself,</p> <p>For ex: When the position of the page is 0, I load the adapters with data for page 1 during page 0 itself. </p> <p>The problem is, If I pan the pages slowly, the list is populated with data and displayed beautifully, if I do a fast panning, the screen gets empty with no Lists.</p> <p>I tried viewpager.getadapter,notifydatasetchanged(), invalidate(), onpagechangelistener(), nothing works, I have been stuck on this small isuue for weeks, please guide me.</p>
java android
[1, 4]
4,847,038
4,847,039
JS: setInterval and clearIntervals with jQuery
<p>I'm probably tired for staring at this for too long, maybe someone can clear this up for me:</p> <pre><code>//scripts in whispers are setup this way. var something = function(){ setInterval(function1,1000); setInterval(function2,1000); blah .. blah... } //function2 is the same as this one var function1 = function(){ ajax to do something on server blah... blah... } //button to stop things from running anymore $('.stop').live('click',function(){ clearInterval(function1); clearInterval(function2); return false; } </code></pre> <p>I should be able to stop function1 and/or 2 from running after clicking the button yeah? For some reason - the ajax calls within the two functions keep running and pinging the server.</p>
javascript jquery
[3, 5]
5,266,527
5,266,528
Change input language for selected Controls - ASP.NET
<p>I've a text area in my application. I want to programatically set the input language for the text area alone without affecting other controls.</p> <p>Any ideas?</p> <p>Regards</p> <p>NLV</p>
c# asp.net
[0, 9]
2,764,504
2,764,505
javascript: Defining "this" in the context of a function
<p>When jQuery calls a function as an event handler for a raised event, jQuery is somehow able to define "this" in the context of a function that it calls. In the following example, jQuery define this as the dom element that was clicked on.</p> <pre><code>&lt;input id="someButton" type="button" value="click me!"/&gt; &lt;script type="text/javascript"&gt; $("#someButton").click(EventHandler); function EventHandler() { alert($(this).attr("id")); //This raises an alert message "someButton" } &lt;/script&gt; </code></pre> <p>How does jQuery do this? I would like replicate this behaviour for my own custom framework.</p>
javascript jquery
[3, 5]
1,802,860
1,802,861
Is Python-based software considered less-professional than C++/compiled software?
<p>I'm working on a plugin for some software that I'm planning on selling someday. The software I'm making it for has both a C++ SDK and a Python SDK.</p> <p>The C++ SDK documentation appears incomplete in certain areas and isn't documented that well.</p> <p>The Python SDK docs appear more complete and in general are much easier to work with.</p> <p>So I'm trying to decide if I want to go through the potential trouble of building a C++ plugin instead of a Python plugin to sell. About the only thing that makes me want to do a C++ plugin is that in my mind, a "C++ plugin" might be an easier sell than a "Python plugin". A lot of programmers out there don't even considered writing Python to be real "programming".</p> <p>Do you think that potential customers might say "Why would I pay money for a measly little Python script?"? As opposed to "Oh it was written in C++ so the guy must be a decent programmer"?</p> <p>Writing the Python plugin would be faster. Both plugins would look and behave exactly the same. The C++ plugin might be faster in certain spots, but for the type of plugin this is, that's not a huge deal.</p> <p>So my question is, would a Python plugin be considered not as professional/sellable as a C++ plugin, even if it looks and acts EXACTLY the same as a C++ plugin?</p>
c++ python
[6, 7]
1,025,547
1,025,548
I want to write a Reordering User Interface? How to do it?
<pre><code>&lt;ul style="padding: 5px; margin-left: 20px;"> Hardware &lt;li style="padding: 10px; margin-left: 40px;">Product 1&lt;/li> &lt;li style="padding: 10px; margin-left: 40px;">Product 2&lt;/li> &lt;li style="padding: 10px; margin-left: 40px;">Product 3&lt;/li> &lt;li style="padding: 10px; margin-left: 40px;">Product 4&lt;/li> &lt;li style="padding: 10px; margin-left: 40px;">Product 5&lt;/li> &lt;/ul&gt; </code> </pre> <p>I have this structure i want to do a reodering interface where user can move product 5 up in the hiearchy by click up arrow and likewise bring something down. I want to do this using javascript of jQuery. I just need some hint about how to do it right.</p>
javascript jquery
[3, 5]
1,710,673
1,710,674
Open anew window using java
<p>Is there any way to open a new window with a specified URL using java only.I know that we can use window.open in javascript but i need it to be in java page.Anyidea?.</p>
java javascript
[1, 3]
5,282,575
5,282,576
how to make a counter like badoo.com
<p>I'm really amazed with Badoo.com counter. How can we implement such a graphical counter, wich is by the way very eye-catching. When It adds one number it shows all the number from 0 to that number. With firebug I just noticed that all of it a picture. They use css to show a specific number.<br> thanks </p>
php jquery
[2, 5]
2,664,682
2,664,683
How to delete an item from an array in jquery?
<p>I have an array :</p> <pre><code>var menu_items = []; </code></pre> <p>I push two element in it like this :</p> <pre><code> menu_items.push({ order: menu_items.length + 1, // value= 1 title: 'Label', url: '', IsSystemMenuItem: true }); menu_items.push({ order: menu_items.length + 1, // value =2 title: 'grid', url: '', IsSystemMenuItem: true }); </code></pre> <p>now i want to delete second item (i.e where order: menu_items.length + 1, // value =2 and title: 'grid')</p> <p>how can i delete this item ??</p>
javascript jquery
[3, 5]
2,261,840
2,261,841
Input field values not adding up correctly
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/588004/is-javascripts-math-broken">Is JavaScript&#39;s Math broken?</a> </p> </blockquote> <p>I'm attempting to add up three input fields, each containing a value of 33.3 which should total 99.9, however they are totaling to 99.89999999999999</p> <p>Could someone explain how this is happening. Below is my code. Thanks in advance. </p> <pre><code>$("#modify-funding input.percentCalc").sumValues() $.fn.sumValues = function () { var sum = 0; this.each(function () { sum += $(this).fieldVal(); }); return sum; }; $.fn.fieldVal = function () { var val; if ($(this).is(':input')) { val = $(this).val(); alert("val " + val); } else { val = $(this).text(); } return parseFloat(('0' + val).replace(/[^0-9-\.]/g, ''), 10); }; </code></pre>
javascript jquery
[3, 5]
3,887,060
3,887,061
what's the difference between these two javascript calls?
<p>what does the 'function' do in the following:</p> <pre><code>$('.event-row').on('mouseover',function(){ arc.event_handler.event_row_over(); }); $('.event-row').on('mouseover',arc.event_handler.event_row_over ); </code></pre> <p>thx in advance</p>
javascript jquery
[3, 5]
5,696,026
5,696,027
Stripe texts out of string
<p>I want to strip the <code>&lt;img&gt;</code> tags and it's contents out of my string that is returned from the database.</p> <p><strong>Example string</strong></p> <pre><code>//I want to retrive dummy texts from my string. var string = "&lt;img src='test.jpg'/&gt;dummy texts &lt;img src='text.jpg'/&gt; dummby text dummy texts"; </code></pre> <p>I have tried</p> <pre><code>if (string.indexOf('&lt;img') != -1) { var newString = $(string).filter(function() { return this.tagName != 'img'; }).text(); } </code></pre> <p>However, my DB has crappy data and sometimes return</p> <pre><code>//There is no closure for image tag. var string = "&lt;img src='test.jpg'/&gt;dummy texts &lt;img src='text.jpg'/&gt; dummby text dummy texts"; </code></pre> <p>and my code would strip the entire string. </p> <p>The image tag positions vary.</p> <p>How do I strip the <code>&lt;img&gt;</code> tags efficiently?</p>
javascript jquery
[3, 5]
4,736,970
4,736,971
Using jQuery or JavaScript to Add Attribute to Anchors After DOM Already Loaded
<p>I have an application that requires the "ontouchstart" attribute to be added to each and every anchor in order to have the anchor:active CSS state to work on iOS devices.</p> <p>Trouble is that the entire application loads content via AJAX after the DOM has already loaded, which means any <code>$(selector).attr('ontouchstart','')</code> call will only work on the initial screen, not content added later via AJAX.</p> <p>Because each screen is being loaded by separate functions (in some cases being constructed by the function itself) I would like to find a solution that allows a single jQuery or JavaScript call that applies to all anchors, even those added after the DOM is loaded rather than going through each and every function and adding in the call individually (there are hundreds of them).</p> <p>Is this even possible? Any help would be greatly appreciated.</p>
javascript jquery
[3, 5]
3,341,638
3,341,639
Getting client ID in javascript
<p>I am trying to fix someone else's code and I have lines like this throughout my javascript -</p> <pre><code>var dataDiv = document.getElementById("ctl00_cpMain_tcMainTabs_tResBDetails_tcDetailTabs_tBDetail_bmrDetailDataDiv") </code></pre> <p>What is the preferred syntax?</p> <p>FYI, this is a jQuery enabled web application.</p>
javascript jquery
[3, 5]
4,287,763
4,287,764
byte[] operations in Java
<p>Let's say I have array of bytes:</p> <pre> byte[] arr = new byte[] { 0, 1, 2, 3, 4 }; </pre> <p>Does platform has functions that I can use to play with this array - for example, how to invert it (get 4,3,2,1,0)? Or, how to invert part of it (2,1,0,3,4)? Get part of array (0,1,2,3)?</p> <p>I know I can manually write functions but I am curious if I'm missing useful util functions in platform that I should know about (and couldn't find any useful guide using google).</p> <p>Thanks!</p>
java android
[1, 4]
3,497,865
3,497,866
Call jQuery function from PHP
<p>How do I call a jQuery function from PHP?</p> <pre><code>&lt;?php if ($error == 1) { ?&gt; &lt;script type="text/javascript"&gt; error('1'); &lt;/script&gt; &lt;? } ?&gt; </code></pre> <p>It doesn´t work.</p>
php jquery
[2, 5]
2,813,914
2,813,915
Android: ExpandableListView and context menus
<p>I'm writing an app utilizing <strong>ExpandableListView</strong>.<br> I use a subclass of <strong>BaseExpandableListAdapter</strong> to provide data to my <strong>ExpandableListView</strong>.</p> <p>Then I try to add context menus to this view, but these menus should be different for group an child items in the expandable list. So in my adapter's <strong>getChildView</strong> and <strong>getGroupView</strong> I call <strong>setOnCreateContextMenuListener</strong> like this:</p> <pre><code>TextView textView = new TextView(TestActivity.this);; textView.setText(getChild(groupPosition, childPosition).toString()); textView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() { @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { TestActivity.this.onCreateChildContextMenu(menu, v, menuInfo); } }); return textView; </code></pre> <p><strong>TestActivity.this.onCreateChildContextMenu</strong> simply adds a few string to menu.</p> <p>The problem:<br> This works quite fine - context menu appears and works as expected but group item cannot be expanded anymore. It simply ignores short clicks. I've checked - as expected the textView becomes isLongClickable() after this line but it remains not isClickable() - so I cannot see how this context menu callback can affect short click functionality.<br> I've solved this problem for me by adding this listener at the whole ExpandableListView and then patching the menu for children. But it looks ugly. Do I miss something?</p> <p>Thanks.</p>
java android
[1, 4]
1,067,427
1,067,428
is in iphone javascript Enable dispble?
<p>i have one project working greate but in other iphone not working .both are same model with same os. i m thinking i may be of javascript problem . is it so ? how can i Enable disable javascript wih code ?</p>
javascript iphone
[3, 8]
2,826,099
2,826,100
How can i convert the List<string> to a dataset in the required format
<p>Hi all i will read the required Content from an Excel sheet so that i will get the required data and i am saving that to <code>List&lt;String&gt;</code> as follows</p> <p><img src="http://i.stack.imgur.com/eIVIp.jpg" alt="enter image description here"></p> <p>Now i would like to have my dataset in such a way that i would like to format in this way</p> <p><img src="http://i.stack.imgur.com/CQ7ZL.jpg" alt="enter image description here"></p> <p>Is it possible to do as per my requirement if so can any one help me..</p>
c# asp.net
[0, 9]
4,134,527
4,134,528
jQuery: how to change output with click and change functions?
<p>I have a form where I have a group of fields that can be added and removed. One of these fields contains a set of numbers that are added to produce a sum. You can see an example of this here: <a href="http://jsfiddle.net/beehive/HGJck/" rel="nofollow">http://jsfiddle.net/beehive/HGJck/</a></p> <p>Here's my problem: the sum does not change when I select a different number value when the form first loads, and there is only one group of fields (nothing added). It only changes after I've added or removed fields. How can I fix this?</p> <pre><code>$(document).ready(function() { /* Add &amp; Remove */ var removeButton = "&lt;button id='remove'&gt;Remove&lt;/button&gt;"; $('#add').click(function() { $('div.container:last').after($('div.container:first').clone()); $('div.container:last').append(removeButton); /* Sum */ $(".number").change(function() { var combined = -10; $(".number").each(function() { combined += parseInt(this.value); }); $("#sum").html(combined); }).trigger("change"); return false; }); $('#remove').live('click', function() { $(this).closest('div.container').remove(); }); });​ </code></pre>
javascript jquery
[3, 5]
4,561,319
4,561,320
how to convert text to image on the fly without image file
<p>I am doing some sort of directory in ASP.NET, in which everyone has phone numbers displayed. I dont want harvesting on my site, so instead of writing 123-123-1234 I want it to be rendered from image.</p> <p>another limitation is that I dont want to save any TMP image file. I want the server to send it right back to the client for redrawing. Is that something doable? via JS?</p> <p>Thanks!</p>
javascript asp.net
[3, 9]
2,560,700
2,560,701
JQuery Mobile collapsible does not apply to div
<p>I'm very new to both JQuery and Javascript. I have an feed, I would like to display these feed inside a collapsible div AS a collapsible div. I have the following Javascript file:</p> <pre><code>&lt;script type="text/javascript" src="https://www.google.com/jsapi"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; google.load("feeds", "1"); google.setOnLoadCallback(showFeed); function showFeed() { var feed = new google.feeds.Feed("http://www.varzesh3.com/rss"); feed.setNumEntries(10); feed.load(function(result) { if (!result.error) { var container = document.getElementById("headlines"); for (var i = 0; i &lt; result.feed.entries.length; i++) { var entry = result.feed.entries[i]; var di = document.createElement("div").setAttributeNode("data-role", "collapsible"); di.innerHTML = '&lt;h3&gt;' + entry.title + '&lt;/h3&gt;'; di.innerHTML += '&lt;p&gt;' + entry.contentSnippet + '&lt;/p&gt;'; container.appendChild(di); } } else { var container = document.getElementById("headlines"); container.innerHTML = '&lt;li&gt;Get your geek news fix at site&lt;/li&gt;'; } }); } &lt;/script&gt; &lt;body&gt; &lt;div data-role="collapsible-set" id="headlines"&gt;&lt;/div&gt; &lt;/body&gt; </code></pre> <p>This should fetch all my feed names and put them in a collapsible div, it does exactly that but it shows the names as plain HTML text instead of a JQuery Mobile collapsible div.</p>
javascript jquery
[3, 5]
3,784,765
3,784,766
JQUERY .show() and div tag in ASP.NET
<p>Basically, when the page loads i set the div visibility to false. When i click the button, i want the code behind function to be called, and the div tag to be visible, true.</p> <pre><code> $('#Button2').click(function () { $('#edit').show(function () { }); }); &lt;input type="submit" id="Button2" runat="server" value="Search" OnServerClick="Button1_Click" /&gt; </code></pre> <p>but when clicking the button, the page posts back, causing the div tag to be invisible all times.</p> <p>I can set the return false to the onlclick event of the button , but i need to call the function also.</p>
jquery asp.net
[5, 9]
739,124
739,125
How to get Contact Name through Phone Number
<p>I need to directly get the contact name (if registered in contact list) through the contact number. </p> <p>I can do the opposite (get number through name) with this code:</p> <pre><code>ContentResolver cr = getContentResolver(); Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI, null, "DISPLAY_NAME = '"someone"'", null, null); if (cursor.moveToFirst()) { String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID)); Cursor phones = cr.query(Phone.CONTENT_URI, null, Phone.CONTACT_ID + " = " + contactId, null, null); while (phones.moveToNext()) { String number = phones.getString(phones.getColumnIndex(Phone.NUMBER)); int type = phones.getInt(phones.getColumnIndex(Phone.TYPE)); Log.v("TAG3",number); ... } } } </code></pre> <p>But I can't honestly do the opposite. Can you please guys help?</p>
java android
[1, 4]
2,014,815
2,014,816
How to hide div with jquery within the UpdatePanel onClick event?
<p>This is how I'm trying to do it:</p> <pre><code> $(document).ready(function () { $("#ButtonId").click(function () { $('#DivID').hide(); }); }); </code></pre> <p>This is not working for me. Any suggestions would be helpful.</p> <p>Thanks.</p>
jquery asp.net
[5, 9]
4,457,823
4,457,824
ASP.Net RadioButtonList SelectedIndexChanged event not firing
<p>I'm building a dynamic RadioButtonList to list all of the records for a particular search item and allow the user to select the relevant option. The problem I'm having however, is that the SelectedInhdexChanged event is never firing.</p> <p>I've tried initialising the RadioButtonList and assigning its event handler in the page_load and page_init methods. I've also tried dragging the RadioButtonList onto the page and double- clicking it to create the event handler that way- but still no luck.</p> <p>Any ideas? I've pasted my code below for you to have a look:</p> <p>Here's my Page_Load and event handler method:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { measureDropdown = loadDropdown("GetMeasuringTypes", measureDropdown); categoryDropdown = loadDropdown("GetCategories", categoryDropdown); } rBtn = new RadioButtonList(); rBtn.CausesValidation = true; rBtn.SelectedIndexChanged += new EventHandler(rBtn_SelectedIndexChanged); } void rBtn_SelectedIndexChanged(object sender, EventArgs e) { moreThanOneLbl.Text = "Woohoo!"; } </code></pre> <p>Here's how I assign the list items to the RadioButtonList (from a datatable):</p> <pre><code>foreach (DataRow row in table.Rows) { ListItem li = new ListItem(); li.Value = row[0].ToString(); li.Text = row[1].ToString() + ": " + row[2].ToString(); //rBtn.Items.Add(li); RadioButtonList1.Items.Add(li); } </code></pre>
c# asp.net
[0, 9]
1,997,149
1,997,150
Again, how to get data from callback?
<p>I have this code</p> <pre><code>var children; $.ajax({ url: Routing.generate('snmp_ajax_get_children', {dev: root}), async: true, type: "GET" }).done(function(data) { var children = Array(); for(var i in data) { children[i] = data[i].split('|'); for (var j in data[i]) { children[i][j] = $.trim(data[i][j]); } } localStorage.setItem('children', children); }); children = localStorage.getItem(children); localStorage.removeItem('children'); </code></pre> <p>I use localStorage (ugly, i know) to get data from callback, because any other approach wasn't work for me (i don't know why), any suggestion?</p>
javascript jquery
[3, 5]
5,257,359
5,257,360
How to get textbox value in javascript
<p>I have this in the aspx.cs page and trying to get the value of the text box in my js function. This is not working:</p> <pre><code>result += result.Replace(sOptionText.ToString(), "&lt;input type='text' id=\"txtSS_" + Version + "\" size='10' value=\"" +"\" runat = \"server\" style=\"display:none;\" /&gt;"); </code></pre> <p>My js function is here:</p> <pre><code>var sOptionList = ""; var $obj = $('#txtSS_' + VersionID); if ($('#txtSS_' + VersionID).length &gt; 0) sOptionList = $obj.val(); </code></pre> <p>I am getting a null value. What am I doing wrong? Also, wanted to know if my textbox declaration in .cs page is correct. It still shows that the value="" when I firebug it. </p>
javascript asp.net
[3, 9]
3,374,927
3,374,928
How to limit character in jquery tags input?
<p>i have used the following code to limit the character but it is not working.. pls help me. thanks in advance.</p> <pre><code> &lt;td nowrap="nowrap"&gt; &lt;asp:TextBox MaxLength="60" runat="server" ID="Keyword" CssClass="TaskTitle" Width="270px" TextMode="SingleLine" /&gt; &lt;/td&gt; $('#Keyword_tag').bind('keyup', function() { var characterLimit = 60; var charactersUsed = $('#Keyword').val(); charactersUsed = charactersUsed.replaceAll(','); if (charactersUsed.length &gt; characterLimit) { alert(charactersUsed.length); charactersUsed.length = characterLimit; alert(charactersUsed.length); $(this).val($(this).val().slice(0, characterLimit)); $(this).scrollTop($(this)[0].scrollHeight); } </code></pre> <p>I have to limit the character to 60 but when i assign the character limit value to character used it is not getting assigned. I am using jquery tags input plugin for the keyword field</p>
jquery asp.net
[5, 9]
5,851,062
5,851,063
Jquery to a asp.net control
<p>I am trying to use jquery on an Asp.net control. In asp.net id get generated from server. so I am trying to write a selector to use jquery.</p> <pre><code> $(document).ready(function() { $("#ctl00$cphBody$fv$txtDescription").val('blah'); }); </code></pre> <p>I need if the id <strong>contains</strong> 'txtDescription', I need to change the value of that textbox. Please suggest a selector for that</p>
jquery asp.net
[5, 9]
4,250,721
4,250,722
How do I identify which element (or elements) exist at a specific position?
<p>Given the vast number of threads/searches that relate to how to obtain coordinates of an element, I'm having a tough time trying to figure out the opposite - how to get the element (or elements) at a specific x y coordinate. Any suggetions? </p>
javascript jquery
[3, 5]
1,415,035
1,415,036
How can I replace values in an array of variables with jQuery
<p>I have this code</p> <pre><code>newRow = "&lt;tr&gt;&lt;td&gt;[[var1]]&lt;/td&gt;&lt;td&gt;[[var2]]&lt;/td&gt;&lt;td&gt;[[var3]]&lt;/td&gt;&lt;/tr&gt;" </code></pre> <p>Now i have this array</p> <pre><code>data['var1'] ='test1'; data['var2'] ='test2'; data['var3'] ='test3'; </code></pre> <p>I want to replace the above data in newRow in simplest possible way. How can I do that?</p>
javascript jquery
[3, 5]
2,245,548
2,245,549
Using .click() twice
<p>My function right now is set to animate a pop up window on mouse over and close the pop up window when the mouse leaves the area.</p> <p><strong>I would like call .click() twice</strong>. I've been playing around with <code>.click()</code> and can only get it to function once since when used twice it tries to call both <code>.click()</code> functions at the same time.</p> <p>My functions are</p> <pre><code>$('#sdt_menu &gt; li').bind('mouseenter',function(){ } </code></pre> <p>and</p> <pre><code>.bind('mouseleave',function(){ } </code></pre> <p>I've tried putting click into one of the functions,</p> <pre><code>$('#sdt_menu &gt; li').bind('click',function(){ } </code></pre> <p>Which works great but I can't use it in both of them so I'm thinking I need to rewrite and put in new functions for each .click() but I still can't figure out how to use it twice.</p>
javascript jquery
[3, 5]
3,399,557
3,399,558
Jquery conditional statement
<p>I'm really sorry if this come across as stupid but i've searched everywhere but i didn't find any tip on how to go about it. i have this variable </p> <pre><code> var id = $('#sometextfield').val(); </code></pre> <p>This text field value is dynamically generated eg.</p> <pre><code> &lt;input type="text" name="id" id="id" value="&lt;?php echo $_get[something];?&gt;" /&gt;) </code></pre> <p>The problem here is that i have an if condition saying</p> <pre><code>if(id == 100 || id ==120) { // i have these variables var mulitiplier = 0.005 var price = (some alog) * mulitiplier; // do some very long piece of code } else if (id == 200 || id == 220) { // Then i have these variables var mulitiplier = 0.090; var price = (some alog) * mulitiplier; // Do the same very long piece of code(its practically the same thing as // the first if statement and the only change is the ariable multiplier) } </code></pre> <p>This works and all but is there any way to not repeat the same thing. I don't like the look of it atm. Many thanks in advance..</p>
javascript jquery
[3, 5]
3,981,738
3,981,739
How to make a custom Dialog which will display once a day
<p>I am doing an application in which a I want to implement a custom dialogn in the main activity. The thing is a want this dialog to be displayed once a day. How can I accomplished that ? </p>
java android
[1, 4]
3,952,248
3,952,249
Get system ip code not working in server
<p>This code works on my system not in server please help me to fix this error. am not sure what is error..</p> <p>This is my partial code...</p> <pre><code>private IPAddress getMyCurrentIP() { IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); if (host.AddressList.Length == 1) myCurrentIP = host.AddressList[0].ToString(); else { foreach (IPAddress address in host.AddressList) { if (address.AddressFamily == AddressFamily.InterNetwork) { if (IsLocal(address)) return address; } } } return null; } public bool IsLocal(IPAddress address) { if (address == null) throw new ArgumentNullException("address"); byte[] addr = address.GetAddressBytes(); return addr[0] == 10 || (addr[0] == 192 &amp;&amp; addr[1] == 168) || (addr[0] == 172 &amp;&amp; addr[1] &gt;= 16 &amp;&amp; addr[1] &lt;= 31); } </code></pre> <p>please help me to fix this error...</p>
c# asp.net
[0, 9]
5,966,401
5,966,402
How can I show a dialog box like stackoverflow?
<p>I have the following code on my page:</p> <pre><code>$('#Report').click(Report); function Report() { var e = encodeURIComponent, arr = [ "dataSource=" + e($('#DataSource').val()), "statusID=" + e($('#StatusID').val()) ]; window.location.href = '/Administration/Tests/Report?' + arr.join("&amp;"); return false; } </code></pre> <p>When a user clicks on the button with Id=Report then the function is called and it shows a page with report information. </p> <p>However if the dataSource and statusID are not set then my code ends in an exception. </p> <p>Is there some way I can check for the value of DataSource not being equal to "00" and StatusID not being equal to "0" and then show a dialog box telling the user these fields should be selected. </p> <p>Ideally I would like to have something like the dialog box that Stackoverflow uses.</p>
javascript jquery
[3, 5]
1,335,259
1,335,260
where does the Editable.append() implemented?
<p>Here is the code :</p> <pre><code>Editable text = (Editable)mResults.getText(); //mResults is a TextView. </code></pre> <p>I want to know, when i call <code>text.append("***")</code>,which implements is called? I can't find where the Editable interface is implemented.</p>
java android
[1, 4]
3,713,681
3,713,682
Android MediaRecorder release() issue and Video capturing is not in portrait mode
<p>I am facing some issue while developing Video capturing application.</p> <p>1) When I start capturing the Video, the <code>surface view</code> comes in landscape mode. I tried a lot. But i failed. I also referred<br> <a href="http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setRotation%28int%29" rel="nofollow">http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setRotation%28int%29</a> .. but no result</p> <p>2) I am using <code>release()</code> method. but when we use that, after capturing application get closed. if I donot use this in memory card there is a video with no any capture and zero size.</p> <p>Can any body explain why it is happening so?</p> <p>Thanks in Advance</p>
java android
[1, 4]
2,613,064
2,613,065
AND/OR Conditions in jQuery
<p>In jQuery space denotes AND condition "," denotes OR condition, Is that right? But I am facing issues in that. Here is my sample html code</p> <pre><code>&lt;td id="4"&gt; &lt;div id="test1" class="test1"&gt;&lt;/div&gt; &lt;div id="test2" class="test2"&gt;&lt;/div&gt; &lt;/td&gt; &lt;td id="5"&gt; &lt;div id="test1" class="test1"&gt;&lt;/div&gt; &lt;div id="test2" class="test2"&gt;&lt;/div&gt; &lt;/td&gt; </code></pre> <p>If I use the following query, it works</p> <pre><code>jQuery('#4 [id*=test1]') </code></pre> <p>it selects the correct div. However, if I use this query, </p> <pre><code>jQuery('#4 #test1') </code></pre> <p>it doesn't work. Any Idea? </p>
javascript jquery
[3, 5]
2,277,956
2,277,957
how to format data
<p>I am getting the following values from database:</p> <p>99, 12, 12.2222, 54.98, 56, 17.556</p> <p>Now I want to show that values like below: 99%, 12%, 12.22% , 54.98% , 56%, 17.55%</p> <p>Please give me any suggestion to acchive this.</p>
c# asp.net
[0, 9]
3,043,267
3,043,268
change color of an image using a color picker jquery
<p>i currently need some help, im using [Jquery Minicolors color picker][1] and i wanted to implement this png color picker transparency to png images basically color png images without clicking the button preview to apply it basically i want to include it in the jquery Minicolors plugin i made a demo myself but im not very knowledgeable myself i need help..</p> <p>let me make myself clear as much as possible, what i want to do is establish Jquery Minicolors color box to change automatically without the need of the preview button being clicked to change the color,i want to implement that change color png image transparency into the jquery Minicolors. </p>
javascript jquery
[3, 5]
1,131,535
1,131,536
Repel Objects when mouse is near
<p>I have a bunch of span elements in random positions enclosed inside a parent div called '.background'. These are generated with Javascript. Like this:</p> <pre><code>&lt;span class="circle" style="width: 54px; height: 54px; background: #5061cf; top: 206px; left: 306px"&gt;&lt;/span&gt; </code></pre> <p>I want them to move away (or repel) as the mouse draws near, but I have no idea how to do this! How would I go about accomplishing this in jQuery?</p> <p>I imagine you'd have to search for spans that were nearby, and then change their position if they were inside a certain radius surrounding the mouse, but I really don't know where to start. Any help is appreciated!</p>
javascript jquery
[3, 5]
6,192
6,193
Create variable just a number from text/number string - Razor CSHTML
<p>I have a variable <code>var1</code>. In the current context, it is pulled from the database and will be one of those values: </p> <blockquote> <p>2, 6, 7 6t, 7q, 8q, </p> </blockquote> <p>The number will only ever be single digit.</p> <p>The number will only ever be the first characters in the variable.</p> <p>I would like to create a single character variable (the number) from the variable I have put in.</p> <p>Here for instance my variable <code>Fac1Raw</code> has the value of <em>3c</em> and I have tried to use this code:</p> <pre><code>var Fac1 = (int)(Fac1Raw.ToString().Substring(0, 1)); </code></pre> <p>However I can't get it to work. Any ideas?</p>
c# asp.net
[0, 9]
2,205,258
2,205,259
Python to Javascript
<p>are there any tools for Windows to convert python to javascript?</p> <p>regards</p> <p>Alberto</p>
javascript python
[3, 7]
2,895,249
2,895,250
I have two javascript block in the page , one is adding dynamicllay which is , providing all images. should add above existing javascript on page
<p>i am using following code to add javascript dynamically </p> <pre><code> HtmlGenericControl scriptTagLinks = new HtmlGenericControl("script"); scriptTagLinks.Attributes["type"] = "text/javascript"; var scrip = "var aImgs=[" + appendString.ToString().TrimEnd(new char[] { ',' }) + "]"; scriptTagLinks.InnerHtml = scrip; </code></pre> <p>Javascript is adding to ascx page . But my problem I have two javascript block in the page , one is adding dynamicllay which is , providing all images. another one javascript as follows .</p> <pre><code>&lt;script type="text/javascript&gt; window.onload = function () { for (var i = 0; i &lt; aImgs.length; i++) { var oImg = new Image(); oImg.src = aImgs[i]; aImages.push(oImg); oImg.onload = function () { textureWidth = oImg.width; textureHeight = oImg.height; } }} &lt;/script&gt; </code></pre> <p>but dynamically created javascript is being added below the script . But should add above the script like this .</p> <pre><code> &lt;script type="text/javascript"&gt; var aImgs = [ 'DesktopModules/DNAiusCubeImages/Check/pic1.jpg', 'DesktopModules/DNAiusCubeImages/Check/pic2.jpg',]; &lt;/script&gt; &lt;script type="text/javascript&gt; window.onload = function () { for (var i = 0; i &lt; aImgs.length; i++) { var oImg = new Image(); oImg.src = aImgs[i]; aImages.push(oImg); oImg.onload = function () { textureWidth = oImg.width; textureHeight = oImg.height; } }} &lt;/script&gt;How can i achieve this . </code></pre>
c# javascript asp.net
[0, 3, 9]
2,301,008
2,301,009
get an iframe's "src" value in PHP?
<p>I have an iframe on my page, where on click (a menu) will update the iframe with a new URL depending on what menuitem they select.</p> <p>I do that by calling javascript function on 'onclick' passing the URL from the menu :</p> <pre><code> function frameclick(pageurl) { $("#iFrame1").attr('src', pageurl); } </code></pre> <p>What i would like to do whenever they press a menuitem is to store what iframe is loaded, because i have another button (select page language) and when they press that i want to reload the page but pass on the iframe-url that is currently displayed as a variable in the site url.</p> <p>Since PHP is serverside and JS is clientside, i cannot do ex. "$current_iframe_url = pageurl" - which would have enabled me to pass it on as a variable on refresh.</p> <p>You know how i could get around this ?</p> <p>That works fine.</p> <p>What i want to do now, is to whenever they click a menuitem i want to store that URL </p>
php javascript
[2, 3]
5,608,182
5,608,183
How to validate input controls in jquery and json, asp.net
<p>I am using jquery and json to save data to the database. How can I apply validation on textboxes. if conditions fails i have applied return false; still json data saving code executes.</p> <pre><code>$('input[type=text]').each(function() { // Ex: Person['FirstName'] = $('#FirstName').val(); //NewPerson[this.id] = this.value; if ($(this).val() == '') { alert('Please Enter ' + this.id); return false; } }); var DTO = { 'NewPerson': NewPerson }; $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", data: "{'FirstName':'" + $("#FirstName").val() + "', " + "'LastName':'" + $("#LastName").val() + "'," + "'Zip':'" + $("#Zip").val() + "'}", </code></pre> <p>etc.</p> <p>How to stop datasaving code to execute?</p>
jquery asp.net
[5, 9]
4,128,160
4,128,161
send the form information to my email box with php
<pre><code>&lt;input type="button" class="button" /&gt; &lt;form action="" method=""&gt; &lt;input type="text" name="name" /&gt; &lt;input type="text" email="email" /&gt; &lt;input type="text" phone="phone" /&gt; &lt;textarea name="message"&gt;&lt;/textarea&gt; &lt;input type="submit" class="submit"/&gt; &lt;/form&gt; </code></pre> <p>1,click the button, then popup the form, after the user fills out all the information in the form than click the submit button, send all the form information to my eamil box.</p> <p>how to write the action part. and which method should i use? should i use mail function to send the email or other ways?</p> <p>i may use jquery to pop up the form window, but i don't know how to collect the form information,then send it my email box.</p>
php jquery
[2, 5]
5,501,391
5,501,392
create photo slide using javascript
<p>I'm using VS2010,C# to develop a small enterprise ASP.NET web app for a company, I've created a history page, and I'm going to develop a simple photo slide using JavaScript (no JQuery if possible), is there any ready-made library? something that displays small thumbnails of images and where users mouse overs each one, a bigger version of the image is displayed, how can I create or find such a tool?</p> <p>thanks</p>
javascript asp.net
[3, 9]
2,883,000
2,883,001
CSS stylesheet value is not modifying
<pre><code>function getStyle(Selector, Property, Value, StyleSheetIndex) { var Selectors = document.styleSheets[StyleSheetIndex].rules; for (var i = 0; i &lt; Selectors.length; i++) { if (Selectors[i].selectorText == Selector) { alert(Value + " " + Property); Selectors[i].style[Property] = "url(" + Value + ")"; } } } </code></pre> <p>Where Selector = "body", Property="backgroundImage", value="/images/bg.jpg",StyleSheetIndex = 2, but here the property value is not changing.Can anyone tell me why?</p>
javascript jquery
[3, 5]
19,732
19,733
How to obtain the current url
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/593709/how-to-get-the-url-of-the-current-page-in-c-sharp">How to get the URL of the current page in C#</a> </p> </blockquote> <p>If I am in a page say <code>http://myweb/folder/obtain.aspx?thevalue=3</code> , how can i determine if the url contains <code>obtain.aspx?thevalue</code> in c#?. I just need to check whether the user landed on this particular page.</p> <p>PS: I guess I dont really need to check for the <code>?thevalue</code> but just the <code>obtain.aspx</code></p>
c# asp.net
[0, 9]
5,665,244
5,665,245
Am i limited with C# and ASP?
<p>Currently, i have basic C++ and PHP skills. But, i want to switch to C# and ASP ( for the web part ). Why ? you will ask. Because i have the opportunity to learn pretty easily C# ( including OOP-ed ) to a pretty advanced level. And because i read that ASP is very similar to C#, i'm thinking to learn it.</p> <p>So, there are many stuff that can't be done in C# ? What kind of stuff ? The same question for ASP.</p>
c# asp.net
[0, 9]
1,974,598
1,974,599
Selecting values from a multiple select picklist with Javascript
<p>How would I set values of a picklist with Javascript? Like for example, a page loads, and I want several values of a picklist to be selected (I will generate these with PHP from the database and echo the actual Javascript). I don't need the actual page load part, just how to select a value out of a picklist (with multiple select)</p>
php javascript
[2, 3]
5,002,215
5,002,216
Append data to css class - jQuery string operation
<p>Please take a look at the following html. EDIT: UPDATED THE HTML PART</p> <pre><code>&lt;div id="html_editor"&gt; &lt;head&gt; &lt;style type="text/css" &gt; .blog { border:2px solid grey; width:auto; } &lt;style&gt;{customcss}&lt;/style&gt; &lt;/style&gt; &lt;/head&gt; &lt;/html&gt; &lt;/div&gt; </code></pre> <p>Please take a look at the Css Class 'blog',i want to add some other values to that class through js/jQuery. Actually it is a HTML editor ,on the body tag user selecting a the 'blog' element,so that time i want to give the user to set CSS for the blog,user changing the CSS on a text area,after that i want to append/rewrite the data to that 'blog' class.</p> <p>Ex : user setting the class like the following</p> <pre><code>width:250px; background:red; key:value..etc.. </code></pre> <p>so after that i want to change that 'blog' css class to </p> <pre><code>.blog { width:250px; background:red; key:value..etc.. } </code></pre> <p>How can i achieve this ? is there any way by using jQuery ??</p> <p>UPDATE : Please check this image.</p> <p><img src="http://i.stack.imgur.com/RinCV.jpg" alt="http://imgur.com/10JuB"></p> <p>Thank you.</p>
javascript jquery
[3, 5]
1,676,104
1,676,105
Preventing the same sum from appearing
<p>In my game, sums are created randomly by the program and displayed at the top. The user then has to click on the correct number to answer the sum. At the moment there is no way for me to make sure that a sum that requires the same answer as the previous one is chosen. How can I prevent this from happening so that the user is not always clicking the same answer.</p> <p>Here are the functions that generate the sums..</p> <pre><code>function createPlusSum(total) { console.log(total) var int1 = Math.ceil(Math.random() * total); var int2 = total - int1; $('#target').html(int1 + ' + ' + int2 + ' = ?'); } function createTakeSum(total) { console.log(total) var int1 = Math.ceil(Math.random() * total); var int2 = total + int1; $('#target').html(int2 + ' - ' + int1 + ' = ?'); } function createSum() { total = Math.ceil(Math.random() * 10); if (Math.random() &gt; 0.5) { createTakeSum(total); } else { createPlusSum(total) } </code></pre> <p>Fiddle: <a href="http://jsfiddle.net/xgDZ4/3/" rel="nofollow">http://jsfiddle.net/xgDZ4/3/</a></p>
javascript jquery
[3, 5]
5,957,673
5,957,674
Verify each line of a text area starts with something
<p>I'm trying to validate a textarea making sure that each line starts with 'http://':</p> <p><a href="http://jsfiddle.net/n8zYB/1/" rel="nofollow">http://jsfiddle.net/n8zYB/1/</a></p> <p>When the url is wrong, it executes the else statement but if it's correct, it isn't getting executed.</p> <p>What's the problem? </p>
javascript jquery
[3, 5]
4,477,718
4,477,719
call local image in drawable with html (WebView)
<p>This question has been asked few times in forums, but in my code, i can't display my image. I think it's not the right method :</p> <pre><code>webViewContact.loadData(db.getParametres().get(0).getInformationParam(), "text/html", "utf-8"); </code></pre> <p>getInformationParam() recup the HTML code, like :</p> <pre><code>&lt;img src=\\"file:///android_asset/logoirdes_apropos.jpg\\"/&gt; &lt;b&gt;Test&lt;/b&gt; </code></pre> <p>My image file is in drawable, how i can display it ?</p>
java android
[1, 4]
5,724,282
5,724,283
simple Data Pass between HTML, Url static
<p>Actually, I have already asked this question here: <a href="http://stackoverflow.com/questions/12669506/jquery-simple-data-pass-html">jQuery simple Data Pass HTML</a></p> <p>I have 1/2 achieved my goal, I am using <code>window.location.href</code> to pass the variable "<code>VISITORNAME</code>" the Url looks <code>http://myurl/sent#[email protected]</code> (<code>VISITORNAME</code>)</p> <p>then I used window.location.href.replace to get [email protected] (<code>VISITORNAME</code>)</p> <p>how possible to make url like static, just like <code>http://myurl/sent</code> but still passing the value to another page.</p>
javascript jquery
[3, 5]
433,427
433,428
How to add events that repeat on specific days of the week indefinitely with fullcalendar
<p>I see the example for repeating <code>events</code> in the code but I'm confused as to how it works. How would I go about adding an event (adding <code>events</code> as an array for now) which occur every Monday at 4:30pm? I'm trying to use the basicWeek view.</p>
javascript jquery
[3, 5]
1,980,652
1,980,653
submit button also validates and display an alert dialog
<p>In my application i am using a submit button which validates that all fields are inserted or not and then it shows an alert dialog that do u want to save or not. Here is my code:</p> <pre><code>public void OnClick_click2(final Button btnadd) { final Button btn = (Button) btnadd; if(btn.getId()==R.id.btnadd){ if(complain_date_txtbx.getText().toString().trim() .length() &lt; 1 SaveRecord(data); Toast.makeText(getBaseContext(), "Your Task saved Successfully!", Toast.LENGTH_LONG).show(); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }); alert.show(); } } </code></pre> <p>It doesn't show a/c to my my requirements, kindly identify where i go wrong and what is appropriate to first on clicking submit button it checks all fields and then display an alert dialog. Kindly guide me </p>
java android
[1, 4]
2,671,503
2,671,504
global admin page for multiple applications in ASP.Net
<p>I was wondering if anybody could give advice on a secure way to implement a global login. I have an admin page that accesses active directory admin groups after typing in your username and password. </p> <ol> <li>current logged in account (on computer) does not matter</li> <li>user in web browser goes to web app, redirects to global login page with query string of app name </li> <li>types user name and password of an account in AD (not necessarily current computers logged in user)</li> <li>authenticates (looks up user, pass etc and authentication is valid)</li> <li>redirects back to original web app.</li> </ol> <p>Once redirection happens, how do I securely tell the original web app that this user is ok until the original web session dies?</p> <p><strong>The way I'm thinking of implementing it:</strong></p> <blockquote> <p>My original thought was to pass the session ID of original app to the login page as well as the app name. Store that session in a DB once authentication is checked. Master page of the other app validates on page load that the session ID matches. On session close, remove current session ID from DB.</p> </blockquote>
c# asp.net
[0, 9]
1,303,410
1,303,411
How to add a ComboBox to an asp.net unbound GridView
<p>I wonder how I can add a ComboBox column to an unbound GridView <em>through code at runtime</em>.</p>
c# asp.net
[0, 9]
5,850,828
5,850,829
select a child element in jquery object
<p>I'm new to jquery and I have a basic question now.</p> <p>I have a jquery object got from a jquery selector. e.g</p> <pre><code>var obj = $('#certainTR'); </code></pre> <p>Now, I want to get the element in this object and I cannot use '#certainTR > date' in a selector because '#certain' is not passed in my subroutine. Is there anyway to make a selection base on a object? Thanks a lot in advance!</p>
javascript jquery
[3, 5]
304,108
304,109
error:'ddVehicleType' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value
<p>I have a dropdownlist as 'ddVehicleType' that is in edit field. iam getting value from database when page load. but the error is coming like</p> <pre><code> 'ddVehicleType' has a SelectedValue which is invalid because it does not exist in the list of items.Parameter name: value </code></pre> <p>my coding is,</p> <pre><code>while (reader.Read()) { ddVehicleType.SelectedValue = reader["VehicleId"].ToString(); } </code></pre> <p>design page,</p> <pre><code>&lt;asp:DropDownList ID="ddVehicleType" runat="server" AppendDataBoundItems="true" CssClass="drop" DataSourceID="SqlDataSource2" DataTextField="VehicleType" DataValueField="VehicleId"&gt; &lt;asp:ListItem Value="0"&gt;-Select-&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt; &lt;asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="&lt;%$ ConnectionStrings:TAXIConnectionString %&gt;" SelectCommand="SELECT [VehicleId], [VehicleType] FROM [VehicleMaster] WHERE ([Status] = @Status)"&gt; &lt;SelectParameters&gt; &lt;asp:Parameter DefaultValue="Available" Name="Status" Type="String" /&gt; &lt;/SelectParameters&gt; &lt;/asp:SqlDataSource&gt; </code></pre>
c# asp.net
[0, 9]
3,594,400
3,594,401
LINQ Except query with an XElement
<p>I have a data set that I receive from a service. The data comes in XML format. We are given an XElement object with all the data. The structure of the XML document is very simple. Looks like this:</p> <pre><code>&lt;root&gt; &lt;dataPoint&gt; &lt;id&gt;1&lt;/id&gt; &lt;param1&gt;somedata&lt;/param1&gt; &lt;param2&gt;somedata&lt;/param2&gt; &lt;/dataPoint&gt; &lt;dataPoint&gt; &lt;id&gt;2&lt;/id&gt; &lt;param1&gt;somedata&lt;/param1&gt; &lt;param2&gt;somedata&lt;/param2&gt; &lt;/dataPoint&gt; &lt;/root&gt; </code></pre> <p>Of course, I have a large number of dataPoints. I also have a list (List) with the id's of dataPoints being displayed in a GUI. What I'd like to have is the dataPoints that ARE NOT displayed on the GUI so I can manipulate only those and not the whole data set. Thanks</p>
c# asp.net
[0, 9]
6,013,325
6,013,326
Playing sound on app startup
<p>How do I go about getting my app to play an mp3 (in my res) on startup? Or how how about if I wanted this to happen when a button is clicked?</p>
java android
[1, 4]
3,748,634
3,748,635
javascript comparing strings (for date purposes)
<p>Ive only ever done absolute comparisons before, so Im a bit stuck as to how to deal with this...</p> <p>I have two strings returned from PHP (format is DATE_ATOM i.e 2012-01-20)</p> <p>What I need to do is compare one string (date) against another - however, I need to return true on the following three conditions</p> <ul> <li>The first date matches the second date (== got this one...)</li> <li>The first date matches the second date +1 day </li> <li>The first date matches the second date +2 days</li> </ul> <p>Anything over that will return false.</p> <p>How can I do this in as 'clean' a way as possible..</p> <p>P.S This can be done in either PHP or Javascript - just the cleanest way possible would be prefered!!!</p> <p>Many thanks in advance!</p>
php javascript
[2, 3]
2,671,344
2,671,345
jquery: Finding the last child from a selector
<p>For example, I've got a selector here</p> <pre><code>var $myNeeds = $('.history'); </code></pre> <p>This selector would have multiple divs inside, and now I want to get the last child from it, how to do this?</p> <p>I tried <code>$myNeeds.last()</code>, this won't work!</p>
javascript jquery
[3, 5]
1,870,486
1,870,487
Post form data to a new page and show that page with the posted data
<p>I have: form.php preview.php </p> <p>form.php has a form in it with many dynamically created form objects. I use jquery.validation plugin to validate the form before submitting. submit handler: </p> <pre><code>submitHandler: function() { var formData = $("#myForm").serialize(); $.post("preview.php", {data: formData },function() { window.location.href = 'preview.php'; }); </code></pre> <p>Question: - How to change the current page to preview.php and show the data? my submitHandler doesnt work? Any tips? </p> <p>preview.php:</p> <pre><code>$results = $_POST['data']; $perfs = explode("&amp;", $results); foreach($perfs as $perf) { $perf_key_values = explode("=", $perf); $key = urldecode($perf_key_values[0]); $values = urldecode($perf_key_values[1]); } echo $key, $values; enter code here </code></pre>
php jquery
[2, 5]
5,737,968
5,737,969
I want to display the alert box but for a certain interval. is it possible in javascript or in php?
<p>Right now i am using java-script to display alert message box. it contains ok button if i click the button then only it hides .But my requirement is to display it only for few seconds then it should automatically close and redirect to my page. </p> <pre><code>?&gt; &lt;script type="text/javascript"&gt; alert("Enter Mandatory fields");document.location='productsegment.php'; &lt;/script&gt; &lt;? </code></pre>
php javascript jquery
[2, 3, 5]
4,008,272
4,008,273
If parent div is animated by jquery is it possible to prevent some child elements from animating?
<p>I wonder if its possible to keep child elements from being animated. like in the following example: ( <a href="http://jsfiddle.net/JsfMF/6/" rel="nofollow">http://jsfiddle.net/JsfMF/6/</a> ) </p> <p> </p> <pre><code>&lt;head&gt; &lt;meta charset="utf-8" /&gt; &lt;title&gt;test&lt;/title&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function fade(){ $('#fadethis').animate({opacity: 0}, 500).show('#nogoaway'); }; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id ="fadethis"&gt; &lt;p&gt; I should go away &lt;/p&gt; &lt;p id="nogoaway"&gt;hi im not supposed to be animated&lt;/p&gt; &lt;/div&gt; &lt;button id="fade" onClick="fade()"&gt;fade!&lt;/button&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Thanks a lot!</p>
javascript jquery
[3, 5]
883,802
883,803
trigger click on element that has multiple class
<p>I have the following element:</p> <pre><code> &lt;a href="#" class='popup register'&gt;Register&lt;/a&gt; </code></pre> <p>and I want to trigger a clic action on this, how do I do this? I tried doing:</p> <pre><code>$('.popup .register').trigger('click'); </code></pre> <p>but it didn't work</p>
javascript jquery
[3, 5]
2,536,139
2,536,140
How to run javascript in java programming
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1999503/how-can-i-run-javascript-code-at-server-side-java-code">How can I run JavaScript code at server side Java code?</a> </p> </blockquote> <p>How possible to run <strong>java script</strong> in <strong>java platform</strong> </p>
java javascript
[1, 3]
3,686,382
3,686,383
android indexoutofboundsexception passing bundle through intent
<p>I have stumbled upon an issue I can't figure out right now. I get an index out of bounds exception when I pass a bundle to a new activity in intent extras. </p> <p>I use the following code:</p> <pre><code>Intent intent = new intent(this, statelistactivity.class); Bundle bundle = new bundle(); Bundle.putInt("id", _id); Bundle.putString("name", _name); Intent.putExtras(bundle); startactivity(intent); </code></pre> <p>In the receiving activity I use:</p> <pre><code>String name = getIntent().getString("name); </code></pre> <p>Following the same principle for the int.</p> <p>However my code never gets here because of an <code>outofboundsexception</code>. What could cause this?</p>
java android
[1, 4]
350,927
350,928
how to get the current page number from history in JavaScript?
<p>I am using vs2010.</p> <p>I used two link to back/forward between pages.</p> <p>the code like,</p> <pre><code> &lt;a href="#" onclick="history.go(-1);return false"&gt;&lt;img src ="Images/back.jpg" /&gt;&lt;/a&gt; &lt;a href="#" onclick="history.go(1);return false"&gt;&lt;img src ="Images/forward1.jpg" /&gt;&lt;/a&gt; </code></pre> <p>it works well. now i want to enable and disable links based on history like the browser window.</p> <p>How to do this? using vs2010 and JavaScript.</p> <p>So, I have one idea.</p> <p>I get total history length using history.length. then I need to check the current page is the last page or not? how to get the current page number from history in JavaScript?</p>
javascript asp.net
[3, 9]
5,732,904
5,732,905
Get css properties from string
<p>I am creating a plugin that allows the user to define the notification by typing something like this.</p> <pre><code>growl-top-left-300px; </code></pre> <p>I was using a split to get rid the width, but this still required me to have quite a few if statements because I user had the following choices</p> <p>for example I had</p> <pre><code>if (position == "growl-top-left" || position == "growl-left-top") { container.css ({ top: '0px', left: '0px' }); }else if (position == "growl-top-right" || position == "growl-right-top") { container.css ({ top: '0px', right: '0px' }); }else if (position == "growl-top-center" || position == "growl-center-top") { // apply css // Not done yet }else if (position == "growl-bottom-left" || position == "growl-left-bottom") { container.css ({ bottom: '0px', left: '0px' }); }else if (position == "growl-bottom-right" || position == "growl-right-bottom") { container.css ({ bottom: '0px', right: '0px' }); }else if (position == "growl-bottom-center" || position == "growl-center-bottom") { // apply css // not done yet } </code></pre> <p>but as you can imagine that seems like a lot of redundant code, and I just want to know if anyone has a nicer way to clean it up?</p> <p>I thought it would be nice if I could get the top and left css values so I can write the following code:</p> <pre><code>container.css ({ retrivedCSS[0]: '0px', retrivedCSS[1]: '0px' }) </code></pre> <p>where retrivedCSS[0] would be the first position and the [1] would be the second position</p>
javascript jquery
[3, 5]
1,013,508
1,013,509
Java/Python: Integration, problem with looping updating text
<p>Basically I have a script in Python that grabs the text from an open window using getWindowText() and outputs it to the screen. The python loops so as the text in the window changes, it outputs the changes, so the output of the python will always be up to date with the window text.</p> <p>I'm trying to access this text in my Java program by executing the python script as a process and reading the text it outputs using a buffered reader.</p> <p>For some reason this works fine for the first block of text, but will not read any more after this, it wont read any updates to the text as the python outputs it.</p> <p>Can someone shed some light on this? I'm about to try and use Jython, but I'd really like to know what the problem is here...</p> <pre><code>try { Runtime r = Runtime.getRuntime(); Process p = r.exec("cmd /c getText.py"); BufferedReader br = new BufferedReader( new InputStreamReader(p.getInputStream())); int line; while (true) { line = br.read(); System.out.print((char) line); } } catch (Exception e) { e.printStackTrace(); } </code></pre>
java python
[1, 7]