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
53,308
53,309
Add a leading zero until the number 10
<p>I have a list of numbers up to the number 10: 1,2,3,4,5,6,7,8,9,10</p> <p>I need to put a zero in front of each number except the number 10. </p> <p>So it looks like this: 01,02,03,04,05,06,07,08,09,10</p> <p>HTML looks like this:</p> <pre><code>&lt;p class=​"number weight-400"&gt;​1&lt;/p&gt;​ &lt;p class=​"number weight-400"&gt;​2​&lt;/p&gt;​ &lt;p class=​"number weight-400"&gt;​3​&lt;/p&gt;​ &lt;p class=​"number weight-400"&gt;​4​&lt;/p&gt;​ &lt;p class=​"number weight-400"&gt;​5​&lt;/p&gt;​ &lt;p class=​"number weight-400"&gt;​6​&lt;/p&gt;​ &lt;p class=​"number weight-400"&gt;​7​&lt;/p&gt;​ &lt;p class=​"number weight-400"&gt;​8​&lt;/p&gt;​ &lt;p class=​"number weight-400"&gt;​9​&lt;/p&gt;​ &lt;p class=​"number weight-400"&gt;​10​&lt;/p&gt;​ </code></pre> <p>I have jquery to grab them all but I need to figure out how to add a zero to only the first 9 and not the 10th one:</p> <pre><code>$("p.number").each(function(i, index){ if (index &lt; 10){ } }); </code></pre> <p>but my each function grabs all the <code>&lt;p&gt;</code> and not the integer inside the p tag.</p>
javascript jquery
[3, 5]
693,338
693,339
Check that variable is a number
<p>How can I check that a variable is a number, either an integer or a string digit?</p> <p>In PHP I could do:</p> <pre><code>if (is_int($var)) { echo '$var is integer'; } </code></pre> <p>Or:</p> <pre><code>if (is_numeric($var)) { echo '$var is numeric'; } </code></pre> <p>How can I do it in jQuery/JavaScript?</p>
javascript jquery
[3, 5]
5,973,698
5,973,699
How to Identify Postback event in Page_Load
<p>We have some legacy code that needs to identify in the Page_Load which event caused the postback. At the moment this is implemented by checking the Request data like this...</p> <p>if (Request.Form["__EVENTTARGET"] != null<br /> &amp;&amp; (Request.Form["__EVENTTARGET"].IndexOf("BaseGrid") > -1 // BaseGrid event ( e.g. sort)<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|| Request.Form["btnSave"] != null // Save button </p> <p>This is pretty ugly and breaks if someone renames a control. Is there a better way of doing this?</p> <p>Rewriting each page so that it does not need to check this in Page_Load is not an option at the moment.</p>
c# asp.net
[0, 9]
3,047,801
3,047,802
how to get to page1 when i refresh my gridview?
<p>i have gridview in my webform.</p> <p>in my search i got to page 4 for example, now i need to refresh the gridview</p> <p>and go to page 1.</p> <p>how to to it ?</p> <p>thanks in advance</p>
c# asp.net
[0, 9]
4,739,814
4,739,815
How does javascript evaluate arguments?
<p>I write a simple javascript function to display a progressbar with the help of JQuery ProgressBar(<a href="http://t.wits.sg/misc/jQueryProgressBar/demo.php#" rel="nofollow">http://t.wits.sg/misc/jQueryProgressBar/demo.php#</a>)</p> <p>The progressBar function can be set to display different background images with different values. I want to display values in [0, MAX*0.3] as red, (MAX*0.3, MAX*0.7] as orange, and (MAX*0.7, MAX] as green. So I write a helper function as follows:</p> <pre><code>function setBar(bar, cur, total) { var v1 = parseInt(total * 0.3); var v2 = parseInt(total * 0.7); // if I run alert(v1) and alert(v2) here, the values are all right. bar.progressBar(cur, { max: total, textFormat: 'fraction', boxImage: '/img/pbar/progressbar.gif', barImage: { 0: '/img/pbar/progressbg_red.gif', v1: '/img/pbar/progressbg_orange.gif', v2: '/img/pbar/progressbg_green.gif' } }); } </code></pre> <p>The argument <em>cur</em> is the current value while <em>total</em> is the MAX value of the progress bar. The function doesn't seem to work, but when I replace "v1:" and "v2:" with actual values like 50 and 120, the function works well. And I have also checked the value of <em>v1</em> and v2 before calling bar.progressBar, they are all right.</p> <p>So the problem seems that I cannot pass a variable instead of a constant to the function bar.progressBar, I think it maybe have relations with javascript argument evaluation order, is there any fix to this problem?</p>
javascript jquery
[3, 5]
1,093,405
1,093,406
jQuery syntax problem
<p>This is my simple function and I have</p> <pre><code>&lt;p&gt;This is paragraph 1.&lt;/p&gt; </code></pre> <p>like this but this function is not working? What is wrong here?</p> <pre><code>function select(){ $('p')[0].innerHTML="Helooo!!"; } </code></pre>
javascript jquery
[3, 5]
707,488
707,489
Imparting expert knowledge for predicting branch statements in C# or C++
<p>I know some CPUs attempt to predict branch statements when deciding what code to pre-fetch, I was wondering if there was a way to help or hard code those branch predictions in C# (or C++). An example would be an error checking if statement which I know will return false 99.9999999% of the time, I would like to tell the CPU to always expect that branch to never happen for pre-fetching purposes.</p> <p>Thanks.</p>
c# c++
[0, 6]
1,129,548
1,129,549
jQuery $.get() issue
<p>I'm new with jQuery and JavaScript. I'm trying to make a HTTP GET request with the <code>get()</code> function. Below I've reported a part of my code. I don't understand why the http request doesn't work. Thanks for any advice!</p> <pre><code> var jqxhr = $.get("http://lyricwiki.org/api.php?func=getSong&amp;artist=Tool&amp;song=Schism&amp;fmt=xml", function() { alert("success"); }) .success(function() { alert("second success"); }) .error(function() { alert("error"); }) .complete(function() { alert("complete"); }); </code></pre>
javascript jquery
[3, 5]
4,523,793
4,523,794
Customize adapter to use custom font
<p>I have both Custom Font example and a small List View example app. But I am unable to join them !!!</p> <pre><code> /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView tv = (TextView)findViewById(R.id.tv); Typeface cFont = Typeface.createFromAsset(getAssets(), "fonts/jcc.ttf"); tv.setTypeface(cFont); &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" android:textSize="18sp" android:id="@+id/tv" /&gt; </code></pre> <p>and</p> <pre><code> /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_product_list); String asim02 = System.getProperty("line.separator"); String products[] = { "Apple" + asim02 +"Definition1", "Orange" + asim02 +"Definition2", "Banana"+ asim02 +"Definition3", "Onion"+ asim02 +"Definition4", }; lv = (ListView) findViewById(R.id.list_view); // Adding items to listview adapter = new ArrayAdapter&lt;String&gt;(this, R.layout.list_item, R.id.p_list, products); lv.setAdapter(adapter); &lt;TextView android:textColor="?android:textColorPrimary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="15sp" android:id="@+id/p_list" /&gt; </code></pre> <p>Please help me customizing adapter to use custom font</p> <p>Image of ProductList app <a href="https://dl.dropbox.com/u/15065300/ProductList.png" rel="nofollow">https://dl.dropbox.com/u/15065300/ProductList.png</a></p> <p>Here is the two example Apps <a href="http://www.mediafire.com/?scb3hjplb15yly5" rel="nofollow">http://www.mediafire.com/?scb3hjplb15yly5</a></p>
java android
[1, 4]
451,373
451,374
Concatenate values from script-created list into one field
<p>How do I concatenate data from text fields in a script-created list, where the text field names will always be the same as each other? Allow me to explain:</p> <p>I have a series of points that get added to a list that is create using javascript. This is the script to create the list:</p> <pre><code>var src = this.parentNode; var field = $('&lt;input type="text" id="savedpoints" name="savedpoints"&gt;').attr({'value': $(src).data('dbId')}); var but = $('&lt;button&gt;').append('&amp;nbsp;&amp;nbsp;Remove&amp;nbsp;&amp;nbsp;'); var newItem = $('&lt;li&gt;').append(field).append($(src).data('marker').title); newItem.append('&amp;nbsp;').append(but); $(but).click(poi.removeItem); $(poi.saveList).append(newItem); </code></pre> <p>So, there are items getting added to a list with a button next to them to remove them from the list if they are no longer needed. This list works perfectly.</p> <p>What I need is to add the values to a text field at the bottom of the form (say, name="allpoints") that concatenates the field values from this list (the text field labelled "savedpoints", with the attribute 'dbId') into a string (e.g. "6, 7, 10, 13, 14,..." etc) whenever an item is removed from or added to the list. I can't work out how this might work!</p> <p>Any help?</p>
php javascript
[2, 3]
4,031,720
4,031,721
jQuery simple image load
<p>im getting a little issue here. Im trying to load an image, but seems it isnt correct. Im getting the data of image, but i just want to load it instead of.</p> <p>Whats wrong?</p> <pre><code>var url = $(this).find("img").attr("ref"); $("#produto .main-photo .photo img").load(url, function() { $("#produto .main-photo .loader").fadeOut(); $("#produto .main-photo .photo").fadeIn(); }); </code></pre>
javascript jquery
[3, 5]
811,881
811,882
textbox dynamically created not found
<p>I use this method for inserting a textbox in a tablecell</p> <pre><code>protected void EditAttivitaClick(object sender, EventArgs e) { string attivitaID = ((ImageButton)sender).ID.Split('_')[2]; tableCell =(HtmlTableCell)FindControl("AttivitaDescrizione_" + attivitaID); TextBox txt = new TextBox(); txt.Text = tableCell.InnerHtml; txt.ID = "TxtAttivitaDescrizione_" + attivitaID; tableCell.InnerHtml = ""; } </code></pre> <p>It works correctly. And this function for saving in db the textbox's value:</p> <pre><code>protected void SalvaAttivitaClick(object sender, EventArgs e) { string attivitaID = ((ImageButton)sender).ID.Split('_')[2]; TextBox txt = (TextBox)FindControl("TxtAttivitaDescrizione_" + attivitaID); string a = txt.Text; attivitaTableAdapter.UpdateID(txt.Text, Int32.Parse(attivitaID)); tableCell.Controls.Clear(); tableCell.InnerHtml = a; } </code></pre> <p>But it doesn't work. beacuse it doesn't find the textbox created previously.</p> <p>I've put also EnableViewState="true" in the file aspx.</p> <p>Why?</p>
c# asp.net
[0, 9]
5,151,214
5,151,215
Remove QueryString Variable in c#
<p>I am very beginner With Programming...(unfortunately)</p> <p>I want to remove Any added QueryString To Address after i get the variables. for example:</p> <p>www.websiteName.com/page.aspx?a=344&amp;b=233</p> <p>i will get a and b and after that i want my address to look like this: </p> <p>(www.websiteName.com) . </p> <p>"root location". </p> <p>any help...</p> <p>thanks.</p>
c# asp.net
[0, 9]
4,191,789
4,191,790
Is it advisable to store large strings in memory, or repeatedly read a file?
<p>Let's say I have various text/json/xml/whatever files (stored locally, in the assets directory), ranging in size from 20 - 500 KB. Assuming these files are going to be referenced frequently, throughout the application, is it better to:</p> <p>A) Read the file once, the first time it's requested, and store the data in a variable</p> <p>or</p> <p>B) Read the file each time it's requested, grab the requested bit of information, and allow GC to clean up afterward?</p> <p>Coming from web-dev, I generally use option (A), but I wonder if the storage limitation of mobile devices makes B preferred in this context (Android app development).</p> <p>TYIA.</p>
java android
[1, 4]
1,120,894
1,120,895
window.open() returns undefined when called from setTimeout on Android
<p>I am having strange behaviour on my Android emulator. window.open() always returns undefined when called from setTimeout or callback function e.g. AJAX callback. However window.open() successfully opens a popup when called from an event handler e.g. onclick here is sample code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; function fnc() { setTimeout(function() { alert(window.open('about:blank')) }, 100); } &lt;/script&gt; &lt;input type="button" onclick="fnc()" value="push me"&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>In the example alert(window.open('about:blank')) shows 'undefined' and the popup is not created The same function works when called straight from fnc()</p> <p>Any ideas?</p> <p>Thanks</p>
javascript android
[3, 4]
1,035,362
1,035,363
How can I refresh a specific image after an update?
<p>I have several div tags with unique ids and after a click event for a specific image I'm trying to refresh it. How can I do this? This is what I have for code so far:</p> <p>HTML:</p> <pre><code>&lt;div class="photo_gallery_container" &lt;?php echo($div_id); ?&gt;&gt; &lt;table class="table table-bordered table-condensed"&gt; &lt;thead &gt; &lt;tr style="background-color: #f5f5f5;"&gt; &lt;th colspan="2" style="text-align: right;"&gt;&lt;span style="cursor:pointer" id="delimg_&lt;?php echo($id); ?&gt;" class="delimg"&gt;&lt;span class="label label-important"&gt;Delete&lt;/span&gt;&lt;/span&gt;&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt; &lt;img src="&lt;?php echo($url['url'])?&gt;" style="height:120px;"/&gt; &lt;/td&gt; &lt;td&gt; &lt;a href="#" id="rotateimg_&lt;?php echo($id); ?&gt;" class="rotateimg"&gt;Rotate&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; </code></pre> <p>My click event for rotate looks like this:</p> <pre><code>$('.rotateimg').click(function(e) { e.preventDefault(); var id = $(this).attr('id').substr(10); $.post("/functions/photo_functions.php", { f: 'rotate', imgid: id }, function(status){ if (status == 'true') { // How can I reload the specific image after being rotated } }); }); </code></pre>
php jquery
[2, 5]
2,963,886
2,963,887
What does "i = +i" mean in Javascript?
<p>In jquery source:</p> <pre><code>eq: function( i ) { i = +i; return i === -1 ? this.slice( i ) : this.slice( i, i + 1 ); }, </code></pre> <p>Is it used for make sure parse i to int?</p>
javascript jquery
[3, 5]
3,436,320
3,436,321
How can I take contents of one element and add to another when they both have an id ending in the same two or three digit number?
<p>I have this code:</p> <pre><code>$('.update-title') .change(function () { $(this).prop('title', $('option:selected', this).prop('title')); }); </code></pre> <p>and this HTML:</p> <pre><code>&lt;select id="modal_TempRowKey_14" class="update-grid update-title"&gt; ... ... &lt;/select&gt; &lt;input id="modal_Title_14" class="update-grid" type="text" value="xx"&gt; </code></pre> <p>Is it possible for me to make it so that when the .update-title changes then the value of the title is put into the input id with the matching number. So in this case the <code>#modal_TempRowKey_14</code> title would go into <code>#modal_Title_14</code> value</p> <p><strong>Important</strong></p> <p>I want this to happen only if the element being changed starts with <code>modal_TempRowKey</code>. Is this possible to put into the change block?</p>
javascript jquery
[3, 5]
2,969,281
2,969,282
Asp:table with Linkbutton in cells and page cycle
<p>I always seem to struggle with asp.net page cycle and dynamically created controls.</p> <p>I have a asp:table that is created in !isPostBack in page_load (i have tried creating it in page load, page_init onint)</p> <p>the table is created with cells that container a LinkButton:</p> <pre><code>LinkButton lb = new LinkButton(); lb.Text = cabinet.CabinetName; lb.CssClass = "child"; lb.Click += new EventHandler(btnChange_Folder); lb.CommandArgument = cabinet.Id.ToString(); </code></pre> <p>Now the problem is, whenver the Linkbutton is clicked, it doesnt fire and the table disappears.</p> <p>I know its to do with the page cycle.</p> <p>So my next action I try is to put the LoadTable() call outside the !IsPostBack block so its loaded everytime..</p> <p>This seems to work, except it requires me to press each button twice for it to fire...</p>
c# asp.net
[0, 9]
3,066,080
3,066,081
click event not firing on newly created list item
<p>I have two lists and when you click on the second list the first list removes the first item and add to the second list but when I click on the newly created list item it doesn't fire why is that. <a href="http://fiddle.jshell.net/g84K9/" rel="nofollow">jsFiddle demo</a></p> <pre><code>$('#SearchList li a').bind("click", function () { var $this = $(this).unwrap('&lt;a href="#"&gt;&lt;/a&gt;').remove().text(); var $that = $('#Search li:first').remove().text(); $('&lt;li&gt;' + $this + '&lt;/li&gt;').insertBefore('#Search li:first') $('#SearchList').append('&lt;li&gt;&lt;a href="#"&gt;' + $that + '&lt;/a&gt;&lt;/li&gt;'); }); &lt;ul id="Search"&gt; &lt;li&gt;Electronics&lt;/li&gt; &lt;li&gt;Image&lt;/li&gt; &lt;/ul&gt; &lt;ul id="SearchList"&gt; &lt;li&gt;&lt;a href="#"&gt;Interests&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Entertainment&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Clothing&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Pharmacy&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Home &amp; Garden&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>
javascript jquery
[3, 5]
4,277,391
4,277,392
ASP.net Client script order issue
<p>I have a client script on a page, that calls a dynamic script generated by a user control using ClientScript.RegisterStartupScript. The user controls script is dynamic, the pages' static.</p> <p>The issue I have, is the page client script cant find the function rendered by the user control. The method signatures match, everything is good. </p> <p>However, the user controls script is contained on the page after the static script. Would this make a difference? If so, is there a way to render the script before the static script - according to the MSDN api docs the only way is to combine all scripts into one. </p> <p>I don't have the luxury of doing this because the dynamic script uses the ClientID of the user control to uniquely identify itself - there is more than one occurrence of the user control.</p> <p>Is there an easy way around this?</p> <p>Cheers</p>
javascript asp.net
[3, 9]
3,381,875
3,381,876
Weird mouse event location Jquery
<p>Jquery:</p> <pre><code>&lt;script&gt; jQuery(document).ready(function() { $("#membership_options li").bind("mousemove", function(event) { $(this).find(".compare_tooltip").css({ top: event.pageY + 5 + "px", left: event.pageX + 5 + "px" }).show(); }).bind("mouseout", function() { $(".compare_tooltip").hide(); }); }); &lt;/script&gt; </code></pre> <p>CSS:</p> <pre><code>.compare_tooltip { position: absolute; width: 230px; background-color: #F1F1F1; border: 1px solid #E2E2E2; border-radius: 9px; z-index: 99999; padding: 10px; font-size: 0.9em; font-style: italic; box-shadow: -1px 1px 2px rgba(184, 184, 184, 0.72); display: none; } </code></pre> <p>html:</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Create Profile on ETLetsTalk Social Community&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Limited Access to ETLetsTalk Community Forum (Read Only)&lt;div class="compare_tooltip"&gt;Users can only view forum posts, topics and replies (read only)&lt;/div&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Community Email Updates&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>The effect:</p> <p><img src="http://i.stack.imgur.com/J4muW.png" alt="enter image description here"></p> <p>I'm hovering on the link inside ul "Limited Access..." and tooltip comes out near the footer. What am I doing wrong?</p> <p>With position fixed:</p> <p><img src="http://i.stack.imgur.com/3lh4E.png" alt="enter image description here"></p>
javascript jquery
[3, 5]
5,909,366
5,909,367
Displaying Integer in a Label
<p>How can I display an integer in a Label? What I am doing is I am calculating the total and I am trying to display it in a label.</p> <pre><code>public partial class total : System.Web.UI.Page { int total; protected void Page_Load(object sender, EventArgs e) { Label1.Text = Server.HtmlEncode(Request.Cookies["confirm"]["quantity"]); int quantity = (int)Session["TextBox1Value"]; if (Request.Cookies["user"]["items"] == "Tyres") { total = 20 * quantity; Label2.Text = ??? } } } </code></pre> <p>Or is there any other way to display the total on same page?</p>
c# asp.net
[0, 9]
2,736,329
2,736,330
How to get the value from a function
<p>How do I get a value from a function inserted into my HTML.</p> <p>I have tried this:</p> <pre><code>function testReturn(value) { var ReturnValue = value; return ReturnValue; } html = "&lt;div&gt;' + testReturn(2) + ' &lt;/div&gt;"; </code></pre> <p>I get an error saying <code>Undefined</code></p>
javascript jquery
[3, 5]
4,298,033
4,298,034
Finding phrases in string. Is there a more elegant way of doing this?
<p>I'm looking to search for 2 or 3 key phrases in a string called <code>lastTestText</code> and I want to return a <code>Boolean</code>. It works nicely with:</p> <pre><code>Boolean tooLong = lastTestText.contains("hour") | lastTestText.contains("min"); </code></pre> <p>But this is going to get a bit long-winded if I have 4 or 5 phrases so I wondered if there's a more elegant way of doing this?</p>
java android
[1, 4]
1,431,609
1,431,610
Is it possible to use jQuery to grab the HTML of another web page into a div?
<p>I am trying to integrate with the FireShot API to given a URL, grab HTML of another web page into a div then take a screenshot of it. </p> <p>Some things I will need to do after getting the HTML </p> <ul> <li>grab <code>&lt;link&gt;</code> &amp; <code>&lt;script&gt;</code> from <code>&lt;head&gt;</code> </li> <li>grab <code>&lt;body&gt;</code> into <code>&lt;div&gt;</code> </li> </ul> <p>But 1st, it seems when I try to do a </p> <pre><code>$.get("http://google.com", function(data) { ... }); </code></pre> <p>I get a 200 in firebug colored red. I think it has to do with sites not allowing you to grab their page with JS? Then is opening a window the best I can do? But how might I control the other page with jQuery or call fsapi on that page?</p> <p><strong>UPDATE</strong></p> <p>I tried to do something like below to do something when the new window is ready, but FireBug says "Permission denied to access property 'document'"</p> <pre><code>w = window.open($url.val()); setTimeout(function() { // if I dont do this, I always get about:blank, is there a better way around this? $(w.document).ready(function() { console.log(w.document.body); }); }, 1000); </code></pre>
javascript jquery
[3, 5]
942,042
942,043
How to use jQuery Flexigrid with php?
<p>I wan to mde flexigirid table; My data which are not comes directly into the database because I put them into the array after that Δ± put them some htlm tables. know Δ± want to use jQuery Flexigrid ;how can Δ± start ? Δ± have to start from scratch;Can u show me a way...or is there any way make like flexigirid table? </p>
php javascript jquery
[2, 3, 5]
5,928,517
5,928,518
access is denied IIS server problem
<p>i have no problem compiling and viewing my asp.net application using visual studio 2008</p> <p>but when i try to see it the IIS server (asp.net 4.0...)</p> <p>i get this message:</p> <pre><code>Server Error in '/' Application. Access is denied. Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL. Error message 401.2.: Unauthorized: Logon failed due to server configuration. Verify that you have permission to view this directory or page based on the credentials you supplied and the authentication methods enabled on the Web server. Contact the Web server's administrator for additional assistance. Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 </code></pre> <p>i did already run this update:</p> <pre><code>asp_net_regiis.exe </code></pre> <p>is there something else that i should configure?</p> <p>i've tried to switch the framework to <code>2.0</code> and that failed as well however i got a different message for 2.0:</p> <pre><code>Server Application Unavailable The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request. Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur. </code></pre> <p>any guidance would be most appreciated.</p>
c# asp.net
[0, 9]
1,600,047
1,600,048
Redirect via datagridView
<p>I am currently working in ASP.Net / C#. I am trying to make the server redirect to another page using via the rows in a datagrid, however, my code doesn't seem to work. Any help would be appreciated. </p> <p> </p> <pre><code> protected void GridView1_RowCreated() { foreach (GridViewRow row in GridView1.Rows) { Color color = row.BackColor; string color2 = System.Drawing.ColorTranslator.ToHtml(color); Session["" + row.Cells[0].Text + ""] = row.Cells[0].Text; //row.Attributes.Add("onclick", "zz(); return false;"); /*if (row.RowState == DataControlRowState.Alternate) { row.Attributes.Add("onclick", "redirectFunction(); return false;"); //row.Attributes.Add("onmouseover", "this.style.backgroundColor=' #FFFFFF';"); //row.Attributes.Add("onmouseout", "this.style.backgroundColor='" + color2 + "';"); //row.Attributes.Add("onclick", cookie.Value = row. GridView1.SelectedRow.Cells[0].Text); //row.Attributes.Add("onclick", "zz(); return false;"); } else { //row.Attributes.Add("onmouseover", "this.style.backgroundColor=' #FFFFFF';"); //row.Attributes.Add("onmouseout", "this.style.backgroundColor='" + color2 + "';"); //row.Attributes.Add("onclick", "zz(); return false;"); }*/ } } public void redirectFunction() { Response.RedirectPermanent("View.aspx"); } Other page if(Session["session"].ToString() != null) { // do something } </code></pre>
c# asp.net
[0, 9]
3,832,113
3,832,114
Count every Buton clicks
<p>the task is to count the number of clicks in a webform.</p> <p>here is the code.</p> <pre><code>public partial class _default : System.Web.UI.Page { int count = 1; private void Page_Load(object sender, System.EventArgs e) { Button btn = new Button(); btn.Text = "Click Me"; btn.Click += btn_Click; Label lbl = new Label(); form1.Controls.Add(btn); form1.Controls.Add(lbl); } protected void btn_Click(object sender, EventArgs e) { count++; //Label1.Text = count.ToString(); } } </code></pre> <p>the problem is that <strong>lbl</strong> is not recognised inside <strong>btn_Click()</strong> ... i cant figure it out... can any one suggest?</p>
c# asp.net
[0, 9]
2,802,218
2,802,219
php parse javascript using xpath
<p>i am trying to parse the html pages using php xpath, there are some data that are inserted into html through javascript, for example </p> <pre><code>&lt;script type="text/javascript"&gt; var insertName = function() { var firstName = 'Hi SomeUserName'; $('#welcomeMessage').html(firstName) } &lt;/script&gt; &lt;h1 id="welcomeMessage"&gt;&lt;/h1&gt; </code></pre> <p>i want to extract the data 'hi SomeUserName' alone, is it possible to do this in php xpath? or is there a best way to do this?</p> <p>thanks!</p>
php javascript
[2, 3]
5,292,269
5,292,270
Javascript function not firing
<p>I am trying to fire a function every 60 seconds.</p> <p>Here is my current code:</p> <pre><code>&lt;script&gt; $(document).ready(function() { setInterval(alertme, 600000); }); function alertme() { alert('1 minute has passed'); } &lt;/script&gt; </code></pre> <p>For some reason the function alertme is not being called.</p> <p>Any ideas why?</p>
javascript jquery
[3, 5]
56,940
56,941
get value by javascript
<p>i m use php which print my table in which first column is sr.no but in which i want to store value of exam_id. how can i get this Exam_id value by javascript</p> <pre><code> foreach ($data as $key) { echo "&lt;tr&gt;"; print' &lt;td class="contact" id="exam_id" name=' . $key['exam_id'] ." width="5%" value='.$key['date'].'&gt;' . $i . '&lt;/td&gt; &lt;td class="contact" width="20%"&gt;' . $key['date'] . '/' . $key['month'] . '/' . $key['year'] . '&lt;/td&gt; &lt;td class="contact" width="30%"&gt;' . $key['Title'] . '&lt;/td&gt; &lt;td class="contact" width="20%"&gt;' . $key['Branch'] . '&lt;/td&gt; &lt;td class="contact" width="6%"&gt;' . $key['Sem'] . '&lt;/td&gt; &lt;td class="contact" width="24%" &gt;&lt;a onclick="javascript:create_result();" href="#"&gt;Create Result&lt;/a&gt;&lt;/td&gt;'; $i++; echo "&lt;/tr&gt;"; } </code></pre> <p>javacript is</p> <pre><code>&lt;script type="text/javascript"&gt; function create_result() { var exam_id = document.getElementById('exam_id').value $.ajax({type:'POST', url: 'result/create_result',data:exam_id, success: function(response) { $('#content').html(response); }}); return false; } &lt;/script&gt; </code></pre>
php javascript
[2, 3]
1,342,522
1,342,523
find all youtube links with js (jquery)
<p>Say there is a div that has content and a youtube link. I want to grab that youtube link and embed it.</p> <pre><code>&lt;div id="content"&gt;&lt;p&gt;Here is a cool video. Check it out: http://www.youtube.com/watch?v=oHg5SJYRHA0&lt;/p&gt;&lt;/div&gt; </code></pre> <p>I want to grab the link and replace it with the embed code with js (jquery).</p> <p>Update 1:</p> <p>This is my js so far:</p> <pre><code> $("#content").each(function(){ var allContent = $(this).html(); //need regex to find all links with youtube in it, ovbiously it can't == youtube.com, but basically the link has to have youtube.com in it. if ($("a",allContent).attr("href") == "youtube.com" ) { // grab youtube video id /* replace link with &lt;div id="yt-video"&gt; &lt;object width="560" height="340"&gt;&lt;param name="movie" value="http://www.youtube.com/v/429l13dS6kQ&amp;hl=en&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/429l13dS6kQ&amp;hl=en&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"&gt;&lt;/embed&gt;&lt;/object&gt; &lt;/div&gt; */ } }); </code></pre>
javascript jquery
[3, 5]
2,086,385
2,086,386
How to retain XML nodes from string in JQuery
<p>I have a sql proc which returns xml. It passes the xml back to Json as a string. however, when it comes back, even though when i step through the code on the server it still looks valid, but then when i pass it back to the page in the .getJson call it looks like this: </p> <pre><code> \u003cROOT\u003e\u003craw\u003e\u003ccol1\u003eTpl1\u003c/col1\u003e\u003c/raw\u003e\u003c/ROOT\u003e\r\n </code></pre> <p>Here is my Jquery Code:</p> <pre><code>var s= $.getJSON("/firessis?a=" + d + "&amp;b=" + t, null, function (z) { }) .success(function () { var response = s.responseText.toString(); $('p#r').replaceWith("&lt;p id='r'&gt;" + response + "&lt;/p&gt;"); }) .error(function () { $('p#r').replaceWith("&lt;p id='r'&gt;Error&lt;/p&gt;"); }) .complete(function () { $('img#l').attr('style', 'display:none;') }); } </code></pre>
c# javascript jquery
[0, 3, 5]
627,145
627,146
In Android, how do I query MediaStore only for files in a specific path? Or alternatively, only display files in a certain path?
<p>Suppose I have an Android block of code that looks something like this:</p> <pre><code>String[] proj = {MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media._ID}; int[] to = new int[] { R.id.artist_name }; Cursor musiccursor = managedQuery(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, proj, null, null, MediaStore.Audio.Media.ARTIST); ListView musiclist = (ListView) findViewById(R.id.mylist); SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.songitem, musiccursor, proj, to); musiclist.setAdapter(mAdapter); </code></pre> <p>But what I want, is this:</p> <pre><code>String selection = MediaStore.Audio.Media.FILE_PATH + " ilike '%audio%books%'"; String[] proj = {MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media._ID}; int[] to = new int[] { R.id.artist_name }; Cursor musiccursor = managedQuery(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, proj, selection, null, MediaStore.Audio.Media.ARTIST); ListView musiclist = (ListView) findViewById(R.id.mylist); SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.songitem, musiccursor, proj, to); musiclist.setAdapter(mAdapter); </code></pre> <p>The only problem, of course, is that FILE_PATH is not actually a column I can use, and as far as I can tell, no such column exists.</p> <p>So I'm wondering:</p> <ol> <li>Is there a way to query only for music in a certain directory? If so, how?</li> <li>If that's not an option, should I make a ListAdapter that filters by directory? If so, again, how would I go about in doing that?</li> </ol> <p>Thanks for any advice.</p>
java android
[1, 4]
2,355,656
2,355,657
To delay javascript function call using jquery
<p><strong>CODES:</strong></p> <pre><code> $().ready(function(){ function sample() { alert("This is sample function"); } $("#button").click(function(){ t=setTimeout("sample()",2000); }); }); </code></pre> <p><strong>HTML:</strong></p> <pre><code>&lt;input type="button" name="button" id="button" value="Call sample function with delay"&gt; </code></pre> <p>Once i click button sample function is not called with a delay of 2 seconds. I dont know whats wrong. Please notify me how to do this</p> <p><strong>Question:</strong> To call javascript function using setTimeout via jquery</p>
javascript jquery
[3, 5]
674,171
674,172
Android : Phone call detect when connected?
<p>I can use this code to make outgoing call: </p> <pre><code>Intent dial = new Intent(Intent.ACTION_CALL); dial.setData(Uri.parse("tel:5556") ); context.startActivity(dial); </code></pre> <p>But how to detect whether the call is picked up or the call is refused? I tried PhoneStateListener, but it is not working. </p>
java android
[1, 4]
3,998,713
3,998,714
how to pass data from javascript to winforms user control
<p>I have a windows user control hosted in IE.</p> <p>how can i paas input from webpage ( propably from javascript ) to win forms user control</p> <p>can any one help me in solving this problem.</p> <p>it is urgent.</p> <p>Thanks.</p>
asp.net javascript
[9, 3]
4,222,757
4,222,758
Strange problem overriding one of LinearLayout's constructors
<p>For some reason, Eclipse doesn't like the call to super(context, attrs, defStyle), yet it's happy with the other super calls. The error is "The constructor LinearLayout(Context, AttributeSet, int) is undefined".</p> <p>I don't think the problem is with this code itself, but something else in the project's settings or something, since I adapted almost identical code from an example that did the same thing but for a RelativeLayout, which ran fine on my Eclipse setup in a test project.</p> <p>Please Help :)</p> <pre><code>public class MyLinearLayout extends LinearLayout { public MyLinearLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); myInit(); } public MyLinearLayout(Context context, AttributeSet attrs) { super(context, attrs); myInit(); } public MyLinearLayout(Context context, int checkableId) { super(context); myInit(); } </code></pre>
java android
[1, 4]
2,149,691
2,149,692
Can I send a string to a php file from my mobile Java app?
<p>I want to be able to send a parameter to a php page that contains a devices IMEI/MEID.</p> <p>I then want the php page to take that IMEI parameter and check a list of IMEI's to see if the IMEI sent as a parameter from my Java mobile app is contained in a database, if it is then return true.</p> <p>I only know the very basics of php but I believe this should be possible?</p> <p>If so can anyone point me in the right direction of what php functions I should be looking into?</p> <p>And also the best way to pass the parameter from java?</p>
java php
[1, 2]
1,209,813
1,209,814
JS/JQuery: I'm trying to move an li node under the one it matches
<pre><code>$(document).ready(function() { var a = $("li.comment").attr("id"); var b = $("li.comment[id='"+a+"']"); var c = $("li.comment &gt; div.comment-body div &gt; p &gt; a").attr("href"); var d = $("li.comment &gt; div.comment-body div &gt; p &gt; a[href='"+c+"']"); var e = new RegExp("[#+'+b+']b") if (d===e) { d.parent().append(a);}; };) </code></pre> <p>If <code>d</code> matches <code>b</code>, I'm trying to move <code>d</code> (starting from the <code>li</code> node) to right under <code>b</code> who's id it matches. I can't figure it out. </p> <p>Sample:</p> <pre><code>&lt;li id="wow" class="comment"&gt; &lt;div class="comment-body"&gt; &lt;div&gt; &lt;p&gt;Any comments?&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/li&gt; &lt;li id="rebble" class="comment"&gt;&lt;div class="comment-body"&gt;&lt;div&gt;&lt;p&gt;Wakatow&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/li&gt; &lt;li class="comment" id="det"&gt; &lt;div class="comment-body"&gt; &lt;div&gt; &lt;p&gt; &lt;a href="#wow"&gt;Yeah! Hold on a sec...&lt;/a&gt; &lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/li&gt; </code></pre> <p>I'm trying to work it out on jsfiddle, but I can't get it done. When it comes out right, the <code>li</code> with the link is supposed to move under the first one</p>
javascript jquery
[3, 5]
4,967,738
4,967,739
How to delete or remove an array value randomly in jQuery?
<p>How can I delete an value from an array in jQuery?</p> <pre><code>var prodCode = ["001","002","003","004","005","006","007","008"]; </code></pre>
javascript jquery
[3, 5]
5,840,192
5,840,193
How to find a text using javascript or jquery.
<p>I need to find a text from a paragraph using java script. Is there any code in JavaScript like we do in c# to find a text using "string.Contains("")" method.</p> <p>Pls help...</p> <p>Thanks Guys..</p>
javascript jquery
[3, 5]
1,266,350
1,266,351
Show issue while deleting directory
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5701586/delete-a-folder-on-sd-card">Delete a folder on SD card</a> </p> </blockquote> <p>In my app i saved all my data using internal storage i.e file. So at the first instance by using the <code>ContextWrapper cw = new ContextWrapper(getApplicationContext());</code> class i get the directory path as <code>m_AllPageDirectoryPath = cw.getDir("AllPageFolder", Context.MODE_PRIVATE);</code> Inside this directory path i saved some file File as Page01, page02, Page03 and so on.</p> <p>Again inside Page01 i saved some file like image01, image02...using the same concept <code>m_PageDirectoryPath = cw.getDir("Page01", Context.MODE_PRIVATE);</code> Now on delete of m_AllPageDirectoryPath i want to delete all the file associate with it. I tried using this code but it doesn't work.</p> <pre><code>File file = new File(m_AllPageDirectoryPath.getPath()); file.delete(); </code></pre>
java android
[1, 4]
2,206,137
2,206,138
Jquery Editable Table: How can i Make certain cells editable?
<p>I am building an editable table in jquery for fun.</p> <p>Here is my table:</p> <pre><code>&lt;table id="horiz-min" summary="Indices"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th scope="col"&gt;&lt;/th&gt; &lt;th scope="col"&gt;ID&lt;/th&gt; &lt;th scope="col"&gt;Description&lt;/th&gt; &lt;th scope="col"&gt;&lt;/th&gt; &lt;th scope="col"&gt;&lt;/th&gt; &lt;th scope="col"&gt;&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr onclick="show();" id="IDOL-FT"&gt; &lt;td class="editable" id="edit"&gt;Edit&lt;/td&gt; &lt;td class="edit-field"&gt;454&lt;/td&gt; &lt;td class="edit-field"&gt;TEXTTEXTTEXTTEXT&lt;/td&gt; &lt;td class="editable"&gt;Details&lt;/td&gt; &lt;td class="editable"&gt;Feeds&lt;/td&gt; &lt;td class="editable"&gt;Fields&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>The first thing i would like to do is to make the ID and Descriptions editable by clicking on edit.</p> <p>So in JQUERY, i am trying to do this to replace, these td's content with the content that is currently inside of them, in an editable text box.</p> <p>Fixed: but what i have gives a console error of "$ is not defined"</p> <p>jquery:</p> <pre><code>$('td.edit-field').replaceWith('&lt;textbox&gt;&lt;/textbox&gt;'); </code></pre>
javascript jquery
[3, 5]
1,217,431
1,217,432
How to alert a user when an event occurs?
<p>I am trying to create a news portal, on which if their is say a new event like "breaking news" and the user is viewing another website,he should be alerted by means of tab blinking or any sound or if the browser is minimized,it should open up by itself. Is it possible using php or jquery?</p>
php jquery
[2, 5]
2,791,825
2,791,826
Put a tags round user highlighted text?
<p>I need to get the user selected area of a textarea and then insert <code>&lt;a&gt;</code> tags round it.</p> <p>I use this to get the user selected area:</p> <pre><code>var textComponent = document.getElementById('article'); var selectedText; if (document.selection != undefined) { textComponent.focus(); var sel = document.selection.createRange(); selectedText = sel.text; } // Mozilla version else if (textComponent.selectionStart != undefined) { var startPos = textComponent.selectionStart; var endPos = textComponent.selectionEnd; selectedText = textComponent.value.substring(startPos, endPos) } </code></pre> <p>Now, I know I can do a string search for the user selected text and insert a tags round it, but what happens if that user selected text appears twice in the text, for example.</p> <blockquote> <p>Hello to you, goodbye to you.</p> </blockquote> <p>If the user highlights the second 'you' for the link they want, surely a string replace would put a tags around every instance of 'you'.</p> <p>Whats the best way to do this?</p>
javascript jquery
[3, 5]
2,397,902
2,397,903
jQuery: toogle--> open only one and collapse other sibling items
<p>jfiddle: <a href="http://jsfiddle.net/ZmDs2/1/" rel="nofollow">http://jsfiddle.net/ZmDs2/1/</a> Hi Im trying to accomplish collopsing other parent items while opening only one with jQuery toggle. </p> <p>I tried </p> <pre><code>var index = $(this).index(); $('.togglebox').eq(index).slideToggle("fast").siblings('.togglebox').hide(); </code></pre> <p>I would like you guys help.. Thanks</p>
javascript jquery
[3, 5]
803,373
803,374
JQuery onclick do something ... after click alert
<p>I am using this code:</p> <p><code>onclick="$('#default').click();"</code> ... is there any way to return an alert of something if it's done sucessfully?</p> <p>Update:</p> <p>There seems to be a proble here:</p> <pre><code>onclick="$('#default').click( function() { alert('clicked'); });" </code></pre>
javascript jquery
[3, 5]
691,937
691,938
How to prompt the "open with" menu after download a zip file
<p>In my app I download .zip files. Is there a way when those files are downloaded, have a button/notification when clicked prompt the "open with" menu with third party compatible apps? </p> <p>How to do that without knowing which zip handling apps are installed in the user phone?</p> <p>Also, how to apply to apk files , to prompt app install ?</p>
java android
[1, 4]
1,494,878
1,494,879
facebook app loading slow in android
<p>i took the example from </p> <p><a href="http://developers.facebook.com/docs/guides/mobile/" rel="nofollow">http://developers.facebook.com/docs/guides/mobile/</a> now whenever </p> <p>i run the app...either it takes too long time to load the face book sign-up or it never loads...it stays in whit screen with heading <img src="http://i.stack.imgur.com/bsveB.png" alt="this is the way it loads the fc app"></p> <p>now what shall i do to load in a faster way... </p> <p>`public class MyGreatActivity extends Activity {</p> <pre><code>Facebook facebook = new Facebook("20875929582353"); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); facebook.authorize(this, new DialogListener() { @Override public void onComplete(Bundle values) { // TODO Auto-generated method stub } @Override public void onFacebookError(FacebookError e) { // TODO Auto-generated method stub } @Override public void onError(DialogError e) { // TODO Auto-generated method stub } @Override public void onCancel() { // TODO Auto-generated method stub } }); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); facebook.authorizeCallback(requestCode, resultCode, data); } </code></pre> <p>}`</p>
java android
[1, 4]
756,888
756,889
How to create deployable JavaScript file
<p>To give a quick example of my question, consider the JS file provided by Google to capture Analytics data that we paste in our files. How does this JS file get all the data? I want to know how to create such JS files that I can give out to others who can then run it on their own websites and yet, store data on my website server. In short, they only copy the 1-2 lines of JS in their pages and all the intended functionality would run on their website, but the data will be stored on my web server database. </p> <p>How can I attach the functionality to such a JS file? I mean, how can I tell the JS file whether to collect Analytic data or show a form, etc. I am using PHP for server side processing. I did not find any good information on this so far.</p> <p><strong>Edit 1:</strong></p> <p>I wanted to add that the functionality is <strong>NOT</strong> limited just to analytics. It could be even as simple as showing a contact form that sends email to recipients, etc.</p>
php javascript
[2, 3]
2,008,373
2,008,374
How to check/pass setting status
<p>I have a preferences class that allows the user to turn on 'hints' from the settings of the application:</p> <pre><code>public class Prefs extends PreferenceActivity { //Option names and defualt values private static final String OPT_HINTS = "hints"; private static final boolean OPT_HINTS_DEF = true; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.settings); } /**Get the current value of the hints option */ public static boolean getHints(Context context) { return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(OPT_HINTS, OPT_HINTS_DEF); } } </code></pre> <p>The xml file contains:</p> <p></p> <pre><code>&lt;CheckBoxPreference android:key="hints" android:title="@string/hints_title" android:summary="@string/hints_summary" android:defaultValue="true" /&gt; </code></pre> <p></p> <p>How can I check if 'hints' is set On. Then if it is set On, I want to allow the application to do a certain thing.</p> <p>thanks for any help</p>
java android
[1, 4]
5,614,542
5,614,543
How to unbind an event
<p>I'm binding a dropdown</p> <pre><code>("#dropdownlist").change(function(){ //Do stuff }); </code></pre> <p>The above code gets called many times.</p> <p>How can I unbind this event before binding it each time?</p>
javascript jquery
[3, 5]
4,807,737
4,807,738
Thread stopping in synchronized block
<p>I am facing a problem with a stopping thread which is in a synchronized block. I am using TCP socket. The problem is that I am waiting on a <code>DataInputStream</code> object and I want to create a new socket again but it doesn't allow me to do because of the synchronized block.</p> <p>I have tried with <code>Thread.interrupted()</code>. I cannot avoid the synchronized block. Is there any other way to do the same?</p> <pre><code>dis = new DataInputStream(ReadWriteData.kkSocket.getInputStream()); int i = -1; String aval = ""; //new String(); char c = (char)dis.read(); </code></pre> <p>It is getting blocked on <code>dis.read()</code>.</p> <p>What I should do for escaping the <code>dis.read</code> when I want to create a new socket? </p> <p>Thanks in advance.</p>
java android
[1, 4]
3,719,990
3,719,991
Convert datetime to Time and show in a label in GridView
<p>I have a grid view in which I have a label in which I want to show the date and time as</p> <p><strong>Nov 19 at 07:30 am</strong></p> <p>i have a field in the database which give the datetime value as <strong>2011-11-19 07:30:43.193</strong></p> <p>How can I get the desired result?</p>
c# asp.net
[0, 9]
2,544,012
2,544,013
Load a new value into an input from PHP with jQuery?
<p>I have some input like:</p> <pre><code>'&lt;input type="text" name="display-count" class="display-count" value="23" autocomplete="off" readonly="readonly" /&gt;'; </code></pre> <p>And I'm using this jQuery code to remove the value it has and replace it with another one:</p> <pre><code>var count = $('form.user-count-form').find('.display-count'); $(count).val(''); $(count).load("admin/user-count.php"); </code></pre> <p>But the new value it isn't loaded. I have tried some other ways like: </p> <pre><code>$(count).val().load("admin/user-count.php"); </code></pre> <p>or</p> <pre><code>$(count).val(load("admin/user-count.php")); </code></pre> <p>But didn't work as well. How do I do what I want ?</p>
php jquery
[2, 5]
2,344,621
2,344,622
Change color depending on value
<p>I don't why this is not working. Can somebody tell me what is the problem with this?</p> <pre><code>var x = $('#clicked_info').val(); if(x == 1) { $('#companyname_ph').css({'color':'yellow'}); } else if(x == 2) { $('#companyname_ph').css({'color':'red'}); } </code></pre>
javascript jquery
[3, 5]
1,084,240
1,084,241
Session var not accessible in my script
<p>I have two <code>$_SESSION</code> variables impossible to access in any script of my page but it's sure they exist in the PHP code of the same page when I use <code>echo</code> to display their values.</p> <p>I can display in jQuery every classical PHP variables I want with the following code, but it's impossible when they are <code>$_SESSION</code> variables :</p> <pre><code>&lt;?php if( isset($_SESSION['id']) ){ echo $_SESSION['id']; // it displays the value } ?&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $("#some_button").click(function(){ var a = &lt;?php echo $_SESSION['id']; ?&gt;; alert(a); }); }); &lt;/script&gt; </code></pre> <p>I don't understand why honestly...</p>
php javascript jquery
[2, 3, 5]
3,863,866
3,863,867
How to make sure the values are increments of 12 in jQuery?
<p>Ok so I have an ajax call that I need to preform if and only if the user has a quantity of 12 because the items are sold as dozens</p> <p>Here is my html</p> <pre><code>&lt;input class="items" type="text" name="quantity_26" size="3"&gt;&lt;/span&gt;&lt;br&gt; &lt;input class="items" type="text" name="quantity_27" size="3"&gt;&lt;/span&gt;&lt;br&gt; &lt;input class="items" type="text" name="quantity_28" size="3"&gt;&lt;/span&gt;&lt;br&gt; &lt;input class="items" type="text" name="quantity_29" size="3"&gt;&lt;/span&gt;&lt;br&gt; </code></pre> <p>here is my jQuery for the ajax call</p> <pre><code>if(is_mulitple_of_12){ $.ajax({ url: 'processing.php', type: 'post', ... ... } </code></pre> <p>obviously the is_mulitple_of_12 variable is what I need a way to find. I was thinking of maybe the <a href="http://www.java2s.com/Tutorial/JavaScript/0040__Operators/Modulus.htm" rel="nofollow">Modulus</a> javascript operator but i was wondering if there is a better way</p>
javascript jquery
[3, 5]
5,184,106
5,184,107
JavaScript Best Practices: where should I include my JavaScript?
<p>I am building a website using PHP and JavaScript, and I feel that I have a good grasp on where to include my JavaScript, but a more specific situation has come up that has me confused. I currently have all of my JavaScript in one external file, which is being included on every PHP page.</p> <p>Let's say that I have a paragraph with an id='myParagraph' and I need to highlight this paragraph in red with JavaScript on page load. This paragraph is only on ONE PHP page and my website has about 50 different pages. I immediately assumed that I should throw some code into my one external JavaScript file, something like:</p> <pre><code>$('#myParagraph').css('color', 'red') </code></pre> <p>and the paragraph would be highlighted when that page loads.</p> <p>My question is: is this the best way to do it? To my understanding, every time I load a page it will be searched for an element with the id myParagraph, yet 98% of my pages won't even have that id. Is this wasteful? Should I instead include the following code:</p> <pre><code>function highlightParagraph() { $('#myParagraph').css('color', 'red') } </code></pre> <p>in my one JavaScript file and then put some inline JavaScript in the PHP file with the id myParagraph to call the function highlightParagraph() when it's loaded? That way, only the one page with myParagraph will be searched and highlighted.</p> <p>I feel like option 2 is the best, but I read all the time not to use inline JavaScript.</p> <p>edit: I realize that for this example you would just use CSS. I'm just using it to get my question across</p>
javascript jquery
[3, 5]
608,145
608,146
Populate a form with data from an associative array with jQuery
<p>Last time <a href="http://stackoverflow.com/questions/169506/get-form-input-fields-with-jquery">I asked about the reverse process</a>, and got some very efficient answers. I'm aiming for least lines of code here. I have a form of fields and an associative array in the {fieldname:data} format, I want to populate a corresponding form with it.</p>
javascript jquery
[3, 5]
1,111,182
1,111,183
Content slider like a slideshow
<p>I have almost identical content slider like <a href="http://www.webdeveloperjuice.com/2010/01/12/lightest-jquery-content-slider-ever-made-380-bytes/" rel="nofollow">this one</a>: </p> <p>How could I make it rotate automatically? I have tried different ways but I cant make it work. I have tried putting a click on the link but it doesn't work:</p> <pre><code>i=1; function autoplay(){ $('#navPoveznica'+i).click(); i++; if(i&gt;5){i=0}; setTimeout(autoplay, 2000); } </code></pre> <p>And I called the function when DOM was <code>.ready()</code><br> I'm really out of ideas, why doesn't this work? Can I select this way?<br> Should I use the class of the link and <code>.each()</code>?</p>
javascript jquery
[3, 5]
5,288,395
5,288,396
Loading an image buried within several divs when the parent div is shown by a .show jQuery command
<p>I have a jQuery script running on an ASP site that shows hidden DIVs when the id of a select form matches the div's ID:</p> <pre><code>$(document).ready(function(){ $('select[name$="_77"]').change(function() { $(".select_77").hide(); $(".select_77[id='" + this.value + "']").show(); }) }) </code></pre> <p>The form truncated to only one option for this example:</p> <pre><code>&lt;select name="option____jdfhj387___77"&gt; &lt;option value="1922"&gt;Raisins&lt;/option&gt; &lt;/select&gt; </code></pre> <p>And this is one of the many divs that gets unhidden:</p> <pre><code>&lt;div id="select_image"&gt; &lt;div class="select_77" id="1922" style="display:none;"&gt; &lt;div class="border"&gt; &lt;div class="content"&gt; &lt;img src="photos/option/1922.jpg"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>The photos are medium sized, and it takes roughly 20-30 seconds for the page to load when I have 200+ of these images. Is there anyway to have the image load only when the parent div becomes visible, without having to manually put in every image url inside the script?</p>
javascript jquery
[3, 5]
4,964,236
4,964,237
"too much recursion" in my rotating banner script
<p>My rotating banner script is throwing a "Too much recursion" error when the <code>iKeyless.widget.Rotator.rotate();</code> function is called within <code>init();</code>. I can't figure out why, <code>init();</code> is only called once and there's a defer() on the second call.... when the page loads it lags before throwing "too much recursion"</p> <pre><code> return { init: function () { ui.container = $("#rotating-banner"); ui.thumbs = $("#rotating-banner .tabs .tab"); ui.banners = $("#rotating-banner .banner"); ui.fadeBox = $(".rotate .bd .fade-box"); ui.thumbs.each(function (idx, el) { $(el).click(function () { paused = true; iKeyless.widget.Rotator.rotate.show(idx); }); }); iKeyless.widget.Rotator.rotate(); }, show: function (idx) { ui.fadeBox.css("display", "block"); ui.fadeBox.animate({ opacity: 1 }, .125, function () { $('.active', $(ui.banners[idx]).addClass('active').parent()).removeClass('active'); ui.fadeBox.animate({ opacity: 1 }, .125, function () { ui.fadeBox.css("display", "none"); }); }); }, rotate: function () { if (!paused) { this.show(counter); counter = counter + 1; if (counter === ui.thumbs.length) { counter = 0; } iKeyless.widget.Rotator.rotate().defer(5000); } } } </code></pre>
javascript jquery
[3, 5]
2,077,593
2,077,594
PHP jQuery - Dynamic load or complete Page
<p>i want to write a middle sized web-application in php with mysql and jquery. Does it make sense to generate only one "startup" page and load every content site dynamic with a jquery post ?</p> <p>And does it make sense to make a folder structure like</p> <pre><code>images index.php func.js content / news / add.php / delete.php / index.php / func.js </code></pre> <p>where the root index.php describe the full website layout and in the root func.js is the "what to load on landing and witch button goes to witch function" content and in the content/news/ folder there are many files for every action one file with a specific func.js file with actions for the news site ( in this demo ).</p> <p>Or is it better to make only one file with a get like : <code>news.php?action=show</code></p> <p>Or would you preferr that the news/add page includes the full webpage? not only the content to load from the main - layout ?</p> <p>greetings</p>
php jquery
[2, 5]
1,401,430
1,401,431
Access method in class library
<p>I've moved a class in my project into a class Library in the same solution. I've added a reference in the web project to the class library.</p> <p>How do I access the methods in the class library?</p>
c# asp.net
[0, 9]
2,268,077
2,268,078
Tracking incoming URL
<p>I have a situation where I need to change some CSS on a page based off the URL where the visitor came from. I'm using a form to submit a value to a new page (a checkout page) which is hosted on a different server/site than where the form resides. I have different forms sending this info over to the checkout page on 2 totally different sites. On this checkout page, if the user comes from site A, I need to add a certain class to a div. If the user comes over from site B, I need to add a different class to a div. Something like this:</p> <pre><code>if incoming URL is equal to www.abc.com, then addClass ('classABC'); if incoming URL is equal to www.xyz.com, then addClass ('classABC'); </code></pre> <p>Am I providing enough information to properly evaluate this? Ideally I'd like to pull this off in jQuery but not sure if there's an existing plugin that can check this. One thing to note, not all the forms being submitted to the checkout page reside on the same pages (i.e. www.xyz.com/index.html). Some may be on different pages through each site, so I need to be able to figure this out based off the primary URL.</p> <p>Thanks!</p>
javascript jquery
[3, 5]
1,888,709
1,888,710
Insert scripts into an existing function?
<p>This function is built into the page and I cannot modify the original .js file:</p> <pre><code>cool.lol = function () { // contents here } </code></pre> <p>Is there a way for me to append this function with some of my own scripts?</p> <p>Like this:</p> <pre><code>cool.lol = function () { // contents here // i would like to add my own stuff here!!! } </code></pre> <p>Or is there a way for me to detect that the function has been executed so I can run something after it?</p>
javascript jquery
[3, 5]
1,772,879
1,772,880
replacing page content with .html(content) is not working
<p>I have a weird problem in jQuery. The problem is that I can smoothly use <code>$('#container').html(content)</code> to replace the page content but to specific page. It is not working all around. Gives 'TypeError' message in console. Is there any probability that using SlickGrid can cause such error. Because error is thrown only in that pages where I have used SlickGrid. </p> <p>Any suggestion would be highly appreciated.</p>
javascript jquery
[3, 5]
5,320,558
5,320,559
jquery how to get the index of a click event when after doing an ajax call
<p>In the following code how would I use <code>$(this).parents('#friendRequest').remove();</code> in my ajax success callback function, and use <code>$(this)</code> to get selector of the click event in the first line?</p> <pre><code>jQuery(".notyAcceptFriendRequest").on('click', function() { notyId = jQuery(this).attr("notyIdOne"); // pull in the id of the current selected notification userProfilesUserId = $('#requestAlert').attr('userProfilesUserId'); // pull in the id of the current selected user profile id if (notyId == userProfilesUserId) { // if notification id is the same as the user profiles id, do the following $("#requestAlert").replaceWith('&lt;span class="font1"&gt;You two are now friends&lt;/span&gt;'); // the user profile friend requester will be replaced with the text $(this).parents('#friendRequest').remove(); // find the '#friendRequest' id from the parent elements and fade it out } else if (notyId != userProfilesUserId) { /* the below will execute when the user * clicks the 'Add' button and he/she is * not on the targeted users page */ $.ajax({ type: "POST", dataType: "JSON", url: "&lt;?=base_url()?&gt;index.php/reguserDash/acceptFriendNoty", data: {notyId: notyId}, json: {friendshipCaneled: true}, success: function(data) { if(data.acceptNotyFriendSuccess == true) { $(this).parents('#friendRequest').remove(); } } }) } }); </code></pre>
javascript jquery
[3, 5]
5,866,328
5,866,329
how button click event works in combobox?
<p>I am trying to dynamically append options in a combo box.</p> <p>How does button click event work in a combo box element? I am using change event. But I need button click event in the combo box. How can I 'uniquify' the combo box element in jquery?</p>
javascript jquery
[3, 5]
212,550
212,551
jQuery - How do I make custom event fire only once?
<p>I need to control the order in which events are fired. To ensure that my custom event is fired only after another event has finished I am triggering the custom event in the handler of the first event.</p> <pre><code> $(".HwRadioButton").click(function(event) { //Stuff that needs to happen before custom event ... //trigger custom event $(".HwRadioButton").trigger("onAnswerChange"); }); </code></pre> <p>Custom event binding:</p> <pre><code>$(document).ready(function() { $(".HwRadioButton").bind("onAnswerChange",function(event) { //custom event stuff }); }); </code></pre> <p>The problem is that I have 12 elements that have a class attribute value of ".HwRadioButton". The event, "onAnswerChange" is triggered 12 times. Why is that? Should I even need to select any elements? I just want to define a custom event and explicitly trigger it.</p> <p>Thanks!</p>
javascript jquery
[3, 5]
537,988
537,989
Getting system Mydocument path using C#.net(Web based Application)
<p>Am using C#.net(Web based) and Am trying to get Mydocument file path using following code </p> <pre><code> Label1.Text = System.Environment.GetEnvironmentVariable("USERPROFILE") +"\\My Documents\\"; or Label1.Text = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); </code></pre> <p>while running using IDE .i got correct mydocument path . if i host my application i got different path rather getting mydocument path .</p> <p>Please help me to find solution </p> <p>Regrads, ash</p>
c# asp.net
[0, 9]
4,000,317
4,000,318
modify class in stylesheet in codebehind
<p>I am Working in asp.net and c#.</p> <p>I have a css stylesheet named STYLE.css in my application,and i have a some classes in that stylesheet.I want to change the style in that classes in my codebehind.How to do that.Give ur suggessions.</p> <p><strong>Style.CSS</strong>:</p> <pre><code> .someclass { //some attributes } </code></pre> <p>I Want to change the attributes of <strong>someclass</strong> Class in codebehind.</p>
c# asp.net
[0, 9]
1,397,042
1,397,043
btnAdd_Click fires when i press F5
<p>Hi I've a simple code to insert data into db in button click event. It is executing fine and insert data into db. After inserting data if i press f5 button it is again inserting a new row into db with the same values.</p> <p>Button click event fires on each f5 button (refresh)</p> <p>Wat is the problem?</p> <p>Thank you, Nagu</p>
c# asp.net
[0, 9]
1,952,887
1,952,888
Get the position(index) of an element in the parent
<p>I want to get the position of a an element in its parent. For example</p> <pre><code>&lt;div&gt; &lt;h2 class="one"&gt;A&lt;/h2&gt; &lt;span&gt;Something&lt;/span&gt; &lt;h2 class="two"&gt;B&lt;/h2&gt; &lt;h2 class="three"&gt;C&lt;/h2&gt; &lt;/div&gt; </code></pre> <p>Now suppose I get a reference of h2.two $('h2.two'); in an event. I want the position of this element relative to other h2's in the div. In this case it is 2. and please don't tell me I can get it through the classname, because there won't be these classnames. Its just for explanation.</p> <p>NB: I want its position in the list of h2, basically in $('h2.two').parent().children('h2') not all elements</p> <pre><code>function buildPath(element) { var Xpath,position=-1; element=$(element);//Just in case; Xpath=getTagName(element); parent=element.parent(); console.log(parent.children(Xpath)); var position = element.siblings(Xpath).element.index(element);//I want the position here Xpath="/"+Xpath+"["+position+"]"; console.log(Xpath); console.log(getTagName(parent)); if (getTagName(element)=='body') return Xpath; } </code></pre>
javascript jquery
[3, 5]
3,631,526
3,631,527
How can I program a decimal addition with JavaScript
<p>How can i program this, the decimal shift needs to be programed that most of it I think , the rest would be just a normal add, any thoughts on how to program this? This is for an incrementer I'm building, the user can press plus or minus and increment a text input.</p>
javascript jquery
[3, 5]
3,830,542
3,830,543
On submit values lost
<p>I have a javascript that fires on change of radio button. On my radio button also have this code below.</p> <pre><code>&lt;input type="radio" name="design" style="vertical-align: middle" value="1" onchange="this.form.submit()" &lt;?php if(isset($_POST['design'])){ if($_POST['design'] == 1) {echo "checked";}} ?&gt;/&gt; </code></pre> <p>So when this group 'design' radio buttons changes this age is submit and data is loaded depending on which radio button.</p> <p>I also have a javascript with code below.</p> <pre><code>$("#lensType input:radio[name='design']:checked").change(populate); </code></pre> <p>It fires though when a change occurs but now when the form is submit and it is loaded that execution of change is lost. How can I retain that value or have this function execute still.</p> <p>This function loads a combo dynamic select list depending on which radio button is selected. At the same time the radio buttons load data on a table depending on what design it is.</p>
php javascript jquery
[2, 3, 5]
1,674,332
1,674,333
how facebook control elements stays open while navigating
<p>i was wondering how facebook controls its new slideshow / pircture viewer black box while navigating through images with arrow keys via jquery or what ever technique.</p>
php jquery
[2, 5]
4,524,716
4,524,717
Calling A Function In External Javascript Asp.Net
<p>I am having trouble calling an external javascript function from my asp.net page</p> <p>I have a file called user.js which I have this..</p> <pre><code> UseThisNewThing:function () { alert("In Function External"); } </code></pre> <p>My asp.net page references this file in the head tag..</p> <pre><code>&lt;script src="Js/User.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>Now I wanna call this function via jquery so in the code behind I have this</p> <pre><code> if (page != null &amp;&amp; !string.IsNullOrWhiteSpace(scriptName) &amp;&amp; !string.IsNullOrWhiteSpace(scriptCommands)) { Type parentType = page.GetType(); // Check to see if the include script exists already. if (!page.ClientScript.IsStartupScriptRegistered(parentType, scriptName)) { page.ClientScript.RegisterStartupScript(parentType, scriptName, "&lt;script type=\"text/javascript\"&gt;\njQuery(document).ready(function () {" + scriptCommands + "});&lt;/script&gt;"); ; } } </code></pre> <p>where parentType is this.Page, <code>scriptName="InitPage",</code> and </p> <pre><code>scriptCommands=@"User.UseThisNewThing();" </code></pre> <p>I must be miossing something in this hook up beacuse I cannot get the alert to fire on page load</p>
javascript asp.net
[3, 9]
2,540,802
2,540,803
JQuery hide/show gone wrong
<p>Here is a simplified example of what i'm working with, working around preexisting code:</p> <p>Basically I have 2 divs I want to hide/show in multiple places(stage 1, stage 2, stage 3,etc), as so: </p> <pre><code>var blue_div = "#Blue"; var red_div = "#Red"; var blue_stage = "#Blue" + count; var red_stage = "#Red" + count; </code></pre> <p><i>Adding insult to injury</i> the div's exist elsewhere on page and are hidden. Need to pull the content into another div for each stage. So i'm using .prepend() to grab the content, as so:</p> <pre><code>var blue_html = $(blue_div).html(); var new_div = "#new_div"; $(new_div).prepend(blue_html); $(new_div).attr('id', blue_stage); //Changing the id based on the stage </code></pre> <p><b>That last part is really whats throwing me</b>...As now I'm trying to use the new_div without first ending the script so it's not yet in the DOM...</p> <pre><code>if ($(blue_stage).is(':hidden')) { $(blue_stage).show() $("#cancel").bind("click",function(){ $(blue_stage).hide() } } </code></pre> <p>I've seen a lot done with <i>Window setTimeout()</i> as well as <i>setinterval</i> and <i>.queue()</i>. But my attempts have all failed. Hopefully my example wasn't confusing, any help at all is appreciated!</p>
javascript jquery
[3, 5]
4,187,274
4,187,275
Removing dropdown item from .aspx at pageload
<p>I have the following code that removes the item selected in dropdown1 from dropdown2 when a value in dropdown1 is selected:</p> <pre><code>protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { DropDownList2.Items.Remove(DropDownList1.SelectedItem); } </code></pre> <p>that works fine. However I tried adding the same code at pageload but it's not removing the value I'm guessing because nothing has been selected how can I accomplish this?</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { DropDownList2.Items.Remove(DropDownList1.SelectedItem); } </code></pre> <p>This is what is not working, any ideas?</p>
c# asp.net
[0, 9]
1,004,903
1,004,904
JQuery Sync Selected Radio Button between 2 radio button groups
<p>I know it can be done with input boxes using keyup paste on JQuery but what about Radio buttons?</p> <p>Example:</p> <p>User Selects option from Area A (radio button) and it selects(syncs) area B</p> <pre><code>&lt;!--AREA A (Source) --&gt; &lt;input id="radio_A" name="radio_A" type="radio" value="Value1" /&gt; &lt;input id="radio_A2" name="radio_A" type="radio" value="Value2" /&gt; &lt;!--AREA B (Target)--&gt; &lt;input id="radio_B" name="radio_B" type="radio" value="Value1" /&gt; &lt;input id="radio_B2" name="radio_B" type="radio" value="Value2" /&gt; </code></pre>
javascript jquery
[3, 5]
2,504,132
2,504,133
Partially expanding a div to preview contents
<p>When I hover over a div, I want another div (which starts as <code>display:none</code>) to partially expand downward, revealing only the top of its contents. How can I partially expand a hidden div with jQuery? Preferably so that the div fades out towards the bottom. There don't seem to be parameters for the <code>toggle()</code> command or <code>fadeIn()</code> that allow partial expansion.</p> <h1>Edit</h1> <p>Unfortunately, the requirements don't allow a separate 'teaser' div to be used. The hidden div containing all the text has to be partially expanded.</p>
javascript jquery
[3, 5]
5,211,029
5,211,030
get all child elements that are not a table
<p>I try to get all children, but skip tables:</p> <p>What I have is:</p> <pre><code>var allElements = $("body").children(); $.each(allElements, function(i, element) { // Do something }); // each element </code></pre> <p>Now I look for either a way, that allElements does not include tables or a function, that returns true, if an element is a table:</p> <pre><code>if(element.is("table")); </code></pre> <p>I do not find anything. Does anyone know a solution for this issue?</p>
javascript jquery
[3, 5]
838,091
838,092
Uncaught SyntaxError: Unexpected identifier
<p>It seems I have found myself yet again in quite of a pickle. From what I understood via searching this issue was that if <code>var</code> is <code>int</code>, this error might occur. But as far as my amateur Javascript skills go, I did not detect such a thing in my completely <a href="http://blog.alexmaccaw.com/svbtle-image-uploading" rel="nofollow">stolen code</a>.</p> <pre><code>var createAttachment = function(file) { var uid = [guava_uid, (new Date).getTime(), 'raw'].join('-'); var data = new FormData(); data.append('attachment[name]', file.name); data.append('attachment[file]', file); data.append('attachment[uid]', uid); $.ajax({ url: '/attachments', data: data, cache: false, contentType: false, processData: false, type: 'POST', }).error(function(){ console.log('could not upload'); }); var absText = '![' file.name + '](/attachments/' + uid + ')'; // &lt;&lt;&lt; ERROR $('#editor textarea').insertAtCaret(absText); }; </code></pre> <p><code>guava_uid</code> is defined before any of the code above as <code>guava_uid = "1";</code>, I tried it as <code>guava_uid = 1;</code> as well, but same result. All help is, as usual, appreciated. </p>
javascript jquery
[3, 5]
3,384,064
3,384,065
In asp.net, how can I tell what triggered an additional page_load call?
<p>Greetings.</p> <p>Is there a good way to determine what is calling my Page_Load method? I've got a few Componentart WebUI grids that call it, although I've checked all of those (using the gridName.IsCallback property). I've also got an update panel, but I'm not sure how to check if it is the caller.</p> <p>I'm betting there is a property somewhere that will tell me.</p> <p>Thanks!</p>
c# asp.net
[0, 9]
2,994,126
2,994,127
Problem with removing child
<p>I have two drop down forms. When the first is "changed" the second is populated with some data via ajax.<br> It's work but the value of the second drop down is not cleared on every request (I'm using $('#second_drop_down').children().remove();)</p> <p>Here is sample code</p> <pre><code>$('#first_drop_down').live('change', function() { var x = "some ajax data recived via ajax"; $('#second_drop_down').children().remove(); $('#second_drop_down').append(f); }); </code></pre>
javascript jquery
[3, 5]
5,025,157
5,025,158
php/python date conversion
<p>Guys, I have a python script which builds up a MySQL table with timestamps that look like: </p> <pre><code>2011-04-18 09:54:45 </code></pre> <p>To interface with this MySQL table, I need a php script to match updates. If I run this in PHP:</p> <pre><code>$todaysdate = date(DATE_RFC822); print $todaysdate; </code></pre> <p>returns:</p> <pre><code>Mon, 18 Apr 11 09:57:57 -0400 </code></pre> <p>How do I get php to return 2011-04-18 09:54:45 style result? instead of a RFC822?</p> <p>Thanks!</p>
php python
[2, 7]
4,534,906
4,534,907
Creating custom jQuery class
<p>I am creating a photo gallery for my website. I want a grid of the photos displayed when the page loads. Then when the user hovers over each photo, the photo enlarges a little.</p> <p>I created the javascript for the hovering, but I do not know how to properly package this into a class.</p> <p>Basically, I want to just create a list like this</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;img src="img1.jpg" /&gt;&lt;/li&gt; &lt;li&gt;&lt;img src="img2.jpg" /&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>And then it automatically creates each image with my hovering mechanism already in place. Here is my code thus far.</p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;script src="jquery.js"&gt;&lt;/script&gt; &lt;style text="text/css"&gt; .hoverImage { position: absolute; width: 200px; left: 500px; top: 200px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;script&gt; var originalWidth; var originalHeight; function onHover() { originalWidth = $(this).width(); originalHeight = $(this).height(); $(this).stop(false, true).animate({ left: $(this).offset().left-(Math.floor(originalWidth/4)), top: $(this).offset().top-(Math.floor(originalHeight/4)), width: 300, },200); } function offHover() { $(this).stop(false, true).animate({ left: $(this).offset().left+(Math.floor(originalWidth/4)), top: $(this).offset().top+(Math.floor(originalHeight/4)), width: 200, },200); } $(document).ready(function() { $("img").hover(onHover, offHover); }); &lt;/script&gt; &lt;img class="hoverImage" src="Test.jpg"/&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript jquery
[3, 5]
3,948,991
3,948,992
jQuery solution for content zooming/switching?
<p>I'm designing a page for a kiosk at a local business that displays both a flash solar monitor as well as a slideshow of images of their new green roof but want a way to focus on each of these objects individually, making the one in focus larger in the foreground while having the other smaller and more subtle in the background or on the side. Every few minutes the two div's would effectively swap places, bringing the other to the foreground (like when listening to music in FrontRow on a Mac). Is this possible with a current jQuery or MooTools plugin? I'd like to avoid a flash page if at all possible.</p>
javascript jquery
[3, 5]
106,847
106,848
how can I get asp.net aspx page name from javascript?
<p>Trying to get the aspx name from the current page from javascript?</p>
javascript asp.net
[3, 9]
1,176,250
1,176,251
Time duration based city and country asp.net
<p>I want to find out the duration between two different time zone. Issue is, I have only city and country with two date time. I am thinking, If I will able to get the time zone based on City and country then I will able to subtract the duration.</p> <p>Supposed I am listing flight result page with departure date time and arrival date time.</p>
c# asp.net
[0, 9]
4,350,828
4,350,829
Detect close tab/browser without message etc?
<p>I would like doing in javascript (jQuery):</p> <pre><code>if (close tab || close window) { $.ajax({ type: "POST", url: "process_form.php", data: dataString }); } </code></pre> <p>Is this possible without message if you want leave page etc?</p>
javascript jquery
[3, 5]
996,059
996,060
How to process groups of duplicate fields and organize by common field key - PHP / Array
<p>Looking to mimic what's going on on this website where you can add multiple field groups: When you click "add another card", it duplicates the field -- I've got this covered with jquery and clone(). However, if you input two gift cards with the same amount, on the next step they've combined the quantities for those gift cards into one group. So here's a scenario that I'm facing and the output that I would like to see:</p> <p>User Input:</p> <pre><code>Field Group 1 -- Amount: $100 Quantity: 1 Field Group 2 -- Amount: $75 Quantity: 2 Field Group 3 -- Amount: $100 Quantity: 1 </code></pre> <p>Desired Output on Next Page:</p> <pre><code>$100 Gift Card Group: 2 $75 Gift Card Group: 2 </code></pre> <p>I've been searching for different ways to do this and can't find anything, please help!!</p>
php javascript
[2, 3]
3,123,405
3,123,406
Screen scape altered info from another website
<p>I'm trying if it is possible to get the result of another site after clicking some items and altering some data on that site.</p> <p>For example, you have a site which asks you first for some input and then gives a result. This result i want to have and save it to a database and display it on my own site. Is there any possibility for this?</p> <p>I searched for hours and i can only find static examples.</p> <p>Any help or link would be much appriciated.</p>
c# asp.net
[0, 9]
37,897
37,898
Better way to find Class in event.target parentnodes using jquery and javascript?
<p>Currently, I check the target of the input box keyup event to see if it is contained within a div wit class "editorRow" using:</p> <p>var $parentClass = event.target.parentNode.parentNode.parentNode.className;</p> <p>Is there a better way to do this in case extra markup is added between the div and the span tags?</p> <pre><code> &lt;div class="editorRow"&gt; &lt;li&gt; &lt;span class="wi1"&gt; &lt;input type="text" value="" style="width: 80px;" name="LineItems9" id="LineItems_9"&gt; &lt;/span&gt; &lt;/li&gt; &lt;/div&gt; </code></pre> <p>&nbsp; </p> <pre><code>$("input").live("keyup", function(event) { return GiveDynamicFieldsLife(event); }); function GiveDynamicFieldsLife(event) { **var $parentClass = event.target.parentNode.parentNode.parentNode.className;** if ($parentClass == "editorRow") { //Do Stuff } } </code></pre>
javascript jquery
[3, 5]
5,200,590
5,200,591
How to parse XML from another server using JavaScript or jQuery?
<p>I am new to Javascript. I need to parse XML using javascript or jQuery which is another server. I tried by using the below code. But when I executed it, it was not going to success method.</p> <p>I was able to parse the XML which is in the same folder. Is it possible in javascript to access content from another server. I read the Same Origin Policy. </p> <p>I was able to get the success message, but cant get the xml data</p> <pre><code>$.ajax({ type: 'GET', url: 'http://10.47.5.69/myxml.xml', dataType: "xml", success: function(data){ alert('success'); $(data).find("Node").each(function() { alert($(this).find("element").text()); }); }, error: err }); function err(xhr, reason, ex) { alert('xhr.status: ' + xhr.status); alert('ex "'+ex); } </code></pre>
javascript jquery
[3, 5]