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
4,537,074
4,537,075
Run JS function from parent window in child window?
<p>Want to run javascript function from parent window in child window </p> <p><strong>Example</strong> </p> <p>I have to different websites let's say <code>site1.com</code> and <code>site2.com</code></p> <p>I want from <code>site1.com</code> to open new window of URL <code>site2.com</code></p> <pre><code>new_window = window.open("site2.com/index.php", "window2"); </code></pre> <p>Then i want to run a js function <code>test()</code> on this new_window.</p> <pre><code>// Where site2.com/index.php &lt;html&gt; ...... &lt;/html&gt; &lt;script&gt; function test(){ // some code here } &lt;/script&gt; </code></pre> <p><strong>Summary</strong> </p> <p>Want to open new window (child) and run some JS functions from parent window.</p>
javascript jquery
[3, 5]
8,004
8,005
Calling Ajax and returning response
<p>I have search for so many questions but didnt get the right answer. I have made the following function from what my research i understand that ajax call is async so on its done passing a value to global variable and returning that but i get a blank or undefined value.i can do it with $('#someid').html in response or some other methods but i dont want to implement them . Any idea what i am doing wrong here</p> <pre><code>function SimpleAjax(form, postData, url) { var returnData; var sendData; if (form == "") { sendData = postData; } else if (postData == "") { sendData = $(form).serialize(); } $.ajax({ type: 'POST', url: url, cache: false, data: sendData, success: function(data) { if (data != null || typeof data != 'undefined') { returnData = data; } } }).done(function(data) { returnData = data; }); return returnData; }​ </code></pre>
php javascript jquery
[2, 3, 5]
438,740
438,741
Append object to a existing file in android
<p>i have append an object to a existing file but i can not read it ,i can read the first object and this is my code What is the problem ??</p> <pre><code>try{ FileOutputStream fos = openFileOutput("f.txt",MODE_PRIVATE | MODE_APPEND ); ObjectOutputStream oos = new ObjectOutputStream(fos); String a=new String ("Hello object1 "); String b=new String("Hello object2 "); String c=new String("Hello object3 "); oos.writeObject(a); oos.writeObject(b); oos.writeObject(c); oos.close(); // Reading it back.. FileInputStream fis = openFileInput("f.txt"); ObjectInputStream ois = new ObjectInputStream(fis); //ois=new ObjectInputStream(fis); // r=(String)ois.readObject(); String r; while ((r= (String)ois.readObject()) != null) { Log.i("while Read r",r); Toast.makeText(getApplicationContext(),r, Toast.LENGTH_SHORT).show(); } ois.close(); }catch (Exception e){ Log.i("Exception",e.getMessage()); } </code></pre> <p>I hope you can help me!! thanks.</p>
java android
[1, 4]
616,266
616,267
Checking all checkboxes in list by single checkbox click
<p>On my webpage, I have a CheckBoxList and a single checkbox. When I click on the check box, all the Check Boxes in the CheckBoxList should get checked. My CheckBoxList has to be under Bodycontent placeholder because that's how the layout of webpage is, and I kept the script in the same placeholder.</p> <pre><code>&lt;asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"&gt; &lt;script type="text/javascript"&gt; function select(ch) { var allcheckboxes = document.getElementById('&lt;%=CheckBoxList1.ClientID %&gt;').getElementsByTagName("input"); for (i = 0; i &lt; allcheckboxes.length; i++) allcheckboxes[i].checked = ch.checked; } &lt;/script&gt; &lt;asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow"&gt; &lt;asp:ListItem&gt;Item A&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;Item B&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;Item C&lt;/asp:ListItem&gt; &lt;/asp:CheckBoxList&gt; &lt;asp:CheckBox ID="allCheck" onclick="select(this)" runat="server" Text="Select all" /&gt; &lt;br /&gt; &lt;/asp:Content&gt; </code></pre> <p>The above doesn't do anything. On clikcing on the checkbox nothing happens! I have been stuck on this small issue from quite long and not able to do the same. Any suggestions what's wrong?</p>
c# javascript asp.net
[0, 3, 9]
1,916,906
1,916,907
How can I download scaled down version of an image?
<p>I need to download images that are very large 5mb+.</p> <p>I am aware of scaling the image before displaying it to save phone memory but the problem of downloading a large image still remains.</p> <p>How can I download, say, a 50% scaled down version of an image rather than downloading a full image then scaling it?</p>
java android
[1, 4]
2,107,122
2,107,123
FindControl in MasterPage, first click generates empty string
<p>My web site uses a master page, where I've placed two controls, a TextBox and an ImageButton, they are intended to be viewed and accessible on all content sites. Here's the aspx code in <strong>Site.Master</strong>:</p> <pre><code>&lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:ImageButton ID="ImageBtn" runat="server" ImageUrl="~/Image.png" PostBackUrl="~/Result.aspx"&gt;&lt;/asp:ImageButton&gt; </code></pre> <p>Clicking the button should redirect the visitor to Result.aspx, which it does.</p> <p><strong>Result.aspx.cs</strong> has the following in the Page_Load event:</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { TextBox txbx = this.Master.FindControl("TextBox1") as TextBox; if (txbx != null) { Label1.Text = "Value: " + txbx.Text; } else { Label1.Text = "TextBox seems to be null"; } } </code></pre> <p>The weird behavior appears when the image button is clicked the first time. The visitor gets this information from the page "Value: " (i.e an empty string ""), even though a value was entered in TextBox1. The subsequent clicks presents the value(s) correctly, e.g "Value: SomeText".</p> <p>Why doesn't the value "come along" the first time?</p> <p>Is there a better way to ensure that?</p> <ul> <li>The visitor is redirected to Result.aspx AND</li> <li>that the value is "registered" and can be handled in Result.aspx.cs AND</li> <li>that a user will be redirected, if Result.aspx is entered without the use of the image buttons PostBackURL </li> </ul> <p>I've tried IsPostBack but it seems to behave strangely when using a master page as previous page ...</p> <p>Very thankful for an answer!</p> <p>Sincerely,</p> <p>Mr Kay</p>
c# asp.net
[0, 9]
2,220,965
2,220,966
jquery trigger action on option add
<p>I have an select field which is on a jsp page and I add options to it through an external js library. Now is there a way on my jsp to trigger an action when an option is added? </p> <p>Its because I need to get some value from backend and its not possible to do everything on an external js page.</p> <p>I used .change() but I guess because of the fact that the adding takes place in an external page, it does not trigger anything.</p>
javascript jquery
[3, 5]
4,685,170
4,685,171
java.lang.ArrayIndexOutOfBoundsException on android input form
<p>I have an input form that has 38 fields I know it's too much but my boss want it to be like that</p> <p>There are 4 edit texts and spinners as the rest and 1 imageView that'll be uploaded to server using http client</p> <p>I use AsyncTask to send the data like this :</p> <pre><code>new asyncTask().execute(array, array, array); </code></pre> <p>Because there's too many of items, I think I missed one of them I've checked many times but I still get the <code>indexOutOfBounds</code> exception</p> <p>Can you help me find them or give me solution / advice to make simpler code</p> <p>Here's the code (your eyes might hurt coz it's the whole code) :</p> <p><a href="http://pastebin.com/0dUss9ak" rel="nofollow">http://pastebin.com/0dUss9ak</a> </p> <p>(it's too much to write here)</p> <p>Why i'm using alphabets for the variable's name? If I use name for each of them i'll be dead.</p> <p>Thanks before</p>
java android
[1, 4]
4,375,314
4,375,315
Add selected values to a string
<p>Trying to iterate through ListItems in lstViolations. Only the first selected value is added to the messagebody and can't figure out why this code won't work </p> <pre><code>foreach (ListItem item in lstViolations.Items) { if (item.Selected) { messageBody += item.Value + Environment.NewLine; } } </code></pre> <p>By the way, adding messageBody += "test" prints only the first list item followed by test.</p>
c# asp.net
[0, 9]
5,595,398
5,595,399
why does loading jquery after mootools causes conflicts
<p>I was wondering what is the reason for the conflict when jquery is loaded after mootools. Anyone has a nice explaination since the web gives me shady answers. Thanks</p>
javascript jquery
[3, 5]
1,772,927
1,772,928
Search array for object property then hide first occurence of found object
<p>I have an array of objects that I've created using Javascript. The objects are map layers and have various properties associated. Upon creation they are pushed into an array. Below is a simplified example</p> <pre><code>var activeLayers = []; var mapLayer1 = new mapLayer(); mapLayer1.name = 'roads'; mapLayer1.class = 'infrastucture'; mapLayer1.type = 'line'; activeLayers.push(mapLayer1); var mapLayer2 = new mapLayer(); mapLayer2.name = 'cities'; mapLayer2.class = 'infrastucture'; mapLayer2.type = 'point'; activeLayers.push(mapLayer2); var mapLayer3 = new mapLayer(); mapLayer3.name = 'counties'; mapLayer3.class = 'boundaries'; mapLayer3.type = 'polygon'; activeLayers.push(mapLayer3); var mapLayer4 = new mapLayer(); mapLayer4.name = 'zoningDistricts'; mapLayer4.class = 'political'; mapLayer4.type = 'polygon'; activeLayers.push(mapLayer4); </code></pre> <p>What I want to do is force my map to not allow more than one layer of type==polygon to be displayed at the same time. I would like to iterate through the array 'activeLayers' and if type==polygon.length > 1 then I would like to remove the oldest from the map. Removing a layer from the map is accomplished with a function of</p> <pre><code>mapLayer3.hide(); </code></pre> <p>In the above array mapLayer3 is a polygon and was added before mapLayer4 and would be hidden from the map. </p> <p>Thanks for taking a look. </p>
javascript jquery
[3, 5]
3,619,740
3,619,741
Get value of asp:textbox with javascript .net 4 framework
<p>I thought I heard that in .net 4 we would be able to reference asp:textbox's by id and not have to use clientid to get the value. I can't find this documented anywhere. Just wondering if anyone knows if this works and what the syntax is? </p>
javascript asp.net
[3, 9]
4,822,615
4,822,616
jQuery/javascript - Wire up event handler only when its not already assigned
<p>I'm assigning an onclick handler to a checkbox. Sometimes javascript that does the binding of event runs more than once (on partial postbacks) and the handler gets assigned twice. How can I prevent the handler from being assigned multiple times? </p> <p>Okay thanks for responses. I wrote something up to figure out if element has a hanlder:</p> <pre><code>$.fn.hasHandler = function(eventName, handler) { var _hasHandler = false; if(handler != undefined &amp;&amp; this.data("events") !== null &amp;&amp; this.data("events") !== undefined) { $.each(this.data("events"), function(name, handlers) { if(name === eventName) { $.each(handlers, function(index, value) { if(value.handler === handler) { _hasHandler = true; } }); } }); } return _hasHandler; } </code></pre>
javascript jquery
[3, 5]
1,734,207
1,734,208
Can't get JavaScript increment ++ to work
<p>I'm trying to count the number of times jQuery uses its $.get function.</p> <p>I have a simple variable: <code>var max = 0;</code>.</p> <p>When the <code>$.get</code> is passed I then have <code>max++</code> in the appropriate region but this does not work because when I alert max later it still shows up as 0. I even tried <code>max = max + 1</code>. </p> <p>What could be the problem?</p>
javascript jquery
[3, 5]
2,007,752
2,007,753
Javascript issue
<p>I have a question regarding my button disappear</p> <p>I've put an image as my button</p> <pre><code>&lt;div id="button1"&gt; &lt;a href="javascript:example_animate('-=200px')"&gt; &lt;img src="images/button1.jpeg"&gt; &lt;/a&gt; &lt;/div&gt; </code></pre> <p>that is animated with this function</p> <pre><code>&lt;script language="javascript"&gt; function example_animate(px) { $('#content2').animate({ 'marginTop' : px }); } &lt;/script&gt; </code></pre> <p>and i can't get it disappear after doing this function with this script</p> <pre><code>&lt;script language="javascript"&gt; $("#button1").click(function () { this.visible = false; }); &lt;/script&gt; </code></pre> <p>please help!</p>
javascript jquery
[3, 5]
4,283,639
4,283,640
Android How to listen for Volume Button events?
<p>I know you guys are probably tired of these kinds of posts, but why doesn't anything happen when I press volume down? I'm just trying to make a simple code, but apparently it's not working.</p> <pre><code>package com.cakemansapps.lightwriter; import android.app.Activity; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.widget.FrameLayout; import android.view.KeyEvent; import android.util.Log; public class LightWriter extends Activity implements OnTouchListener { private static final String TAG = "Touch" ; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); FrameLayout main = (FrameLayout) findViewById(R.id.main_view); } @Override public boolean onKeyLongPress(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { Log.w("LightWriter", "I WORK BRO."); return true; } return super.onKeyLongPress(keyCode, event); } public boolean onTouch(View view, MotionEvent me) { throw new UnsupportedOperationException("Not supported yet."); } } </code></pre>
java android
[1, 4]
2,561,551
2,561,552
Response.Redirect doesn't work after 2 minutes subroutine
<p>I've bound an asp button to a subroutine that generates an xls file through these steps:</p> <ol> <li>Executes some sql queries (successfully)</li> <li>Builds the excel file with the resulting data sets (successfully, 2MB)</li> <li>Redirects the current page to a "DownloadPage.aspx?filename=" with the standard operations to build and download the file </li> </ol> <p>But at this point it doesn't start any download even if the excel file is available in the source folder. The strange thing is that sometimes it works, randomly. No exception is throwed but the Thread Abort dued to redirection.</p> <p>So, I haven't other ideas...Do you?</p> <p>Thanks</p> <p>p.s. I've tried to set some IIS parameters to 6 minutes or over.</p>
c# asp.net
[0, 9]
3,539,587
3,539,588
How can I add a delay to a change of .css state
<p>I have the following:</p> <pre><code> $(document) .ajaxStart(function () { $(this).css({ 'cursor': 'progress !important' }) }) .ajaxStop(function () { $(this).css({ 'cursor': 'default !important' }) }); </code></pre> <p>Is there a way that I can prolong the cursor progress state by 2 seconds. Right now it comes and goes too quick. In other words I would like to have the cursor change to "progress" for at least a couple of seconds. </p>
javascript jquery
[3, 5]
327,911
327,912
String extraction with javascript
<p>I'm using jquery and have an entire html page stored in <code>var page</code></p> <pre><code>var page = '&lt;html&gt;...&lt;div id="start"&gt;......&lt;/div&gt;&lt;!-- start --&gt;....&lt;/html&gt;'; </code></pre> <p>How can I extract only the section that starts with <code>&lt;div id="start"&gt;</code> all the way to after the end tag <code>&lt;/div&gt;&lt;!-- start --&gt;</code> such that my output is</p> <pre><code>&lt;div id="start"&gt;......&lt;/div&gt;&lt;!-- start --&gt; </code></pre>
javascript jquery
[3, 5]
967,674
967,675
how i am get current time in PST in php and javascript?
<p>how i am get current time in PST in php and javascript ?</p>
php javascript
[2, 3]
2,449,953
2,449,954
PHP read Javascript array
<p>I am passing an array from Javascript to PHP page, as below.</p> <pre><code>var arrF1 = [{"Item":"item1no", "Desc":"item1desc", "Remarks":"item1note"}, {"Item":"item2no", "Desc":"item2desc", "Remarks":"item2note"} ]; $.ajax({ type: "POST", url: "http://www.mydomain.com/pdfs/flist.php", data: { favArray : arrF1 }, success: function() { alert('ok, sent'); } }); </code></pre> <p>In my PHP page, I read the array as below.</p> <pre><code>$fArray = json_decode($_POST['favArray']) </code></pre> <p>And I tried to access the arrays value like this.</p> <pre><code>$fArrav[0]-&gt;{'Item'} $fArrav[0]-&gt;{'Desc'} $fArrav[1]-&gt;{'Item'} </code></pre> <p>Is this correct? I am generating a PDF on the server using FPDF. But with the above, its not reading the array.</p> <p>I must not be doing this right. Please help.</p> <p>Thank you.</p>
php javascript
[2, 3]
1,135,052
1,135,053
Error parsing attribute 'enableEventValidation': Type 'System.Web.UI.Page' does not have a public property named 'enableEventValidation'
<p>Not seen this error discussed previously here (see subject line), maybe someone has run into the same problem. I have <code>enableEventValidation = "False"</code> set for the <code>&lt;page&gt;</code> tag in my web.config file. As I try to build my web app project on VS2010, I receive this error , rendering me unable to continue with my debugging of the app. The page in question does not have enableEvenValidation set in its Page directive.</p> <p>Any ideas out there on this one ?</p> <p>Appreciate the feedback</p> <p>Thanks</p>
c# asp.net
[0, 9]
3,424,964
3,424,965
Passing a string in javascript and retrieving it through php file
<p>I am passing a string to a javascript through call by reference. The string is a text retrieved from a textarea field. The problem is that a single word is retrieved properly, but when i send multiple text it shows a problem. the sample code is like this in a php file,</p> <pre><code>&lt;input type=button onclick="send(txt.value,123,456)"&gt; </code></pre> <p>The txt is the name of textarea field. If i type hello in the field and send it works prorperly but whenever i type string like hello india, it gives a problem and nothing is retrieved</p>
php javascript
[2, 3]
3,597,197
3,597,198
jQuery Disable Link until page load
<p>I have a jquery pop-up window attached to a link. If the page is not fully loaded (i.e. the .js files) when the link is clicked it opens in the browser window rather than a pop-up.</p> <p>I was thinking of disabling/hiding the link until the page was loaded.</p> <p>What would best practice be for handling this scenrio and have you any code examples?</p>
javascript jquery
[3, 5]
284,296
284,297
How to format this date + time got from JavaScript? (+jsFiddle)
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1536516/how-to-display-a-date-as-2-25-2007-format-in-javascript-if-i-have-date-object">how to display a date as 2/25/2007 format in javascript, if i have date object</a> </p> </blockquote> <p>How can I format the following date+time to this one <strong>2012-07-24 17:00</strong> ?</p> <p><a href="http://jsfiddle.net/28Tgz/1/" rel="nofollow">http://jsfiddle.net/28Tgz/1/</a></p> <p>I am trying to make use of </p> <pre><code>formatDate('yy-mm-dd HH:ii', now)); </code></pre> <p>without luck.</p> <pre><code>jQuery(document).ready(function() { var foo = jQuery('#foo'); function updateTime() { var now = new Date(); foo.val(now.toString()); } updateTime(); setInterval(updateTime, 5000); // 5 * 1000 miliseconds }); </code></pre> <p>this return me <strong>Wed Jul 25 2012 17:14:02 GMT+0300 (GTB Daylight Time)</strong></p>
javascript jquery
[3, 5]
619,667
619,668
Increment a clock counter
<p>Hello I have a clock counter which I need to increment by 1, the counter can be found at:</p> <p><a href="http://carbonexpert.lu12.com/private.php" rel="nofollow">http://carbonexpert.lu12.com/private.php</a></p> <p>So from: 6,204,988,466 to: 7,204,988,466 (but it still needs to count in the current manner)</p> <p>This is a project I was given, I tried tinkering with the code but to no avail. Please help me</p>
javascript jquery
[3, 5]
4,361,625
4,361,626
android inline class
<p>This might be a dumb question, but I've been thinking about it for some time and I have no idea what it's really called.</p> <p>So for Android, for OnClickListeners, OnTouchListeners, etc., you're allowed to do the following:</p> <pre><code> bio.setOnCancelListener(new OnCancelListener() { public void onCancel(DialogInterface arg0) { // TODO Auto-generated method stub } }); </code></pre> <p>Pretty much making a new class inline. What is this called in Java or is it an Android specific thing? Basically, what's going on when this happens? Are you pretty much creating an inner class that implements OnCancelListener since On[blah]Listeners are interfaces?</p> <p>Thanks!</p>
java android
[1, 4]
1,756,542
1,756,543
Change CSS class based on bound value?
<p>I have an item template in a grid view:</p> <pre><code> &lt;asp:TemplateField HeaderText="Name" SortExpression="GroupDescription"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lblName" CssClass="edit" runat="server" Text='&lt;%# Bind("GroupDescription") %&gt;'&gt;&lt;/asp:Label&gt; &lt;asp:HiddenField ID="lblHidden" EnableViewState="false" runat="server" /&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre> <p>The CssClass is 'edit'. If the GroupDescription is default then there should be no css class. Is there some way to do this?</p> <p>Thanks</p>
c# asp.net
[0, 9]
3,778,165
3,778,166
Error handling in javascript
<p>I was wondering how to handle errors inside a script that is meant to be used as a "parser". Basically I need a way to handle parsing errors.</p> <p>Since the text that this script parses should be provided in the HTML, I guess throwing the error in the javascript console is not an option, right? The user of the script should not be aware of this script, he just needs to know the syntax required for a certain HTML attribute in order to change the way the element behaves. <strong>Think of it like markdown.</strong>, the only difference is that my parser will not generate any html, text, etc., it just hides or shows certain input elements if they meet conditions provided in the text to be parsed.</p> <p>Should I stick with a simple browser alert message?</p> <p>Appending an error message in the document (near the element that contains the text to be parsed) is not really an option, because the point of this script is to modify behaviour of certain input elements, and not to append text or something like that. Besides, it would produce inconsistent styling..</p>
javascript jquery
[3, 5]
2,768,404
2,768,405
How to pass arguments inside function?
<p>I started to learn Jquery and but I am having trouble understanding function parameters:( If you look my <b>first</b> code and run it: my script <b>WILL work</b> <i>(WITHOUT parameters)</i>. And if you look my <b>second</b> code <br/><i>(WITH parameters)</i> and run it: <b>second script</b> <i>WILL ALSO WORK!!</i><br/> <br/>My first question: Did I correctly <b>set</b> parameter in my <b>second script?</b><br/>Second question: How can I <b>check</b> is my parameter <b><i>set</i></b> or being <b><i>passed correctly</i></b> to my function? <br/>P.S. Sorry for being NOOB and <b>THANK YOU!!</b> </p> <pre><code> //First code (WITHOUT PARAMETERS!!!) $(document).ready(function () { var addclass = $('p:first'); function AddClass() { addclass.addClass('first'); if (addclass.is($('.first'))) { alert('here'); } else { alert('not here'); } } $('.button').click(function () { AddClass(addclass); }); }); //Second code (WITH PARAMETERS) $(document).ready(function () { var addclass = $('p:first'); function AddClass(addclass) { addclass.addClass('first'); if (addclass.is($('.first'))) { alert('here'); } else { alert('not here'); } } $('.button').click(function () { AddClass(addclass); }); }); </code></pre>
javascript jquery
[3, 5]
3,455,386
3,455,387
Jquery Javascript syntax
<p>Can someone please explain the following syntax</p> <pre><code>$(function(){ $(".myPage").live("click", myHandler); // NOT THIS BIT!! }); </code></pre> <p>It looks globally defined, if that makes any difference?</p>
javascript jquery
[3, 5]
1,163,754
1,163,755
jquery grid bind to sql server throuh page.aspx.vb
<p>I am trying to bind jquery grid to sqldata through .aspx page but i cant</p> <p>Iam having one jquery grid and one jquery chart so i have to bind the grid and chart to sql server using asp.net and vb</p> <p>Alredy im get the data in aspx.vb page and the data in datatable </p> <p>so frnds help me how to bind that aspx page to jquery grid </p>
jquery asp.net
[5, 9]
5,321,381
5,321,382
select box manipulation
<p>I would like to dynamically change the option value of a select tag. Is this possible? When I say value, I mean the "Change Me" portion. If this is possible, can someone please show me how?</p> <pre><code>&lt;option value="0"&gt;Change Me&lt;/option&gt; </code></pre>
javascript jquery
[3, 5]
5,979,320
5,979,321
Is there any way we can stop the animate in Jquery (also stop the complete call back function)
<p>I think the issue is relative with queue in Jquery. We can use clearQueue() to clear queue to stop any animate, however the clear queue cannot stop the call back function consider this</p> <pre><code>$("#sth").animate( { width:'100%' }, 2000, function() { $("#sth").css("width","0%"); }); </code></pre> <p>and</p> <pre><code>$("#sth").clearQueue().css("width","0%"); </code></pre> <p>is able to stop the animate and push back the width. However, after 2000 miliseconds, it will also turn to 100% width, because of the complete call back function. the function will invoke after 2000 miliseconds no matter whether the queue exists.</p>
javascript jquery
[3, 5]
5,252,240
5,252,241
Is it better to use .delegate() performance wise?
<p>One of the developers I work with began to write all his code this way:</p> <pre><code>$('.toggles').delegate('input', 'click', function() { // do something }); </code></pre> <p>vs:</p> <pre><code>$('.toggles').click(function() { // do something }); </code></pre> <p>Are there any performance benefits to doing this?</p>
javascript jquery
[3, 5]
2,642,066
2,642,067
An example of javascript__dopostback
<p>Please provide an example of calling the <code>__doPostBack</code> function.</p>
c# javascript asp.net
[0, 3, 9]
5,648,254
5,648,255
Jquery autosuggest not working
<p>Hey guys, I'm using jQuery's autosuggest plugin by using php to get the data. But it doesn't seem to work since I always get: No Results Found, even though I'm sure there are results:</p> <p>Here's the php code:</p> <pre><code>&lt;?php ini_set('display_errors', 'On'); error_reporting(E_ALL | E_STRICT); $input = mysql_escape_string($_GET["q"]); $data = array(); $mysql=mysql_connect('localhost','***','***'); mysql_select_db('jmtdy'); $query = mysql_query("SELECT * FROM users WHERE username LIKE '%".$input."%'"); while ($row = mysql_fetch_assoc($query)) { $json = array(); $json['value'] = $row['id']; $json['name'] = $row['username']; $data[] = $json; } header("Content-type: application/json"); echo json_encode($data); ?&gt; </code></pre> <p>And the script:</p> <pre><code>&lt;script &gt; $(document).ready(function () { $("#suggestedfriend").autoSuggest("suggestedf.php"); }); &lt;/script&gt; </code></pre>
php javascript jquery
[2, 3, 5]
2,413,226
2,413,227
Label that turns into textbox when clicked?
<p>Maybe there is a CSS style for this, but, I want my TextBox to look like a label. When it is focused, I want it to look like whatever CSS style is applied. I am using bootstrap so that would be the style.</p> <p>Is there some way to do this?</p> <p>I have a grid view that I want to allow the user to rename without using the Edit Mode.</p> <p>Thanks</p> <p>(EDIT)</p> <p>I mean an editable label: see <a href="http://dotnetspeaks.net/post/exm/EditableLabel.aspx" rel="nofollow">http://dotnetspeaks.net/post/exm/EditableLabel.aspx</a></p>
c# asp.net
[0, 9]
128,325
128,326
add class current when slidetoggle
<p>i try to create simple accordion menu with simple code.</p> <p>Here is my <a href="http://jsfiddle.net/aCaEG/" rel="nofollow">Jsfiddle</a></p> <pre><code>$('li').click(function(ev) { $(this).find('&gt;ul').slideToggle(); ev.stopPropagation(); }); </code></pre> <p>my problem is how to add class <code>current</code> to parent li when slidedown, something like below:</p> <pre><code>&lt;ul&gt; &lt;li class="current"&gt; level 2 </code></pre> <p>and remove class <code>current</code> when slide is closed.</p>
javascript jquery
[3, 5]
3,763,049
3,763,050
run asp.net function when The page is closing
<p>I have an asp.net page when Loading this page it creates a Thread to do some thing My Question is : How to kill this thread when the user close the page ? I have tried with "onUnload" event but it just works with javascript function (as I know) and we can't use asp.net code in javascript function Do You have a way to help me ... thanks a lot</p> <p><strong>Edit:</strong> It 's difficult to explain what I am Trying to do.. The asp.net page must show a message to the user and this message must appear directly without refreshing so I was trying to use a thread which listen wait the message and then run an AJAX code to show the message ..</p>
c# asp.net
[0, 9]
5,944,068
5,944,069
video streaming with php and javascript
<p>hello so i am uploading several files to my apache server through a php script using the following script</p> <pre><code>$uploaddir = 'photos/'; $file = basename($_FILES['userfile']['name']); $uploadfile = $uploaddir . $file; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) else </code></pre> <p>what i am aiming to do is for my server to compress and send them to a webpage in order to livestream the videos and delete them accordingly. how would i go around executing and coverting videos to mpeg or h264 format? Also should i redirect the end webpage everytime there is a new video to upload to the server or would long polling with javascript work with this?</p>
php javascript
[2, 3]
3,238,497
3,238,498
How can I get the index of non-sibling elements in jquery?
<p>HTML:</p> <pre><code>&lt;ul&gt; &lt;li&gt;Help&lt;/li&gt; &lt;li&gt;me&lt;/li&gt; &lt;li&gt;Stack&lt;/li&gt; &lt;li&gt;Overflow!&lt;/li&gt; &lt;/ul&gt; &lt;br&gt; &lt;ul&gt; &lt;li&gt;Can&lt;/li&gt; &lt;li&gt;I&lt;/li&gt; &lt;li&gt;connect&lt;/li&gt; &lt;li&gt;these?&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Javascript/JQuery:</p> <pre><code>$("li").live('click', function(){ alert($(this).index()); }); </code></pre> <p>I put together a simple jsfilled page to help describe my problem: <a href="http://jsfiddle.net/T4tz4/" rel="nofollow">http://jsfiddle.net/T4tz4/</a></p> <p>Currently clicking on an LI alerts the index relative to the current UL group. I'd like to know if it was possible to get a 'global index' so that clicking on "Can" returns the index value of 4.</p> <p>Thank you, John</p>
javascript jquery
[3, 5]
1,187,951
1,187,952
Interpolate or "tween" between two values (but not animating)
<p>I have a variable that is increasing let's say from 0 to 99.</p> <p>Then I have a div that I want to move at the same rate of the increasing variable but I only want to define the two ends of the movement (for example moving from top to down, I only define the topmost position and the downmost position). The rest should be interpolated automatically while the main variable is changing it's value from 0 to 99.</p> <p>All the search results I got were related to animating. But this is not exactly animating since the div should not move if the variable is not changing. How would you do this best in javascript?</p> <p>EDIT: Some mock up code (probably has syntax errors ):</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;div id="increase"&gt;&lt;/div&gt; &lt;div id="move"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; &lt;script&gt; var counter =0; var topValue =50; var bottomValue =150; var interpolatedValue $('#increase').click(){ counter++; } $('#move').css(){ top: interpolatedValue; //this should be an interpolation between 50 and 150 based on the current counter value } &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
5,238,516
5,238,517
Passing itself value into function
<p>I have the following and you can see I am trying to pass <code>this</code> through on the function is this possible in JavaScript\jQuery if so how? Can't seem to find anything I think I have the terminology wrong.</p> <pre><code>function pageLoad(sender, args) { if (args.get_isPartialLoad()) { jQuery(".ShowPleaseWait").click(function () { processingReplacer("Please Wait...", this); }); jQuery(".ShowProcessing").click(function () { processingReplacer("Processing...", this); }); } } function processingReplacer(message, this) { if (Page_IsValid) { jQuery(this).hide(); jQuery(this).after("&lt;img id='" + jQuery(this).attr('id') + "' class='" + jQuery(this).attr('class') + "' src='/content/images/processing.gif' /&gt; " + message); alert("woohoo"); } } </code></pre>
javascript jquery
[3, 5]
699,808
699,809
I cannot see my grid view when running the website
<p>In my asp.net website project, I need to use a grid view that fetches data from my access database. I though I knew how to do that. But apparently something is missing. I configured the AccessDataSource to my table in the database, and did a grid view to show the contents of this table. but still when I run the website I can't get the grid to show. What could be wrong with my code?</p> <p>and another question. when I do make it run, I need to get the value of a cell in that grid when I click it. How can i do that?</p>
c# asp.net
[0, 9]
4,203,058
4,203,059
Convert UTC Time T0 Local Time In Java and c#
<p>In c#:</p> <pre><code>DateTime dateTime = DateTime.Parse(text, CultureInfo.InvariantCulture); string s = dateTime.ToLocalTime().ToString("s", CultureInfo.InvariantCulture)); </code></pre> <p>The <code>text</code> is <code>2011-06-30T05:48:34Z</code>, and the <code>s</code> is <code>2011-6-30 13:48:34</code></p> <p>In java:</p> <pre><code>DateFormat df = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); // explicitly set timezone of input if needed df.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai")); java.util.Date dateTime ; dateTime = df.parse(text); String s= df.format(dateTime)); </code></pre> <p>but the <code>s</code> is <code>2011-6-30 05:48:34</code>. How to implement ToLocalTime() function in Java?</p>
c# java
[0, 1]
2,582,901
2,582,902
Stop page execution like the alert() function
<p>When I write <code>alert('Hello')</code>, the page execution stops and waits for approval to continue.</p> <p>I have <strong>div</strong> setup to display as a fake alert, using HTML - this div has an 'OK' button.</p> <p>I want the page to stop its execution (just like as in a real alert) until the user presses 'OK'.</p> <p>I don't want to use jQuery.</p>
javascript jquery
[3, 5]
4,232,159
4,232,160
Condensing a Javascript array
<p>I have a javascript array (from a <a href="http://pipes.yahoo.com/pipes/pipe.info?_id=dc16e694967418792beaa97d7bf1999a" rel="nofollow">yahoo pipe via JSONP</a>) in which I have a sub-array called 'moby'.</p> <p>I'd like to change the current structure:</p> <pre><code>value { callback =&gt; blah, generator =&gt; blah, items { 0 { author =&gt; blah, category =&gt; blah, moby { day_no =&gt; 168, more =&gt; Keep_this_stuff }, 1 { author =&gt; blah, category =&gt; blah, moby { day_no =&gt; 167, more =&gt; Keep_this_stuff },... etc } } </code></pre> <p>Into a more sparse object that looks something like this:</p> <pre><code>moby { 168 { day_no =&gt; 168, more =&gt; Keep_this_stuff }, 167 { day_no =&gt; 167, more =&gt; Keep_this_stuff },... etc } </code></pre> <p>I know how I'd do it in ruby (with the funky <code>Array.collect</code>) but I have no idea in Javascript! Any clues? (I have jQuery loaded in the page I'll be using this on)</p>
javascript jquery
[3, 5]
5,155,946
5,155,947
jQuery ajax - Absolute URL's and error handling
<p>Is it possible to catch the HTTP errors (like 404, 500, 504 etc) when we call an external webservice by specifying an absolute url?. (like setting the <code>url:</code> attribute of <code>$.ajax</code> call to have a url value as <code>http://api.geonames.org/findNearbyPostalCodes</code>.</p> <p>Right now I'm unable to receive any errors although firebug is catching them and showing it in the console.</p> <p>Can someone help?</p> <p>Here is my code.</p> <pre><code>$.ajax({ type: 'GET', url: "http://api.geonames.org/findNearbyPostalCodes", data: '{"lat":47,"lng":"9","username":"demo"}', dataType: 'json', cache:false, async:false, statusCode:{ 404: function(){ alert('Page not found'); }, 500: function(){ alert('Page not found'); }, 504: function(){ alert('Unknown host'); } }, success: function(data){ alert(data); } error: function (xhr, exception, thrownError) { alert(xhr.status); } }); </code></pre>
javascript jquery
[3, 5]
2,963,435
2,963,436
Session Expire if i'm not in idle asp.net
<p>im getting problem with session, when i'm not idle and still using webpage thes session expires I am using VS 2005</p> <p>thanks in advance</p>
c# asp.net
[0, 9]
781,382
781,383
How to utilize idle CPU cycles during WebService invocation
<p>I am invoking a web service, which displays the result in the UpdatePanel. The web sevice returns the result in approximately 30 sec. to 1 min. During this time interval I am currently displaying UpdateProgress Bar.</p> <p>My goal is to utilize idle processor time &amp; do some useful operation in foobar() method, out of following approach which one fits best in current scenario -</p> <ol> <li>Call the web sevice asynchronously using BeginAsync keep doing other task until BeginAsync invokes its callback method.</li> <li>Add webservice operation inside a thread, and use QueueUserWorkItem to enque this thread to a ThreadPool. (I will have to use WaitAny in this case, since as soon as webservice returns data, I need to terminate thread running foobar method.)</li> <li>I wonder whether it is possible in asp.net to callback a method once UpdataProgress control gets triggered and terminate this, when this is done.</li> </ol>
c# asp.net
[0, 9]
1,966,597
1,966,598
How would I go about expanding my PHP code library with Python code?
<p>I have a rather large API written in PHP that I've worked on for years. Some of the functionality needs to be upgraded to the extent where I should really just rewrite the classes. Since I need to scrap the old code anyway, I was thinking perhaps I could replace the old functionality with Python code.</p> <p>I came across <a href="http://www.csh.rit.edu/~jon/projects/pip/" rel="nofollow">PiP</a> while searching for answers, and it seems like an <strong>exellent</strong> solution (Since I can actually create Python class instances in PHP and call their methods etc.) but it seems it was abandoned in the Alpha stages for reasons unknown to me.</p> <p>I suppose the simplest solution would be a CLI one, meaning I could run a python instance from PHP and collect the results. I don't particularly like this solution though, considering the amount of Python code I'd have to write just to handle input from PHP and respond accordingly. Plus it's not very reusable.</p> <p>I don't know if this is a normal problem, Google certainly don't seem to think so, but what would be the best way of complementing a PHP code library with Python code?</p>
php python
[2, 7]
4,297,037
4,297,038
FancyUpload with JQuery
<p>How to use FancyUpload in a JQuery based project? The page in which I will use FancyUpload is made of JQuery. How to use FancyUpload? Please mention every steps in details. Please</p>
javascript jquery
[3, 5]
4,249,936
4,249,937
Bulk mailing using SMTP server in ASP.Net
<p>We are sending free newsletters to all users who have registered for this service. Since these newsletters are sent free of cost we expect at least 5000 subscribers within a month. I am worried whether bulk mailing using SMTP server concept will cause some issue. First we thought of developing a windows service which would automatically mail to subscribers on periodical basis but the business users have given requirement that the newsletters should be editable by the admin and then only mailed to users so we had to develop this functionality in website itself!. I get the subscribers for the particular user in data table and then mail to each user inside for loop, will this cause any performance issue? The code is pasted below:</p> <p>dsEmailds.Tables[0] has list of newsletter subscribers.</p> <pre><code>for (iCnt = 0; iCnt &lt; dsEmailIds.Tables[0].Rows.Count; iCnt++) { MailMessage msg = new MailMessage(); msg.From = new MailAddress("[email protected]", "test1"); msg.To.Add(dsEmailIds.Tables[0].Rows[iCnt]["mailid"]); msg.IsBodyHtml = true; msg.Subject = subject; AlternateView av1 = AlternateView.CreateAlternateViewFromString(MailMsg, null, System.Net.Mime.MediaTypeNames.Text.Html); av1.LinkedResources.Add(lnkResLogo); av1.LinkedResources.Add(lnkResSalesProperty); av1.LinkedResources.Add(lnkResLeaseProperty); msg.AlternateViews.Add(av1); SmtpClient objSMTPClient = new SmtpClient(System.Configuration.ConfigurationManager.AppSettings["mailserver"].ToString()); objSMTPClient.DeliveryMethod = SmtpDeliveryMethod.Network; objSMTPClient.Send(msg); } </code></pre> <p>Any suggestions would be great! </p>
c# asp.net
[0, 9]
919,818
919,819
How to pass parameter with a href and onclick function
<p>I want to pass parameter when I click in <code>&lt;a href&gt;</code>, first I have this and works fine:</p> <pre><code> &lt;a href="#" rel="like{{num}}"&gt; I like &lt;/a&gt;| $("a[rel^='like']").click(function(){ $.ajax({ ... }); </code></pre> <p>but I don't know how to pass parameter to that function, so I do this:</p> <pre><code> &lt;a href="#" rel="like{{num}}" onclick="cap(para1, para2)"&gt; I like &lt;/a&gt; </code></pre> <p>Finally, in my Javascript I have this simple function:</p> <pre><code> function cap(para1, para2){ alert('here'); } </code></pre> <p>but I obtain this error:</p> <pre><code>ReferenceError: cap is not defined </code></pre> <p>Any idea?</p>
javascript jquery
[3, 5]
1,005,202
1,005,203
How to check if an input box contains only numbers or commas?
<p>Given:</p> <pre><code> var input_val = $('#field').val(); </code></pre> <p>How do I check whether input_val contains only numbers or commas? The solution must work in the 4 main browers.</p>
javascript jquery
[3, 5]
5,135,303
5,135,304
Choosing between PHP or Java to use
<p>I'm having trouble choosing between PHP or Java to develop a fairly small web application for a school project.</p> <p>Our project is to create a very crude/working/barebones ticket and events management system. Think of the basic functionality of Ticketmaster.</p> <p>I have people in my team who are confident with Java but not ALL. Would it be better to choose PHP due to its small learning curve?</p> <p>Obviously the standard things like speed and security wont matter since this is a project. We want the coding/debugging to be easier.</p> <p><strong>EDIT:</strong> At the end of the project we'll have to demonstrate our web app using our laptop, so no distribution etc is required. Our goal is: as long as it works and ensures it. It doesn't have to work well, it doesn't have to use super efficient code (we are not marked by our code).</p>
java php
[1, 2]
1,619,684
1,619,685
How to get a fraction from a float number?
<p>I have a floating point number:</p> <pre><code>var f = 0.1457; </code></pre> <p>Or:</p> <pre><code>var f = 4.7005 </code></pre> <p>How do I get just the fraction remainder as integer?</p> <p>I.e. in the first example I want to get:</p> <pre><code>var remainder = 1457; </code></pre> <p>In the second example:</p> <pre><code>var remainder = 7005; </code></pre>
javascript jquery
[3, 5]
5,681,842
5,681,843
NullPointerException after disabling Wifi state and trying to enable again
<p>The first time I enable Wifi and then disable it everything is fine, but if I try to re-enable the Wifi after (either immediately or waiting for mobile data to connect again) it throws a NullPointerException and Force Closes.</p> <pre><code>private void toggleWifi(){ if (wifi == 0){ wifiManager.setWifiEnabled(true); scanOnly = wifiManager.createWifiLock(WifiManager.WIFI_MODE_SCAN_ONLY, "scanOnly"); scanOnly.acquire(); bWifi.setText("Turn Wifi OFF"); List&lt;ScanResult&gt; wifiResults = wifiManager.getScanResults(); StringBuilder sb = new StringBuilder("Scan Results:\n"); sb.append("-----------------------\n"); for (ScanResult r : wifiResults) { sb.append(r.SSID + " " + r.level + " dBM\n"); } tvWifi.setText(sb.toString()); wifi = 1; } else { scanOnly.release(); wifiManager.setWifiEnabled(false); bWifi.setText("Turn WiFi ON"); tvWifi.setText(""); wifi = 0; } } </code></pre> <p>The error is on this line:</p> <pre><code>for (ScanResult r : wifiResults) { sb.append(r.SSID + " " + r.level + " dBM\n"); } </code></pre>
java android
[1, 4]
5,190,376
5,190,377
What are the fundamental differences between ASP.net and PHP?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/606419/net-asp-vs-php">.NET &amp; ASP vs PHP</a> </p> </blockquote> <p>Are there speed differences, performance issues, and what reasons do businesses have when they choose one or the other, is the learning curve steeper for one over the other? </p> <p>Also... are you likely to be paid more using one over the other?</p>
php asp.net
[2, 9]
5,068,588
5,068,589
Get mouse relative position to dropped div
<p>I can get the absolute position of the mouse with:</p> <pre><code>$(document).mousemove(function(e) { window.x = e.pageX; window.y = e.pageY; }); </code></pre> <p>How can I get this position relative to a specific div? </p>
javascript jquery
[3, 5]
5,100,944
5,100,945
Suppose i have an HTML table. How do I use JQuery events on this?
<pre><code>&lt;table&gt; &lt;tr class="myRow"&gt;&lt;td class="col1"&gt;&lt;/td&gt;&lt;td class="col2"&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr class="myRow"&gt;&lt;td class="col1"&gt;&lt;/td&gt;&lt;td class="col2"&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr class="myRow"&gt;&lt;td class="col1"&gt;&lt;/td&gt;&lt;td class="col2"&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr class="myRow"&gt;&lt;td class="col1"&gt;&lt;/td&gt;&lt;td class="col2"&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr class="myRow"&gt;&lt;td class="col1"&gt;&lt;/td&gt;&lt;td class="col2"&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre> <p>How do I make the appropriate <code>col1</code> fill with the letters "ABC" when the user rollovers the row?</p> <p>And then disappear the "ABC" when the user moves the mouse away from that row?</p> <p>So far, I got this. I solved it.</p> <pre><code> $(".ep").hover(function(){ $(this).find('td.playButtonCol').html('PLAY'); },function(){ $(this).find('td.playButtonCol').html(''); }); </code></pre>
javascript jquery
[3, 5]
233,524
233,525
jQuery 1.2.6 caching
<p>I'm doing quite a bit of DOM manipulation in my app, adding new nodes, and I've found that the children() function can get out of sync. I've got a tbody element with two rows, I use the children() function on this to do some manipulation with these rows. I then add two more rows to the tbody, when I use the children function again to do more manipulation I only get back the original two rows, not these plus the two rows I've just added. I'm doing a new call to children every time, not relying on any variable to auto-update. Is there any way to clear jQuery's cache - I've noticed problems like this a few times with selectors and got around it by selecting further up the DOM tree then navigating back down (i.e. don't select the tbody with a jQuery CSS selector, select the table then do table.tBodies[0].rows), but that won't work in this case.</p> <p>Thanks, Phil</p>
javascript jquery
[3, 5]
2,521,009
2,521,010
Javascript if/else
<p>Can someone please help me? I am not sure why this is not working. The else portion of the if/else does not execute.</p> <pre><code>$.post("_inc/signupform.php", formdata,function(data){ console.log(data); if(data.status == 1){ $('#frontpagevalid').append(data.message).show(); $("#frontpagenameemail").slideUp(); $("#frontpageschoolzip").fadeIn(); $('#userid').attr({value : data.uid}); } else { $('#frontpagevalid').append(data.message).show(); } }, "json"); </code></pre> <p>Thanks in advance! Joe</p>
javascript jquery
[3, 5]
893,017
893,018
Show/hide div based on checkbox value
<p>When the user checks 'student'(check-1). The 2 checkbox values are supposed to disappear and reveal a text input div. As of right now I've got the input-reveal down. But I can't seem to get the checkboxes to disappear. </p> <p>I've tried: </p> <pre><code>$(function () { $('#check-1').change(function () { $('.name').toggle(this.checked); $('#check-1').hide(); $('#check-2').hide(); }).change(); }); </code></pre> <p>But that doesn't work. How do I hide the checkboxes once 'student' is checked? Any idea's?</p> <p>Here is a small <a href="http://jsfiddle.net/vkAy4/8/" rel="nofollow">fiddle</a> . Thanks for your help in advance.</p>
javascript jquery
[3, 5]
4,432,146
4,432,147
Different apk signatures in Android
<p>I have a little problem. I program in two different computers and when I change from one to the other and I try to run an aplication the adb return an error because the instaled apk and the new one have different signatures and I have to manually uninstall it.</p> <p>Is there some way of avoiding that?</p> <p>Thanks</p>
java android
[1, 4]
607,537
607,538
email form select llist menu
<p>i have a select list menu that i use in my email form:</p> <pre><code>&lt;select name="orgSelect" class="orgSelect"&gt; &lt;option value="0"&gt;----Select product----&lt;/option&gt; &lt;option value="1"&gt;Product 1&lt;/option&gt; &lt;option value="2"&gt;Product 2&lt;/option&gt; &lt;option value="3"&gt;Product 3&lt;/option&gt; &lt;/select&gt; </code></pre> <p>But when the email form is sent its posts the value and i dont want him to get the value, but yes the item label in front "Product 1"..., the Value of the options is using ofr anotehr thing, can someone tell me how to get the data "Product 1" or Product 2...</p>
php javascript
[2, 3]
3,698,445
3,698,446
Dynamically created elements - How to make proper selector and access top objects
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1266604/jquery-selection-within-a-selection">Jquery: Selection within a selection</a> </p> </blockquote> <p>Consider this code:</p> <pre><code>var $el = $('&lt;div class="test"&gt;&lt;div&gt;Foor&lt;/div&gt;&lt;/div&gt;&lt;div class="test"&gt;&lt;div&gt;Bar&lt;/div&gt;&lt;/div&gt;&lt;div class="other"&gt;Leave it!&lt;/div&gt;'); // won't work $el.find('div.test').css('color','red'); $('body').append($el); </code></pre> <p>jsFiddle:</p> <ul> <li><a href="http://jsfiddle.net/bVJkR/2/" rel="nofollow">http://jsfiddle.net/bVJkR/2/</a></li> </ul> <p>How can I access <code>&lt;div class="test"&gt;</code> elements using jQuery? </p> <p>Please note I would like to access <code>.test</code> elements before using them in document.</p> <p>I know I can create wrapper for divs, but I really would like to avoid it.</p>
javascript jquery
[3, 5]
5,264,663
5,264,664
AlertDialog style buttons for an Activity
<p>I have an activity with a Save and Cancel button at the bottom.</p> <p>In AlertDialog, the buttons are displayed inside a styled container view of some sort. </p> <p>How could I give the buttons in my Activity that same appearance? Specifically, how could I apply the style of the button container view in the AlertDialog to say a LinearLayout in my Activity containing the buttons? </p> <p>Thanks</p>
java android
[1, 4]
189,598
189,599
Escaping special characters
<p>Just a quick question. I want to send data from Javascript to a PHP script to store it in my database, then getting it back the same way (a script calls a PHP function, and data is sent back with JSON). </p> <p>Which function should I use in the javascript ? I should never need to get the data only with PHP, so is it ok to use <code>escape(string);</code> then <code>unescape(encoded_string);</code> to display ?</p> <p>Thanks.<br> Regards from France ;)</p> <p>EDIT : Forgot to mention : The data is a string from an user input (hence the security issues)</p>
php javascript
[2, 3]
716,116
716,117
How to edit input file properties by using an android app?
<p>i want to make an app which can add the file properties of a song file that the user inputs. Like adding the Album name of the song.. i am still a newbie in android app development... Thank you.</p>
java android
[1, 4]
3,557,178
3,557,179
Oauth query - using access token and secret
<p>I am developing an application based on google Oauth. Now my all authentications are done. Even I have now the access token and secret. Now I dont know how to use this access token and secret. Please I really need Help on this. I have already done the hard work which is getting access token and secret. Only need to know how to use this token and secret to call an api.</p>
c# java
[0, 1]
4,203,346
4,203,347
How to put a string into a text file
<p>I need to put a string into a text file with jQuery. When I press the button it must send the string in a text file. I tried to search but I can't find this specifically. This is my PHP code.</p> <pre><code> &lt;!doctype html&gt; &lt;html lang="eng"&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;Jquery tests&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;input id="name" type=" text"/&gt;&lt;input id="button" type="button" value="Load"/&gt; &lt;div id="content"&gt;&lt;/div&gt; &lt;script type="text/javascript" src="js/jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="ajax.js"&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
php jquery
[2, 5]
2,255,936
2,255,937
Given a ISO 8601 weeknumber, how would you get the dates within that week
<p>I got a weeknumber from a jquery datepicker, when a user selects a date. But now I want to get all the days within that week.</p> <p>I could add a click event that loops through all the td's of the tr the selected date is in and graps it's value but I'm looking for a more reliable way.</p> <p>So my question is, given a certain date and a weeknumber (iso 8601 formatted), how can you derive the other dates within that week with javascript?</p>
javascript jquery
[3, 5]
3,806,837
3,806,838
post back occurs javascript listbox items lost in asp.net
<p>i have 10 list boxes in my aspx page for all 10 list boxes same function is using for some buttons i want to add listbox data to grid can you help me my java script code shown below</p> <p></p> <pre><code>function MoveItem(ctrlSource, ctrlTarget) { var Source = document.getElementById(ctrlSource); var Target = document.getElementById(ctrlTarget); if ((Source != null) &amp;&amp; (Target != null)) { while ( Source.options.selectedIndex &gt;= 0 ) { var newOption = new Option(); // Create a new instance of ListItem newOption.text = Source.options[Source.options.selectedIndex].text; newOption.value = Source.options[Source.options.selectedIndex].value; Target.options[Target.length] = newOption; //Append the item in Target Source.remove(Source.options.selectedIndex); //Remove the item from Source } } </code></pre> <p>}</p> <p>i tried a javascript above code to move items between listbox using html input button problem when i trying to save listbox.items.count giving 0 can anyone tell me why this happening and also when post back occurs listbox items lost.</p>
c# javascript asp.net
[0, 3, 9]
4,451,256
4,451,257
Does anyone know how to access this function: GenerateNewWindowLightbox("Viewer.aspx?documentID=" + 21, null, true, "");
<p>In the plugin below, the documentation says I should be able to call GenerateNewWindowLightbox as a global function - but when I try it says undefined. The documentation is in German - but I have feeling it has something to do with scope and maybe a smarter javascript person than I might know how to get quick and easy access to the GenerateNewWindowLightbox function in the plugin below:</p> <p><a href="http://code.google.com/p/synergyrms/source/browse/branches/SourceCode/SynergyRMS/Scripts/jquery-AeroWindow.js?spec=svn301&amp;r=301" rel="nofollow">Windows Aero Plugin</a></p>
javascript jquery
[3, 5]
3,479,823
3,479,824
How to convert the String to expected date format in javascript?
<p>I have the String 08082012, now i need to convert this into expected date format in js/jquery, for example the format is M/d/y. So result will be 08/08/2012.</p> <p>Can you guys suggest me the possible ways to achieve? Thanks in advance.</p>
javascript jquery
[3, 5]
1,224,615
1,224,616
Save Data Into Table Before Deleting
<p>I have a detailview that has the Delete button; when user clicks the Delete button they get the delete confirmation dialog box. What kind of command do i need to use in the detailview before the data gets deleted? When user selects "Yes" i want to save the data in the detailview into some kind of variable first then delete it. I want to get some kind of high level guidance or some hint. thanks Here is the code for the confirmation dialog box in my ASPX file.</p> <pre><code>&lt;ItemTemplate&gt; &lt;asp:Button ID="Button1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" /&gt; &amp;nbsp;&lt;asp:Button ID="Button2" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you sure you want to delete');" /&gt; &lt;/ItemTemplate&gt; </code></pre>
c# asp.net
[0, 9]
562,142
562,143
Javascript detect when inner html has changed
<p>I have tried attaching the even onchange and change(with jquery) to an element that updates every couple seconds. Neither of these events are raised when the inner html is changed. How can I detect with with javascript or jquery?</p>
javascript jquery
[3, 5]
946,656
946,657
Moving from string array into datarow
<p>I have a problem with assigning string array into Datarow. Firstly, i have created the object for string array and put 2 values in the array out of 100(whole size). How many values should be placed in the array dependds on a different, which i am not showing here, though. </p> <p>Then i tried converting into DataRow. But it says. "object reference not set to an instance of an object"</p> <pre><code>DataRow dr = null; string[] strconcat = new string[100]; dr["concat"] = strconcat[i]; </code></pre> <p>Thanks in advance</p> <p>Edit-- Actually i was trying put these string array values into dropdown (ddchooseadeal). Is there any other good way other than this.</p> <pre><code> locname = ddchoosealoc.SelectedValue.ToString(); string[] strdeals = new string[100]; string[] strconcat = new string[100]; int i; for(i =0; i&lt; dsdeal.Tables[0].Rows.Count; i++) { strdeals[i] = Convert.ToString( dsdeal.Tables[0].Rows[i]["Title"]); strconcat[i] = strdeals[i]+" -- "+ locname; } DataRow dr = null; ddchooseadeal.Items.Clear(); ListItem li = new ListItem("Choose a Deal"); ddchooseadeal.Items.Add(li); dr["drconcat"] = strconcat[0]; ListItem item = new ListItem(); item.Text = NullHandler.NullHandlerForString(strconcat[i], string.Empty); ddchoosealoc.Items.Add(item); </code></pre>
c# asp.net
[0, 9]
3,526,210
3,526,211
jQuery Selectable only select 1 and get a value?
<p>This might seem like an odd request but I'd like to use jQuery's Selectable tool to only select one item at a time and I'd like it to show me a value I'll have within each tag. At the very least I want the contents of that selection. Has anyone tried to do this? For some reason these little things seem to not be all that easily findable in their API for it.</p>
asp.net jquery
[9, 5]
3,266,232
3,266,233
How to change non-default constructor in fragments to default constructor?
<p>Code:</p> <pre><code>public PlacePickerFragment() { this(null); } public PlacePickerFragment(Bundle args) { super(GraphPlace.class, R.layout.com_facebook_placepickerfragment, args); setPlacePickerSettingsFromBundle(args); } </code></pre> <p>Hello, I want to remove deprecation warning from code above, is there a way changed it to default constructor?</p>
java android
[1, 4]
873,384
873,385
The content of the Intent in the BroadcastReceiver
<p>I am learning how to send SMS in android, have seen the code as below:</p> <pre><code>public class SMSReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { //---get the SMS message passed in--- Bundle bundle = intent.getExtras(); SmsMessage[] msgs = null; String str = “”; if (bundle != null) { //---retrieve the SMS message received--- Object[] pdus = (Object[]) bundle.get(“pdus”); msgs = new SmsMessage[pdus.length]; for (int i=0; i&lt;msgs.length; i++){ msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]); str += “SMS from “ + msgs[i].getOriginatingAddress(); str += “ :”; str += msgs[i].getMessageBody().toString(); str += “\n”; } //---display the new SMS message--- Toast.makeText(context, str, Toast.LENGTH_SHORT).show(); } } } </code></pre> <p>Now my question is how do I know what are the contents of Intent object that are passed into onReceive function? As below:</p> <pre><code>Object[] pdus = (Object[]) bundle.get(“pdus”); </code></pre> <p>How do I know there is a "pdus" key in the bundle object? I can't find any clue in the API doc, anyone know where is the related information located?</p> <p>I don't only want to know what the SMS intent pass into onReceive function, but also the other system related Intent, but I can't locate any related information in the API doc. I wonder does the information really exist?</p>
java android
[1, 4]
4,970,511
4,970,512
Script onload in IE
<p>I have script, which appends in the document:</p> <pre><code>window.d = document s = d.createElement('script') s.setAttribute('type','text/javascript') s.setAttribute('src',options.url) d.getElementById(block_id).appendChild(s) $(s).load(function() { alert('') }) </code></pre> <p>In Opera, FF and Chrome <code>load</code> works fine, but not in IE. </p>
javascript jquery
[3, 5]
811,174
811,175
JavaScript equivalent of C#'s DynamicObject?
<p>Just to be clear, a class that inherits DynamicObject (in C# of course) is not the same concept as JavaScript's variables being dynamic. DynamicObject allows the implementer to programmatically determine what members an object has, including methods.</p> <p><strong>Edit</strong>: I understand that JavaScript objects can have any members added to them at run time. That's not at all what I'm talking about. Here's a C# example showing what DynamicObject does:</p> <pre><code>public class SampleObject : DynamicObject { public override bool TryGetMember(GetMemberBinder binder, out object result) { result = binder.Name; return true; } } dynamic obj = new SampleObject(); Console.WriteLine(obj.SampleProperty); //Prints "SampleProperty". </code></pre> <p>When a member of obj is accessed, it uses the TryGetMember to programmatically determine whether the member exists and what its value is. In short, the existence of a member is determined when it's requested, not by adding it before hand. I hope this clarifies the question a little. In case you're wondering, I'm trying to determine if it's possible to make an object in JavaScript, that when the function call syntax is used on it like so:</p> <pre><code>myAPI.uploadSomeData(data1, data2) </code></pre> <p>The uploadSomeData call goes to a "TryGetMember" like function, which performs an $.ajax call using the name "uploadSomeData" to generate the URL, and the return value is the result.</p>
c# javascript
[0, 3]
4,106,429
4,106,430
how we can assign single value of array to any variable in javascript
<pre><code>&lt;?php $abc=array(); $abc = (abc, cde,fre); ?&gt; &lt;script language="javascript" type="text/javascript"&gt; for (var i = 0; i &lt; 3; i++) { var gdf = "&lt;?php echo $lat['i'];?&gt;"; alert("value ="+gdf); } &lt;/script&gt; </code></pre>
php javascript
[2, 3]
4,881,846
4,881,847
Jquery scroller causing horizontal scrolling issue on all browsers
<p>I'm having horizontal scrolling issues and i'm thinking my jquery for the slider is causing the issue. Go to and you'll see the issue. It is difficult to show the code since I have no idea what to fix. Thanks :)</p>
c# jquery
[0, 5]
4,231,913
4,231,914
Logging Javascript interactions with c#
<p>I was wondering if anyone might have any suggestions on how to log javascript interactions with a browser in C#. The reason behind it is I would like to design a web crawler that take note of any javascript interactions, which I would like to potentially sift through to find any sort of malicious calls of any kind. </p>
c# javascript
[0, 3]
686,618
686,619
Help Me Understand This Comment Re Page Lifecycle
<p>I encountered this comment recently:</p> <pre><code>protected void Page_PreRender(object sender, EventArgs e) { // doing this at PreRender so we don't have to worry about when/if // we should bind based on if it's a postback or callback and what not. OrderList.DataSource = OrderItems; OrderList.DataBind(); } </code></pre> <p>I was under the impression that PreRender fired every time Load fires, as part of normal page lifecycle, so what's the advantage of doing databinding here? </p>
c# asp.net
[0, 9]
1,120,357
1,120,358
How do I chain multiple selectors with filters in jQuery?
<p>I'm trying to select multiple elements which do not have the attribute 'disabled' but I'm not sure if there's an easier way to type this:</p> <pre><code>$('input:not(:disabled), select:not(:disabled), textarea:not(:disabled)') </code></pre> <p>It seems a little wasteful to be typing multiple 'not(:disabled)'.</p>
javascript jquery
[3, 5]
4,619,110
4,619,111
Efficient JQuery login script
<p>I have been able to create a login form using 2 different methods.</p> <p>1) Use $.POST to send password to server PHP script which returns a success true flag. The form then needs to be submitted a second time so PHP 'header' can be called to load a new page (this has the ajax advantage that an error message can be faded in if success flag returns false).</p> <p>2) Use JQuery Submit allowing the server PHP 'header' to redirect to a new page on first submission. However if the password is incorrect there is no way to pick up a returned value and fade in an error message - a complete new page needs to be loaded.</p> <p>Is there anyway of getting the best of both worlds, i.e. $.POST function or PHP 'header' can be made to direct to a new page on first submission OR Submit can pick up a return value?</p>
php jquery
[2, 5]
4,121,670
4,121,671
textbox validation with jQuery, reject numbers
<p>With the help of stack overflow i got the below code for text box validation on conditions</p> <ol> <li><p>it must contain atleast 3 characters</p></li> <li><p>it must contain atleast one vowel</p></li> <li><p>it must contain only alphabets</p></li> <li><p>submit button must be enabled only if above 3 condtions are met</p> <pre><code>var $input = $('#myinput'); var $error = $('.error'); var $submit = $('#submit'); var Filters = { min: { re: /.{3,}/, error: 'Must be at least 3 characters.' }, char: { re: /[a-z]/i, error: 'Must be only letters.' }, vowel: { re: /[aeiou]/i, error: 'Must have at least one vowel.' } }; function test(value, filters) { var isValid = false; for (var i in filters) { isValid = filters[i].re.test(value); $error.hide(); $submit.show(); if (!isValid) { $error.show().text(filters[i].error); $submit.hide(); break; } } return isValid; } $input.on('keyup blur', function() { test(this.value, Filters); }); </code></pre></li> </ol> <p>But still, it is accepting numbers.. consider the input is aa99. its enabling button.</p>
javascript jquery
[3, 5]
4,026,145
4,026,146
learning Java, already know c++
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="http://stackoverflow.com/questions/307934/learning-java">Learning Java?</a><br> <a href="http://stackoverflow.com/questions/1852003/java-jvm-for-c-programmer">Java/JVM for C++ programmer?</a> </p> </blockquote> <p>I have been learning c++ for quite some time, i would like to learn Java now.Is there any resource which would teach me java faster knowing that I am already familiar with C++, please provide some good resources.</p>
java c++
[1, 6]
3,293,494
3,293,495
Best way to store a key=>value array in Javascript?
<p>What's the best way to store a key=>value array in javascript, and how can that be looped through?</p> <p>The key of each element should be a tag, such as <code>{id}</code> or just <code>id</code> and the value should be the numerical value of the id.</p> <p>It should either be the element of an existing javascript class, or be a global variable which could easily be referenced through the class.</p> <p>Jquery can be used</p>
javascript jquery
[3, 5]
5,367,532
5,367,533
Is it possible to access an html document from a different PHP script than the one that generated it?
<p>Here is the scenario: I have a page that is logging data to MYSQL. I have another page that reads that data and allows it to be viewed. When a new piece of data is logged I would like to have the first script check and see if the viewing page is open in the browser, and if so append the newest data to the end of the view. Also - could anyone point to some info giving an overview of how PHP and the browser interact? I think I have the concept of the DOM down for javascript...but as far as PHP it just appears that once the page is sent, that's it...</p>
php javascript
[2, 3]
440,623
440,624
Reloaded : Replace text into links using jquery
<p>I was searching so much over the net to convert text into links. I found one solution for that but now after testing that code i came up with problem. </p> <p>Here is discussion regarding that : <a href="http://stackoverflow.com/questions/37684/how-to-replace-plain-urls-with-links">How to replace plain URLs with links?</a></p> <p>Code i used : <a href="http://tech.cibul.net/turn-urls-into-links-in-text-with-jquery/" rel="nofollow">http://tech.cibul.net/turn-urls-into-links-in-text-with-jquery/</a></p> <p>Problem: suppose i have html code like this </p> <pre><code> &lt;a name="../uploads/1/7367217144viruddh7(www.songs.pk).mp3" href="#viruddh7(www.songs.pk).mp3" onclick=" playmedia(this.name)" id="viruddh7(www.songs.pk).mp3"&gt;viruddh7(www.songs.pk).mp3&lt;/a&gt; </code></pre> <p>Then it converts links with in name, id and href as well. I want to stop this kind of thing. I want to convert text into links which is out of the <code>&lt;a&gt;</code>and <code>&lt;img&gt;</code> tag</p>
javascript jquery
[3, 5]
4,354,112
4,354,113
Expired session on a website using callbacks
<p>I have an aspx.cs page that use only callback to connect to server side.</p> <p>After the website starts running, if I work on this page for several minutes, the session has been expired. I have only used callback and I haven't used any postback. I think the session has expired because it's not arising from the postback, but my web site is callback based and I never use postback.</p> <p>How can I resolve this expired session problem?</p>
c# asp.net
[0, 9]
5,981,527
5,981,528
Toggle text on button tag
<p>I have a show hide table rows feature but would now like to change my text. </p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; function HideStuff(thisname) { tr = document.getElementsByTagName('tr'); for (i = 0; i &lt; tr.length; i++) { if (tr[i].getAttribute('classname') == 'display:none;') { if (tr[i].style.display == 'none' || tr[i].style.display=='block' ) { tr[i].style.display = ''; } else { tr[i].style.display = 'block'; } } } } </code></pre> <p>The html is as follows...</p> <pre><code>&lt;button id="ShowHide" onclick="HideStuff('hide');&gt;Show/Hide&lt;/button&gt; </code></pre> <p>I want to toggle the "Show/Hide" text. Any ideas?</p>
javascript jquery
[3, 5]
3,502,833
3,502,834
correct way to display image from php onto page
<p>I am not getting my image correctly. I am unsure what is happening. First things first, the image is coming out of a mysql query. Little confused about how to make that image ready for a ajax call?</p> <p>here is how I get the image out mysql</p> <pre><code> if(mysql_query("insert into Personal_Photos (Email, Pics) values('$email', '$data')")) { $query="select Pics, MAX(ID) from Personal_Photos where Email='$email'"; $result=mysql_query($query) or die("Error: ".mysql_error()); $row=mysql_fetch_array($result); //$mime = 'image/yourtype'; //$base64 = base64_encode($contents); //$uri = "data:$mime;base64,$base64"; //header("Content-type: image/jpg"); echo '&lt;img src="data:image/jpeg;base64'.base64_encode($row['Pics']).'"/&gt;'; } </code></pre> <p>the jquery that I use is like so</p> <pre><code>$('#profilepicbutton').live('change', function(){ $("#preview").html(''); $("#preview").html('&lt;img src="loader.gif" alt="Uploading...."/&gt;'); $("#registerpt3").ajaxForm({ target: '#preview', success: function(data) { $("#preview").html(''); $("#preview").append(data); } }).submit(); }) </code></pre>
php jquery
[2, 5]
1,904,636
1,904,637
How to update details while pressing enter key on Grid view row editing in asp.net
<p>How to update details while pressing enter key on Grid view row editing in asp.net.</p> <p>I got many references and i used the code in below link.</p> <p><a href="http://stackoverflow.com/questions/152099/i-want-to-prevent-asp-net-gridview-from-reacting-to-the-enter-button">I want to prevent ASP.NET GridView from reacting to the enter button</a></p> <p>But it disable the enterkey.</p> <p>I want to update the row, </p> <p>I used this link <a href="http://www.codeproject.com/KB/webforms/gridviewenterkey.aspx?display=PrintAll" rel="nofollow">http://www.codeproject.com/KB/webforms/gridviewenterkey.aspx?display=PrintAll</a></p> <p>But i got command name is Edit while pressing enter key in row command event.</p> <p>How to handle this,</p> <p>Thanks in advance.</p>
c# asp.net
[0, 9]