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
1,330,837
1,330,838
JQuery - Select menu - OnChange Reevaluate Value
<p>I have a select menu with a list of country names. I'm using jquery to get the value of the currently selected option. I'm appending this to the url of the remote source file that I am using to populate the autocomplete field. </p> <p>I need to update the value of the select menu within the function onchange of the country select menu. Currently it uses the value of the select menu when the page is first loaded. </p> <p>I'm trying to have it reevaluate the value onchange as to alter the results of the mysql query I am trying to run on the remote page.</p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { $('#from_country').val(""); $("#city").autocomplete({ source: "json-list.php?country=" + $( "#from_country" ).val(), minLength: 3, select: function(event, ui) { $('#from_zip').val(ui.item.postal_code); } }); }); &lt;/script&gt; &lt;select name="from_country" id="from_country" &gt; &lt;option value='US'&gt;United States&lt;/option&gt; &lt;option value='AU'&gt;Australia&lt;/option&gt; &lt;/select&gt; </code></pre>
javascript jquery
[3, 5]
402,491
402,492
jQuery OnClick not firing my event
<p>I have a jQuery which is like this:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $("#txtAgentName").click(function (event) { alert("I am ready!"); }); }); &lt;/script&gt; </code></pre> <p>What I am assuming that this should fire if I click on my textbox txtAgentName. But it is not happening. </p> <p>This is my textbox markup:</p> <pre><code> &lt;asp:TextBox ID="txtAgentName" runat="server" onclick="Event();"&gt;&lt;/asp:TextBox&gt; </code></pre> <p>However, when I am doing this on my Javascript:</p> <pre><code>function ShowTime() { alert('&lt;%= DateTime.Now.ToString() %&gt;'); } </code></pre> <p>and calling this ShowTime from my TextBox OnClick event, then it is firing up. Dont know what I am doing wrong here :(</p>
javascript jquery asp.net
[3, 5, 9]
3,538,064
3,538,065
webpages inside folder is not referring masterpages efforts
<p>I have some web pages(aspx pages)in my website project placed inside the folder and only those pages are not refering the concerned master pages.</p> <p>Whereas,pages placed outside the folder that is web pages which is under the roor folder is referring properly.</p> <p>The Page directive for web pages inside the folder and outside folder looks alike.</p> <p>For Eg:</p> <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/CDCMaster.master" AutoEventWireup="true" CodeFile="CDCReports.aspx.cs" Inherits="CDCReports" %&gt; </code></pre> <p>Can anyone suggest,how to resolve this?</p>
c# asp.net
[0, 9]
542,342
542,343
Get the file names from multiple file upload field
<p>I am trying to write an ajax uploader using Jquery. In the html I can write a multiple upload field like:</p> <pre><code>&lt;input type='file' multiple='multiple' name='files[]'&gt; </code></pre> <p>But, how can I get the values from this field? When I used:</p> <pre><code> $('input[type='file']').val(); </code></pre> <p>or </p> <pre><code> $('input[type='file']').attr('value'); </code></pre> <p>I only got the file name for the first file I selected to upload. Is there a way I can get an array containing all files?</p>
javascript jquery
[3, 5]
3,753,786
3,753,787
How to call aspx page including server side code in jquery load with out using jquery ajax method?
<p>I have a asp calendar control, it is included in update panel. When click on the date, SelectionChanged() event is not fired. Here is the code.</p> <p>ASPX - </p> <pre><code>&lt;asp:Calendar ID="Calendar" runat="server" BorderColor="green" NextPrevStyle-BackColor="green" BorderStyle="Solid" Height="414px" NextPrevFormat="FullMonth" TitleStyle-BackColor="green" DayStyle-Font-Underline="false" ShowGridLines="True" Width="567px" onvisiblemonthchanged="Calendar_VisibleMonthChanged" SelectedDate="02/23/2013 15:33:22" VisibleDate="2013-02-23" onselectionchanged="Calendar_SelectionChanged"&gt; &lt;DayStyle Font-Underline="True" /&gt; &lt;NextPrevStyle BackColor="green" /&gt; &lt;SelectedDayStyle BackColor="green" Font-Bold="True" ForeColor="Black" /&gt; &lt;SelectorStyle Font-Bold="True" /&gt; &lt;TitleStyle BackColor="green" Font-Underline="False" /&gt; &lt;TodayDayStyle BackColor="green" Font-Bold="True" ForeColor="White" /&gt; &lt;/asp:Calendar&gt; &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"&gt; &lt;ContentTemplate&gt; &lt;asp:Label ID="Label1" runat="server" Text="Label"&gt;&lt;/asp:Label&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID="Calendar" EventName="SelectionChanged" /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p>Server side code - </p> <pre><code>protected void Calendar_SelectionChanged(object sender, EventArgs e) { Label1.Text = CalEdairy.SelectedDate.ToShortDateString(); } </code></pre>
jquery asp.net
[5, 9]
3,759,981
3,759,982
How do I set my environment up for TopCoder?
<p>I tried out TopCoder today. While I liked the problem, the Java editor didn't work for me. The remote compiling time and the lack of unit tests also made it difficult to complete the task.</p> <p>I ended up coding the solution in Eclipse and the pasting it into the TopCoder window. I tried out EclipseCoder, but it didn't suit my needs either.</p> <p>What tools do you use and how do you hook up your development environment with TopCoder? How does TopCoder handle submissions, and is there any way to speed up the time it takes to process them?</p>
java c++
[1, 6]
4,082,552
4,082,553
How do I solve the JavaScript error: method XX is undefined?
<p>I am working on asp.net and jquery website , and when run browse the site an java script error has occurred . Visual studio debuger references that GetMainFrameUrl is undefined :</p> <pre><code>function EBNavigateComplete() { if (!GetMainFrameUrl()) { navCounter++; if (navCounter%100==0) { o.loadEmptyTerm(); counter = 0; } } else { if (o.pbNavigateComplete(GetMainFrameUrl())) { counter = 0; } } } </code></pre> <p>is there help please??? </p>
javascript asp.net jquery
[3, 9, 5]
50,592
50,593
show/hide loading message for html table
<p>How can I show a "loading" message when clicked/checked to expand table column(s), and hide the message as soon as its expended. <a href="http://jsfiddle.net/xamsw/" rel="nofollow">Here</a> is demo of what I've got so far. I can make the message appear, but can't hide it once the job is done. It seems useful when I'm trying to expand a large table, and I think it would be nice to let the user know that it's working. Any help/suggestion will be greatly appreciated.</p> <pre><code>$(document).ready(function() { $("#load").hide(); $("#check").live("click", function() { $("#load").show(); if ($("#check").is(":checked")) { $(".hidden").show(); } else { $(".hidden").hide(); } }); $("#load").hide(); }); </code></pre>
javascript jquery
[3, 5]
1,306,159
1,306,160
Load JavaScript dynamically
<p>I have a web page and a canvas with Google Maps embedded in it. I am using jQuery on this site.</p> <p>I want to load Google Maps API only if the user clicks on "Show me the map". Further, I want to take away the whole loading of the Google Maps from the header in order to improve my page performance.</p> <p>So I need to load JavaScript dynamically. What JavaScript function I can use? </p>
javascript jquery
[3, 5]
5,267,210
5,267,211
How did the guys at DeviantArt implemented the Shadowing in their images?
<p>I just want to know how the guys at <a href="http://browse.deviantart.com/?order=24&amp;offset=24" rel="nofollow">DeviantArt.com</a> implemented the shadowing on each images.</p> <p>If you look at the thumbnails, you'll see that the images are shadowed a bit. I think they done it with Javascript because when I turned off my Javascript the shadows were gone. And they are also using jQuery btw.</p>
javascript jquery
[3, 5]
5,680,273
5,680,274
How to set a var to true or false using .val()
<p>I have a textbox, I need to check if the textbox is empty and set a variable accordingly to true or false.</p> <p>my code at the moment print the value of the textbox.</p> <pre><code>var isDateTimEndEmpty = dateTimeEnd.val() == null ? true : false; </code></pre> <p>what am I doing wrong here?</p>
javascript jquery
[3, 5]
9,018
9,019
Use jQuery to set background color with value from database
<p>I'm looking for an example of how I would read a value from a database and use it in a jQuery script to set the background color of a control. I'm still learning jQuery, and it's not clear to me how to get a value from the database. I'm using ASP.NET MVC, and my form is already pulling the value - do I need to put it in a hidden field and use it that way, or is there a better/different way to communicate the color value to jQuery?</p>
asp.net javascript jquery
[9, 3, 5]
1,329,966
1,329,967
Highlight the selected row in data list
<p>I have a DataList on ym web page, from which a user can choose a certain option within the DataList row.</p> <p>I use the <code>ItemCommand</code> of DataList for this. Actually, I want to highlight the selected row when the user clicks on the item in the row.</p> <pre><code>&lt;ItemTemplate&gt; &lt;tr&gt; &lt;td style="text-align:center"&gt;&lt;asp:LinkButton ID="Item" Text='&lt;%#Eval("Item")%&gt;' CommandName="select" runat="server" /&gt; &lt;br /&gt;&lt;/td&gt; &lt;td style="text-align:center"&gt;&lt;asp:Label ID="lbQuery" Text='&lt;%#Eval("Query")%&gt;' runat="server" /&gt;&lt;br /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/ItemTemplate&gt; </code></pre> <p>As shown above, the user can click on the LinkButton to choose an item. How do I highlight the corresponding row or only the cell?</p>
c# asp.net
[0, 9]
5,789,470
5,789,471
How to remove all items except the first item from dropdownlist in C#?
<p>I need to clear drpAddressTypes dropdown values except the first item and bind again that dropdownlist. </p> <pre><code>drpAddressTypes.Items.Clear(); var lstAddressTypes = repository.GetAddressTypes(userId); if (lstAddressTypes != null) { foreach (var item in lstAddressTypes) { var addressType = new ListItem(item, item); drpAddressType.Items.Add(addressType); } } </code></pre> <p>When I am using <strong><em>drpAddressTypes.Items.Clear();</em></strong> it is clearing all items. How can I clear all items except the first item.</p> <p>Thanks in advance. :)</p>
c# asp.net
[0, 9]
1,834,325
1,834,326
How to perform jquery actions on elements not yet visible
<p>I have a textarea in a div that I need to call a jquery function on to activate my rich textbox. The div is initially hidden and becomes visible through a button click on the server side:</p> <pre><code>&lt;div id="RichTextDiv" style="display:none"&gt; &lt;textarea id="RichText" /&gt; &lt;/div&gt; &lt;script type="text/javascript" language="javascript"&gt; $(document).ready(function () { $("#RichText").markItUp(mySettings); } &lt;/script&gt; </code></pre> <p>The above code doesn't work because RichTextDiv is not visible during page load. I need to perform the markItUp() action on RichText as soon as it becomes visible. How can this be achieved in jquery?</p> <p>Thanks...</p>
javascript jquery
[3, 5]
354,720
354,721
How would I echo selected form values in an HTML element (like a p tag)?
<p>Is there a way to show/echo form values in an HTML element as the user fills out a form?</p> <p>I am creating a giant search form and would like to add a helpful area by the submit button that reminds the user of what they are about to search for.</p>
php javascript jquery
[2, 3, 5]
746,669
746,670
jquery select text
<pre><code>&lt;div&gt;select this&lt;strong&gt;dfdfdf&lt;/strong&gt;&lt;/div&gt; &lt;div&gt;&lt;span&gt;something&lt;/span&gt;select this&lt;strong&gt;dfdfdf&lt;/strong&gt;&lt;/div&gt; </code></pre> <p>how do i use jquery or just javascript to select the value of the div tag but not include any child elements</p> <pre><code>//output select this </code></pre>
javascript jquery
[3, 5]
1,262,630
1,262,631
Get the next element (not necessarily a sibling) which matches a selector in jQuery
<p>I have this markup</p> <pre><code>&lt;a class="foo"&gt;&lt;/a&gt; &lt;div&gt; &lt;span class="foo"&gt;&lt;/span&gt; &lt;ul&gt; &lt;li class="foo"&gt;&lt;/li&gt; &lt;/ul&gt; &lt;em class="foo"&gt;&lt;/em&gt; &lt;/div&gt; &lt;div class="foo"&gt;&lt;/div&gt; </code></pre> <p>I'll have a click handler attached to <code>.foo</code>. I want to fetch the next element in the DOM tree that has the same class.</p> <p>I've made a <a href="http://jsfiddle.net/Dogbert/tXxng/" rel="nofollow">jsFiddle</a> with the markup and js code, if you want to try out something.</p> <p>I could make an array of all .foo elements, and then run loops to find the current index, and return the next index, but I'm sure there's a better solution. Also, that solution won't work if I add elements dynamically to the page (which I will).</p> <p>How should I proceed with this?</p>
javascript jquery
[3, 5]
684,232
684,233
highlight selected tab
<p>I have searched but could not find answer to my satisfaction so I have a header file, which is being included on top of every page and part of the header is a menu with 3 tabs, when user click on tab browser take them to that page (working fine), what i want is, that what ever tab user clicks to be highlighted(diff back color) when that page is loaded.</p> <p>Here is html :</p> <pre><code>&lt;div id="top-choicebar"&gt; &lt;ul id="topmenu"&gt; &lt;li&gt;&lt;a href="daily.php" class="ww" &gt;Daily&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt; href="weekly.php" class="ww"&gt;Weekly&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt; href="monthly.php" class="ww"&gt;Monthly&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div id="event-menu"&gt; </code></pre> <p>New to php and jquery ... any help will be greatly appriciated </p>
php jquery
[2, 5]
5,562,126
5,562,127
ASP.net page_load doesn't detect session
<p>I have a problem with using <code>session</code> variable in the <code>page_load</code>. I have a page (<code>members.aspx</code>) which is a members area. </p> <p>If the user isn't <code>logged</code> in, it will display a form asking them to login. The form submits their details, checks if ok then sets <code>session</code> variables if <code>OK</code>. It then reloads the page.</p> <p>So if the user has authenticated correctly, it sets <code>Session["memberLoggedIn"] = true</code>. My <code>page_load</code> function then looks like this</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (Convert.ToBoolean(Session["memberLoggedIn"]) == true) { Response.Write("OK"); } } </code></pre> <p>There is more code, but essentially, the "OK" should be written. However, it doesn't appear. Even though the <code>session</code> IS set. If I go to the page directly it will then show. It's just for the reloading of the members page from the initial login which stops it. </p> <p>any ideas?!</p> <p>====================== the code to set the session is</p> <pre><code>if (logindetails.Count &gt; 0) { System.Data.DataRow details = logindetails[0]; Session["memberLoggedIn"] = true; } </code></pre> <p>I then just check if <code>(Convert.ToBoolean(Session["memberLoggedIn"]) == true)</code> on all my pages. To be honest it doesn't seem that reliable and I Think sometimes I need to understand the order in which pages are loaded as when I destroy the session on the log out page, some parts still show the logged in features! (but that's another story....)</p>
c# asp.net
[0, 9]
3,575,927
3,575,928
What is the relation between a content page and master page in terms of OOP?
<p>What are class relations? Can anybody help to explain the relationship between a content page and a master page in terms of OOP?</p>
c# asp.net
[0, 9]
2,011,051
2,011,052
Javascript function not firing
<p>I am trying to fire a function every 60 seconds.</p> <p>Here is my current code:</p> <pre><code>&lt;script&gt; $(document).ready(function() { setInterval(alertme, 600000); }); function alertme() { alert('1 minute has passed'); } &lt;/script&gt; </code></pre> <p>For some reason the function alertme is not being called.</p> <p>Any ideas why?</p>
javascript jquery
[3, 5]
95,238
95,239
C# to C++ 'Gotchas'
<p>I have been developing a project that I absolutely must develop part-way in C++. I need develop a wrapper and expose some C++ functionality into my C# app. I have been a C# engineer since the near-beginning of .NET, and have had very little experience in C++. It still looks very foreign to me when attempting to understand the syntax.</p> <p>Is there anything that is going to knock me off my feet that would prevent me from just picking up C++ and going for it?</p>
c# c++
[0, 6]
2,546,482
2,546,483
<br/> is stored in database
<p>I am sending a mail with the selected checkbox items in emailbody. I wanted a line break after each checked items. I get a line break which i needed in email body but my problem is while it is stored in database, it is storing with <code>br</code> for example: </p> <pre><code>apple &lt;br&gt;orange &lt;br&gt; </code></pre> <p>So is there a way to give line break without br being stored in the database?</p> <pre><code>protected void check1_SelectedIndexChanged(object sender, EventArgs e) { for (int i = 0; i &lt; check1.Items.Count ;i++ ) { if (check1.Items[i].Selected) { comment.Text = "\u2022 " + check1.Items[i].Text + "&lt;br/&gt;" + comment.Text; } } } </code></pre>
c# asp.net
[0, 9]
4,882,997
4,882,998
Function "remembers" value problem
<p>This is a simplified partial version of my code to demonstrate the issue:</p> <pre><code>function testFunc(){ var randomNum = Math.floor( Math.random() * 100 ); if( !flag ){ addEvents(); flag = true; }; function checkNumber(){ alert(randomNum) } function addEvents(){ $("#someElement").click(function(e){ checkNumber() }); } } </code></pre> <p>I want to bind the click event only ONCE for this element, but use outside variable that changes from someplace else. thing is, this always alerts randomNum with the initial value it had when the bind first took place! </p> <p>why doesn't it "reads" the variable everytime click is triggered?</p>
javascript jquery
[3, 5]
3,726,521
3,726,522
How to check/uncheck radio button on click?
<p>I want to be able to uncheck a radio button by clicking on it.</p> <p>So, if a radio button is unchecked, I want to check it, if it is checked, I want to uncheck it.</p> <p>This does not work:</p> <pre><code>$('input[type=radio]:checked').click(function(){ $(this).attr('checked', false); }); </code></pre> <p>I am not able to check a radio button now.</p>
javascript jquery
[3, 5]
5,842,370
5,842,371
Javascript on lost focus event for tab out
<p>I have a javascript function like this:</p> <pre><code>ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "watermark", "function WaterMark(txtWaterMark, event, text) {if(event.type == 'keyup') {var charCode; if (event.charCode) { charCode = event.charCode;} else { charCode = event.keyCode; } if(charCode == 9 &amp;&amp; txtWaterMark.value.length == 0) txtWaterMark.value = 'Pakistan';} if (txtWaterMark.value.length &gt; 0 &amp;&amp; event.type == 'mouseover') { txtWaterMark.style.color = '#c6c1c1'; } if (txtWaterMark.value.length &gt; 0 &amp;&amp; event.type == 'mouseout') { txtWaterMark.style.color = 'gray';} if (txtWaterMark.value.length == 0 &amp;&amp; event.type == 'mouseout') {txtWaterMark.value = text; } if (event.type == 'focus') {txtWaterMark.style.color = 'gray'; if (txtWaterMark.value == text) { txtWaterMark.value = ''; } }}", true); </code></pre> <p>and I am calling it like this:</p> <pre><code> &lt;asp:TextBox ID="txtFirstName" runat="server" Width="110px" Text="First Name." ForeColor="Gray" onmouseover="WaterMark(this, event,'First Name.');" onmouseout="WaterMark(this, event,'First Name.');" onfocus="WaterMark(this, event,'First Name.');" onkeyup="WaterMark(this, event,'First Name.');" ToolTip="First Name." ValidationGroup="CheckoutConfirm"&gt;&lt;/asp:TextBox&gt; </code></pre> <p>I am using on keyup event so that if user press tab key to move between textboxes, then a text is added to the text box, but on keyup is fired when i focus is inside the textbox after pressing tab. I want some event like 'on lost focus' I tried on blur but no benefit.</p>
c# javascript asp.net
[0, 3, 9]
2,861,678
2,861,679
How to use this two ArrayAdapter constructor
<p>When I read the API doc, I found 2 weird constructor in ArrayAdapter class:</p> <pre><code>public ArrayAdapter (Context context, int textViewResourceId) public ArrayAdapter (Context context, int resource, int textViewResourceId) </code></pre> <p>There is no List or Array to insert into this 2 public constructor (the rest has), then what are the purpose to have these 2 constructor? How to use them?</p>
java android
[1, 4]
1,775,614
1,775,615
Java and Python
<p>I am trying to open a java link I have saved on my folder on my desktop. I can't get it to find the file. The java address is x:\green\Adam\FILEJAR.jar. This is an executable JAR file I want to open it and have it on my desktop, just open it and have it run as normal for the Java link. Want Python just to open it.</p> <pre><code>import subprocess run="x:\green\Adam\FILEJAR.jar" proc=subprocess.Popen(run) </code></pre> <p>I get this....</p> <pre><code>Traceback (most recent call last): File "C:/Python32/test3", line 3, in &lt;module&gt; proc=subprocess.Popen(run) File "C:\Python32\lib\subprocess.py", line 741, in __init__ restore_signals, start_new_session) File "C:\Python32\lib\subprocess.py", line 960, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified </code></pre> <p>What am I doing wrong, why can't it find the file?</p>
java python
[1, 7]
590,313
590,314
Converting a line of Java to C#
<p>Can someone explain to me what this line below in Java means and how would I convert it to C#? Thanks.</p> <pre><code>private class X extends Y&lt;Void, Object, Void&gt; { ....... } </code></pre>
c# java
[0, 1]
1,953,909
1,953,910
Trouble with using layout-large with 160dpi large screen emulator (Android)
<p>I'm having trouble getting a 160dpi, 480x800 emulator to display the contents of my main.xml in a layout-large folder. It seems to still be using the main.xml in my regular layout folder. Are there any common reasons it wouldn't be reading this file correctly?</p> <p>To put it into context, I have a .png called "back_large" in my drawable-mdpi folder. I also have a .png called "back." Both are 160dpi, but "back_large" is roughly twice the size of "back." In the main.xml within the layout-large folder, I have an ImageView that points to "back_large". In the main.xml within the regular layout folder, I have an ImageView that points to "back." When I run both the Normal- and Large-sized 160dpi emulators, they both pick up "back," which leads me to believe layout-large is not being implemented properly. I just don't know why.</p> <p>Thanks.</p>
java android
[1, 4]
1,942,908
1,942,909
How do I perform chaining of asynchronous functions in Javascript with jQuery
<p>I'm fiddling with some Javascript using jQuery. </p> <p>I have a call to a data service which loads up a collection of 'notes'. For each 'note' I need to make a further call to get 'tags' for each of these notes. The code looks like this:</p> <pre><code> $.when(datacontext.notes.getData(dataOptions(force))) .done( function () { //Once the notes are loaded you need to go through each of the notes, and load the tags. _.each(notes, function (note) { var noteEntitySet = datacontext.noteTagsFactory(note.id()); noteEntitySet.getData(note.tags) }); } ) .always(//Do some cleanup); </code></pre> <p>Now clearly the 'always' chain gets called only once the 'tag' getting calls have been initiated. But I want to callback to some function when all of the calls have returned.</p> <p>I'm struggling to work out how I can create this asynchronous chain in Javascript. Can anyone help?</p>
javascript jquery
[3, 5]
2,804,047
2,804,048
Jquery .height() Inconsistent Results on Page Reload
<p>I'd like to adjust the margin of container divs and the padding for links within a list so that the last line-item is as close as possible to the bottom of a variably sized image next to it. The function works exactly as I had expected when the page loads the first time. </p> <p>However, if the page is reloaded, the .height() and .outerHeight() functions return different values than they originally had. They also return different values depending on the browser, even though the heights are explicitly stated in an external style sheet.</p> <pre><code>$(document).ready(function(){ var headingSize = 2*($('div.title').outerHeight(true) + $('div.hint').outerHeight(true)); var adjHeight = $('#image img').height() + 70; var rowCount = $('div#options ul li').length; var rowHeight = $('div#options ul li a').height(); var padding = (((adjHeight - headingSize) / rowCount) - rowHeight)/2; if(padding &lt; 4){ padding = 4; } var margin = (rowHeight + 2*padding)/2; if(margin &lt; 10){ margin = 10; } $('div.options').css({'marginTop': margin}); $('div#options ul li a').css({'paddingTop' : padding, 'paddingBottom' : padding}); }); </code></pre> <p>Because it works on first load, I can't imagine what could be wrong with the script. Why would it be doing this? What am I missing?</p> <p>Thanks!</p> <p>-fucla</p>
javascript jquery
[3, 5]
2,646,157
2,646,158
Dropdown selection navigation to different page with dropdown values; Asp.Net + Javascript
<p>I want to access drop down menu's variable in java script on change event, here is my code</p> <pre><code> &lt;asp:DropDownList ID="DropDownList1" runat="server" onchange="document.location.href = url_Lookbook;" &gt; &lt;asp:ListItem Value="0"&gt;hello&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="1"&gt;world&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt; </code></pre> <p>here is the script coding:</p> <pre><code>&lt;script type="text/javascript"&gt; var url_Lookbook = "http://microsoft.com"; &lt;/script&gt; </code></pre> <p>My question is how do I pass down value=0 or value = 1 to different page, any help is appreciated.</p>
asp.net javascript
[9, 3]
5,469,776
5,469,777
SimpleCart(js) Quantity limit
<p>I'm using simpleCart(js) to integrate shopping cart into my WordPress site. </p> <p>I am selling articles and I really don't need quantity because obviously nobody wants to purchase 2 same articles and I want to prevent users from adding more than 1 article to cart.</p> <p>So the question is: how to prevent adding same item more than once ?</p> <p>I just can't find a solution to this on my own, so please help me (I am OK with any method as long as it works)! </p> <p>Thanks !</p> <p>P.S. This is very poorly documented, but the script is very light <a href="http://simplecartjs.com/documentation.html" rel="nofollow">CLICK HERE FOR LINK</a></p>
javascript jquery
[3, 5]
2,658,924
2,658,925
On click event of image button
<p>I have a problem that when I click on the image button instead of redirect me to the corresponding page, it will just redirect back to the same page. </p> <p>This is the code in asp;</p> <pre><code> &lt;asp:ImageButton ID="header1" src="Resources/Icons/Header1.jpg" runat="server" /&gt; </code></pre> <p>And this is in my page load in the code behind;</p> <pre><code> header1.Attributes.Add("onclick", "~/ChildSelection.aspx"); </code></pre> <p>Any ideas why this is happening?</p>
c# asp.net
[0, 9]
1,359,101
1,359,102
jQuery Remove specific span based on id
<p>I want to be able to remove only spans which has an id that stars with the key word "junk_"</p> <p>for example if I have </p> <pre><code>&lt;span id="junk_8345"&gt;A&lt;/span&gt; &lt;span id="valid_2972"&gt;B&lt;/span&gt; &lt;span id="junk_9249"&gt;C&lt;/span&gt; </code></pre> <p>The output should look like</p> <pre><code>&lt;span id="valid_2972"&gt;B&lt;/span&gt; </code></pre> <p>I've tried to use</p> <pre><code>$("span:has(junk)").remove(); </code></pre> <p>but it does not seem to work. I'm open to use regex expression with the replace function if I can accomplish the same goal. Any help would be greatly appreciated!</p>
javascript jquery
[3, 5]
4,436,911
4,436,912
Using beforeunload and unload together?
<p>I heard that Opera doesn't work with beforeunload. And some earlier versions of IE also. So how can I use these together ? If I use below, it runs 2 times (They all work) in Firefox.</p> <pre><code>$(window).bind('beforeunload', function () { }); $(window).unload(function () { }); </code></pre>
javascript jquery
[3, 5]
5,431,034
5,431,035
Getting value in a TextBox after paste
<p>I have a scenario like this where i have dynamically generated textboxes. I have to validate the textbox for max 15 characters and restricting special characters.</p> <p>Below is the code by which in document.ready() i am generating the textboxes and binding paste events to them.</p> <pre><code>$(document).ready(function(){ //Generate textboxes..i have some logic by which i am generating //textboxes on the fly and giving textboxes a class flagText GenerateFlagBoxes(); //i am binding the textboxes by class names var $flagArea = $('.flagText'); $flagArea.bind('paste', function () { var element = this; setTimeout(function () { alert($(element).val()); }, 100); }); }); </code></pre> <p>But this is not working.The alert i provided is not coming.I think that the controls are created in the ready event can't be bound to listen events.Am i wrong.I don't know why it is happening. I want some suggestions.</p> <p>Thanks in advance.</p> <p>This fiddle is working.I am checking , i might be wrong some where.I will update where i am wrong;</p> <p><a href="http://jsfiddle.net/mnsscorp/8QFGE/1/" rel="nofollow">http://jsfiddle.net/mnsscorp/8QFGE/1/</a></p> <p>Yes now working .In the document ready i am able to bind paste event.I was wrong some where in the code. :) Thanks for suggestions.</p>
javascript jquery
[3, 5]
2,032,893
2,032,894
How can I clone everything in a div without cloning the outer div?
<p>I'd like to use <code>jQuery.clone()</code> but I only want to copy the inner elements, not the element itself. If needed I can wrap the contents but I was hoping to find another way to just clone the inner html. </p> <p>Thanks. </p>
javascript jquery
[3, 5]
5,467,502
5,467,503
Why call the superclass method when you override the existing method?
<p>I'm new to JAVA and OOP in general. In this very simple code, why I have to call the onCreate method from the superclass? isn't it inherited from the superclass? I know that a constructor method is not inherited to the child class and if you want to call the constructor you must invoke the superclass. Is super.onCreate a constructor call? Doesn't the constructor name must be the same with the class name ? I know this is a silly question and thank you for your responses.</p> <pre><code>import android.app.Activity; public class MainActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } </code></pre>
java android
[1, 4]
395,363
395,364
For Each loop in JavaScript are making me mad
<p>My problem is pretty simple. I'm trying to update a list of objects (localDatz) with another list of objects received after an AJAX request (data). So It consists in two loops.. But when I try to update two objects, only one object is updated. There is something I really don't understand. Any help ?</p> <pre><code> // fetch the localdata first var localData = getAll(); // Loop through my 'localData' $.each(localData.features, function(index,feature){ // Loop through the new data that are received $.each(data.features, function(){ newFeature = this; if (feature.properties.id==newFeature.properties.id){ // i think here is the problem..but can't figure out how to fix it // I remove the old feature and push the new one localData.features.splice(index,1); localData.features.push(newFeature); } }); }); </code></pre>
javascript jquery
[3, 5]
4,766,902
4,766,903
What's the difference between $.add and $.append JQuery
<p>I was wondering and couldn't get any best documentation that what's the difference between $.add and $.append when we have single element to add or append to a container.</p> <p>Thanks in Advance</p>
javascript jquery
[3, 5]
2,341,213
2,341,214
jQuery Sparkline Boxplots - What does it expect for values array?
<p>I'm trying to wrap my head around the values that jQuery Sparklines expects in the values array for box plots. It doesn't seem to expect raw statistical values, but rather min value, 1st quartile value, median value, 3rd quartile value, and max value as the values array. Is that so? I went through the minified JavaScript and that seems to be the case, but I'm just not making full sense of it so wanted to double check with anyone that's worked with the Sparlines boxplots. </p> <p>I have the option of showing outliers disabled. I also let the boxplots determine the chart min and max values. The code to construct my boxplot is: </p> <pre><code>$('#ctl00_MainBodyContentPlaceHolder_rptrMultipleChoiceDimensionResult_ctl00_lblBoxPlot') .sparkline( [3.13, 3.2925, 3.375, 3.3975, 3.53], { type: 'box', targetColor: '#fff', boxLineColor: '#777', boxFillColor: '#ccc', whiskerColor: '#777', medianColor: '#000', lineColor: '#777', width: '500px', height: '30px', showOutliers: false, rangeColors: ['#eee', '#bbb', '#888', '#000'] } ); </code></pre> <p>From what I've gathered, when showOutliers is disabled the API expects the values array to be passed as min value, 1st quartile value, median value, 3rd quartile value, and max value. Just wanted to confirm that that is indeed the case, if anyone has used the component before.</p> <p>The documentation doesn't really describe what it expects for the values either: <a href="http://omnipotent.net/jquery.sparkline/" rel="nofollow">http://omnipotent.net/jquery.sparkline/</a>. </p> <p>Thanks</p>
javascript jquery
[3, 5]
609,441
609,442
canvas.drawText question
<p>i am drawing text in my custom view in android using canvas.drawtext. i need to change back color, and want text right aligned. for example i want to print the text in a 10, 10, 100, 20 rectangle of color yellow and text color red and right aligned. how can i do that ?</p>
java android
[1, 4]
501,859
501,860
JQuery Add Value of 2 input boxes to a third
<p>I have 3 input boxes in my page.</p> <p>What I need to do is Onchange add the values of Input box A and Input Box B with a comma separating the two values.</p> <p>For example:</p> <pre><code>Input A = 'MyValueA' Input B = 'MyValueB' Result = 'MyValueA , MyValueB' </code></pre>
javascript jquery
[3, 5]
1,403,325
1,403,326
Save HTML from one page to another page onclick
<p>I know I could use a php include to read the html from a file on the server but how do I write a file to the server once the user clicks to navigate to the next page?</p> <p>I have a div that is changed by jquery on the 1rst page. I want to read the changed div when the user clicks to go to the 2nd page and write the html from the 1rst page to the 2nd page. </p>
php jquery
[2, 5]
1,348,507
1,348,508
Why a class in App_Code/BLL is not accessible in pages?
<p>Hi I have a class in folder App_Code/BLL/Countries.cs ,which is a public class. But when I tried to access the class in a ASP.NET page like:</p> <pre><code>Countries MyCountries = new Countries(); </code></pre> <p>its showing error:</p> <p>"The type or namespace name 'Countries' could not be found (are you missing a using directive or an assembly reference?)"</p>
c# asp.net
[0, 9]
1,232,177
1,232,178
How do I slide down one tab and close any others that are open (JQuery/JavaScript)
<p>Here is my code:</p> <pre><code>&lt;script&gt; $(document).ready(function () { $('#t1').click(function() { $('#p1').slideToggle('slow'); $("#pm1, #pm1h").toggle(0); removeContainer(); $("#load1").load('file', showPlayer); }); $('#t2').click(function() { $('#p2').slideToggle('slow'); $("#pm2, #pm2h").toggle(0); removeContainer(); $("#load2").load('file', showPlayer); }); $('#t3').click(function() { $('#p3').slideToggle('slow'); $("#pm3, #pm3h").toggle(0); removeContainer(); $("#load3").load('file', showPlayer); }); $('#t4').click(function() { $('#p4').slideToggle('slow'); $("#pm4, #pm4h").toggle(0); removeContainer(); $("#load4").load('file', showPlayer); }); }); &lt;/script&gt; </code></pre> <p>Alright so what I want to do is when someone clicks on t1,t2,t3 or t4, all the other tabs that are in the slide down position will slide up (For example if t3 and t4 are down, once I click on t1 the t3 and t4 will slide up and then the t1 will slide down). This will make it so that only one tab can be open at a time.</p> <p>I also need the proper toggle to correspond with the position of the tab. By default all tabs are hidden and all have a plus sign but when you click on any tab it will expand and have a negative sign. I this to stay true.</p> <p>Can anyone help or need more clarification?</p>
javascript jquery
[3, 5]
4,585,345
4,585,346
not able to pass value to javascript function from jquery's success
<p>I am calling javascript function filename in success of jquery as below , but i am not able to get p in javascript </p> <pre><code> success: function(result) { var htmlString = [result]; for (i = 0; i &lt; htmlString.length; i++) { var p = htmlString[i].Number; $('#MyGrid tbody').append('&lt;tr&gt;&lt;td&gt;&lt;a rel="' + p + '" href="#" onclick="filename(p);" class="filePreview"&gt;&lt;/a&gt;&lt;/tr&gt;'); } } </code></pre> <p>how to get p in filename?</p> <p>thanks,</p> <p>michaeld</p>
javascript jquery
[3, 5]
860,669
860,670
Getting ANDROID_ID Trying to understand the java
<p>I'm still new to programming/Java/Android so I'm trying to understand everything I do and trying to figure out how to properly read the reference section of developer.android.com and so maybe one of you guys can help me out. Thanks in advance</p> <p>These calls get me the ANDROID_ID. They both give me the same output. I just do not understand how the Second Way works. It shouldn't work in my opinion. </p> <h2>First way</h2> <pre><code>AndroidID = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); </code></pre> <h2>Second way</h2> <pre><code>AndroidID = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID); </code></pre> <p>Why does it work like that?</p> <p>I used <a href="http://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID" rel="nofollow">this</a> to find the getString() method. I get the ANDROID_ID. It works perfectly using both calls, but I want to know why it works the second way.</p>
java android
[1, 4]
2,910,647
2,910,648
What is the best way to transfer files between an ASP.NET site and a PHP site?
<p>I have a web-site, based on ASP.NET, hosted at provider x. For various reasons, I would like to keep all image files, uploaded by the users, on another site hosted a provider y. Provider y is PHP based.</p> <p>What would be the best way to transfer the images from my ASP.NET site on x to the "PHP Store" at provider y? The images come in on the ASP.NET site via web-services and "manual" file uploads.</p> <p>It is only a "problem" when storing the images, on read the image urls will of course just point to the location on y.</p> <p>I guess the only way is to create a web-service in PHP that I can call at y with my image from x, but are there other better ways? And if not does, anyone know a link to an example of the required ASP.NET and PHP code for that web-service setup?</p>
php asp.net
[2, 9]
4,820,351
4,820,352
Java Script validation
<p>Am validating a form for empty check.</p> <p>All fields works fine.</p> <p>I have a dropdown when i select some value from dropdown some fields will be disabled. onchanging the dropdown value someother fields will be disabled. </p> <p>Now am struck in validating the fields which are getting disabled and enabled.</p> <pre><code>if((document.form1.varAuctionTime.disabled = false) &amp;&amp; (document.form1.varAuctionTime.value == "")) </code></pre> <p>I used above code but it is enabling the fields.</p> <p>can anybody help me out.</p>
php javascript
[2, 3]
2,131,786
2,131,787
How to add touch events to a class?.. prefereably through jquery
<p>How can you do something like the following?</p> <pre><code>$('.myDivs').ontouchstart(function(){ alert('touch'); }) </code></pre> <p>the only way I appear to be able to implement touch events is using javascript.. like so </p> <pre><code>document.getElementById('singleDiv').addEventListener("touchstart",touchHandler, false); </code></pre> <p>However I would like to implement this to a class, rather than an id... therefore is there a way to do it using jquery like the above example?....</p> <p>I have found the answer:</p> <pre><code>$('.myDivs').bind('touchstart', function (event) { alert('touch');}); </code></pre> <p>Kind regards J</p>
javascript jquery
[3, 5]
5,242,110
5,242,111
jquery post on document ready
<p>All i want is, a data will pass into this php file: check.php and this php file will pass data into that function when the page is ready. this is just an expirement.</p> <p>ok I have this code:</p> <pre><code>$(document).ready(function() { $.post("check.php", { name: "log" }, function(data) { if (data === "yes") { alert('has been login'); } else { alert('has not login'); } }); });​ </code></pre> <p>and i have this php code ("check.php") where the jquery post will pass the data into. ​</p> <pre><code>&lt;? //check $chk = $_POST['name']; if (isset($chk === "log")) { if (isset($_COOKIE['admin'])) { if ($_COOKIE['admin'] === "login") { echo "yes"; } } else { echo "no"; } } else { echo "no"; } ?&gt; </code></pre> <p>but nothing happen, even i change the whole code in check.php into: "echo "yes";" theres nothing happen, i guess, its either there is no data receive or there is no data pass. Hope someone could help me into this simple and cute problem that im stuck with. thank you in advance</p>
php javascript jquery
[2, 3, 5]
825,397
825,398
How to reset a fragment's view?
<p>If I have a fragment where I dynamically set a view with onCreateView(), how would I go about calling it again? </p> <p>I want to implement some kind of "refresh" where the view changes based on the JSON response. I tried making a new function that does midnightSV.removeAllViews(), but how can I call onCreateView() again?</p>
java android
[1, 4]
4,316,806
4,316,807
javascript windows "Yes/No" asking twice?
<p>I am using below code for javascript window "Yes/No". It is firing twice. Is there any way I can avoid this? Or use any other code?. I need this code behind.</p> <pre><code>Response.Write("&lt;script language='javascript'&gt; { self.close() }&lt;/script&gt;"); </code></pre>
asp.net javascript
[9, 3]
5,815,238
5,815,239
javascript code for .emtpy() function
<p>i need code for clear the contents of the div using.</p> <p>i found some j-quey code for the clear contents the div like: <code>$('#masterdiv').empty();</code> is there any similar JavaScript code for this j-query code</p>
javascript jquery
[3, 5]
2,533,474
2,533,475
Changing div text with jquery
<p>When I click on a div, I would like to change the text inside it to <code>New Text</code>. </p> <p>How can I do that with jquery</p> <pre><code>$('#mydiv').???? </code></pre>
javascript jquery
[3, 5]
1,626,708
1,626,709
error after submit a form
<p>i have a php like this:</p> <pre><code>&lt;?php ...... ?&gt; &lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;div id="content"&gt; &lt;form id="myform" name="myform"&gt; &lt;?php include_once("ronny.php"); ?&gt; ..... &lt;input type="button" value="Save" id="Save" name="Save" onclick="if(check123()==true){document.myform.submit()}" /&gt; &lt;/div&gt; &lt;/form&gt; ... </code></pre> <p>Now, in this case after i click on save i have an error <code>document.myform.submit is not a function</code> in firebug and in IE the error is <code>Object doesn't support this property or method</code>. If i delete the <code>&lt;?php include_once("ronny.php"); ?&gt;</code> everything is ok.</p> <p>ronny.php is like that:</p> <pre><code>&lt;?php if(......)){ ?&gt; &lt;div&gt;&lt;/div&gt; &lt;div&gt;&lt;/div&gt; &lt;SCRIPT LANGUAGE="JavaScript"&gt; .... &lt;/SCRIPT&gt; &lt;?php } ?&gt; </code></pre> <p>If i put the include in the php at the top it's ok as well.</p> <p>thank you!</p>
php javascript
[2, 3]
4,463,871
4,463,872
How to split an audio file into frames ??? in C#
<p>i want to split a wave file(.wav) into frames of 1 second or for a fixed time period. How can i do it using C# or Java. Can any one help me out for this with some code examples or some related links regarding this.</p>
c# java
[0, 1]
2,161,418
2,161,419
ASP.NET equivalent of the java code
<p>Can anyone take time to convert this into ASP.NET?Please..</p> <pre><code>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String content = request.getParameter("content"); response.setHeader("Content-type", "text/calendar"); response.setHeader("Content-length", String.valueOf(content.length())); response.setHeader("Content-disposition", "attachment; filename=event.ics"); response.getOutputStream().write(content.getBytes()); } </code></pre>
java asp.net
[1, 9]
3,052,793
3,052,794
how to find control of dropdownlist inside a datalist
<p>I have a DataList and inside it I have a DropDownList:</p> <pre><code> &lt;asp:DataList ID="dlconfigureItem" runat="server"&gt; &lt;ItemTemplate&gt; &lt;asp:DropDownList CssClass="config-select" ID="ddlitem runat="server"&gt;&lt;/asp:DropDownList&gt; &lt;/ItemTemplate&gt; &lt;/asp:DataList&gt; </code></pre> <p>How can I get selectedindexchanged event of DropDownList on the server side? I tried this:</p> <pre><code> public void ddlitem_selectedindexchanged (object sender, EventArgs e) { } </code></pre> <p>but it is not working.</p>
c# asp.net
[0, 9]
4,030,285
4,030,286
How to build a countdown timer?
<p>I am new in android and java programming, and I want to make a CountDown Timer just like a scoreboard. Timer for mm:ss/ 10:00. </p>
java android
[1, 4]
3,537,498
3,537,499
How to reach child element within <a> element
<p>I have a structure like this</p> <pre><code> &lt;ul&gt; &lt;li&gt; &lt;a&gt; &lt;img /&gt; &lt;span /&gt; &lt;/a&gt; &lt;/li&gt; &lt;li&gt; ...... &lt;/li&gt; &lt;li&gt; ...... &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I am using jquery like this#</p> <pre><code> $("ul#someid").find("li:last &gt; a[name="some.....] </code></pre> <p>How can i access the img element and the span element within the "a" element like above.</p> <p>i am using now like this</p> <pre><code> $("ul#pushedProducts").find("li:last &gt; a[name= &lt;%=PushedProductsParametersMapper.PARAMS_PRODUCTS_INFO%&gt;]").children('span').attr({name:'&lt;%=PushedProductsParametersMapper.PARAMS_PRODUCTS_INFO%&gt;' + pushedProductsTypesCount, id:'&lt;%=PushedProductsParametersMapper.PARAMS_PRODUCTS_INFO%&gt;' + pushedProductsTypesCount , style :'display:none;'}); </code></pre>
javascript jquery
[3, 5]
1,174,500
1,174,501
How to open file using Intents programatically?
<p>I have following code for opening files programatically:</p> <pre><code> Uri path = Uri.fromFile(file); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(path, type); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); </code></pre> <p>But now I need to set MIME-type of file, and it isn't universal method for all files. Is there any mean for opening file through Intent without defining type? </p>
java android
[1, 4]
1,277,714
1,277,715
GridView DataKeyName for a DropDownList Select Statement
<p>When the user selects a row to edit I have a dropdownlist as one of the controls. In order for me to populate that ddl I need one of the datakeyname values (there are three). I was guessing that I could retrieve this value when the OnEditing event fired and pass it to the select statement for the ddl. Just not sure how to do this. I am using a stored procedure to query the Database.</p> <p>This is my sqldatasource for the ddl -</p> <pre><code>&lt;asp:SqlDataSource ID="SqlDataSourceDebtor" runat="server" ConnectionString="&lt;%$ ConnectionStrings:AuditDevConnectionString2 %&gt;" SelectCommand="sp_fc_vm_getDebtorList" SelectCommandType="StoredProcedure"&gt; &lt;SelectParameters&gt; &lt;asp:ControlParameter ControlID="GridView1" DefaultValue="0" Name="ClientKey" PropertyName="SelectedValue" Type="Int32" /&gt; &lt;/SelectParameters&gt; &lt;/asp:SqlDataSource&gt; </code></pre> <p>The "ClientKey" is the datakeyname value I need.</p>
c# asp.net
[0, 9]
2,192,008
2,192,009
grid CSS issue in td on some data
<p><img src="http://i.stack.imgur.com/8zOPe.jpg" alt="enter image description here">I had taken grid in which there are some <code>CSS issues</code> on grid td become distorted Whats the reason for this?</p> <pre><code> &lt;asp:GridView ID="GridView2" runat="server" class="grd" AutoGenerateColumns="False"&gt; &lt;Columns&gt; &lt;asp:BoundField DataField="itdrate" HeaderText="rate" /&gt; &lt;asp:BoundField DataField="itdAmou" HeaderText="amt" /&gt; &lt;asp:BoundField DataField="itdquan" HeaderText="quantity" /&gt; &lt;asp:BoundField DataField="itdrema" HeaderText="remark" /&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; .grd { font-family:Verdana; min-height:400px; } .grd td { text-align:center; border: solid 1px #000000; } </code></pre>
c# asp.net
[0, 9]
4,504,728
4,504,729
javascript alternative to php seralize
<p>hello I have a javascript array and I would like to use a function for javascript that will take my array and serialize it.</p> <p>Thanks</p>
php javascript
[2, 3]
3,650,392
3,650,393
Looping a json encode filtered by type
<p>I create a json encode in PHP like this:</p> <pre><code>$get = mysql_query("SELECT * FROM $table") or die(mysql_error()); $data = array(); while($row = mysql_fetch_assoc($get)){ $data[$row['id']][0] = $row['g']; $data[$row['id']][1] = $row['w']; $data[$row['id']][2] = $row['s']; $data[$row['id']][3] = $row['name']; $data[$row['id']][4] = $row['type']; } $data4 = json_encode($data); </code></pre> <p>I assign it to a js variable: var bdata;</p> <p>So what im trying to do is now loop the content filtered by [4] = type.</p> <p>This is my loop:</p> <pre><code> for(var key in bdata){ //stuff here } </code></pre> <p>But this will loop all of them... but I want to loop only ones that have a [4] (type) of a certain value lets say the value was "2".</p> <p>Is there a way to do that?</p>
php javascript
[2, 3]
2,322,105
2,322,106
Custom Section in Web.config
<p>how to create and use a custom section in web.config ?</p>
c# asp.net
[0, 9]
2,098,205
2,098,206
Clone Object multiple times and append the clones in jQuery
<p>I try to provide a predefined Object <em>Grab</em> to clone it later and populate the clones with further functionality. The problem I am facing is, that I can clone the objects, but only one of them is appended to the DOM afterwards.</p> <p>The Code so far is:</p> <pre><code>var foo = jQuery.extend({}, Grab); var bar = jQuery.extend({}, Grab); $('body').append(foo); $('body').append(bar); </code></pre> <p>I use <em>jQuery.extend()</em> because I need the <em>.daggable</em> feature of Grab with the clone.</p> <p>Any suggestions are highly appreciated!</p>
javascript jquery
[3, 5]
1,372,604
1,372,605
Android java load images from url
<p>I have a question</p> <pre><code>private final String images[] = {"http://developer.android.com/images/dialog_custom.png", "http://developer.android.com/images/dialog_progress_bar.png"}; </code></pre> <p>how can i change this</p> <p>to load all of the links from a file from my website?</p> <p>like a .txt on my site just has like</p> <pre><code>http://link.com/1.png http://link.com/2.png http://link.com/3.png http://link.com/4.png http://link.com/5.png http://link.com/6.png http://link.com/7.png http://link.com/8.png http://link.com/9.png http://link.com/10.png </code></pre> <p>so it will just load all those then later on i can add more links without having to update the app</p>
java android
[1, 4]
2,909,200
2,909,201
Pass value from pop up to parent window via window.opener
<p>I know that similar questions have been asked before but I have not been able to find one that uses window.opener in the same way that I have.</p> <p>I have a page that opens a pop up to display/edit/delete values in a db. Once it has done it's thing I use this to end the script and go back to the parent. </p> <pre><code>die( "&lt;script&gt;window.opener.location.reload();window.close();&lt;/script&gt;"); </code></pre> <p>This works well but I would like to pass a value back to the parent that I can use $_GET to retrieve.</p> <p>This is for a a calendar and I use the above code to refresh the parent page so that the changes made to the diary event displayed in the pop up are automatically displayed (otherwise the user has to refresh themselves). At the moment when the page refreshes it goes back to the default date which is today rather than the date of the event affected. I would like to pass the date back to the parent</p> <p>tia</p>
php javascript
[2, 3]
4,659,120
4,659,121
How to find number of <ul> inside each div
<p>I have a large file of this form [similar div's throughout]. I want to be able to select a <code>div</code>, find the number of <code>ul</code>'s in it and traverse through each of them to get value of each <code>li</code> in it. </p> <pre><code>&lt;div class="experiment"&gt; &lt;div class="experiment-number"&gt;5&lt;/div&gt; &lt;ul class="data-values"&gt; &lt;li&gt;&lt;div&gt;&lt;/div&gt; 14&lt;/li&gt; &lt;li&gt;&lt;div&gt;&lt;/div&gt; 15&lt;/li&gt; &lt;/ul&gt; &lt;ul class="data-values"&gt; &lt;li&gt;&lt;div&gt;&lt;/div&gt; 16&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>I have tried looping through all experiment <code>div</code>s, then select the <code>ul</code>s, but it selects all the <code>ul</code> in the page, not only the ones under current <code>div</code>. </p> <pre><code>$('experiment ul').eq('$i'); </code></pre>
javascript jquery
[3, 5]
1,829,519
1,829,520
Converting a normal date to ISO-8601 format
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2573521/how-do-i-output-an-iso-8601-formatted-string-in-javascript">How do I output an ISO-8601 formatted string in Javascript?</a> </p> </blockquote> <p>I have a date like </p> <pre><code>Thu Jul 12 2012 01:20:46 GMT+0530 </code></pre> <p>How can I convert it into ISO-8601 format like this</p> <pre><code>2012-07-12T01:20:46Z </code></pre>
javascript jquery
[3, 5]
54,052
54,053
Prevent a modal from opening again if there is an error
<p>I have a code that prevents a modal from opening when there is an error but the problem is when i open it once the next time it opens even if there is an error so the question is how to stop it from opening on the next time when there is an error again?</p> <p>Here is the code:</p> <pre><code> jQuery(".link").click(function(a){ var newVal2 = jQuery("#appID").val(); if(error === '1' || defaultVal2 === newVal2){ alert("Please fill in a valid App ID."); a.preventDefault(); } else { //Access Token Modal jQuery(".link").colorbox({inline:true, width:"90%"}); a.preventDefault(); //Access Token Modal CLOSING } }); </code></pre> <p>P.S <code>colorbox</code> is the modal plugin.</p>
javascript jquery
[3, 5]
5,199,653
5,199,654
Why does this break in jQuery 1.7.x?
<p>The following code snipplet shows what my issue is:</p> <pre><code>var $div = $('&lt;div&gt;'); $('span').live('click', function() { this.innerHTML = 'changed'; }); $div.append( $('&lt;span&gt;span&lt;/span&gt;').click() ); $div.appendTo('body'); ​ </code></pre> <p>This works as expected in jQuery <a href="http://jsfiddle.net/BSbAA/" rel="nofollow"><strong>1.6.x</strong></a> but not in <a href="http://jsfiddle.net/NQ9jk/" rel="nofollow"><strong>1.7.x</strong></a></p> <p>Why is it not working in 1.7.x? Is it a bug? Is there any way to get it to work in 1.7.x?</p> <p>EDIT: <a href="http://jsfiddle.net/3BTaz/" rel="nofollow"><code>.on</code> doesn't change anything!!</a></p>
javascript jquery
[3, 5]
4,761,982
4,761,983
Simple JS timer using JS Fiddle
<p>This may not be the place for this question, but here goes anyways.</p> <p>I am trying to learn more about the JS timers and am using the JS Fiddle for this purpose. In my script, I am using a script that binds functionality to a few elements, but I need the JS Fiddle to not execute it until the page loads completely due to it needing all elements to be initialized and available (see my fiddle at: <a href="http://jsfiddle.net/radi8/W2b2M/4/" rel="nofollow">http://jsfiddle.net/radi8/W2b2M/4/</a>). This fiddle is a VERY rough skeleton.</p> <p>The format of the script is as follows: How can I make the JS Fiddle only load this after all other elements are finished?</p> <pre><code>$(document).ready(function() { var tmr = { init: function(){ }, somefunct1: function(){ }, somefunction2: function(){ } };tmr.init(); }); </code></pre> <p>Any help is appreciated.</p>
javascript jquery
[3, 5]
4,418,367
4,418,368
jQuery Dialog but get dynamic inputs
<p>All, I'm trying to send an email with the jQuery dialog modal window. I can get the window to populate correctly and everything like that however I'm trying to populate some email addresses when I open the dialog window. Here is the jQuery to open the dialog window:</p> <pre><code>$( "#dialog-form" ).dialog({ autoOpen: false, height: 600, width: 750, modal: true, show: 'slide', buttons: { "Send Email": function() { var message_to_send = $( "#message_to_vendors" ).val(); alert(message_to_send); var vendor_ids = $("#email_vendor_ids").val(); alert(vendor_ids); $.post("send_vendor_emails.php", { email_vendor_ids: vendor_ids, message_to_vendors: message_to_send }, function(data) { alert("The data is: "+data); if(data=="yes"){ $("#dialog-form").dialog( "close" ); } }); }, Cancel: function() { $( this ).dialog( "close" ); } }, close: function() { allFields.val( "" ).removeClass( "ui-state-error" ); } }); </code></pre> <p>Then here is my dialog form:</p> <pre><code>&lt;div id="dialog-form" title="Email Vendors"&gt; &lt;form&gt; &lt;select data-placeholder="Vendors to Email" style="width:350px;" multiple class="chzn-select"&gt; &lt;div id="email_options"&gt; &lt;option selected&gt;Email Address 1&lt;/option&gt; &lt;option selected&gt;Email Address 2&lt;/option&gt; &lt;/div&gt; &lt;/select&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>I'm storing some email addresses in session variables and what I'd like to happen is when I click the dialog box to open it up that I can populate the email addresses in the Session variables. How can I do that with the dialog box?</p> <p>Thanks for any help in advance!</p>
php jquery
[2, 5]
1,472,358
1,472,359
How check whitespaces?
<p>Want to check white spaces in a form. If somebody inserted some text without spaces, what to do? How validate this</p>
php javascript
[2, 3]
4,571,072
4,571,073
Move text display area from one place to another
<p>Imagine I have a html page which has a 2x2 matrix (4 quadrants) and in each quadrant I can have a text display listing. People can just click on + button on any quadrant and add text there. Once text has been added, it will be displayed in those quadrants. </p> <p>My question is:</p> <p>How do I enable that a text line display from one quadrant be moved to another quadrant. </p> <p>I would prefer using PHP, javascript for this. Any pointers to examples would help</p>
php javascript
[2, 3]
868,794
868,795
calling a php function from Javascript same file
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4172976/calling-php-function-within-javascript">Calling PHP Function within Javascript</a> </p> </blockquote> <p>I have a small JavaScript code in a php file. This JavaScript code runs some logic and in the end should call a php function which is defined in the same php file. How can I do this ? any guidance ?</p>
php javascript
[2, 3]
2,403,361
2,403,362
how to change class of <a> tags in jquery
<p>I have a table structure, something similar to</p> <pre><code>&lt;table style="width: 100%;"&gt; &lt;tr&gt; &lt;td&gt; &lt;a href="#" class="xx"&gt;one&lt;/a&gt; &lt;/td&gt; &lt;td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;a href="#" class="xx"&gt;Two&lt;/a&gt; &lt;/td&gt; &lt;td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;a href="#" class="xx"&gt;Three&lt;/a&gt; &lt;/td&gt; &lt;td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>css:</p> <pre><code>.xx { border: 5px solid green; } .yy { border: 5px solid red; } </code></pre> <p>Now what I expect is, if I click on 1st row/1st <code>&lt;a&gt;</code> its border will turn to red, and rest of <code>&lt;a&gt;</code> in green, again if I clcik on 1st row/1st <code>&lt;a&gt;</code> it should turn to green. Also if I click on any other <code>&lt;a&gt;</code> then only it should turn to red, but rest of the <code>&lt;a&gt;</code> should be green.</p> <p>I tried:</p> <pre><code>$(function () { $("a.xx").click(function () { if ($(this).hasClass("xx")) { $(this).removeClass("xx").addClass("yy"); } else { $(this).removeClass("yy").addClass("xx"); } }); }); </code></pre> <p>But it's not working.</p>
javascript jquery
[3, 5]
1,037
1,038
member visibility and 'this' scope in javascript objects
<p>I still haven't quite wrapped my head around object definitions and the <code>this</code> scope in javascript. I think the (c#ish) pseudocode below sums it up quite nicely. </p> <p>How can I define a piece of javascript code that creates an object that has all of the following properties:</p> <ol> <li>private members that are only visible inside the methods of the object</li> <li>public members that are also visible outside the object</li> <li>a (parametrized) constructor that is executed when the object is instantiated and initializes members</li> <li>register callback inside the object that points to a method of the object itself </li> <li>when the callback is executed inside the method (<code>PrivateMethod</code>) it is possible to access all members of the object instance, preferably using the <code>this</code> pointer</li> </ol> <p>.</p> <pre><code>class MyObjectDefinition { public int publicField = 0; private int privateField; public MyObjectDefinition(int parameter) { this.privateField = parameter; SomethingThatWantsA.CallBack(this.PrivateMethod); } public void PublicMethod() { this.privateField--; this.publicField--; } private void PrivateMethod() { this.privateField++; this.publicField++; } } var instance = new MyObjectDefinition(); </code></pre>
c# javascript
[0, 3]
564,161
564,162
javascript replace not workings
<p>I've got a problem with replace not working.</p> <pre><code>alert($('input#membership_edc').next("label").html().replace(/£/g, "")); </code></pre> <p>The value of the label after the input would be £24.00, but I want to do a math on that value then put it back with the new value. It's not removing the pound sign.</p> <p>What's wrong? Thanks.</p>
javascript jquery
[3, 5]
5,441,891
5,441,892
jquery lightbox issue
<p>on <a href="http://www.holzschild24.com/schritt1.php" rel="nofollow">http://www.holzschild24.com/schritt1.php</a> i use <a href="http://leandrovieira.com/projects/jquery/lightbox/" rel="nofollow">http://leandrovieira.com/projects/jquery/lightbox/</a></p> <p>and i get an error: <code>$("#slider").easySlider</code> is not a function</p> <p>Any ideas, what that can be? All files are laoded correctly, i want that when i click on a pic, i get a big version,...any ideas?</p>
javascript jquery
[3, 5]
3,499,872
3,499,873
a hideable and 'recyclable' javascript context toolbar
<p>I am searching for plugins/scripts that provide a toolbar when hovering elements of a big list. Almost like in this question: <a href="http://stackoverflow.com/questions/3139406/javascript-html-hover-menu-toolbar">JavaScript/HTML hover menu/toolbar</a></p> <p>However, I don't want it to be a css-menu-like one. As I said, It will be a very big list and I would like its markup not to be duplicated <em>n</em> times. So I need a javascript that will move the same toolbar from list element to list element when they're hovered.</p> <p>I know the <a href="http://developer.yahoo.com/yui/container/tooltip/" rel="nofollow">YUI2 tooltip</a> applies this strategy of moving the tooltip element, and changing the contents at display, but it's only for informative text displaying. I can't add buttons to it, and it's positionned according to the actual mouse position, and not to the element hovered.</p> <p>ps: I tagged this question jQuery because the project is using it but i'm open to any framework-dependant or not solution.</p>
javascript jquery
[3, 5]
2,874,056
2,874,057
open and close or return if already open nav
<p>I have a nav which on a click i expand it, but if it's already expanded and we click on the item again it shouldn't do anything (return). I have this code but it is not working properly, currently if I click on the item it expands it but if i click again it closes the nav and if i click once again it expands it but it behaves funny. I basically only need to be able to click and open and do nothing if already opened as I will have a close button anyway. p.s. "item" is a var i defined before in the code.</p> <pre><code>var item = $(".nav a"); &lt;div class="nav"&gt; &lt;a href="#"&gt;Trigger&lt;/a&gt; &lt;div class="wrapSubContent"&gt; &lt;div class="wrapNavtoShowHide"&gt; ..content.. &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; item.click(function(e) { e.preventDefault(); $(".wrapSubContent").slideToggle("slow", "linear", function(){ $(".wrapNavtoShowHide").slideToggle("slow", "linear"); }); }); </code></pre> <p>Anyone?</p>
javascript jquery
[3, 5]
3,360,602
3,360,603
Save base64 encoded image into the file in PHP
<p>I have the following code : </p> <pre><code>&lt;?php header('Content-Type: image/png'); $data = "iVBORw0KGgoAAAANSUhEUgAAAuAAAAI8CAYAAACwIh5dAAAgAElkZJgRCXxOAuIPzzTlg......"; define('UPLOAD_DIR', '/home/Desktop/image.png'); $img = $data; $img = str_replace('data:image/png;base64,', '', $img); $img = str_replace(' ', '+', $img); $data = base64_decode($img); $file = UPLOAD_DIR . uniqid() . '.png'; $success = file_put_contents($file, $data); print $success ? $file : 'Unable to save the file.'; ?&gt; </code></pre> <p>Here <code>$data</code> contain the encoded string of image in base-64. I want to save the image into the file. I did the previous code also go through lot of tutorial in google but it's not working. </p> <p>Can anyone help me where I am going wrong.</p> <p>Thanks in advance.</p>
php jquery
[2, 5]
741,258
741,259
Character limit for asp label upto 1000 characters
<p>I want to restrict my label upto 1000 characters only. how to achieve this? please help...</p>
c# asp.net
[0, 9]
5,207,458
5,207,459
extract the ajax response in jQuery?
<p>How can i extract the returned response of the ajax response? to catch the response i should write:</p> <pre><code>$.post('server.php',{x : 9}, function(response){ alert(response); }); </code></pre> <p>Now, how can i take the " response " out of the function(){} ?, because it doesn't exist outside .. and i wanna compare it with some other value, i attempted to assign it to a global var and to a jQuery object " $response ", but it always "undefined" while the " response " it self have the correct value !.. Generally i want it this way, if possible :)</p> <pre><code>response= $.post('..',{.. : ..}); </code></pre> <p>Thanks in advance :)</p>
javascript jquery
[3, 5]
4,779,006
4,779,007
how to get the dropdown value?
<p>Hi i am using dropdown for display the timezone.The timezone values are come from database.Whenever the user change the value I need to alert the new timezone.For example if <strong>user change the time GMT+5.30 to GMT+6.30</strong> then <strong>I want to alert GMT+6.30</strong>.Here the the dropdown values coming as an array?What can I do to get the values?</p>
php jquery
[2, 5]
385,275
385,276
No DataTypeConverter Method option in android
<p>I want to use <strong>DataTypeConverter.printBase64Binary(.........)</strong> in my project. But there is no option coming through intellisense. Am i missing some jar ? </p>
java android
[1, 4]
3,305,909
3,305,910
how to make an checkboxlist select only one item selected
<p>i am using an checkboslist binding to a datatable. but here i need to make user select only one item selected from checkbox list is there way we can aachive this</p> <p>either JQuery, javascript, c# thank you </p>
asp.net jquery
[9, 5]
529,811
529,812
Simple error on simple code, but I don't get it?
<p>I'm getting this error:</p> <pre><code>Syntax error on token ";", , expected </code></pre> <p>On this very simple code:</p> <pre><code>TextView bio = (TextView)findViewById(R.id.biographyText); String bioText = new String(); bioText = bio.getText().toString(); </code></pre> <p>The error is on the semicolon after "new String()" </p> <p>What's wrong with this? In the end, if someone clicks on the TextView, it'll change the text to whatever they enter.</p> <p>Here's the whole Java class:</p> <pre><code>public class Profile extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); } TextView bio = (TextView)findViewById(R.id.biographyText); String bioText = new String(); bioText = bio.getText().toString(); } </code></pre>
java android
[1, 4]
2,853,301
2,853,302
pdf2image.dll license file missing
<p>1) in my code i am using PDF2Image.dll file to convert pdf to images.in uncompile version it work perfect but when i publish the website and try to convert an image to pdf, it say no license found. 2) I am using cutewebui ajax uploader to upload files to server. it is the same problem with it. It works fine but when i publish the website then it gives me the same error. and i do not know where to locate or how to fix the license of file. so how to locate/fix this? i am using c#,asp.net</p>
c# asp.net
[0, 9]
3,287,401
3,287,402
Create multiple labels on fly in asp.net
<p>I want to create multiple labels on fly based on the number entered by user. For example if user writes 10 in textbox, 10 labels should be created with id label1 - label10 and i want to put separate text in those labels. Any idea how to do it in asp.net with c# sharp code ?</p>
c# asp.net
[0, 9]
3,101,525
3,101,526
Checking jQuery event types
<p>Let's say, jQuery has <code>scroll</code> event type. Is there a chance to determine whether it's assigned an event handler?</p>
javascript jquery
[3, 5]
4,674,157
4,674,158
How to create sql connection with c# code behind, access the sql server then conditionally redirect?
<p>This is a question from an experienced beginner!</p> <p>Using ASP.NET 4 C# AND SQL server,</p> <p>I have a connection string in web.config to myDatabase named "myCS". I have a database named myDB. I have a table named myTable with a primary key named myPK</p> <p>What are the NECESSARY lines of code behind (minimal code) to create a SQL connection, then select from myTable where myPK=="simpleText"</p> <p>it will probably include:</p> <pre><code>sqlconnection conn = new sqlconnection(??? myCS) string SQLcommand = select * from myDB.myTable where myPK==myTestString; sqlCommand command = new SqlCommand(SQL,conn); conn.Open(); booleanFlag = ???? conn.Close(); conn.Dispose(); </code></pre> <p>then</p> <pre><code>If ( theAnswer != NULL ) // or (if flag) { Response.Redirect("Page1.aspx"); } else { Response.Redirect("Page2.aspx"); } </code></pre>
c# asp.net
[0, 9]