Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
5,096,483
5,096,484
Read text from response
<pre><code> HttpWebRequest request = WebRequest.Create("http://google.com") as HttpWebRequest; request .Accept = "application/xrds+xml"; HttpWebResponse response = (HttpWebResponse)request .GetResponse(); WebHeaderCollection header= response.Headers; </code></pre> <p>Here google returns text. How to read it?</p>
c# asp.net
[0, 9]
3,736,977
3,736,978
Java programmer needs to learn C++ fast
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2041102/java-to-c-guides">Java to c++ guides</a> </p> </blockquote> <p>Hi,</p> <p>I am a Java programmer, but recently the need came up for me to learn C++ fast. I am thinking in about a week, obviously also with normal daily obligations (meaning I can't spend 8 hrs in front of a computer every day). </p> <p>I realize that this is quite a short time span, and I am certainly not looking to master the language. I just need some basic C++ knowledge to be able to write working code, understand documentation, etc as part of a project. I am a CS student, so I don't really need the "if-else statements control program flow by..." kind of tutorial. </p> <p>What do you guys recommend? I am debating between just working through a straight up C++ book or one of those "Java to C++" type tutorials. </p>
java c++
[1, 6]
271,869
271,870
How to make checkboxlist work as radiobuttonlist
<p>I am developing an application which consists of two checkboxlist which displays like true or false. How to make second checkboxlist unchecked when first checkboxlist checked like radio button using javascript ?</p>
javascript asp.net
[3, 9]
4,953,241
4,953,242
Implement partial methods across multiple assemblies
<p>In one of the applications I am working on, there are two basic functionalities included: Create and Update.</p> <p>However, there is a need sometimes to add custom code, so I thought of extending the code by allowing 3rd parties to write and embed their own code:</p> <p>OnCreating OnCreated OnUpdating OnUpdated</p> <p>Is there a way to enable the above across multiple assemblies? MEF might help here?</p> <p>Thank you Regards</p> <hr> <p>Thanks all for your replies.</p> <p>Having such an interface means each external assembly has to implement that interface as needed. Then, my application's code, needs to loop through the currently running assemblies, detect all classes implementing that interface, and run their methods?</p> <p>Does MEF fit here? I can export the implementation from external assemblies and import them inside my app?</p> <p>Thank you Regards</p>
c# asp.net
[0, 9]
4,327,363
4,327,364
loading javascript file in ASP.NET for a single page
<p>I'm using ASP.NET with a master page containing a script manager. I want to add a javascript file to only one page, but all pages inherit from the master. What is the proper way to accomplish this?</p> <p>thanks in advance</p>
asp.net javascript
[9, 3]
3,083,407
3,083,408
Javascript function calling question
<p>Is it possible to do what I want? the <code>changeEl()</code> function is also in <code>fadeGall()</code></p> <pre><code> function initOpen(){ $('ul.piple-holder &gt; li &gt; a, ul.work-holder &gt; li &gt; a').each(function(){ var _box = $(this); _box.click(function(){ //SOME CODE HERE TO RUN changeEl(0); on each _hold //element from fadeGall() }); }); } function fadeGall(){ var _hold = $('div.work-info'); _hold.each(function(){ var _hold = $(this); function changeEl(_ind){ return; } }); } </code></pre>
javascript jquery
[3, 5]
2,550,343
2,550,344
iWebkit Vs JqueryMobile Vs JQtouch?
<p>Hii Friends,</p> <pre><code>i m newbie to iphone development , i have to design a iphone webapp,have found these three have the best features, </code></pre> <p>Plz point out these pros and cons of these mobile frameworks?</p> <p>Does php is needed for form processing or we can use xml,feeds etc?</p>
jquery iphone
[5, 8]
2,081,237
2,081,238
Show menu/div onclick or onmouseover not the easy way
<p>I'm trying to make a menu that can collapse:</p> <ul> <li>If you click on a button div the menu shows and stays even if you hover the button div.</li> <li>If you click again on the button div the menu hides.</li> <li>When the menu is hiding onmouseenter or mouseover it shows onmouseleave or mouseout it's hiding.</li> </ul> <p>I can't make this happen, this is my code:</p> <pre><code> $(function() { $('#arrow').bind('mouseenter', function(){ if($('#hoofdmenu').attr("class") == "show"){ $('#hoofdmenu').addClass("class", "mousehide"); $('#hoofdmenu').hide(); } else { $('#hoofdmenu').removeClass("class", "mousehide"); $('#hoofdmenu').addClass("class", "mouseshow"); $('#hoofdmenu').show(); } }); $('#arrow').bind('click',function(){ if ($('#hoofdmenu').attr("class") == "show"){ $('#hoofdmenu').attr("class", "hide"); $('#hoofdmenu').hide(); } else { $('#hoofdmenu').attr("class", "show"); $('#hoofdmenu').show(); } }); }); </code></pre> <p>Someone can help me with this problem? Kind regards, Frank</p>
javascript jquery
[3, 5]
2,418,551
2,418,552
Duplicating JQuery/Javascript functions
<p>I have a jquery/javascript function that creates an array to be placed in a form's hidden field. However, this is a nested form and so I need to invoke this function many times to populate the hidden field for all the children: <code>test_suite_run[test_runs_attributes][//id][packages_id]</code>. This means that I need to run this function with a different child id each time.</p> <p>I have added <code>//id</code> to indicate the only differences between the many function calls. I do not know how to duplicate this function without copying it many times manually and replacing //id with the indexes 0...n, for each nested child instance. Could this somehow be done by passing parameters to the javascript function?</p> <p>Sorry if this a little confusing, I will be happy to explain in more detail if needed.</p> <p>JQuery Function</p> <pre><code>$(document).ready(function () { arr = new Array(); $(document).on('change', 'select[id ^="s_package//id"]', function () { var arr = $('select[id ^="s_package//id"]').map(function () { return this.value }) result = "" for (j = 0; j &lt; arr.length - 1; j++) { result += (arr[j] + ", "); } result += (arr[arr.length - 1]) $("input[name='test_suite_run[test_runs_attributes][//id][packages_id]']").val(result); }); }); </code></pre>
javascript jquery
[3, 5]
1,235,514
1,235,515
writing a time out event for android
<p>i have a small issue i can't figure out. for my program, i basically want to execute some code if the user hasn't done anything with the application for 5 minutes (say log out).</p> <p>how can i go about doing this? i'm lost on detecting that the user has done nothing, and then reset the count once the user has touched the tablet or something. can somebody give me some pointers?</p> <p>thanks in advance!</p>
java android
[1, 4]
3,723,311
3,723,312
Why is there usually a reference to Java when when people talk about C#?
<p>I don't know much about C# but I've been programming in Java for a few months now. I had always heard what C and C++ were, but was a little curious about where C# came from. I'm a little confused about the C# language since even though it's one of the 'C' languages (C, C++, C#), on the other hand all of my professors seem to line it up against Java, and not the others.</p> <p>If anyone can clarify that would be great :)</p>
java c#
[1, 0]
1,165,699
1,165,700
client side validation error
<pre><code>&lt;%@ Page Language="C#" MasterPageFile="~/HomeMaster.master" AutoEventWireup="true" CodeFile="HomePage.aspx.cs" Inherits="Default2" Title="Untitled Page" %&gt; &lt;asp:Content ID="Content1" ContentPlaceHolderID="cp1" Runat="Server"&gt; &lt;script language="javascript" type="text/javascript"&gt; function checkInput() { var uname = document.getElementById("txtUName").value; var pwd = document.getElementById("txtPWord").value; var counter=0; if(uname.length==0) counter++; if(pwd.length==0) counter++; if(counter &gt; 0) { document.getElementById("dvError").innerHTML = "user name or password can not be blank" ; // alert("blank field"); return false; } return true; } &lt;/script&gt; &lt;div id="dvError" style="height: 102px; color:Red; " &gt;&lt;/div&gt; **on button click::** &lt;asp:Button ID="btnSin" runat="server" Text="SignIn" OnClientClick="return checkInput()" onclick="btnSin_Click" /&gt; </code></pre> <p><em>then i got an error::</em> <strong>Microsoft JScript runtime error: Object required</strong></p>
c# javascript asp.net
[0, 3, 9]
3,716,749
3,716,750
how to create the image dynamically in ASP.NET?
<p>how to create the image dynamically based on the points i get from table</p> <p>if point =1</p> <p>my image must be displayed once,</p> <p>if point=2</p> <p>imgae has to be display twice.... in that way</p>
c# asp.net
[0, 9]
2,363,745
2,363,746
I would like to know how to put a "change image" layer like in facebook on a mouseover event
<p>Hello: I have a photo gallery I would like that every time a user does mouseover the image, there is a button on the top of this image that appears. The user can click on it. But every time that the user mouse out of the photo it must disappear.</p> <p>It works like the "change photo" in Facebook, with the photo of your profile.</p> <p><img src="http://www.freeimagehosting.net/uploads/7f584370dc.gif" alt="alt text"></p> <p>The problem I am having is that when I try to get over the button that appears (in my code is a link), it disappear because javascript understands that the mouse is just out of the image, even if this button/link is over the image.</p> <p>The image that I use is positioned absolutely over the image.</p> <p>This is my code, where you can see that I create a dom element that I append on the link of the image and then when there is a mouseout, I remove it.</p> <blockquote> <p>$('a.ftelement').mouseover(function() {</p> <pre><code> var fav = $('&lt;a&gt;&lt;/a&gt;'); fav.attr("class","imgfavorito"); fav.attr("id","fav"+$J(this).attr("id")).html("&lt;img src=\"/im/favorito.gif\"/&gt;"); fav.appendTo(this); }); </code></pre> <p>$('a.ftelement').mouseout(function() {</p> <p>$("a.imgfavorito").remove() });</p> </blockquote> <p>The result is this graphically (http://www.freeimagehosting.net/uploads/41fbac8994.gif):</p> <p><img src="http://www.freeimagehosting.net/uploads/41fbac8994.gif" alt="alt text"></p>
javascript jquery
[3, 5]
3,116,046
3,116,047
Page Title from a User Control possible?
<p>I have a <code>Search.aspx</code> page which calls <code>UCSearch</code> control. <code>UCSearch</code> control does everything like getting what is being searched and what should be displayed, etc. I am trying to give the title to the page. As i dont have any info to write the code in the aspx page, i am thinking to write it in the control. But it is not displaying me when i tried using <code>Page.Title</code> in control. What am i doing wrong?? This is in Asp.net and C#.</p> <pre><code>Page.Title = "Search Results for Newark, NY"; </code></pre> <p>Thanks in advance!!</p>
c# asp.net
[0, 9]
1,450,122
1,450,123
trigger a click event if confirmation message
<p>Here is my code :</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $(window).bind('beforeunload', function () { alert("unload"); if (closeIt()) $("#&lt;%=Button1.ClientID %&gt;").trigger('click'); }); function closeIt() { var ans = confirm("save current layout ?"); if (ans) return true; } }); &lt;/script&gt; &lt;asp:Button ID="Button1" runat="server" OnClick="btnSaveState_Click" style="display:none;" /&gt; </code></pre> <p>the new problem is that the confirm message is displayed twice on firefox and non of chrome</p>
c# javascript jquery
[0, 3, 5]
5,004,821
5,004,822
Access Cookie into sub domains
<p>I want to host multiple sites under one domain. But currently I am working on localhost, so I added these 2 lines to my etc/hosts file:</p> <pre><code>127.0.0.1 something.com 127.0.0.1 orders.something.com </code></pre> <p>There are 2 applications hosted in IIS. One can be browsed using: <code>orders.something.com/OrdersSSO</code> and other can be browsed using <code>something.com/SSOSample/</code>.</p> <p>I created authentication cookie using this code in <code>something.com/SSOSample/</code>:</p> <pre><code>FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, "abc", DateTime.Now, DateTime.Now.AddMinutes(30), // value of time out property true, // Value of IsPersistent property String.Empty, FormsAuthentication.FormsCookiePath); string encryptedTicket = FormsAuthentication.Encrypt(ticket); HttpCookie authCookie = new HttpCookie( FormsAuthentication.FormsCookieName, encryptedTicket); Response.Cookies.Add(authCookie); </code></pre> <p>So I am logged in this application. However when I browse orders.something.com/OrdersSSO I don't get my authentication cookie.</p> <p>This is my forms section in web.config:</p> <pre><code>&lt;authentication mode="Forms"&gt; &lt;forms loginUrl="~/Account/Login.aspx" enableCrossAppRedirects="true" timeout="2880" domain=".something.com" /&gt; &lt;/authentication&gt; </code></pre> <p>What am I missing?</p>
c# asp.net
[0, 9]
2,400,978
2,400,979
Save string from jQuery's `$.get`
<p>I'd like to load some content from an URL, to use it in my code. I tried closures and this:</p> <pre><code>function getStringFromURL(url) { var getter = function() { this.result = "undef"; this.func = function(response) { this.result = response; }; }; var x = new getter(); $.get(url, x.func); return x.result; // the it returns "undef" and not the wanted response } </code></pre> <p>Nothing worked at all. I'll never got the content, but if I call it with <code>alert</code> like <code>$.get("http://localhost:9000/x", function(response) { alert(response) });</code> it works -- but I'd like to save the response. I think theres a problem with the scope of the <code>$.get</code>-method.</p> <p>Whats wrong with this?</p>
javascript jquery
[3, 5]
4,203,583
4,203,584
Failed to load PDF document
<pre><code>//the func merges the src pdf with the memory stream, wherein the stream may contain //few othr src pdf streams in previous calls to this func //in first cal, ms would be null public static void MergePdf(MemoryStream ms, string srcFile) { PdfReader reader = new PdfReader(srcFile); Document document = null; PdfWriter writer = null; int n = reader.NumberOfPages; if (document == null) { document = new Document(reader.GetPageSizeWithRotation(1)); writer = PdfWriter.GetInstance(document, ms); document.Open(); } PdfContentByte cb = writer.DirectContent; PdfImportedPage page; int rotation; int i = 0; while (i &lt; n) { i++; document.SetPageSize(reader.GetPageSizeWithRotation(i)); document.NewPage(); page = writer.GetImportedPage(reader, i); rotation = reader.GetPageRotation(i); if (rotation == 90 || rotation == 270) { cb.AddTemplate(page, 0, -1f, 1f, 0, 0, reader.GetPageSizeWithRotation(i).Height); } else { cb.AddTemplate(page, 1f, 0, 0, 1f, 0, 0); } } } </code></pre> <p>I write the Memory stream, back to context.response.Outputstream; but the pdf doesnt load, the page 'Failed to load Pdf' results; Is there any problem in converting btwn memorystream and Pdf contents, or what may be the issue?</p>
c# asp.net
[0, 9]
3,931,871
3,931,872
Ajax jquery returns blank page
<p>I have this JavaScript code:</p> <pre><code>$(document).ready(function(){ $('#sel').change(function(){ $.ajax({ type: "POST", url: "modules.php?name=TransProject_Management&amp;file=index", data: "&amp;op=index_stat&amp;stat="+$(this).val(), cache: false, success: function(data) { //alert(data); $("#ajax_results").html(data); } }); }); }); </code></pre> <p>On status change i need to refresh a div without page reload. But it returns blank page. If i try alert the result on success, i get the response, also i checked with inspect element, its ok. The problem is that it returns blank page.</p> <p>The file i'm working on, is the same( modules.php?name=TransProject_Management&amp;file=index ) i called in ajax.</p> <p>the html:</p> <pre><code>&lt;body&gt; //... &lt;div id="ajax_results"&gt; //..... //somewhere here is the select option &lt;select id="sel"&gt;......&lt;/select&gt; //..... &lt;/div&gt; &lt;/body&gt; </code></pre> <p>Any help, would be very appreciated.</p>
php jquery
[2, 5]
4,107,675
4,107,676
How do I write the following code as a for loop?
<p>Firstly, Is there a way for me to put variable declarations in a for loop?</p> <p>E.g. the following:</p> <pre><code>var origh1 = $('#candidates img:eq(0)').height(); var origh2 = $('#candidates img:eq(1)').height(); var origh3 = $('#candidates img:eq(2)').height(); var origh4 = $('#candidates img:eq(3)').height(); var thumb1h = $('#candidates img:eq(0)').height()*0.20; var thumb2h = $('#candidates img:eq(1)').height()*0.20; var thumb3h = $('#candidates img:eq(2)').height()*0.20; var thumb4h = $('#candidates img:eq(3)').height()*0.20; </code></pre> <p>Then using that those variables, I would like the following in a for loop. Naturally, 'origh1' should equal img:eq(i), where i = 0. So I imagine if origh1 were in the loop, it would be something like origh(i+1). </p> <pre><code>$('#candidates img:eq(0)').fadeIn('normal').delay(300).animate({ height : origh1}, 1200, 'easeInQuad'); $('#candidates img:eq(1)').fadeIn('normal').delay(300).animate({ height : origh2}, 1200, 'easeInQuad'); $('#candidates img:eq(2)').fadeIn('normal').delay(300).animate({ height : origh3}, 1200, 'easeInQuad'); $('#candidates img:eq(3)').fadeIn('normal').delay(300).animate({ height : origh4}, 1200, 'easeInQuad'); </code></pre> <p>Thanks :)</p>
javascript jquery
[3, 5]
1,137,898
1,137,899
Passing a string from JavaScript of popup window to parent window
<p>I have a JavaScript function that looks like this. I need help passing these values from JavaScript of the pop up window to the parent window. I know that I have to use </p> <pre><code>window.opener.document.getelementbyD("ID Of TextBox"); </code></pre> <p>method in my child aspx page but the <code>textbox</code> is inside another user control. How do I do it?</p> <pre><code>function(PersonName, EmailID){ //assign these values to text boxes of a parent window //the text boxes of parent window are inside of control } </code></pre> <p>Regards<br> -Vishu</p>
javascript asp.net
[3, 9]
2,982,361
2,982,362
Want to pass php variable as argument in javascript function?
<p><br> i want to pass my php variable in one javascript function.<br> i know it seems simple but i don't know where am i missing something?</p> <pre><code> &lt;?php while($gg=mysql_fetch_array($lg)) { ?&gt; &lt;td id="add_td"&gt; &lt;?php $id = $gg['p_id']; echo "&lt;a onclick=cnf('Are you sure you want to delete that?',$id)&gt;"; ?&gt;Delete&lt;/a&gt; &lt;/td&gt; &lt;?php } ?&gt; </code></pre> <p>and in my javascript function</p> <pre><code>function cnf(msg,id) { cnf = confirm(msg); if(cnf) { parent.location.href = 'p_update.php?d=' + id; } } </code></pre> <p>so i need to know on which id that user had clicked so that i will only delete that id from database.<br> if i try this thing then it showing error on "cnf" function and its saying like "unterminated string literal"?<br></p>
php javascript
[2, 3]
1,022,778
1,022,779
Format a label in a gridview to hide first 5 digits of a social security number
<p>I have a data-bound label inside a template field of a griview that displays Social Security Numbers. It currently shows the SSN's as such, 123-45-6789. I need to hide the first 5 digits so it show's like ###-##-6789. Does anyone have an example of how I might accomplish this. </p> <p>Here is the mark-up for the template fied:</p> <pre><code> &lt;asp:TemplateField HeaderText="Social Security Number" SortExpression="SSN"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lblSSN" runat="server" Text='&lt;%# Bind("SSN") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre> <p>Code block that adds decrypted SSN to grid:</p> <pre><code> table.Columns.Add("SSN"); foreach (DataRow row in table.Rows) { row["SSN"] = DecryptSSN(row["EncryptedSSN"].ToString()); row.AcceptChanges(); } </code></pre> <p>I'm new to programming so any help would be greatly appreciated.</p>
c# asp.net
[0, 9]
1,555,570
1,555,571
Replace a string in JavaScript and PHP
<p>How can I replace this character <code>|</code> in JavaScript?</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; var str="data|data|data"; document.write(str.replace(/|/g,"&lt;br /&gt;")); &lt;/script&gt; </code></pre> <p> </p> <p>In the output of given code, every character has the "&lt; br />"</p> <p>I don't know what is wrong with my code.. :)</p> <p>Also, for PHP, I want the function to use if the input is</p> <pre><code>|string|| </code></pre> <p>and the output should be </p> <pre><code>string </code></pre> <p>only. I want only the outer part of the string in PHP to be subtituted: <code>||hel||lo||</code> would become <code>hel||lo</code>.</p> <p>Could I use <code>trim()</code>? I think <code>trim()</code> only applies to white spaces.</p>
php javascript
[2, 3]
3,887,009
3,887,010
put a tabactivity in a tabactivity
<p>I'm developing a sport application wit a statistics tab. In that TabActivity, I would like to put another TabActivity. Is that possible? Is there a best practice? </p> <p>Best regards!</p>
java android
[1, 4]
4,299,051
4,299,052
Android development (Button and XML Layouts)
<p>Today I've been attempting to make an application with multiple page , but i have looked everywhere and cannot find a tutorial in english to follow , but heres what im trying to do , </p> <p>When i click a button i want it to take me to a specific XML layout (Example , "Button1" takes the user to "Page1.xml"</p> <p>thanks for your time! </p> <p>CrackerzUnk</p>
java android
[1, 4]
3,051,097
3,051,098
How do i use captcha in the asp.net application for test input in simple way
<p>I'm working on asp.net web application where I need to use CAPTCHA to test input enter into textbox please let me know very simple way to implement CAPTCHA in asp.net.</p>
c# asp.net
[0, 9]
4,484,059
4,484,060
How do I Add Distinctive Blocks of Form Controls Using jQuery?
<p>I am doing a small human resource web application in my workplace and i have a CV section were employees can add their CVs to be displayed to the human resource manager.</p> <p>I want to make something similar to what <a href="http://careers.stackoverflow.com/" rel="nofollow">Stackoverflow Careers</a> has done in the <strong>Experience</strong> and <strong>Education</strong> sections where the users can click the "<strong>add more experience</strong>" or "<strong>add more education</strong>" links for new form elements to appear and a <strong>remove</strong>, <strong>move up</strong> and/or <strong>move down</strong> links appear.</p> <p>I think that this was possible using jQuery and either the <strong>append</strong> or <strong>appendTo</strong> functions. That's as much as I know about jQuery and have no idea on how to go about implementing that.</p> <p>The solution that i require should:</p> <ul> <li>Enable me to add a template one for the Experience section and the other for Education</li> <li>On the loading of the page at least one education section and one Experience section appears on the form</li> <li>Form controls must have an identifying value added to them to distinct them from other sections. For instance, when the page first appears each form control should end with 0, when the <strong>add more</strong> button is clicked, each form control's name should end with 1, and so on.</li> <li>Some sort of validaion</li> </ul> <p>I am using ASP.NET WebForms if such information is needed.</p> <p>Thanks,,</p>
asp.net jquery
[9, 5]
3,132,123
3,132,124
nextUntil() jQuery selector
<p>why does it return an error?</p> <p><a href="http://jsfiddle.net/L82JU/" rel="nofollow">http://jsfiddle.net/L82JU/</a></p> <p>Uncaught TypeError: Object [object Object] has no method 'replace'</p> <p>I want to select the first child of <code>.x</code> until the 3rd child of <code>.x</code></p> <p>html</p> <pre><code>&lt;div class="x"&gt; &lt;div class="a"&gt;a&lt;/div&gt; &lt;div class="b"&gt;b&lt;/div&gt; &lt;div class="c"&gt;c&lt;/div&gt; &lt;div class="d"&gt;d&lt;/div&gt; &lt;div class="e"&gt;e&lt;/div&gt; &lt;/div&gt; </code></pre> <p>jquery</p> <pre><code>a=$('.x').children(); alert(a.eq(0).nextUntil(a.eq(3)).length); </code></pre>
javascript jquery
[3, 5]
5,289,792
5,289,793
Multiple Checkbox in ListView?
<p>Anyone having multiple checkbox in listview program?</p>
java android
[1, 4]
1,866,387
1,866,388
jQuery - get reference to this
<pre><code>function Request(params) { // Stuff stuff stuff // And then $.ajax( { type: 'GET', url: 'someurl', success: this.done }); } Request.prototype.done = function() { // "this" in this context will not refer to the Request instance. // How to reach it? } </code></pre>
javascript jquery
[3, 5]
5,380,930
5,380,931
C# Declaring Multiple Instances of the Same Table
<p>I have a table that needs 27 drop down menus in 27 cells to accept user input. Currently I am declaring all 27 of them like this:</p> <pre><code>DropDownList DropList1 = new DropDownList(); DropList1.ID = "TrendList1"; DropList1.AutoPostBack = true; DropList1.SelectedIndexChanged += new EventHandler(this.Selection_Change); DropList1.DataSource = CreateDataSource(); DropList1.DataTextField = "ColorTextField"; DropList1.DataValueField = "ColorValueField"; DropList1.DataBind(); DropDownList DropList2 = new DropDownList(); DropList2.ID = "TrendList2"; DropList2.AutoPostBack = true; DropList2.SelectedIndexChanged += new EventHandler(this.Selection_Change); DropList2.DataSource = CreateDataSource(); DropList2.DataTextField = "ColorTextField"; DropList2.DataValueField = "ColorValueField"; DropList2.DataBind(); etc... </code></pre> <p>However I know there has to be a better way than the brute force code I have written. Unfortunately I am new to web programming and I haven't been able to figure out a better way to do this.</p> <p>Any advice is appreciated.</p> <p>Regards.</p>
c# asp.net
[0, 9]
5,842,520
5,842,521
Function not defined - jQuery/Javascript
<p>Another hapless noob... Okay, so I've looked everywhere to try and find out how to make this jQuery/JavaScript function, I hope it's just a mistake in my syntax, but here's my code:</p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { function loadNext(choice) { $("#thequestion").load("question.php", { ans: choice, id: "&lt;?php echo $row['id']; ?&gt;", nextId: "&lt;?php echo $nextQuestionId; ?&gt;" } ); $("#graph").load("graph.php", { id:"&lt;?php echo $row['id']; ?&gt;", nextId: "&lt;?php echo $nextQuestionId; ?&gt;" } ); alert("loadNext activated"); } }); &lt;/script&gt; </code></pre> <p>I then call the <code>loadNext(choice)</code> function using an <code>onclick</code> event like so: <code>onclick="loadNext(YorN);"</code>. </p> <p>Following this I get a 'loadNext is not defined' error.</p> <p>Amongst the answers that I would accept are: "Y U NO LEARN!" and "You are silly."</p> <p><a href="http://stackoverflow.com/questions/3075449/function-is-not-defined">Here is a similar problem.</a></p> <p>Thanks.</p>
javascript jquery
[3, 5]
725,414
725,415
jQuery - call a function anytime a user changes any form input?
<p>I have a page that has multiple forms. Anytime the user clicks an input or modifies text in an input I would like a function to be called. Any ideas on how to do this efficiently and in a way where it doesn't require the form IDs?</p>
javascript jquery
[3, 5]
3,406,263
3,406,264
Form submit using jquery & passing values
<p>I want to accomplish the following using jQuery:</p> <pre><code>frm_rooms.action="create_rooms.php?action=Save"; frm_rooms.submit(); </code></pre> <p>I tried following jQuery but it doesn't work:</p> <pre><code>$('#frm_rooms').submit(function(event) &lt;br/&gt;{ $.post("create_rooms.php", { action: "Save" } ); }); </code></pre>
javascript jquery
[3, 5]
151,070
151,071
Jquery animate function not working
<p>I'm using the following javascript to animate a div, but the div isn't animating... does anyone know what can be?</p> <p>JavaScript: </p> <pre><code> &lt;script language="JavaScript"&gt; $(document).ready(function(){ $('#LayoutDiv1').animate({top: "500px"}, 1500); }); &lt;/script&gt; </code></pre> <p>HTML: </p> <pre><code>&lt;div id="LayoutDiv1"&gt; &lt;img src="images/logo.png"&gt; &lt;/div&gt; </code></pre> <p>CSS:</p> <pre><code>#LayoutDiv1 { clear: both; float: left; width: 100%; display: block; } </code></pre>
javascript jquery
[3, 5]
269,030
269,031
Making a simple Image Switcher
<p>I know that there are many jQuery scripts ready to implement something like this here that I'm trying to pull together, but I want to make it as simple as possible. Basically when each image thumb of the list is clicked the main image shows the respective image just only bigger. </p> <p>So, here is my question. Does anyone have a simple script that does that?</p> <pre><code> &lt;div class="main_image"&gt; &lt;img src="&lt;?=href['imagem'];?&gt;" /&gt; &lt;/div&gt; &lt;ul&gt; &lt;li&gt; &lt;a href="img01.jpg"&gt;&lt;img src="img01.jpg" alt="Image Name" /&gt;&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="img02.jpg"&gt;&lt;img src="img02.jpg" alt="Image Name" /&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre>
javascript jquery
[3, 5]
905,537
905,538
Setting jEditable parameter
<p>I'm working with jEdtable and would like to add 2 more parameters into the posted URL. Is there a way to accomplish this?</p> <p>Here's the default parameters -</p> <pre><code>$(document).ready(function() { $('.edit').editable('http://www.example.com/save.php', { id : 'elementid', name : 'newvalue' }); }); </code></pre> <p>But I would like to add <code>pageName</code> to as parameter which will be posted along with the <code>id</code> and <code>name</code>.</p> <p>I tried something like this </p> <pre><code>$(document).ready(function() { $('.edit').editable('http://www.example.com/save.php', { id : 'elementid', name : 'newvalue', pageName: 'story' }); }); </code></pre> <p>But on the save.php page, pageName is not being displayed. Any help would be appreciated.</p>
php jquery
[2, 5]
4,145,581
4,145,582
how to check for input validation java
<p>this is what i have so far, how do i make it so it will check the the EditText boxes are empty. when i test it out with all empty boxes it will force close, why and/or how do I fix it?</p> <pre><code>if ((x1field.getText().toString().equals(""))); { forgetunits.setText("you have forgotten a number"); } if ((x2field.getText().toString().equals(""))); { forgetunits.setText("you have forgotten a number"); } if ((y1field.getText().toString().equals(""))); { forgetunits.setText("you have forgotten a number"); } if ((y2field.getText().toString().equals(""))); { forgetunits.setText("you have forgotten a number"); } </code></pre>
java android
[1, 4]
1,633,842
1,633,843
PHP - how can I stop a function from printing an extra || at the end?
<p>In PHP I have a function, the problem is it will output an extra || at the end that I dont want.</p> <pre><code>&lt;script type="text/javascript"&gt; function hide_card_code() { var payment_source=document.getElementById('payment_source'); if( &lt;? forEach($result_cards as $key =&gt; $value) { echo "payment_source.value=='$value' || \n"; } ?&gt; ) { //do stuff... return true; } } &lt;/script&gt; </code></pre> <p>It will output the following HTML. Note the extra || at the end.</p> <pre><code>&lt;script type="text/javascript"&gt; function hide_card_code() { var payment_source=document.getElementById('payment_source'); if( payment_source.value=='23' || payment_source.value=='24' || payment_source.value=='25' || ) { //do stuff... return true; } } &lt;/script&gt; </code></pre> <p>How do I stop that extra || ?</p>
php javascript
[2, 3]
4,825,325
4,825,326
Using jquery calender control in ASP.Net C#
<p>I am using a ready-made calender control available at <a href="http://www.eyecon.ro/datepicker/#download/datepicker.zip" rel="nofollow">http://www.eyecon.ro/datepicker/#download/datepicker.zip</a>.</p> <p>The date picker's object is readily provided.</p> <p>In that there is one example showing that the calendar control is attached with the text box but my problem is it works fine with the HTML text box, but when I try to do it with ASP it does not attach with asp:textbox.</p> <p>my code is:</p> <pre class="lang-html prettyprint-override"><code>&lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;link rel="stylesheet" media="screen" type="text/css" href="DatePicker/cssdatepicker.css" /&gt; &lt;script type="text/javascript" src="DatePicker/js/datepicker.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $('#TextBox1').DatePicker({ flat: true, date: '2008-07-31', current: '2008-07-31', calendars: 1, starts: 1 }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:TextBox ID="TextBox1" runat="server"&gt; &lt;/asp:TextBox&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; </code></pre>
c# asp.net
[0, 9]
3,770,513
3,770,514
how can I $_POST this below
<p>Below is my javascript and form code where it appends a question number (qnum) for each table row appended in the application one by one. So if user adds a table row then it contains question number 1, when second row is added, question number 2 is added, then 3 for third row and etc.</p> <pre><code>&lt;script&gt; function insertQuestion(form) { var $tbody = $('#qandatbl &gt; tbody'); var $tr = $("&lt;tr class='optionAndAnswer' align='center'&gt;&lt;/tr&gt;"); var $qid = $("&lt;td class='qid'&gt;" + qnum + "&lt;/td&gt;"); $tr.append($qid); $tbody.append($tr); ++qnum; $("#questionNum").text(qnum); &lt;/script&gt; &lt;form id="QandA" action="insertQuestion.php" method="post" &gt; &lt;div id="detailsBlock"&gt; &lt;table id="question"&gt; &lt;tr&gt; &lt;th colspan="2"&gt; Question Number &lt;span id="questionNum"&gt;1&lt;/span&gt; &lt;/th&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>The problem I have is that I want to do a <code>$_POST</code> in the next page for all the question numbers added. The only problem is that because I am not using an input field, I do not have a name attribute to <code>$_POST</code>. so what I want to know is that if I can use 'name' attribute to <code>$_POST</code>, then how else can I post the question numbers?</p>
php javascript
[2, 3]
5,446,546
5,446,547
Move an element left on each click
<p>I think My main question is "how do I write this?" Its a simple thing. for every click the css left property gets 500px taken off. (moved 500px to the left)</p> <p>I am having a hard time with the variables and just ... I don't know.</p> <pre><code>$(document).ready(function() { var belt-move = 500; var belt-ammount = $(".belt").css('left'); belt-move -= belt-ammount; $(".next").click(function() { $(".belt").animate(belt-move, 500, "swing"); }); }); </code></pre>
javascript jquery
[3, 5]
4,943,954
4,943,955
How to clear button's color when next button is clicked?
<p>How to change button's color to default after next button is clicked? I have this code that sets color to the button in onclicklistener:</p> <pre><code>Button button = (Button) v; button.getBackground().setColorFilter(new LightingColorFilter(0xFFFFFFFF, 0x003333)); </code></pre> <p>I have one click listener for all my buttons. How to clear this botton's background color when the next one is clicked?</p>
java android
[1, 4]
1,683,278
1,683,279
Refreshing a part of a page
<p>I don't know if this is possible but I'd like to refresh the contents in a div when a button is clicked.</p> <p>Example:</p> <pre><code> &lt;div id="div"&gt; Some contents &lt;/div&gt; &lt;input type="button" value="button" onClick="div.refresh()"/&gt; </code></pre> <p>I'm not trying to change the contents of the div just to refresh only that part of the page.</p> <p>Is this possible?</p>
javascript jquery
[3, 5]
54,232
54,233
PHP script sample for iPhone hi-score/survey uploading?
<p>I am looking for a PHP example/tutorial which can accept hi-scores/survey upload from an iPhone. Hopefully, the PHP script:</p> <ul> <li>accepts POST, in additional to GET</li> <li>works over SSL (https)</li> <li>connects to MySQL</li> </ul> <p>In addition, it'd best the iPhone can get a session from the server and submit the session value along with the hi-score. Thanks</p>
php iphone
[2, 8]
711,274
711,275
How to add text to dynamically created DOM objects?
<p>Say I have two buttons "Add Link" and "Add Text". The "Add Link" button automatically appends the following to the existing page:</p> <pre><code>&lt;a href="text.html"&gt;&lt;/a&gt; </code></pre> <p>When i click on the button "Add Text", the text of all dynamic links created should contain the text "Text". </p> <p>I originally use "$("a").text("Text")" for the function of the "Add Text" button, but it does not work because the links are dynamically created as the user clicks the "Add Link" button. </p> <p>How do I make it so that I can get "Text" into all of the dynamically created link?</p> <p>NOTE: Something Like this</p> <pre><code>$('buttonforaddtext').live('click', function() { $("a").text("Text"); }); </code></pre> <p>Does not work for me because the button has been there the whole time, its the "a" that are dynamically created with the click of the "Add Link" button.</p>
javascript jquery
[3, 5]
497,647
497,648
Clearing all fields in an asp.net form
<p>I have an <code>asp.net</code> <code>form</code>. In this <code>form</code>I want to clear all the data what I entered in <code>textbox</code>,<code>dropdownlist</code> etc. So how can I do without going to each textbox and set the value.</p> <p>like <code>TextBox1.Text="";</code> etc. How can i clear all values of a form ?</p>
c# asp.net
[0, 9]
3,281,902
3,281,903
Problem accessing private variables in jQuery like chainable design pattern
<p>I'm trying to create my custom toolbox which imitates jQuery's design pattern. Basically, the idea is somewhat derived from this post: <a href="http://stackoverflow.com/questions/2061501/jquery-plugin-design-pattern-common-practice-for-dealing-with-private-function">http://stackoverflow.com/questions/2061501/jquery-plugin-design-pattern-common-practice-for-dealing-with-private-function</a> (Check the answer given by "David").</p> <p>So here is my toolbox function:</p> <pre><code>(function(window){ var mySpace=function(){ return new PrivateSpace(); } var PrivateSpace=function(){ var testCache={}; }; PrivateSpace.prototype={ init:function(){ console.log('init this:', this); return this; }, ajax:function(){ console.log('make ajax calls here'); return this; }, cache:function(key,selector){ console.log('cache selectors here'); testCache[key]=selector; console.log('cached selector: ',testCache); return this; } } window.hmis=window.m$=mySpace(); })(window) </code></pre> <p>Now, if I execute this function like:</p> <pre><code> console.log(m$.cache('firstname','#FirstNameTextbox')); </code></pre> <p>I get an error 'testCache' is not defined. I'm not able to access the variable "testCache" inside my cache function of the prototype. How should I access it? Basically, what I want to do is, I want to cache all my jQuery selectors into an object and use this object in the future.</p>
javascript jquery
[3, 5]
169,655
169,656
Is it possible to raise an event of other control on selecting another
<p>I am having a drop down and a radio button on my form. What i would like to do is i would like to call <code>radio_CheckedChanged</code>on <code>drodown_SelectedIndexChanged</code>. Can any one tell me the best way to do</p>
c# asp.net
[0, 9]
2,582,942
2,582,943
Executing custom JavaScript on specific pages of the site from a single file
<p>my js file loads on all pages. Some functions are meant to run only on certain pages like the homepage only <code>http://site.com</code>. Can javascript read the url of the page it's being called from to determine if it's the homepage?</p>
javascript jquery
[3, 5]
3,860,882
3,860,883
Where is the best place to store user related data in asp.net?
<p>When a customer logs in to my site, I need to know their account id and their menu id. This lets me know what data they can see on a page and what menu they get. I don't want to have to read this data over and over. Should I store this in a session variable or customize the membership user and membership provider to contain this information?</p>
c# asp.net
[0, 9]
2,042,601
2,042,602
How to add and repeat title="some text" same as alt="some text" if title is already not present?
<p>I want to add and repeat title="some text" same as alt="some text" if title is already not present. To show Alt text in FF also.</p> <p><strong>before</strong></p> <pre><code>alt="some text" alt="some text" title="some another text" </code></pre> <p><strong>After</strong></p> <pre><code>alt="some text" title="some text" alt="some text" title="some another text" </code></pre> <p>**I need *</p> <h2>jquery(with no conflict)</h2> <ul> <li>or simple javascript code.**</li> </ul>
javascript jquery
[3, 5]
4,903,768
4,903,769
Keep value after postback
<p>I have an ASP.NET web site with something similar to the following code:</p> <p><strong>.aspx</strong></p> <pre><code>&lt;asp:UpdatePanel ID="UpdatePanel" runat="server"&gt; &lt;ContentTemplate&gt; &lt;table id="RatesTable"&gt; &lt;tr&gt; &lt;td&gt;Hotel&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;tr id="NewRateRow"&gt; &lt;td&gt; &lt;asp:DropDownList ID="TxtHotel" runat="server" OnSelectedIndexChanged="TxtHotel_SelectedIndexChanged" AutoPostBack="true"&gt; &lt;/asp:DropDownList&gt; &lt;/td&gt; &lt;td&gt; &lt;a href="javascript:AddHotelPackRate()"&gt;Add&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p>AddHotelPackRate JS function, reads the value in the dropdown and "draws" a new row at the beginning of the table, containing this value. The problem is that after this, when the SelectIndexChanged fuction is executed again, the row that was added before, now dissapears. </p> <p>Is there a way to avoid losing this type of information after postback?</p>
c# javascript asp.net
[0, 3, 9]
4,778,776
4,778,777
Cannot use a leading .. to exit above the top directory
<p>I'm getting this error when I start my project</p> <p>It is being caused by the css and js files in the master page.</p> <pre><code>&lt;link href="../assets/css/jquery.ui.theme.css" rel="stylesheet" type="text/css" /&gt; </code></pre> <p>When I remove this line the project starts functioning correctly(without the style)</p> <p>Any ideas Sp </p>
c# asp.net
[0, 9]
3,996,150
3,996,151
How to detect 404 error in a url then set the url image to display:none using Jquery
<p>I have a table which repeats an image link to a file download for every row of data. I want to use Jquery or Javascript to detect if a image link returns a 404 error, meaning the file its trying to find doesn’t exist, then set the image link to <strong>display:none</strong> so its hidden.</p> <p>Any help is much appreciated!</p> <p>Jamie.</p> <p>---Edit---</p> <p>This is my url which needs to be set to hidden if it cant find the .igs file</p> <p><code>&lt;a href="/path/to/file.igs"&gt;&lt;img src="pic.jpg" alt="My Image Link"&gt;&lt;/a&gt;</code> </p> <p>Unfortunately I cannot utilize server-side processing.</p>
javascript jquery
[3, 5]
5,325,765
5,325,766
"Input type file.files" selector not works in jquery
<p>this is html:</p> <pre><code> &lt;form&gt; &lt;input id="my_file" type="file" name="my_name" /&gt; &lt;input id="btn" type="button" /&gt; &lt;/form&gt; </code></pre> <p>this js:</p> <pre><code> $(document).ready( function () { $('#btn').on('click', function() { file_size = $("#my_file").files[0].size; alert(file_size); }); }); </code></pre> <p>Not works and consol tells that <code>$("#my_file").files is undefined</code>, please tell me, why this happened?</p>
javascript jquery
[3, 5]
2,361,373
2,361,374
Window.showModalDialog() using javascript
<p>I am opening a child window using window.showModalDialog() method. In the child page i have few server side controls whenever a postback happens the child page opens in a new window.</p> <p>I have also set in my head tag,but it is not working. </p> <pre><code>&lt;base target ="_self/&gt; </code></pre> <p>For example In Page 1: i have an anchor on whose click i open a child page(page2). In my child page Page2: I have an asp.net button to search based on the criteria. when i enter the criteria and click search, the search results are show in new window rather then the same window.</p> <p>similar to the post <a href="http://forums.asp.net/p/1246676/2297583.aspx" rel="nofollow">http://forums.asp.net/p/1246676/2297583.aspx</a></p>
javascript asp.net
[3, 9]
5,443,702
5,443,703
calling methods between classes
<p>Is there a way to call a method in one class from another class. I could have say 5 classes and more than one may want to perform the same operation. So can I have one file (class??) with these common methods and call into that? If so what is the necessary modifier for these 'common' methods - public, final??</p> <p>If anyone can point me to a suitable tutorial I would be grateful - in this instance I havent had much useful from Google Thanks Ron</p>
java android
[1, 4]
3,977,679
3,977,680
Need a Property to hold the result from a data table
<p>I need to create a property tha will hold to ints for example</p> <p>int age and int numbers so.. something like This data is comming from a function in another class that returns a DataSet, in the data set there will be those two items like:</p> <pre><code>Age number 24 1 29 6 32 2 27 1 19 3 </code></pre> <p>So like I said, at the end I would like to have a property that contains this data and can reference at any time from different classes</p> <p>so I am not sure what to use to hold that data, but it would be something like</p> <pre><code>public &lt;int, int&gt; personData { get { return _personData; } set { _personData = value; } } </code></pre> <p>so I do not know what to use for _personData and for . And how can I access the values of such solution</p> <p>I would appreciate your help</p>
c# asp.net
[0, 9]
155,703
155,704
disable textbox Required field validator control
<p>I want to disable the requiredfield validator control for the textbox based on some condition of a variable</p> <pre><code>if(var==null) { //Activate it } else { //disable it } </code></pre> <p>Can some one help me with the code</p>
c# asp.net
[0, 9]
1,506,488
1,506,489
how might I disable a div when the data inside it reaches 0 possibly using an if else?
<p>I have a snippet of javascript that displays the amount of sessions available for an event </p> <pre><code>for ( var j in data.events[i].sessions ) { first_session_id = !first_session_id ? data.events[i].sessions[j].id : first_session_id; session_html += '&lt;li id="session_row_'+ data.events[i].sessions[j].id +'"&gt;'+ data.events[i].sessions[j].time+ '&lt;div class="right"&gt;'+ data.events[i].sessions[j].available +' sessions remaining&lt;/div&gt;&lt;/li&gt;'; } </code></pre> <p>at the moment when the sessions become empty or are all booked the value -1 is displayed. What I would like to do is add an if else statement that basically disables or blacks out the .right when we get to 0?</p> <p>Can anyone advise me on how this might be done?</p> <p>Regards Kyle</p>
javascript jquery
[3, 5]
4,864,231
4,864,232
Why doesn't my hide function work on a click
<pre><code>$(document).ready(function() { $('#promotion_profile_booking_description').keyup(function () { var left = 200 - $(this).val().length; if (left &lt; 0) { left = 0; } $('#counter').text('Characters left: ' + left); }); $('#counter').bind('click', function() { (this).hide(); }); }); </code></pre> <p>The previous code essentially inserts "Characters left: x", as a text counter. It works great. However hiding the element on a click is another story. Why isn't my hide function working? Do you see any obvious errors in my JS?</p>
javascript jquery
[3, 5]
1,873,596
1,873,597
How to move the textbox viewport when gaining focus?
<p>I have a textbox that may contain strings larger than the textbox size. When I'm typing, the textbox "viewport" always moves to show the last character I typed (for example when you write a very large title in a SO question). a</p> <p>The problem is that if the texbox loses focus, when it is focused again the viewport always is set at the start of the text, and I want it at the end.</p> <p>I tried moving the caret programatically to the end of the text and it works, but the viewport is still at the beginning of the text, so the user still has to press any key to move the viewport to the end of the text.</p> <p><strong>Example</strong></p> <p>This is the textbox before losing focus:</p> <p><img src="http://img35.imageshack.us/img35/6697/10437837.jpg" alt="alt text"></p> <p>And this after focus is lost:</p> <p><img src="http://img11.imageshack.us/img11/1390/33816597.jpg" alt="alt text"></p> <p>I'd like that when the txtbox gains focus again the viewport is set like in the first image.</p> <p>Is possible to do this ?</p>
javascript jquery
[3, 5]
398,322
398,323
find the variable which is equal to the value of another variable
<p>I came across a confusing fact during coding a script.</p> <p>How can i find the variable which is equal to the value of another variable. THEN , get the value of that variable.</p> <p>Here's an example:</p> <pre><code>var result; var 1 = "john"; var 2 = "amy"; var 3 = "micheal"; var info = "1"; </code></pre> <p>When var info is set to <code>1</code> , the script will then look for variable 1 which has the value <code>JOHN</code> then get the value <code>john</code> . Then set the result's value to "john".</p> <p>For the same thing ,</p> <p>When var info is set to <code>2</code> , the script will then look for variable 2 which has the value <code>AMY</code> then get the value <code>amy</code> . Then set the result's value to "amy".</p> <p>and so on..</p> <p>My info variable's value is not determined. it could be 1 , 2 or 3 which is set/determined by an user event.</p> <p>P/S i can use if and else , but i want to know how this can be done. :)</p> <p>So how can i do this?</p>
javascript jquery
[3, 5]
5,544,959
5,544,960
JavaScript class function this operator
<p>I have a JS class that contains a AJAX post. I'm trying to refer to the class members from within the post function using <code>this</code> but it doesn't seem to be working. </p> <p>For example, from this: </p> <pre><code>function Classy() { this.goal = 0; $.post( "class/initial.php", function(back) { this.goal = back.goal; }, "json"); this.SampleFunction = function() { alert(this.goal); } } tester = new Classy(); tester.SampleFunction(); </code></pre> <p>The alert box outputs a value of <code>0</code>, even though this is definitely not what is coming back from the php file. I think the issue is I need something other than <code>this</code> to refer to the parent class. Anyone have any ideas?</p>
javascript jquery
[3, 5]
1,151,992
1,151,993
Add a timeout to load()
<pre><code>var refreshId_hxlatestposts = setInterval(function() { var el = $("#hxlatestposts"); var req = $.get("example.php"); el.fadeOut('slow', function () { req.done(function( data ){ el.html(data).fadeIn('slow'); }); }); }, 60000); </code></pre> <p>This is what i use to refresh a div every minute, sometimes it gets hung up when the site it is getting the feed from is down or something. I'd like to some how have a timeout so if it cannot load the php file in X seconds then return 'Fail to load'.</p>
javascript jquery
[3, 5]
3,415,110
3,415,111
checking out the login result
<p>i am trying to integrate cpanel to my cms... i have this code to remote logins:</p> <pre><code>&lt;form action=’http://www.yourdomain.com:2082/login/’ method=’post’&gt; &lt;table border=’1′ width=’250′ cellpadding=’2′ cellspacing=’0′&gt; &lt;tr&gt; &lt;td align=’right’&gt;Username:&lt;/td&gt; &lt;td&gt;&lt;input type=’text’ name=’user’&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align=’right’&gt;Password:&lt;/td&gt; &lt;td&gt;&lt;input type=’password’ name=’pass’&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan=’2′ align=’center’&gt;&lt;input type=’reset’ name=’r1′ value=’Reset’&gt;&lt;input type=’submit’ name=’s1′ value=’Login’&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>this form loads cpanel after successful login. i dont want this form to loads cpanel after successful login. i want to load another page of my cms after successful login. so, i would like to check if login is successful or not. i tried to do it with jquery however jquery did not work on cross domain. does anyone got any suggestion for this situation?</p>
php jquery
[2, 5]
3,447,551
3,447,552
How to wait for file scanning finished before starting the launcher app
<p>I am currently working on an Android launcher application, and I would like to play some intro video before the launcher starts. Knowing that playing video directly from assets or raw folder does not work on some devices, I include the video file in assets folder, and let the app copy the video file to SD card before playing it.</p> <p>However, since launcher is always the first application to be started upon bootup, there is a media scanning process right after the bootup. So the problem is when the launcher is started, the SD card file system may still being scanned and not ready to be accessed, therefore the video cannot be played.</p> <p>Any suggestions and comments are appreciated!</p>
java android
[1, 4]
4,345,733
4,345,734
Having problem with jQuery Countdown? Function serverSync: serverTime
<p>serverSync: serverTime Function return value from server but I have checked both server and client time both are same.When i called server to sync with server it will not display countdown. help me ?</p> <pre><code> $(function() { var shortly = new Date(); var newTime = new Date('April 9, 2010 20:38:10'); //for loop divid /// $('#defaultCountdown').countdown({ until: shortly, onExpiry: liftOff, onTick: watchCountdown, serverSync: serverTime }); $('#div1').countdown({ until: newTime }); }); function serverTime() { var time = null; $.ajax({ type: "POST", //Page Name (in which the method should be called) and method name url: "Default.aspx/GetTime", // If you want to pass parameter or data to server side function you can try line contentType: "application/json; charset=utf-8", dataType: "json", data: "{}", async: false, //else If you don't want to pass any value to server side function leave the data to blank line below //data: "{}", success: function(msg) { //Got the response from server and render to the client time = new Date(msg.d); alert(time); }, error: function(msg) { time = new Date(); alert('1'); } }); shortly = time; return time; } [WebMethod] public static String GetTime() { DateTime dt = new DateTime(); dt = Convert.ToDateTime("April 9, 2010 22:38:10"); return dt.ToString("dddd, dd MMMM yyyy HH:mm:ss"); } </code></pre>
c# asp.net jquery
[0, 9, 5]
743,769
743,770
Android- Image shape changed on screen rotation
<p>I created an app that uses a 9.png file as its background. The problem is, when I rotate the screen, the background shape changes weirdly. </p> <p>I am attaching the screenshot: </p> <p><img src="http://i.stack.imgur.com/J0SfY.png" alt="Application in normal mode"></p> <p><img src="http://i.stack.imgur.com/tbjFS.png" alt="After Screen Rotation"></p> <p>As you can see, the background of the layout containing the name and image takes a weird shape. </p> <p>What can be the possible reason? And how can I make it work?</p> <p>I have checked that the image is perfectly smooth and in perfect shape.</p> <p>EDIT: I am talking about the following background that is not stretching properly(The leftmost part is smaller in height than the rightmost part): <img src="http://i.stack.imgur.com/tHU4k.png" alt="The right portion is larger than the left portion"></p>
java android
[1, 4]
809,685
809,686
Just a simple thing about windowsTitle change background in Java
<p>i wan't to do a simple thing, my background's windowTitle must change in my application. But how i can access to my background's windowTitle ? </p> <p>My style.xml :</p> <pre><code>&lt;resources&gt; &lt;style name="CustomWindowTitleBackground"&gt; &lt;item name="android:background"&gt;@drawable/fond&lt;/item&gt; &lt;/style&gt; &lt;style name="CustomTheme" parent="android:Theme.Light"&gt; &lt;item name="android:windowTitleSize"&gt;40dip&lt;/item&gt; &lt;item name="android:windowTitleBackgroundStyle"&gt;@style/CustomWindowTitleBackground&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>And in my Activity :</p> <pre><code>super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.page_doc); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title); </code></pre> <p>How i can do this ?</p>
java android
[1, 4]
3,817,253
3,817,254
login using open id authentication
<p>I would like to know as in StackOverflow website user can login with open id authentication how it has been done.Can I get any sample example of doing this.</p>
c# asp.net
[0, 9]
5,379,018
5,379,019
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]
2,361,947
2,361,948
How to create dynamic id selector in Jquery?
<p>My php code goes something like this way- </p> <pre><code>for($i=1;$i&lt;=$n;$i++) { $id='selectThisID-' . $i; ?&gt; &lt;div id="&lt;?php echo $id;?&gt;"&gt;On Select this Div(say #selectThisID-3)&lt;?php echo $field-n; ?&gt;&lt;/div&gt; &lt;?php $id= 'paraID-' . $i; &lt;p id="&lt;?php echo $id; ?&gt;" style="display:none"&gt;Toggle this para(say #paraID-3) for selected ID only&lt;/p&gt; } </code></pre> <p>Now how can I handle this variable number of id's in my jquery. As I know for single div statement it could be-</p> <pre><code> &lt;script&gt; $(document).ready(function(){ $("[id^=selectThisID-]").click(function(){ $("[id^=paraID-]").toggle(); }); }); &lt;/script&gt; </code></pre> <p>So on selecting element with id <code>'#selectThisID-1'</code>, <code>&lt;p&gt;</code> will toggle. How can I use <code>#selectThisID-2, #selectThisID-3....#selectThisID-n</code> as jquary selector. How can I get value of 'n' from php code to JQuery? Please help. Thanks in advance.</p> <p>Edit- Suppose <code>$n=5</code>, so there are total 5 <code>div</code> elements. Now the problem is that when I select any of <code>div</code>(say <code>#selectThisID-3</code>) all <code>&lt;p&gt;</code> elements get toggled(i.e. <p> with <code>#paraID-1, #paraID-2....#paraID-5</code> all toggled). However I need to toggle para-3 when div-3 selected, toggle para-4 when div-4 selected and so on. Please help.</p>
php javascript jquery
[2, 3, 5]
4,406,041
4,406,042
Define a map as constant in java
<p>For my Android app I've the need of defining some keys in a single constant, and I think the best way to do it is using a map. But not sure whether that's really the way to go, and how to do it correctly. As I'm targeting Android, a Bundle may also be an option.</p> <p>I have a list of keys like: <br>"h" = "http" <br>"f" = "ftp"</p> <p>Basically the program is to read a QR code (to keep that code from growing too big I'm using super-short keys), gets those keys, and has to translate them to something useful, in my case a protocol.</p> <p>I'm trying to define a constant called KEY_PROTOCOLS, I think this should be a Map, so later I can call something like KEY_PROTOCOLS.get("f") to get the protocol that belongs to key "f". </p> <p>Other classes should also be able to import this constant, and use it. So this map has to be populated in the class right away.</p> <p>How can I do this?</p>
java android
[1, 4]
1,929,184
1,929,185
cross-browser async uploader?
<p>Anyone looked into this recently?</p> <p>12 months ago i was using <a href="http://www.uploadify.com/" rel="nofollow">Uploadify</a></p> <p>6 months ago i switched to <a href="http://www.plupload.com/" rel="nofollow">Plupload</a> which was the best i could find,</p> <p>what are people's thoughts, is Plupload still the best uploader for multibrowser async image uploads?</p> <p>I'm about to start a new site...</p>
php javascript jquery
[2, 3, 5]
311,380
311,381
Android Back Button reacts too quickly
<p>I'm developing an android application and when I press the back button from my device (normal press time for a person, 1 second or less), it skips from my activity, to the previous activity (menu) and then exits the application. But if I tap the back button quickly, it reacts as expected, it goes to the menu. I've tried to find a solution but no success. I've always tried to override the back button default behavior but no success either. Is there a way to set a reaction time for the back button to react?</p> <p>Many thanks in advance!</p> <p>P.S.- I have other activities that maintains the expected behavior in back button when pressed with a normal press time.</p>
java android
[1, 4]
5,227,380
5,227,381
Optimising event handling: one large, or many small?
<p>Which pattern is best, and why?</p> <pre><code>$myElements.delegate(selector, 'event1 event2', function () { if (event.type === 'event1') { /* Handle event 1 */ } if (event.type === 'event2') { /* Handle event 2 */ } } </code></pre> <p><strong>OR</strong></p> <pre><code>$myElements .delegate(selector, 'event1', function () { /* Handle event 1 */ } .delegate(selector, 'event2', function () { /* Handle event 2 */ } </code></pre> <p>In other words, is it better to have one large unified handler, or many small separate handlers?</p>
javascript jquery
[3, 5]
909,455
909,456
Change part two class in div
<p>I want change part two of class name in each div into tag <code>&lt;span&gt;</code> from '.myclass_2' to 'yourclass', (in following html code). Here is my try with jQuery but they doesn't work true. How is fix it?</p> <p>Demo: <a href="http://jsfiddle.net/sTF3U/" rel="nofollow">http://jsfiddle.net/sTF3U/</a></p> <pre><code>&lt;span&gt; &lt;div class="myclass_1 myclass_2"&gt; &lt;a href="" class="click"&gt;Click Me_1&lt;/a&gt; &lt;/div&gt; &lt;div class="myclass_1 myclass_2"&gt; &lt;a href="" class="click"&gt;Click Me_2&lt;/a&gt; &lt;/div&gt; &lt;/span&gt; var $this = $('.click'), $clone_1 = $('span').clone(); alert($clone_1.html()); $('.click').live('click', function (e) { e.preventDefault(); $clone_2 = $('span').clone(); $clone_2.find('div').split(" ")[1].addClass('youClass'); $clone.find('.auto_box2:last .mediumCell').each(function () { $(this).split(" ")[1].removeClass().addClass(unique()); }); var $result = $('span').clone(); alert('ok'); }) </code></pre>
javascript jquery
[3, 5]
1,871,561
1,871,562
Expanding compressed div
<p><a href="http://jsfiddle.net/Y8MUF/" rel="nofollow">http://jsfiddle.net/Y8MUF/</a></p> <p>It can expand the div when i click on it. How do i make it look nicer by adding a "See More" link then hide it when the div exapands and adjust the row height relative to the See More link?</p> <pre><code>$(document).ready(function(){ var rowsshown = 2; var rowheight = 1.2; // line height in 'em' var ht = (rowsshown * rowheight) - .5; // subtracting the .5 prevents the top of the next line from showing $('.info') .css({'overflow':'hidden','line-height' : rowheight + 'em','height': ht + 'em' }) .click(function(){ if ( $(this).css('height') == 'auto') { $(this).css('height', ht + 'em'); } else { $(this).css('height','auto'); } }); }) </code></pre>
javascript jquery
[3, 5]
2,025,772
2,025,773
jquery library conflict
<p>I use two jQuery Library in a single page (Tab &amp; Gallery) for both used two different versions of jQuery libraries now it both wont work at a time. i have to remove a library to work another.</p> <p>Used versions</p> <p><a href="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" rel="nofollow">1.7.1 jQuery.mini.js for Gallery</a></p> <p><a href="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" rel="nofollow">1.6.2 jQuery.mini.js - for tab</a></p> <p><strong>and</strong></p> <p>this one</p> <p>--http://ajax.googleapis.com/ajax/libs/jquery-ui-1.8.16.custom.min.js</p> <p>Here how i used this coding</p> <pre><code>&lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt;window.jQuery || document.write('&lt;script src="../js/libs/jquery-1.6.2.min.js"&gt;&lt;\/script&gt;')&lt;/script&gt; &lt;script src="../js/libs/jquery-ui-1.8.16.custom.min.js"&gt;&lt;/script&gt; &lt;script // type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt;&lt;/script&gt; </code></pre> <p>Please tell a solution for this</p>
javascript jquery
[3, 5]
4,089,797
4,089,798
HttpSessionState as parameter
<p>What is the highest class in the hierarchy I can use to pass HttpSessionState as a parameter and add values to it?</p> <p>For instance to a method like</p> <pre><code>public void MyMethod(IDictionary&lt;string, object&gt; input) { input.Add("something", something); } </code></pre> <p>I see that implements ICollection and IEnumerable, but that only allows me to read values, not add them.</p>
c# asp.net
[0, 9]
2,498,744
2,498,745
How to disable the Javascript for current page by using Javacript
<p>I have an unusual problem. I make a page filled with some JS and old browsers simply mess it up. A lot of it is included directly to the page - not in separate files - but not inlined.</p> <p>I wonder if there is a way to generate (using PHP) some JS that would make the browser ignore all the following scripts?</p> <p>Otherwise I have to make conditional inclusion of all the JS and that is something I really would like to avoid. </p> <p>Thanks for any proposals.</p>
php javascript
[2, 3]
4,659,525
4,659,526
using the window object for accessing global user defined objects and using text within html for creating additional specificity
<p>I don't do very much jquery / javascript but wanted to ask for some advice on the following piece. I have tried to cut out as much as possible. Most of this was semi-inherited code with catching a bunch of events just hardcoded in. I'd like to generalized them more by putting the object name in the html and accessing via jquery on processing (by_date, by_popularity). I retriev as string and access the object via window[current_obj]. Is this a good way to do this or am I missing something? Are there preferable ways to introduce specificity. thanks for any advice.</p> <pre><code>&lt;script&gt; var by_date={}; by_date.current_page=1; by_date.per_page=4; var by_popularity={}; by_popularity.current_page=1; by_popularity.per_page=4; $(function(){ $('.previous.active').live('click',function(){ window[current_obj].current_page--; process(window[current_obj]); }); }); function process(game_obj){ //will process and output new items here } &lt;/script&gt; &lt;div class="otherContainer"&gt; &lt;a class='previous active'&gt;Prev&lt;/a&gt;&lt;div style="display:none;"&gt;by_date&lt;/div&gt; | &lt;a class='next'&gt;Next&lt;/a&gt;&lt;div style="display:none;"&gt;by_date&lt;/div&gt; &lt;/div&gt; &lt;div class="topPrevNextContainer"&gt; &lt;a class='previous active'&gt;Prev&lt;/a&gt;&lt;div style="display:none;"&gt;by_popularity&lt;/div&gt; | &lt;a class='next'&gt;Next&lt;/a&gt;&lt;div style="display:none;"&gt;by_popularity&lt;/div&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
578,740
578,741
Problem with string format
<p>I would like to assign string "{"MY_URL", "MY"}" to string variable. So in my code behind (C#) I wrote like <code>string str ="{\"MY_URL\", \"MY\"}"</code>. When i will assign this to textbox it will print escape character ("\") as well. That i don't want so what i have to do to achieve this??</p>
c# asp.net
[0, 9]
3,435,956
3,435,957
Changing JavaScript source
<p>The below code is not changing the javascript source:</p> <pre><code>if($.browser.msie){ var new_scr=document.createElement('script'); new_scr.src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"; document.getElementsByTagName('head')[0].appendChild(new_scr); } </code></pre> <p>I have a feeling it might be because it is missing the <code>type="text/javascript"&gt;</code></p> <p>I know it is not working because I have a function that works only with jquery 1.3 and the function is not working.</p> <p>You can find the full code here: cloudintegrationservice.com</p>
javascript jquery
[3, 5]
1,779,741
1,779,742
Dynamic Mathematical Formula Builder in C#
<p>How to write code to create a dynamic formula builder and how to map formula's variable with field values(TextBoxes, Dropdown etc.). I also want to save this formula in database for further use. </p> <p>Any help would be appreciable.</p>
c# asp.net
[0, 9]
3,844,771
3,844,772
display photo or video from a link
<p>is there some kind of a plugin to display a photo or video from a website link like if you post a link on Facebook it loads a miniature picture of the link? </p>
javascript jquery
[3, 5]
5,384,776
5,384,777
Creating a dynamic array and then choosing highest value
<p>I did some googling and didnt quite find what I was looking for. I have an app in which a user inputs values and when pressing calculate it will generate 64 values. My question is 2 parts.</p> <ol> <li>How to do I capture these results and create a temporary array</li> <li>How do I pick the largest value from the array and assign it to a double to use in a final equation in the app.</li> </ol> <p>Thank you all in advance for your help.</p>
java android
[1, 4]
5,717,101
5,717,102
Javascript splice is breaking on jQuery .each()?
<pre><code>var results = ['one', 'two', 'one hundred', 'three']; var removal = []; $.each(results, function(i) { removal.push(i); if (results[i].indexOf('one') == -1){ console.log('Removing:' + results[i] + '(' + removal[i] + ')'); results = results.splice(removal[i], 1); } }); </code></pre> <p>I have the following code, but it is breaking after it removes the first result.</p> <p>I want it to remove anything that does not contain the word 'one'.</p> <p>I am guessing it is breaking because the removal order changes once one has been removed.</p> <p>What am I doing wrong?</p>
javascript jquery
[3, 5]
1,860,109
1,860,110
How to create rotating tag cloud in jQuery
<p>I cannot explain the functionality actually. I want to rotate the links in spheric form. Visit this <a href="http://www.chemicalformula.org/" rel="nofollow">http://www.chemicalformula.org/</a>. On this site, see the region "Chemical formulas" in middle-left of the page, where links are rotating in spheric, circular form. I want this functionality using jQuery / jQuery in ASP.net application. Can I achieve this ?</p>
jquery asp.net
[5, 9]
3,565,512
3,565,513
Best way to make alert messages safe in javascript
<p>I want to display messages from my asp.net pages by registering a script, sometimes even the exception code from an error. I use this code:</p> <pre><code>ScriptManager.RegisterStartupScript(this, Page.GetType(), "NoDept", "alert('Adjustments require the Total Amount to be ZERO to post!');", true); </code></pre> <p>This works great if I can decide the information to display during development, but if I want to display something that is data from the application, it may include invalid text, which of course screws up the script and it does not display. An example would be something with ' in the message.</p> <p>I am running into the problem when I try to display a message from an exception such as:</p> <pre><code>ScriptManager.RegisterStartupScript(this, Page.GetType(), "processError", "alert('" + ptcred.TransactionError + "');", true); </code></pre> <p>The ptcred.TransactionError is the ASP.NET Exception error, and it may contain invalid characters.</p> <p>What would be the best way to handle presenting this information in my alert() function that will not screw up my javascript? Possibly something that jQuery could do to clean it up?</p> <p>EDIT: I should explain, I would like to continue to easily just register an alert script, its easy and convenient. Just wondered if there wsa something like HTML.Encode or something that will clean up infromation that will make a message not screw up the script.</p> <p>Thanks, Cory</p>
c# javascript jquery asp.net
[0, 3, 5, 9]
1,187,568
1,187,569
How would jQuery react to this?
<p>Let's say we got an <code>onClick</code> event to a certain <code>div</code>, but before that, we have a big calculation that needs to be done with jQuery which takes like 3 seconds and jQuery is currently busy so it doesn't recognise my event call.</p> <p>So, 1 second passes and I click on the box. Nothing happens? 2 second. Nothing happens? 3 seconds and jQuery completes his current task. My <code>onclick</code> jQuery event works and the box disappears.</p> <p>The question is; What would jQuery do in this case? Automatically create a thread to execute my onclick event instantly? Queue the call? (so it would execute my 3 clicks when the task done, hence 3 event calls) Ignore the first 2 call completely? Also, what should I do to avoid this kind of problems?</p>
javascript jquery
[3, 5]
3,660,343
3,660,344
Disable slideDown/Up on links inside div
<p>Basicllay i have a div with a class called .li-level-1, and inside that i have differnt ul's with lists. i Have it set up so when you click on a li-level-1 div displays the ul's and li's inside that div by animating a drop down and when you click on the next one it closes the one previously opened and slidesDown the next one.</p> <p>the only thing is the a links that are inside the div's seem to trigger the slideUp/Down on level-1 and animation as well.</p> <p>any Suggestions?</p> <pre><code>$('.sitemap_page .li-level-1').each(function(){ $(this).find('ul.ul-level-2').hide(); $(this).click(function(){ var this_list = $(this); this_list.parent().find('.open').each(function(){ $(this).slideUp(function(){ this_list.find('ul.ul-level-2').addClass("open").slideDown(); }).removeClass('open'); }); if(this_list.find('ul.ul-level-2.open').length == 0) { this_list.find('ul.ul-level-2').addClass("open").slideDown(); } }); }); </code></pre>
javascript jquery
[3, 5]
2,958,353
2,958,354
Create a HTML table from a xml document in ASP.NET/C#?
<p>I am querying a web service and get returned a SOAP message. I want to create a html table and select what node should be in what column and so on. I have been googling a bit but wonder if anyone of you know a good guide on how to do this properly?</p> <p>Thanks in advance.</p>
c# asp.net
[0, 9]
3,864,073
3,864,074
How to do live updates on page
<p>I have a page where users can signup to participate in a game match. A user just fills out a text field with a username and clicks a submit button.</p> <p>Now, I can add their username to a table that shows all signed up users via ajax when they click submit.However, I'd like to have that table update without a page refresh every time a new user is added.</p> <p>Is the only way to do this by setting some kind of interval that updates that table? It seems like it'd be making a lot of un-needed database calls. What's a good interval to use?</p> <p>Should I store the table in a view and use .load to insert it into a div on the page every say, 10 seconds?</p>
javascript jquery
[3, 5]
3,215,817
3,215,818
Load dropdown according to the value of another dropdown - without refreshing the page in PHP
<p>I have created a page in PHP, in that i need to load a dropdown2 corresponding to the value of dropdown1 without refreshing the page. The values for those dropdown's are from the database. </p> <p>I dont want to refresh the page for every click.</p>
php javascript
[2, 3]
742,083
742,084
translating php array into asp.net arraylist
<p>i'm trying translate some php code into asp.net code </p> <p>php code:</p> <pre><code> function setOption ($result) { foreach ($result as $value) { $parentid[$value['id']] = $value['parentid']; $subid[$value['parentid']][] = $value['id']; $name[$value['id']] = $value['name']; $display[$value['id']] = $value['display']; } return array($parentid, $subid, $name, $display); } </code></pre> <p>asp.net code </p> <pre><code>ArrayList al = new ArrayList(); ArrayList parentid = new ArrayList(); ArrayList subid = new ArrayList(); ArrayList name = new ArrayList(); ArrayList display = new ArrayList(); DataTable tbl = ds.Tables[0]; for (int i = 0; i &lt; tbl.Rows.Count; i++) { DataRow myRow = tbl.Rows[i]; int id = Convert.ToInt32(myRow["id"]); int parent_id = Convert.ToInt32(myRow["parent_id"]); int oid = Convert.ToInt32(myRow["oid"]); int dis = Convert.ToInt32(myRow["display"]); string title = myRow["title"].ToString(); parentid.Insert(id, parent_id); subid.Insert(); name.Insert(id, title); display.Insert(id, dis); } al.Add(parentid); al.Add(subid); al.Add(name); al.Add(display); return al; </code></pre> <p>but at $subid[$value['parentid']][] = $value['id']; is two dimensional array code, how do asp.net present it in asp.net arraylist code?</p>
c# php asp.net
[0, 2, 9]