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
40,141
40,142
Cant access object via variable?
<p>I have a javascript object defined as follows:</p> <pre><code>var tabs = { 'nav_tweet_search':'tweet-panel', 'nav_shopping_cart':'cart-panel', 'nav_stats':'stats-panel' }; </code></pre> <p>Im trying to access some values using a variable in another function. However, i am getting <code>undefined</code>. I created some console logs .. </p> <pre><code>console.log("panel: "+panel); console.log("tabs: "+tabs); console.log("tabs.panel: "+tabs.panel); </code></pre> <p>Which outputs, </p> <pre><code>panel: nav_tweet_search tabs: [object Object] tabs.panel: undefined </code></pre> <p>Any reason why i wouldnt be able to access the obj using a variable? If i do "tabs.nav_tweet_search" it works </p>
javascript jquery
[3, 5]
496,698
496,699
How to write action on a alert box ok button in c#?
<p>this is srinivas, I am new to .net application development. In my project i created one form ,when i click on submit button,those values inserted into data base.If it is successfully inserted,then my form navigated to another form using response.redirect("home.aspx").</p> <p>But in this when is click on submit button,values are inserted into database,but with out showing the alert message ,my page navigated to home.aspx page.</p> <p>But my requirement is,it should have to show the alert message,after click on alert box OK button then it is navigate to another page.</p> <p>please help me to go forward, thank you in advance. bye.. my code </p> <pre><code> public static void ShowAlertMessage(string error) { Page page = HttpContext.Current.Handler as Page; if (page != null) { error = error.Replace("'", ""); ScriptManager.RegisterStartupScript(page, page.GetType(), "err_msg", "alert('" + error + "');", true); } } </code></pre>
c# asp.net
[0, 9]
5,684,072
5,684,073
how to add li between each li using Jquery
<pre><code>&lt;ul id='container'&gt; &lt;li&gt;a&lt;/li&gt; &lt;li&gt;b&lt;/li&gt; &lt;li&gt;c&lt;/li&gt; &lt;li&gt;d&lt;/li&gt; &lt;li&gt;e&lt;/li&gt; &lt;li&gt;f&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>i want to add </p> <pre><code>&lt;li class='separator'&gt;&lt;/li&gt; </code></pre> <p>between each li's, at the beginning and at last. so my example will look like this:</p> <pre><code>&lt;ul id='container'&gt; &lt;li class='separator'&gt;&lt;/li&gt; &lt;li&gt;a&lt;/li&gt; &lt;li class='separator'&gt;&lt;/li&gt; &lt;li&gt;b&lt;/li&gt; &lt;li class='separator'&gt;&lt;/li&gt; &lt;li&gt;c&lt;/li&gt; &lt;li class='separator'&gt;&lt;/li&gt; &lt;li&gt;d&lt;/li&gt; &lt;li class='separator'&gt;&lt;/li&gt; &lt;li&gt;e&lt;/li&gt; &lt;li class='separator'&gt;&lt;/li&gt; &lt;li&gt;f&lt;/li&gt; &lt;li class='separator'&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>what is the best way to do that using jquery?</p>
javascript jquery
[3, 5]
3,639,268
3,639,269
Multiple Dropdown Boxes that will fill in a table
<p>I'm going to have 3 drop down menus. </p> <ol> <li>that has garment.</li> <li>has the color. </li> <li>number of colors. </li> </ol> <p>When the person selects these it will generate a table that shows what the cost for the amount of pieces like 1 column 48pc then 72pc then 96pc and so on. I dont expect anyone to write the code but I was trying to figure out the best language to use. I was thinking javascript but i'm not sure where to start if anyone knows some tutorials or something to help. I would appreciate it.</p>
php javascript
[2, 3]
3,188,861
3,188,862
Setting an ASP Label control with text from JQuery
<p>I'm new to JQuery and I'm writing code to check a registration form. Here's my label in the server page:</p> <pre><code>&lt;asp:Label ID="LabelErrorFirstName" runat="server" ForeColor="Red" Font-Size="Small"&gt;&lt;/asp:Label&gt; </code></pre> <p>and my JQuery script:</p> <pre><code>if(firstnameTxt.length == '') { $('#&lt;%= LabelErrorFirstName.ClientID %&gt;').text("Please enter a first name."); } </code></pre> <p>I access this script from the OnClientClick event in a button on the form which I know works i.e. I set alerts here which shows it's getting there. I've commented out the 'if' statement in case that was the problem but it isn't.</p> <p>What I want to happen is to have this label's text property set if the first name textbox is empty to "Please enter.." etc. I've tried many variations but I can't get it.</p> <p>What am I missing?</p> <p>Paul</p>
jquery asp.net
[5, 9]
2,114,328
2,114,329
How to delay execution in between the following in my javascript
<p>I want to delay execution in betwen the follwoing codes:</p> <pre><code>$("#myName").val("Tom"); ///delay by 3s $("#YourName").val("Jerry"); //delay by 3s $("#hisName").val("Kids"); </code></pre>
javascript jquery
[3, 5]
4,664,461
4,664,462
$(window).click(function(e) - identifier of currently clicked element
<pre><code>$(window).click(function(e) { alert(e.???); }); </code></pre> <p>How can I check how id, class or other identifiers of the current click?</p>
javascript jquery
[3, 5]
4,532,070
4,532,071
Setting the focus on a specific row in a textarea
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area">jQuery Set Cursor Position in Text Area</a><br> <a href="http://stackoverflow.com/questions/1552567/specifying-where-to-focus-within-textarea">Specifying Where To Focus Within Textarea</a> </p> </blockquote> <p>I have a textarea with multiple lines. Let's say 10. How to set the cursor on the third line?</p>
javascript jquery
[3, 5]
4,333,263
4,333,264
any disadvantage on setting form value through jQuery
<p>I have form with lot of elements, most are select box, check box, radio . for example below selectbox <code>chart[type]</code> I am setting it value through php </p> <pre><code>&lt;select name="chart[type]" id="chart_type" &gt; &lt;option value="nps" &lt;?php if ( $chart_data['chart']['type'] == 'nps' ) echo ' select="selected" '; ?&gt; &gt;NPS Barchart&lt;/option&gt; &lt;option value="score" &lt;?php if ( $chart_data['chart']['type'] == 'score' ) echo ' select="selected" '; ?&gt;&gt;Number/score&lt;/option&gt; &lt;option value="top5" &lt;?php if ( $chart_data['chart']['type'] == 'top5' ) echo ' select="selected" '; ?&gt;&gt;Top 5&lt;/option&gt; &lt;/select&gt; </code></pre> <p>I tried a code to set from value using jQuery </p> <pre><code>&lt;select name="chart[type]" id="chart_type" &gt; &lt;option value="nps" &gt;NPS Barchart&lt;/option&gt; &lt;option value="score"&gt;Number/score&lt;/option&gt; &lt;option value="top5"&gt;Top 5&lt;/option&gt; &lt;/select&gt; &lt;script&gt; $(function(){ $('[name="chart[type]"]').val( '&lt;?php echo $chart_data['chart']['type']; ?&gt;' ); }); &lt;/script&gt; </code></pre> <p>I feel code is much cleaner . I am planning to change all forms code refill to this way . I would like to know any disadvantage of using second ? .. my application is for chart rendering it will not work, if JavaScript is disabled !</p>
php javascript jquery
[2, 3, 5]
2,889,782
2,889,783
updating updatepanel on checkbox check ( which has client events and is in other updatepanel)
<p>I am working in asp.net application. I have a checkbox and three textboxes inside an <code>updatepanel</code>. I have another updatepanel. I am using Jquery to hide show the textboxes. I want to update the second updatepanel contents as well on first updatepanel's checkbox check/uncheck ( which already has client events) How can I do this ? </p> <p>I don't want to use <code>__doPostBack('__Page', 'MyCustomArgument');</code> because it will postback whole page.</p> <p>Please suggest.</p>
c# asp.net
[0, 9]
1,880,071
1,880,072
How to auto refresh page
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3099430/automatic-page-refresh">Automatic page refresh</a> </p> </blockquote> <p>I found this on and off switch online and would like to use it to refresh a page. If the user click the "on" it will refresh the page every 5 seconds. If they click off it will stop. Can some please help me out. Here's what I have so far: </p> <pre><code>&lt;style&gt; body{ font-family:Verdana, Geneva, sans-serif; font-size:14px;} .left{ float:left; width:120px;} #ajax{ float:left; width:300px; padding-top:5px; font-weight:700; } .clear{clear:both;} &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;/a&gt;&lt;/div&gt; &lt;div id="container"&gt; &lt;div class="left" id="1"&gt;&lt;/div&gt; &lt;div id="ajax"&gt;&lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; $('#1').iphoneSwitch("on", function() { $('#ajax').load('on.html'); }, function() { $('#ajax').load('off.html'); }, { switch_on_container_path: 'iphone_switch_container_off.png' }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
5,817,257
5,817,258
receiving data in php through jquery ajax
<p>i just got the hang of using jquery ajax for example, this code sends the contents of the comment box to the php file.</p> <pre><code> $.post("user_submit.php", { comment: $("#comment").text() }); </code></pre> <p>the question however is how do i receive the data in the user_submit.php file?</p>
php javascript jquery
[2, 3, 5]
3,836,486
3,836,487
Is there a way to get a list of all the users on a domain using ASP.NET with C# as the backend?
<p>The question basically says it all. I want to be able to get a list of all the users on the windows domain (i.e. in the active directory) using c#.</p> <p>Thanks!</p>
c# asp.net
[0, 9]
4,013,120
4,013,121
How to create array of a particular field of json string through collect() method of objx
<p>my json string is as follows:</p> <pre><code>var data = [{"first":"3","second":"1"},{"first":"5","second":"5"},{"first":"7","second":"1"}]; </code></pre> <p>Now i am calling - </p> <pre><code>objx(data).collect("first") </code></pre> <p>and expecting to get an array like [3,5,7]. But i am getting javascript error : object doesn't support this property or method. i have tried with </p> <pre><code>objx(data).collect("first").obj() but with no avail. </code></pre> <p>i have included objx-2.3.6.js file from <a href="http://code.google.com/p/objx/" rel="nofollow">http://code.google.com/p/objx/</a> and i want to create the array with objx api to reduce no of lines of code. i am using IE8</p> <p>please suggest a way out.</p>
javascript jquery
[3, 5]
3,277,565
3,277,566
ASP.NET date and time picker?
<p>I am using ASP.NET 2.0 with SQL Server 2005. I want my user to select a date and time and then save those values into the database. In VS I can use the Calendar control to get the date, but what is a good one for handeling the date the user select plus the time what ever it might be that the user must also select from a control.</p> <p>Thanks in advanced!!</p>
c# asp.net
[0, 9]
274,807
274,808
I want a cross close button on top of my overlay.
<p>I have an overlay which appears over my webpage. I want a cross symbol on top of my overlay so that users can closs the overlay. So How i can close the overlay if the user presses escape key.</p>
javascript jquery
[3, 5]
4,900,137
4,900,138
How do I fire an ASP.NET custom validator from JavaScript?
<p>I want to code a function in javascript that every time I call it in the webform it fires up an specific validator in that same webform.</p>
asp.net javascript
[9, 3]
5,024,176
5,024,177
jquery length of characters in a collection
<p>Is there any way to get the length of characters in a jQuery collection? </p> <p>e.g. you matched a bunch of divs and you want the character count of just the matched divs</p>
javascript jquery
[3, 5]
1,409,313
1,409,314
Set background image dynamically for pages
<p>I have one div#logo. i set background image for this div. I change image dynamically using jQuery. and one common page which contain div#logo. i have one button from UI side which change the background image of div#logo.but when i redirect to another page div#logo page take default background image.</p> <p>What i have to for all page which i select image form UI side button.</p>
javascript jquery
[3, 5]
1,362,415
1,362,416
Suitable technology for web portal
<p>We want to devlop a web portal which will contain - Search Facility - Add/Delete/Update Facility - Discussion forums - Articles - Rating/Feedback etc.</p> <p>Which is best suited for this JAVA OR PHP? Also which framework is bes</p>
java php
[1, 2]
4,839,658
4,839,659
jQuery plugin to work without element
<p>How does one make a jQuery plugin that is possible to execute without using an element selector?</p> <p>Like, usually it's:<br> <code>$('#myElementID').myPluginFunction(myVariables);</code><br> But, instead:<br> <code>$.myPluginFunction(myVariables);</code></p> <p>Thanks in advance!</p>
javascript jquery
[3, 5]
2,881,490
2,881,491
How can two variables both be a JQuery object, yet .css property not work on one of them?
<p>In the following code, how can <code>thebody</code> and <code>app.body</code> both be a JQuery object, yet setting the <code>.css</code> property on <code>thebody</code> works but does not work on <code>app.body</code>?</p> <pre><code>var app = app || {}; app.show = function(html) { this.baseElement.html(html); }; app.body = $('body'); app.init = function() { this.baseElement = $('div#app'); var thebody = $('body'); console.log(app.objectIsJquery(thebody)); //true console.log(app.objectIsJquery(app.body)); //true app.body.css('background-color', 'yellow'); //does not set the background color, no errors //thebody.css('background-color', 'yellow'); //sets color correctly }; app.start = function() { this.baseElement.css('color', 'brown'); this.show(dp.qstr.addStar('testing')); }; app.objectIsJquery = function(obj) { return obj.selector != undefined; } </code></pre>
javascript jquery
[3, 5]
1,052,192
1,052,193
Get DropDown Values from Database Table
<p>I have a ASP:DropDown list which is populated by the following:</p> <pre><code>public void Fill1() { string connectionString = WebConfigurationManager.ConnectionStrings["CRM2Sage"].ConnectionString; using (SqlConnection _con = new SqlConnection(connectionString)) using (SqlCommand cmd = new SqlCommand("SELECT * FROM Products", _con)) { cmd.Connection.Open(); SqlDataReader ddlValues; ddlValues = cmd.ExecuteReader(); txtProduct.DataSource = ddlValues; txtProduct.DataValueField = "Description"; txtProduct.DataTextField = "Description"; txtProduct.DataBind(); cmd.Connection.Close(); cmd.Connection.Dispose(); } } </code></pre> <p>I need to call the <code>SalesPrice</code> from same table and based on the selected value in the drop down update a <code>ASP:TextBox</code> Field called <code>txtUnitAmount</code>.</p> <p>I have tried writing it into the same function and it wont let me set the <code>.Text</code> value for the <code>ASP:TextBox</code>. Can any one suggest a way to achieve this?</p> <p>Thanks to all for their help so far!</p> <p>Cheers</p> <p>Justin</p> <p>Extra Code for Discussion</p> <pre><code>public void Fill2() { string getProdValue = WebConfigurationManager.ConnectionStrings["CRM2Sage"].ConnectionString; using (SqlConnection _con = new SqlConnection(getProdValue)) using (SqlCommand cmd = new SqlCommand("SELECT SalesPrice FROM Products WHERE Description = " + Request.Form["txtProduct"].ToString(), _con)) { int getProdCost = (int)cmd.ExecuteScalar(); txtUnitAmount.Text = getProdCost.ToString("###,###0.000"); } } </code></pre>
c# asp.net
[0, 9]
2,771,651
2,771,652
Is there any way to clone hardcoded Element or Set of Elements using jquery in runtime?
<p>I need to know how to clone hard coded elements in runtime?</p> <p>I have a hard coded input field. In run time is it possible to read that element and make it multiple(append) by user request. Is that possible with jquery or javascript.</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
3,316,486
3,316,487
Drop-down navigation - menu flickering on mouseleave
<p><a href="http://jsfiddle.net/deswolf/D9X53/" rel="nofollow">http://jsfiddle.net/deswolf/D9X53/</a> If you play around with this menu for a little bit, you will notice that when your mouse leaves at the top, you get a lot of flickering, which is really annoying. How can I fix this?</p>
javascript jquery
[3, 5]
1,810,629
1,810,630
asp:RadioButton and javascript function $find()
<pre><code>&lt;asp:RadioButton ID="myButton" Text="Option" GroupName="group" runat="server" /&gt; </code></pre> <p>Why in this case javascript function call <code>$find('&lt;%= myButton.ClientID %&gt;')</code> return <code>null</code>? I need to detect/change value in client javascript. <code>$find()</code> should be shortcut for <code>Sys.Application.findComponent()</code>.</p> <p>UPDATE: There is no problem with ID, i tried $find() in chrome console with real rendered id and still getting null. And i want to get Ajax control, not DOM element.</p>
javascript asp.net
[3, 9]
143,967
143,968
jQuery closest with attribute filter
<p>Does jQuery 1.5.1 support attribute selectors in the closest method?</p> <p>Given the structure below, <code>el</code> represents the checkbox with the value 513, and I'm trying to reach up and check the ancestor checkbox with the value of 0 with</p> <pre><code>$(el).closest("input[value='0']")[0].checked = true; </code></pre> <p>but the selector is returning nothing.</p> <p>Am I missing something silly?</p> <p><img src="http://i.stack.imgur.com/xEGv4.png" alt="enter image description here"></p> <hr> <p><strong>EDIT</strong></p> <p>Sigh, so the checkbox with value 0 isn't an ancestor to <code>el</code>, just a sibling of the <code>ul</code> ancestor. I got it to work with</p> <pre><code>$(el).closest("ul").siblings("input[value='0']")[0].checked = true; </code></pre> <p>But us there a cleaner way to grab it?</p>
javascript jquery
[3, 5]
3,867,382
3,867,383
How to assign height of two dynamic div equal at run time
<p>I have two div one is on left side and another is on right side and these are creating at run time the inner text of both. my problem is that how to make the both div height equal . i am using code</p> <pre><code>$('#div_Set_1_ChannelRoomContent').height($('#div_ChannelRoomName').height()); </code></pre> <p>but it does'nt work</p>
javascript jquery
[3, 5]
2,563,428
2,563,429
Android how to get count of app strat times
<p>I have a question about one problem... I need to count how many times my application was started on some local device... so how i can do it? and can you please give me an advice, where better save info on device, i have heared about some DB which is built in Android... is it good for saving some data? and how i can access it?</p>
java android
[1, 4]
67,897
67,898
How to refresh the parent window from child window close in asp.net
<p>How to refresh the parent window from child window close in asp.net(.cs page).We are using </p> <pre><code>page.ClientScript.RegisterStartupScript(this.GetType(), "PopupSave", "&lt;script&gt; JavaScript(`successfully Saved`); window.close();window.top.opener.RefreshPage();&lt;/script&gt;"); </code></pre> <p>for refresh the parent page from child window close.</p> <p>here <code>RefreshPage()</code> is a custom function</p> <pre><code>function RefreshPage() { window.document.forms[0].submit(); } </code></pre> <p>it is working fine in IE but not in Mozilla Firefox and Google chrome. please help me it is very urgent requirement for me.</p> <hr> <p>Again it is not working with your solution also. My project structure is entirely different then what you explained above. We are calling the java script functions in code behind by using <code>page.ClientScript.RegisterStartupScript()</code>.Here we are calling the different java script functions separated by semicolon(<code>;</code>).see below</p> <pre><code>page.ClientScript.RegisterStartupScript(this.GetType(), "PopupSave", &lt;script&gt;javascript:alert('Successfully Saved'); window.close();window.top.opener.RefreshPage();&lt;/script&gt;"); </code></pre> <p>here RefreshPage() is the user defined java script function i.e.</p> <pre><code>function RefreshPage() { window.document.forms[0].submit(); } </code></pre> <p>It is working fine in <em>IE</em> (internet explorer) but not working in <em>Mozilla Firefox</em> and <em>Google Chrome</em>.</p> <p>In the <em>Mozilla Firefox</em> the pop up value is saving in the database but it is not updating into the parent page. If i did refresh manually the value is getting updating into the parent page.</p> <p>If i put debugger in <code>RefreshPage()</code> function in <em>IE</em> it is firing but not in <em>Firefox</em>. Please help me.</p>
c# asp.net
[0, 9]
987,588
987,589
Flipping an image with JS/Jquery
<p>I am looking to flip an image. I have gotten the css to work using:</p> <pre><code> -moz-transform: scaleX(-1); -o-transform: scaleX(-1); -webkit-transform: scaleX(-1); transform: scaleX(-1); filter: FlipH; -ms-filter: "FlipH"; </code></pre> <p>I am looking to apply this to an image but am unsure of the formatting.</p> <p>I tried doing: <code>var flip = "-moz-transform: scaleX(-1),-o-transform: scaleX(-1),-webkit-transform: scaleX(-1),transform: scaleX(-1),filter: FlipH,-ms-filter: 'FlipH'";</code></p> <p>And then: <code>$("#chicken").delay(scrolllen).fadeOut(0).css({ left: 2600 + "px" , top : 2370 + "px" + flip}).fadeIn(0).animate({ left: 1600 + "px" , top : 2370 + "px"}, 5000, 'linear');</code> at a later point, but it doesn't seem to apply.</p>
javascript jquery
[3, 5]
2,266,472
2,266,473
Jquery get hit from tempary image
<p>Ok so what I am doing is creating an upload form for images that gets displayed as a thumbnail, sort of like a preview. I have a set width that it is displayed and then in php on server side it is cropped to the size I want. However, for client side preview I want to show it at the width I have specified but get the height of the image after being resized to the specified width and adjust it with javascript. I hope that makes sense, anyway here is my code. Im not very Jquery / javascript savy so I am probably missing something.</p> <pre><code>&lt;script&gt; function readURL(input) { if (input.files &amp;&amp; input.files[0]) { var reader = new FileReader(); var imgHeight = $(".previewlogo").height(); reader.onload = function (e) { $('.previewlogo') .attr('src', e.target.result) $('.droparea') .attr('style', 'height:', imgHeight, 'px;') }; reader.readAsDataURL(input.files[0]); } } &lt;/script&gt; </code></pre> <p>and then the html</p> <pre><code>&lt;img class="previewlogo" src="#" alt="Click or Drag image here to add login logo"/&gt; &lt;input type="file" class="droparea spot logoupload" name="logo" onchange="readURL(this);"/&gt; </code></pre> <p>at the moment it is giving the size of the broken image size 39px; and also I am seeming to have an issue mixing the code with html on the .attr() tage, I am sure I am overlooking something</p>
javascript jquery
[3, 5]
3,990,002
3,990,003
Find the indexs of all occerences a character in a string
<p>How to find all occurrences of a character in a string. For example string is: "Hello world" and user want to now the indexes of string where 'L' is present. Which is in example 2,3 and 9. How to find indexes like this in java-script/jquery ?</p>
javascript jquery
[3, 5]
4,230,863
4,230,864
How to make a link in aspx reference from app setting value?
<p>need a classic html link reference from app setting value in web.config</p> <pre><code>&lt;a href="&lt;%$appSettings:link%&gt;"+"search.asp" id="more01" title="More" target="_top" &gt; </code></pre> <p>it can not compile</p> <blockquote> <p>Parser Error Message: Literal expressions like '&lt;%$appSettings:iframedomain%>' are not allowed. Use " /> instead.</p> </blockquote>
c# asp.net
[0, 9]
4,838,892
4,838,893
dynamically adding a class to parent container from a dynamically added container using jquery
<p>I have a method to dynamically add a container which is attached to the target container . When the action has been performed i removed the action container but now I have to add a class to parent container but problem is it is getting set (class name to parent container ) but it gets removed itself. For more clarification I am adding an sample code</p> <pre><code>&lt;div class="main"&gt; &lt;ul&gt; &lt;li&gt;some contents&lt;/li&gt; ................ ................ &lt;/ul&gt; &lt;ul class="dynamic_container"&gt; &lt;li&gt;actions&lt;/li&gt; ................ &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>dynamic_container is added when user mouseover the main class container and this get removed once action has been executed . But now it gets added(class name) but it gets removed too . I believe this is basically because $(e.target) get removed ....</p> <p>Any advice/suggestion will be appreciated . Thanks in advance.</p> <p>edit :</p> <p>$(e.target).parents('.main').addClass('current'); (this code does not able to add class to .main div) . This code is executed from ul.dynamic_container (which is added to the dom on mouseover on div.main)</p> <p>edit 2: jsfiddle link: this is the structure (not the actual code)</p> <p><a href="http://jsfiddle.net/CASy6/" rel="nofollow">http://jsfiddle.net/CASy6/</a></p>
javascript jquery
[3, 5]
5,770,872
5,770,873
how to detect images not use in host
<p>I have a picture upload module. I don't know how to make a script can be do this: after upload 1 day, I want check images upload to be use or not. If not use I want it will do some action..</p>
php jquery
[2, 5]
2,953,017
2,953,018
How to call javascript function/write script inside PHP echo
<p>I have written piece of code, below is the code</p> <pre><code>&lt;script type="text/javascript"&gt; function submitform() { document.myform.action='http://mysite/index.php'; document.myform.submit(); } &lt;/script&gt; &lt;?php if(isset($_POST['submit_details'])) { echo "&lt;script typ=javascript&gt; submitform();&lt;/script&gt;"; } ?&gt; &lt;form id="myform"&gt; ------ ------ &lt;input type="submit" name="submit_details"&gt; &lt;/form&gt; </code></pre> <p>when i try to submit the form , it gives me error document.myform is undefined, how to solve this error</p>
php javascript
[2, 3]
220,440
220,441
Jquery form submit after confirn with setting submit button
<p>I am using JQuery and SimpleModal Confirm Modal Dialog to show a confirm box before uploading. The form is submitting fine but as i'm checking isset submit button in PHP therefore it fails. How could i submit post using JQuery with setting submit button. Here is the code</p> <p>HTML</p> <pre><code>&lt;form enctype="multipart/form-data" action="#duc" method="post" id="uploadform" &gt; &lt;input name="file" type="file" &gt; &lt;input name="Submit_upload" type="submit" value="Upload" id="Upload" &gt; &lt;/form&gt; </code></pre> <p>JQuery</p> <pre><code>jQuery(function ($) { $('#Upload').click(function (e) { e.preventDefault(); confirm("Continue to the Upload?", function () { $('#uploadform').submit(); }); }); }) </code></pre> <p>PHP</p> <pre><code>if(isset($_POST['Submit_upload']) &amp;&amp; $_FILES['file']['name']) { // file uploading process. } </code></pre> <p>I think as after confirm JQuery submitting the form so the actual submit button is not adding in the post array. any help will be much appreciated.</p>
php javascript jquery
[2, 3, 5]
3,594,112
3,594,113
finish executing asynctask first before comparing the boolean
<p>I have 2 classes: checkenrol.java and allcourses.java</p> <p>checkenrol extends AsyncTask. I also have a global boolean named "alreadyEnrolled" in checkenrol. </p> <p>allcourses will execute checkenrol with 2 parameters.</p> <p>The idea is that:</p> <ul> <li>allcourses will load a list of courses.</li> <li>the user will click on a course, at the background it will run the checkenrol class. if the user is already enrolled, global boolean "alreadyEnrolled" will be set to true else false.</li> <li>allcourses now will output if the user is already enrolled or not DEPENDING ON THE VALUE OF THE BOOLEAN</li> </ul> <p>My problem is that the execution of the Asynctask and the comparing of the boolean is done simultaneously. </p> <p>To further illustrate here are fragments of my code:</p> <p>This is my checkenrol.java</p> <pre><code>public class checkenrol extends AsyncTask &lt;String, Void, String&gt; { public static boolean alreadyEnrolled = false; @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub ... if (res.equals("1")) { alreadyEnrolled = true; } else { alreadyEnrolled = false; } ... } ... </code></pre> <p>This is my allcourses.java</p> <pre><code> checkenrol ce = new checkenrol(); ce.execute(param1, param2); if (checkenrol.alreadyEnrolled == true) { //redirect to subject's home System.out.println("Already Enrolled"); } else if (checkenrol.alreadyEnrolled == false){ System.out.println("Not yet enrolled"); } </code></pre> <p>When I click on the item that I am ALREADY enrolled to, it outputs "Not yet enrolled" but the second time I click it, it will output "Already enrolled".</p> <p>Sorry for the long post. hope you will help me :)</p>
java android
[1, 4]
987,713
987,714
How to get selected star value in jQyery Raty
<p>I am using <a href="http://wbotelhos.com/raty/" rel="nofollow">Jquery Raty</a> Plugin which is a star rating plugin and its working fine .<br> Here is my code </p> <pre><code> $('#star').raty({ path: '/Content/RatingPlugin/', numberMax: 5, score: function () { return $(this).attr('data-score'); } }); </code></pre> <p><strong>HTML</strong></p> <pre><code>&lt;div id="star" data-score="@Model.Company.Rating"&gt;&lt;/div&gt; </code></pre> <p>Now there are 2 problem , suppose when my page load @Model.Company.Rating value is <code>4</code> it will show 4 stars on which is right but if any one click on the third star it will off that 4th star and then only 3 stars will be on . I want that if a user click on any star then in javascript I get the value of that star and store that on database but it should not takle effect on user side I mean after clicking of user amount of <code>on stars</code> will remain same . </p> <p>If you need any other detail please let me know . </p> <p>Thanks in advance . </p>
javascript jquery
[3, 5]
416,444
416,445
How to convert the time format in android?
<p>I have the json response like this:</p> <pre><code>{ "Modification": [ { "lastModifiedTime": "1354024211735" } ] } </code></pre> <p>Now I want to convert the <strong>lastModifiedTime</strong> like this <strong>10 Dec 2012 18:41</strong> <em>(DD/MM/Year time)</em>. How I will to achieve this output in Java?</p>
java android
[1, 4]
5,449,602
5,449,603
Displaying xml item in a listbox (XlmSerialiser)
<p>I have the following deserialize method:</p> <pre><code> public static List&lt;Enquete&gt; GetAlleEnquetes() { XmlReader reader = new XmlTextReader(HttpContext.Current.Server.MapPath("~/App_Data/Questions.xml")); try { XmlSerializer serializer = new XmlSerializer(typeof(List&lt;Enquete&gt;), new XmlRootAttribute("enqueteSysteem")); return (List&lt;Enquete&gt;)(serializer.Deserialize(reader)); } finally { reader.Close(); } } public static Enquete GetEnqueteName(string name) { foreach (Enquete e in GetAllEnquetes()) { if (e.Name == name) return e; } return null; } </code></pre> <p>Which works properly (this code is located in a class withing App_data).</p> <p>Next i want to retrieve all the names and display them in a listbox.</p> <p>But how exactly do i retrieve the names? <code>&lt;Enquete Name =""&gt;</code> and list all of those in my listbox control? (through the asp.cs file)</p> <p>My xml structure looks like this:</p> <pre><code>&lt;enqueteSystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;Enquete Name="test"&gt; &lt;Questions&gt; &lt;Question QuestionText="testtest" QuestionType="na"&gt;&lt;/Question&gt; &lt;/Questions&gt; &lt;/Enquete&gt; &lt;/enqueteSystem&gt; </code></pre>
c# asp.net
[0, 9]
5,454,563
5,454,564
ASP.Net Web Application Choose Client Side Directory
<p>I have the requirement to allow a user to provide a local directory path via a UI in a web application so that we can save it to our database. Our other program (a winforms app) will then use this path to store files (actually recordings) that they have created via the app. </p> <p>Ideally I would like to remove as much room for human error as possible i.e. only let them use paths that exist so would prefer to have some kind of select directory dialog that forces them to use existing directories however I have read that this is not possible on client side code for security reasons which of course makes total sense but is there some way that this can be achieved? So far I have been unable to find anything of use besides just letting them type it in and I am not happy with the lack of control over the path they enter.</p>
c# asp.net
[0, 9]
181,754
181,755
static variables, what is their life span?
<p>I am using static variables in my app, lots of them. My question is, when I exit the app will they be still in memory..? If yes, how can I correct this. Thanks in advance.</p>
java android
[1, 4]
4,455,082
4,455,083
how can i open a excel inside a web browser?
<p>I need to open a excel in web browser when click a button.how to do that in asp.net </p>
c# asp.net
[0, 9]
2,157,630
2,157,631
Cannot reach $(this) from within $().data()
<p>I'm trying to set the class of my element inside a data object of the same element, but it keeps returning undefined.</p> <pre><code>$(this).data({ orgSize:{ // Write all the sizes as data. For future reference. width: $(this).width(), //returns the width just fine! height: $(this).height() //returns the height just fine! }, orgClass: function(){ cl = $(this).attr('class'); if(cl){ return ' ' + cl; }else{ return ' somethingelse'; } } //returns undefined }); console.log($(this).attr('class')) //returns the class </code></pre> <p>edit: The problem is within the orgClass.</p>
javascript jquery
[3, 5]
163,684
163,685
Get total amount for each individual row
<p>I am working on at the moment whereby I need to multiply 2 input values (quantity &amp; amount) and then get the total. My issue lies with getting the total for each individual 'row' ideally on keyup as there will be multiple rows / fieldsets. </p> <p>HTML:</p> <pre><code>&lt;fieldset&gt; &lt;p&gt;Title&lt;/p&gt; &lt;label id=""&gt;Quantity&lt;/label&gt;&lt;input type="text" class="quantity" id="" value="Quantity" name=""&gt; &lt;label id=""&gt;Amount&lt;/label&gt;&lt;input type="text" class="amount" id="" value="Amount" name=""&gt; &lt;label id=""&gt;Total&lt;/label&gt;&lt;input type="text" class="total" id="" value="Total" name=""&gt; &lt;/fieldset&gt; &lt;fieldset&gt; &lt;p&gt;Title&lt;/p&gt; &lt;label id=""&gt;Quantity&lt;/label&gt;&lt;input type="text" class="quantity" id="" value="Quantity" name=""&gt; &lt;label id=""&gt;Amount&lt;/label&gt;&lt;input type="text" class="amount" id="" value="Amount" name=""&gt; &lt;label id=""&gt;Total&lt;/label&gt;&lt;input type="text" class="total" id="" value="Total" name=""&gt; &lt;/fieldset&gt; </code></pre> <p>Multiple rows can be added via a button. Any help is greatly appreciated.</p>
javascript jquery
[3, 5]
2,147,903
2,147,904
How to Delete a file using asp.net?
<p>to all i write the code in asp.net using c# to delete the file in my computer, but it is not deleting please help me thank u. this is my code, i write in button click event</p> <pre><code> string path = "E:\\sasi\\delt.doc"; FileInfo myfileinf = new FileInfo(path); myfileinf.Delete(); </code></pre>
c# asp.net
[0, 9]
696,924
696,925
Notify user page was modified if trying to exit, what's the technique?
<p>If a user is on a page with a form, and they have edited something, and then try and navigate to another page, how can I notify them?</p> <p>How do people do this?</p> <p>Is it a matter of computing a hash of all the input fields and comparing if they are exiting the page? </p> <p>Is there a on page unload event?</p>
javascript jquery
[3, 5]
96,801
96,802
jQuery .live and page refresh issue
<p>Why this code fails to prevent a page refresh?</p> <pre><code>$('a').each(function() { var me = $(this); var mytarget = me.attr('href'); var is_link_to_self = mytarget.indexOf("index.php"); if(is_link_to_self !== false) { me.live('click', function() { $('#content').load(mytarget); return false; }); } }); </code></pre>
javascript jquery
[3, 5]
1,252,410
1,252,411
defining a shape xml element in drawable?
<p>I dropped the following into the drawable directory in my Android 1.5 project:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gradient"&gt; &lt;gradient android:startColor="#FFFF00" android:endColor="#FFFFFF" android:angle="270"/&gt; &lt;corners android:radius="0dp" /&gt; &lt;/shape&gt; </code></pre> <p>I get </p> <pre><code>java.lang.ClassNotFoundException at com.android.ide.eclipse.adt.internal.resources.manager.ProjectClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(Unknown Source) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:198) at android.view.BridgeInflater.onCreateView(BridgeInflater.java:99) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:562) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:122) at android.view.LayoutInflater.inflate(LayoutInflater.java:385) </code></pre> <p>etc etc etc in my Eclipse console. </p> <p>I also get the same ClassCastError in my logcat when I try to run the thing in my emulator, setting that drawable to be the background on a linear layout.</p> <p>Any ideas?</p>
java android
[1, 4]
4,188,499
4,188,500
My Canvas on the Image is not zooming along with the Image View.?
<p>I am drawing a canvas on my Custom Image View and applying a zoom in and zoom out animation to my custom Image View.The problem is my canvas is not rescaling alongwith the image view.I want the canvas to be fixed with the my custom Image view and zoom with the custom Image view itself in android.How can I achieve this??</p> <p>Would appreciate if answered.</p> <p>Thank You.</p>
java android
[1, 4]
2,423,472
2,423,473
Make a submit clickable after validations are met
<p>I have the following html:</p> <pre><code>&lt;p&gt;Genre: {{ create_production_form.genre }}&lt;/p&gt; &lt;p&gt;Privacy: {{ create_production_form.privacy }}&lt;/p&gt; &lt;p&gt;&lt;input type="submit" name="next" value="Next" disabled="disabled"&gt;&lt;/p&gt; </code></pre> <p>How would I make the <code>next</code> button clickable only after Genre and Privacy are filled in? For example, something like:</p> <pre><code>if ($("id_genre").val() &amp;&amp; $("id_privacy").val()) { $("input[name=next]").attr("disabled","") } </code></pre> <p>The only thing is, it'd need to be 'live', so it can detect when all these fields are filled in.</p>
javascript jquery
[3, 5]
509,365
509,366
Does jQuery do any initial processing?
<p>Simple question. If you include jQuery in a page of HTML, is there any initialization overhead before one uses any jQuery functions.</p>
javascript jquery
[3, 5]
2,846,900
2,846,901
randomize display order for controls in asp.net
<p>I would like to know how I can randomize the order in which some controls are displayed. Basically, I have 5 hyperlinks, and I want on each load the order in which they are displayed to be randomized. Which way I can accomplish that? Thanks, Laziale</p>
c# asp.net
[0, 9]
2,161,059
2,161,060
jQuery closest() not selecting class added dynamically
<p>I have the <a href="http://jsfiddle.net/WFawp/" rel="nofollow">following jsFiddle</a> which has a <code>.tab</code> class (on a span) that is supposed to remove/replace the open (or close) class on the <code>.container</code> onclick -- and although my console logs are showing that successfully, using <code>closest()</code> I'm not able to grab the specific class in question to change/toggle that class. </p> <p>I've tried quite a few variations, but am not sure if I am selecting this wrong.</p> <p>Any pointers would be greatly appreciated. Thanks!</p>
javascript jquery
[3, 5]
1,722,405
1,722,406
dynamically generated html buttons: source of onclick event caller
<p>I have a DataTable which has a column like such:</p> <pre><code>string temp = row["date"].ToString(); rowDetail[0] = "&lt;input type='button' onclick='showArchive(this)' value='" + temp + "'/&gt;"; myTbl.Rows.Add(rowDetail); </code></pre> <p>So, when I bind myTbl to a datagrid.datasource, these column cells appear as buttons display "date" data. However, in my javascript function where the onclick event takes place, how would I know button/row made the call, so I can grab the rest of the data in that row for processing? I hope that's not lacking too much detail. Thanks all</p> <p><strong>Edit:</strong> Here's my js event:</p> <pre><code>function showArchive(btn) { __doPostBack('btnShowDates', '/*btn.gridRowIndex*/'); } </code></pre> <p>Something like this would be ideal lol.</p>
c# javascript asp.net
[0, 3, 9]
1,063,943
1,063,944
jQuery parents then locate a div to hide
<p>Ok, so i've got this .parents() function that goes outside to a located class/id. In my case, (.wrapper).</p> <pre><code>&lt;div class="wrapper"&gt; &lt;div class="hide"&gt;Hide Class&lt;/div&gt; &lt;div class="boxClass&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>I've got a list of these div's on a single page, so, if i click the "Hide Class" text, everything would fadeout, since everything in the list, has the same class name. Now, back to my question. I use .parents() to locate (.wrapper) (i know this can be done with (.parent)). But how can i use .parents to go back and then select (fadeOut) a class inside it? EX, boxClass?</p>
javascript jquery
[3, 5]
181,452
181,453
get page discription from page url without slowdowing the page load
<p>Is it possible to get page discription from page url without slowdowing the page load? via java script or php or anylanguage?</p> <p>For example I would send this input:</p> <pre><code>http://www.facebook.com </code></pre> <p>and get this output:</p> <pre><code>Facebook is a social utility that connects people with friends and others who work, study and live around them. People use Facebook to keep up with friends, ... </code></pre> <p>How I can do it?</p>
php javascript
[2, 3]
3,256,049
3,256,050
jQuery: Removing Browser Generated Title Attribute
<p>I'm attempting to remove the browser generated title box that appears with anchors that have a title attribute. The reason I want to do this is so it doesn't interfere with my tooltip jQuery.</p> <p>As of right now I am removing the title attr on hover, but it won't reassign it after removing yourself from the hover state. How come?</p> <p><a href="http://jsfiddle.net/fj4xz/5/" rel="nofollow">http://jsfiddle.net/fj4xz/5/</a></p>
javascript jquery
[3, 5]
3,381,452
3,381,453
Cloning divs and replacing id's
<p>Hoping this isnt a repeat question as I could not find an answer.</p> <p>I have a div that I need cloned.</p> <pre><code>&lt;div class="phoneBookEntriesContainer"&gt; content here &lt;/div&gt; </code></pre> <p>I have to add an ID afterwards...dont ask :P.</p> <pre><code>&lt;script type="text/javascript"&gt; var i = 1; $(".phoneBookEntriesContainer").attr("id","phoneBookEntries" + i); var doSomething = function(){ $(".phoneBookEntriesContainer").attr("id","phoneBookEntries" + i); $("#phoneBookEntries" + i).clone().insertAfter("#phoneBookEntries" + i); i ++; }; &lt;/script&gt; </code></pre> <p>The code above kinda works, but instead of giving my divs unique id's, it replaces all of them with the same id.</p> <p>So at the start I would have one <code>#phoneBookEntries1</code> div, after clicking the button to run the function I have two <code>#phoneBookEntries2</code> divs etc etc.</p>
javascript jquery
[3, 5]
1,769,049
1,769,050
Android - Cursor result search string error, need search DISPLAY_NAME for match
<p>I need to search the DISPLAY_NAME field 1st and last name and have tried this code:</p> <pre><code>ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, ContactsContract.Contacts.DISPLAY_NAME + " like %?%", new String[]{ results.get(0) }, null); </code></pre> <p>if (cur.getCount() > 0) { </p> <p>I get error in log cat from the %'s in the cursor line. Any advise would be appreciated. ??</p>
java android
[1, 4]
4,032,768
4,032,769
Selecting divs from jquery array values
<p>i have a easy problem, i need do a action .click() if is clicked on a div in my array...</p> <pre><code>if($('#container_1').click(function(){ $('div#image').fadeOut('fast', function(){ $('div#cat_1').css('background-color', '#F30'); $('#new_frame').show('fast').load('history.html'); }); })); if($('#container_2').click(function(){ $('div#image').fadeOut('fast', function(){ $('div#cat_2').css('background-color', '#F30'); $('#new_frame').show('fast').load('history.html'); }); })); if($('#container_3').click(function(){ $('div#image').fadeOut('fast', function(){ $('div#cat_3').css('background-color', '#F30'); $('#new_frame').show('fast').load('history.html'); }); })); if($('#container_4').click(function(){ $('div#image').fadeOut('fast', function(){ $('div#cat_4').css('background-color', '#F30'); $('#new_frame').show('fast').load('history.html'); }); })); if($('#container_5').click(function(){ $('div#image').fadeOut('fast', function(){ $('div#cat_5').css('background-color', '#F30'); $('#new_frame').show('fast').load('history.html'); }); })); </code></pre> <p>Okay that is my code what works...</p> <p>But i think that i can to do so much shorter... with a code like this::</p> <pre><code>Contenedores = ['1', '2', '3', '4', '5']; if($('#container_'+Contenedores).click(function(){ $('div#image').fadeOut('fast', function(){ $('div#cat_'+Contenedores).css('background-color', '#F30'); $('#new_frame').show('fast').load('history.html'); }); })); </code></pre> <p>But i don't know how do it right to work...</p> <p>Thanks, and sorry my poor english.</p>
javascript jquery
[3, 5]
5,004,856
5,004,857
horizontal pager with vertical pager. How can we apply?
<p>If any one has answer for this question please comment me.</p> <p><a href="https://github.com/grantland/android-verticalpager/tree/be106911947e3dddb6522dbadb4029cea32bd91e" rel="nofollow">Vertical-Pager</a></p> <p><a href="https://github.com/grantland/android-horizontalpager" rel="nofollow">Horizontal-Pager</a></p> <p>So please check this two projects. I just want to implement both in only one class so I can scroll both side with only one class.</p>
java android
[1, 4]
1,938,371
1,938,372
Randomize children elements on load
<p>I want to randomize the children elements of any <code>&lt;div&gt;</code>, <code>&lt;ul&gt;</code> on load with javascript. I am searching for the best approach to do it. Can some one help?</p> <p>Suppose i have a <code>&lt;ul&gt;</code> with 5 <code>&lt;li&gt;</code> elements. On load i want the <code>&lt;li&gt;</code> elements to appear in random order. </p>
javascript jquery
[3, 5]
2,647,411
2,647,412
Populate form input field with php variable value
<p>I have an html form and I need to populate one of the input fields with the url of the page the form is on. To get the url I have:</p> <pre><code>&lt;?php $pageURL="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?&gt; </code></pre> <p>To populate the input field I have: </p> <pre><code>&lt;script type="text/javascript"&gt; // &lt;![CDATA[ $(document).ready(function(){ var getLabel = $(".monkForm label:contains('Page URL')"); var getFor = getLabel.attr('for'); var splitFor = getFor.split('_'); var inputID = $("#" + getFor ); var wrapID = $("#w" + splitFor[1] ); wrapID.hide(); inputID.val('&lt;?=$pageURL;?&gt;'); }); // ]]&gt; &lt;/script&gt; </code></pre> <p>The input field label on the form is "Page URL". The problem is that the page URL is not being added to the input field. </p>
php javascript jquery
[2, 3, 5]
2,168,310
2,168,311
Android : Searching items using there barcodes in ebay
<p>I have a project idea for my college project to develop an android application which can take images of the bar codes of various electronic equipments like cameras laptops and then to read models and brands of them using that bar codes and then to search for that model and brand in Ebay to point the user to relevant web pages. I want to know that is it possible to do this project ?</p> <p>Thanks! </p>
java android
[1, 4]
2,906,114
2,906,115
How to use .next() over several elements
<p>This is the current code:</p> <pre><code>$("input[name='content_use']").click(function() { if ($(this).is(":checked")){ $(this).closest('tr').next().show(); $(this).closest('tr').next().next().show(); $(this).closest('tr').next().next().next().show(); } else{ $(this).closest('tr').next().hide(); $(this).closest('tr').next().next().hide(); $(this).closest('tr').next().next().next().hide(); } }); </code></pre> <p>:|</p> <p><strong>EDIT:</strong> </p> <p>As you can see I must to use <code>next()</code> repeatedly to reach successive rows. How can I code this shorter? </p> <hr> <p><strong>Solution</strong>: <a href="http://api.jquery.com/nextUntil/" rel="nofollow">nextUntil()</a> Thanks to @pimvdb</p>
javascript jquery
[3, 5]
5,466,924
5,466,925
Convert array from php to javascript?
<p>How do i take a php array</p> <pre><code>$arr = (('date'=&gt;'03-22-2012', 'count'=&gt;1000 ), ('date'=&gt;'03-23-2011', 'count'=&gt;1170 )); </code></pre> <p>and convert it to:</p> <pre><code>var arr = [['03-22-2012', 1000], ['03-23-2011', 1170]] </code></pre> <p>usable by a javascript function?</p> <p>is there an easy way to do this?</p>
php javascript
[2, 3]
2,808,638
2,808,639
Handling 404's better in .NET
<p>As some of you guys are running some pretty big sites I wanted to get your opinion on handling 404’s. I have tried loads of different setups with .Net but can never actually get it to do the right thing. I always seem to get some kind of redirect or false header returned, never a 404. This is a real pain because search engines never get the correct feedback and are still hitting these pages despite them no longer existing. In turn this means I get errors reported for pages I know no longer exist. I’m also pretty confused over the way some requests are handled by .Net and some are handled by IIS. </p> <p>My current setup is as follows: IIS7, ASP.Net 3.5 App. I have the custom error pages section of web.config setup to handle 404’s using the new redirectMode="ResponseRewrite" property, forwarding to a html error page. IIS is configured to handle 404’s and forward them to the same html page. Elmah is configured to report any such issues via email too. </p> <p>Now when I try the following address <a href="http://www.severnside.com/document.aspx" rel="nofollow">http://www.severnside.com/document.aspx</a> (a page that doesn’t exist), .net handles the error and shows a 200 response. Obviously this should be a 404. When I try <a href="http://www.severnside.com/document" rel="nofollow">http://www.severnside.com/document</a> I get a correct 404 but the error was handled by IIS. Is it possible to have .Net handle this error too so Elmah can pick up the error?</p> <p>It would be great if I could get an insight into the setups used by others to handle this sort of scenario correctly. </p> <p>Thanks</p>
c# asp.net
[0, 9]
3,316,693
3,316,694
grabbing a subset of data with backbone collections
<p>I have the following function:</p> <pre><code> addBook : function() { _authors = new Array(); authors = $("#id_authors").val().split(","); for (var i=0;i&lt;authors.length;i++) { var firstname = authors[i].split(" ")[0]; var lastname = $.trim(authors[i].replace(firstname,"")); _authors.push({"firstname": firstname, "lastname": lastname}); } this.authors.fetch({data: _authors}); console.log(this.authors); return false; } </code></pre> <p>The value in #id_authors is Leo Tolstoy,Richard Pevear,Larissa Volokhonsky. I would like to loop through these and grab the author information for only these authors.</p> <p>What is happening is it's grabbing the first 20 authors (which don't happen to be these authors). How do I use the collection to grab only the 3 authors that were specified? </p>
javascript jquery
[3, 5]
1,816,889
1,816,890
Better way to listen for click event
<p>I have a graph that is controlled by two calendars. If the user clicks and opens the one calendar to select a date then clicks anywhere off of the calendar that calendar should close. Since there is a "start date" and an "end date" calendar they are both closing each other. So I am attempting to come up with a new solution. My current solution looks something like this.</p> <pre><code>$(document).click(function() { if (this !== $("#startDate") &amp;&amp; this !== #("#endDate")) { $("#startDate").hide(); $("#endDate").hide(); } }); </code></pre> <p>Obviously, this if statement fires on <em>every</em> click. I think this is a poor way of doing this but cannot think of a smarter way. Anyone have a better way? Remember, there are two calendar's that can't close each other.</p>
javascript jquery
[3, 5]
127,741
127,742
Failed to load resource: Frame load interrupted - Agian
<p>I have code which downloads a picture from a fake link. I have looked at others comments / sites but nothing has helped me find the solution to the annoying :</p> <p>"Failed to load resource: Frame load interrupted" </p> <p>my php headers are after I read the GET value: </p> <pre><code>header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: private",false); // required for certain browsers //header('Content-Length: '. @filesize($id)); header('Content-Type: '.$mim); header('Content-Disposition: attachment; filename="'.$date.basename($fileName).'"'); header('Content-Transfer-Encoding: binary'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); readfile($fileName); </code></pre> <p>and I have jQuery script which calls an iframe to download the file: </p> <pre><code>$('body').append('&lt;iframe class="download" src="download.php?id='+downloading+'" style="visibility:hidden;" width="0" height="0"&gt;&lt;/iframe&gt;'); </code></pre> <p>I downloads the file correctly, but shows an error in the console, please let me know if its fixable??</p>
php jquery
[2, 5]
1,402,961
1,402,962
Get a value from a string in an array at a specific character?
<p>I've got an array of values that i need to parse through and extract the values to a new array based off a certain character</p> <p>eg value: <code>2012-04-19T19:21:07-08:00</code></p> <p>I want to loop through an array populated w/ values like the above and extract everything from that value after the "T" from each position in the array and populate a new array with those results.</p> <p>Can anyone point me in the right direction?</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
1,964,219
1,964,220
R.array is a class but not an object?
<p>This is for Android, but I believe it's a general Java question, so I'm labelling it as such.</p> <p>I'm trying to use reflection on R.array to get an array from the list. The arrays are named <code>stringArraySubCategoryX</code> where X is replaced with a number from 0 to 20. This is my code, but I ran into a problem:</p> <pre><code>Field subCatField = R.array.class.getField("stringArraySubCategory" + position); subCatergorySpinner.setAdapter(ArrayAdapter.createFromResource(InfoActivity.this, subCatField.getInt(R.array), android.R.layout.simple_spinner_item)); </code></pre> <p>The problem part is the <code>subCatField.getInt(R.array)</code> bit, which is supposed to return the resource int value of the selected array. But <code>Field.getInt(arg)</code>'s argument is an Object. I checked R.array, and that says <code>public static final class array</code>, but it seems that it's not accepted.</p> <p>What am I doing wrong?</p>
java android
[1, 4]
2,332,681
2,332,682
not validating special character "_" in javascript
<p>hello i am using javascript to validate field</p> <p>i am checking special characters.. the code i am implementing validates all the special characters except _ underscore..</p> <pre><code> &lt;script type="text/javascript" language="javascript"&gt; function validateForm() { var iChars = "!@#$%^&amp;*()+=-[]\\\';,./{}|\":&lt;&gt;?_"; for (var i = 0; i &lt; document.reg_form.txtusername.value.length; i++) { if (iChars.indexOf(document.reg_form.txtusername.value.charAt(i)) != -1) { alert ("Special Characters are not allowed."); return false; } } return true; } &lt;/script&gt; </code></pre> <p>for this filed </p> <pre><code>&lt;input name="txtusername" type="text" id="txtusername" maxlength="10" style="background-color:#CCC" /&gt; </code></pre> <p>but its not validating the underscore</p>
php javascript
[2, 3]
2,016,573
2,016,574
i would like to know how to open a mapview on the click of a button on a another view(this view opens up before the mapview)
<p>please provide the sample code here</p>
java android
[1, 4]
1,637,095
1,637,096
Validating alphabetic only string in javascript
<p>How can I quickly validate if a string is alphabetic only, e.g</p> <pre><code>var str = "!"; alert(isLetter(str)); // false var str = "a"; alert(isLetter(str)); // true </code></pre> <p>Edit : I would like to add parenthesis i.e <code>()</code> to an exception, so </p> <pre><code>var str = "("; </code></pre> <p>or </p> <pre><code>var str = ")"; </code></pre> <p>should also return true.</p>
javascript jquery
[3, 5]
5,972,895
5,972,896
Is there any equivalent of c++ std::next_permutation() in c# 2.0?
<p>Is there any equivalent of <a href="http://www.cplusplus.com/reference/algorithm/next_permutation/" rel="nofollow">std::next_permutation()</a> in c#?</p> <p>I need to use it in .Net 2.0 but I am still curious to know even if later version are supporting it.</p>
c# c++
[0, 6]
3,507,551
3,507,552
Combine 2 jQuery functions shorthand?
<p>I have this:</p> <pre><code>$("#about-us .faq-cta").click(function () { $('#faq').load('faqs.html #main').delay(100).slideToggle('1000', "easeOutQuad", function () { $.waypoints('refresh'); $("#siteNav li a").removeClass("siteNavSelected"); }, { offset: function () { return $.waypoints('viewportHeight') - $(this).outerHeight(); } }); }); </code></pre> <p>And this:</p> <pre><code>if (window.location.hash.toLowerCase() === "#faq") { $("#about-us .faqCta").click(function () { $('#faq').load('faqs.html #main').delay(100).slideToggle('1000', "easeOutQuad", function () { $.waypoints('refresh'); $("#siteNav li a").removeClass("siteNavSelected"); }, { offset: function () { return $.waypoints('viewportHeight') - $(this).outerHeight(); } }); }); } </code></pre> <p>Each do exactly the same thing.</p> <p>Is there a way to write a bit of shorthand to combine the two?</p>
javascript jquery
[3, 5]
4,888,195
4,888,196
Search XML file using javascript
<p>I'm trying to make a page where a user may enter a url into an input box, click submit, and the script will return the WebCite page. (WebCite is a url caching service. For example, if I "archive" www.google.com, the archive page is www.webcitation.org/65YgIgei6.) So WebCite has a query syntax that when given a url to cache, an email, and the parameter <code>&amp;returnxml=true</code>, it will return an xml file. (For example, <a href="http://www.webcitation.org/archive?url=http://www.google.com&amp;email=testtt@test.com&amp;returnxml=true" rel="nofollow">http://www.webcitation.org/archive?url=http://www.google.com&amp;email=testtt@test.com&amp;returnxml=true</a> leads to an xml file where the text between the <code>&lt;webcite_url&gt;</code> tags is the archive page.)</p> <p>So I would like some Javscript (or jquery) that will search the xml file for "<code>&lt;webcite_url&gt;</code>" and "<code>&lt;/webcite_url&gt;</code>" and return the url within those tags. <a href="http://jsfiddle.net/gxHWk/" rel="nofollow">http://jsfiddle.net/gxHWk/</a> is the basic idea.</p> <p>btw, I read stackoverflow.com/questions/6648454/search-and-output-data-from-an-xml-file-using-javascript, but I can't figure out how to adapt the code there to my circumstances.</p> <p>(*removed "http://" from some links because of spam filter)</p> <p>Thanks!</p>
javascript jquery
[3, 5]
3,147,083
3,147,084
How to use Gzip in Webservices Response C#?
<p>I am calling webservices from javascript,i want response back in gzip but presently my response is not gzip. can any on help me out...</p> <p>edit: this is the code i use</p> <pre><code>$.ajax({ type: "POST", url: "wsDashboard.asmx/" + 'Banner_GetAll', dataType: "json", contentType: 'application/json; charset=utf-8', success: function (response) { response = response.d; if (!response.isSucceeded) { j.Alert(response.message, "Error"); return; } var result = response.result; var arrBanner = []; for (var index = 0; index &lt; result.length; index++) { var newBanner = new Banner(result[index].Id, result[index].BannerName, result[index].Url, result[index].HyperLink); arrBanner.push(newBanner); } if (callback) callback(arrBanner); } }); </code></pre> <p>i have configured iis to give responses in gzip all other contents are comming Gziped except for the web service response i would like to compress that too (the response is given in json) the request header contains header accept encoding Gzip</p>
c# javascript jquery
[0, 3, 5]
2,404,546
2,404,547
How to know which button clicked using this.Request.Form
<p>I am using .net 1.1 In My page,i have few <code>ImageButtonClientSide</code> Controls and some other buttons which causes <code>postback.Now</code> I want to know,when page postbacks,In <code>Page_Load</code> which control has been clicked?I am currently doing like this </p> <pre><code> if ( Check.IsNotNulOrBlank(this.Request.Form["__EVENTTARGET"]) ) { if(this.Request.Form["__EVENTTARGET"].Equals("imgButtonSearch")) { } } </code></pre> <p>But <code>this.Request.Form["__EVENTTARGET"]</code> is showing empty values.</p>
c# asp.net
[0, 9]
3,525,096
3,525,097
Open clicked thumbnail in a new tab
<p>I have the below code on one page:</p> <pre><code>&lt;div id="prodoneid" class="prodcls"&gt; &lt;a href="javascript:void(changeIt('big.png', 'pagewrapid')());"&gt; &lt;img src="images/zara/thumbnails/1.png" alt="ZARA"/&gt; &lt;/a&gt; &lt;/div&gt; </code></pre> <p>By the below code I am opening the image in a new window. The new page is opening but is not showing the image in the div.</p> <pre><code>var changeIt, img; changeIt = function(imageName, objName) { img = '&lt;img src="images/zara/' + imageName + '"&gt;'; newwindow = window.open( 'fprod.html', target="_blank" ); document.getElementById(objName).innerHTML = img; setTimeout('newwindow.document.getElementById("pagewrapid").innerHTML=img',0) }; </code></pre>
javascript jquery
[3, 5]
4,853,014
4,853,015
How do I get the list of ids in a particular class using jquery?
<p>e.g.</p> <pre><code>&lt;div class="myclass" id="div_1"&gt;&lt;/div&gt; &lt;div class="myclass" id="div_2"&gt;&lt;/div&gt; &lt;div class="notmyclass" id="div_3"&gt;&lt;/div&gt; </code></pre> <p>I'd like to end up with array something like ["div_1","div_2"]</p>
javascript jquery
[3, 5]
4,358,443
4,358,444
Compare day and show hour only using DateTime formats
<p>I have a DateTime column in my SQL database, how do I check if the Day in that is Today, or yesterday?</p> <p>What I want to is something like: If date is today then the result would be "Today, at " same for yesterday..</p>
c# asp.net
[0, 9]
1,473,544
1,473,545
Event at the end of the document
<p>I don't understand why this doesn't work. Explanation will be appreciated.</p> <pre><code> var scrollTop = $(window).scrollTop(); var height = $(window).height(); if (scrollTop === height ) { alert("end!"); } </code></pre> <p><a href="http://jsfiddle.net/Zasxe/" rel="nofollow">http://jsfiddle.net/Zasxe/</a></p>
javascript jquery
[3, 5]
1,017,339
1,017,340
How to Delete *.aspx files from IIS server using asp.net and C#
<p>Hi please help me as i am trying to delete some unnecessary aspx and aspx.cs files from IIS server with code below</p> <pre><code>File.Delete(Server.MapPath("~/Index.aspx")); </code></pre> <p>but it is not working.</p> <p>It showing Access denied exception.</p> <p>please help me.</p>
c# asp.net
[0, 9]
5,159,337
5,159,338
jQuery.ajax() works only with integers
<p>Everything works fine and dandy with integers/floats but when I enter a String into the textbox the data never gets recieved by the C# method <code>GetData</code> . </p> <p>ASP CODE</p> <pre><code>&lt;asp:TextBox id="txtBoxVersion" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:ImageButton id="iconVersionSave" class="iconSave" runat="server" imageUrl="Resources/iconSave.png" OnClientClick="asyncServerCall(document.getElementById('txtBoxVersion').value); return false;"&gt;&lt;/asp:ImageButton&gt; </code></pre> <p>JQUERY</p> <pre><code>function asyncServerCall(userData) { jQuery.ajax( { url: 'SurveyUpload.aspx/GetData', type: "POST", data: "{\"userData\":" + userData + "}", //Data to be sent to the server !!WARNING!! Field Name must match C# parameter name contentType: "application/json; charset=utf-8", //when sending data to the server dataType: "json", //The type of data that you're expecting back from the server. success: function (data) { alert('Success');} } }); } </code></pre> <p>C#</p> <pre><code>[WebMethod()] public static Boolean GetData(String userData) { System.Diagnostics.Debug.WriteLine(userData); //DEBUGGING return true; } </code></pre>
c# jquery asp.net
[0, 5, 9]
1,455,591
1,455,592
how does form authentication work in asp.net?
<p>Please any one help me... i am new in asp.net...</p>
c# asp.net
[0, 9]
723,849
723,850
How can I change the position of the input cursor in text fields to be right justified for arabic text
<p>Arabic writing starts from right to left but the blinking cursor is on the left side. is there a way to program it or configure it to be positioned on the right?</p>
javascript jquery
[3, 5]
5,048,464
5,048,465
Generating the correct content for a page without JS when using Hash tag.
<p>My page is currently loaded using a GET variable. when you arrive at the page, the GET vairable loads in a set of images, starting off with the GET variable one. You then browse these images and if you have JS enabled the Hash tag is updated to reflect the current image. If you dont have JS enabled then the page is regenerated with a new GET variable. </p> <p>the problem is if someone has JS enabled and moves to an image which they then want to send the URL link to a friend who doesn't have JS enabled, the friend will receive the incorrect link, as the GET variable will be used (which hasn't changed) and the # will be ignored because PHP can't read it.</p> <p>an example of this is on my site using this link </p> <pre><code>www.martynazoltaszek.com/artpages?nid=27#Safe Place </code></pre> <p>with JS enabled you arrive correctly (at Safe Place(based on #value)), without JS you arrive incorrectly (at #Dream (based on GET Variable))</p> <p><a href="http://www.martynazoltaszek.com/artpages?nid=27#Safe%20Place" rel="nofollow">Safe Place</a></p> <p><a href="http://www.martynazoltaszek.com/artpages?nid=27" rel="nofollow">Dream</a></p> <p>One obvious solution is to use the GET Variable instead of the # but this generates a Page refresh, which I'm trying to avoid. </p> <p>Any ideas of a solution here?</p> <p>And thanks for looking.</p>
php javascript
[2, 3]
1,416,016
1,416,017
How to get Contact Name through Phone Number
<p>I need to directly get the contact name (if registered in contact list) through the contact number. </p> <p>I can do the opposite (get number through name) with this code:</p> <pre><code>ContentResolver cr = getContentResolver(); Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI, null, "DISPLAY_NAME = '"someone"'", null, null); if (cursor.moveToFirst()) { String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID)); Cursor phones = cr.query(Phone.CONTENT_URI, null, Phone.CONTACT_ID + " = " + contactId, null, null); while (phones.moveToNext()) { String number = phones.getString(phones.getColumnIndex(Phone.NUMBER)); int type = phones.getInt(phones.getColumnIndex(Phone.TYPE)); Log.v("TAG3",number); ... } } } </code></pre> <p>But I can't honestly do the opposite. Can you please guys help?</p>
java android
[1, 4]
3,486,925
3,486,926
Invalid postback or callback argument
<p>I had web site I launched it on server and it worked well internal but when it being online this error appear in registration form</p> <blockquote> <p><code>&lt;error&gt;</code></p> <p>Invalid postback or callback argument. Event validation is enabled using <code>&lt;pages enableEventValidation="true"/&gt;</code> in configuration or <code>&lt;%@ Page EnableEventValidation="true" %&gt;</code> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the <code>ClientScriptManager.RegisterForEventValidation</code> method in order to register the postback or callback data for validation. </p> </blockquote>
c# asp.net
[0, 9]
993,667
993,668
update record without page refresh in javascript
<p>I have a span in which dropdown is taken here dropdown records are with checkbox option .</p> <p>If I select "All" checkbox &amp; click on save button then all checkboxes are selected using ajax therfore page is not refreshed but when I does not check any checkbox &amp; click on "Save" button I give a confirm box but when user press "Cancel" button on confirm box the the page is refreshed and data will not change, I want same but without this page is refreshed on cancel button</p>
php javascript
[2, 3]
683,593
683,594
Change text on hover not working
<p>I have a button to select images, it's default state is "Select Image", after an image is selected, the innerHTML of the button is changed to the filename. Now, what I want to do, is that if I hover over the button while it does not say "Select Image", I want it to say "Select a different image", and then onmouseout I want it to go back to what it was before (the image filename).</p> <p>I put together the following, but it's not working... I am open to JS and jQuery options.</p> <pre><code>window.addEventListener('load', function(event) { var btn = document.getElementById('file-button'); if (btn.innerHTML !== "Select Image") { var temp = btn.innerHTML; btn.onmouseover = btn.innerHTML = "Select a different image"; btn.onmouseout = btn.innerHTML = temp; } }); </code></pre> <p><strong>SOLUTION</strong> -- thanks to Ian</p> <pre><code>window.addEventListener('load', function(event) { var btn = document.getElementById('file-button'); btn.onmouseover = function () { if (this.innerHTML !== "Select Image") { var temp = this.innerHTML; this.innerHTML = "Select a different image"; } }; btn.onmouseout = function () { if (this.innerHTML !== "Select Image") { this.innerHTML = temp; } }; }); </code></pre>
javascript jquery
[3, 5]
2,577,762
2,577,763
Split String using delimiter that exists in the string
<p>I have a problem and I am wondering if there is any smart workaround.</p> <p>I need to pass a string through a socket to a web application. This string has three parts and I use the '|' as a delimiter to split at the receiving application into the three separate parts.</p> <p>The problem is that the '|' character can be a character in any of the 3 separate strings and when this occurs the whole splitting action distorts the strings.</p> <p>My question therefore is this: Is there a way to use a char/string as a delimiter in some text while this char/string itself might be in the text?</p>
c# java
[0, 1]
3,298,432
3,298,433
Why Dead Code Warning?
<p>i have: </p> <pre><code> if (Constants.IS_LIVE_MOD == false) account = Constants.OM_ACCOUNT; else account = "abc"; </code></pre> <p>i am getting a dead code warning on 'else'. Why is it so and wat is the solution for it. Please help.</p>
java android
[1, 4]
587,888
587,889
Difference using if/else vs just if before a return statement?
<p>I found it hard to search for this question. </p> <p>Will the else statement make any difference in the code below?</p> <pre><code>public string Test() { if (statement) return "a"; else return "b"; } </code></pre> <p>What's good practice in this case?</p>
c# asp.net
[0, 9]
4,804,788
4,804,789
jQuery: how to get file name from fileupload control?
<p>What I want to implement is by clicking "attach a file", a file browser will be open to let user choose a file. I use jQuery to set onclick function of "attach a file", and set the opacity of a fileuload control to be 0. So it is like display:none. But I don't know how to get the file that user selected from fileupload control. Even don't know what event should be capture in the process. I want to save the file in a hidden div, so I can use it in backend code. Any method?</p> <p>UPDATE: OK, I think it's better to describe my question more clearly. That is, how to get selected filename when you click open button in browser window? If in backend it is as easy as</p> <pre><code>string fileName=FileUpload1.PostedFile.FileName; </code></pre> <p>I want to get the fileName in client using jQuery. Since I will use same fileUpload control to select multiple files, I need to add the filename into a hidden div when the browser window closed. Any idea?</p>
jquery asp.net
[5, 9]