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
3,936,873
3,936,874
HOw to call custom validtor on page load?
<p>On the page load i wanna call a custom validator which validates my page and display corresponding error messages. How can i do this?</p> <p>I am using javascript in the custom validator.</p>
c# asp.net
[0, 9]
3,951,457
3,951,458
Does the browser "cache" javascript code?
<p>I was fine tuning a page that is heavy on jquery and stumbled across this website:</p> <p><a href="http://www.componenthouse.com/extra/jquery-analysis.html" rel="nofollow">http://www.componenthouse.com/extra/jquery-analysis.html</a></p> <p>When I click on the "Run Test" button the first time, the numbers are way higher than subsequent clicks. Is this because JS is cached by the browser? Can someone explain how this works internally? Can a user choose to not cache the JS?</p>
javascript jquery
[3, 5]
418,047
418,048
inline image captions plugin?
<p>Is there such thing as an inline image caption plugin for jquery?</p> <p>So a user can someone select a point on an image, and then insert a text caption. Whenever someone hovers over the image, the caption displays.</p> <p>Flickr has this type of functionality.</p>
javascript jquery
[3, 5]
5,731,791
5,731,792
How to create .rdlc files?
<p>i am using visual studio 2010 for generating reports using report viewer... As i am totally new for that i do'nt know how to create RDLC file and how to use it... Please tell me also that what connection between reportviewer and rdlc please help me out. Thanks</p>
c# asp.net
[0, 9]
1,463,426
1,463,427
Can you refer to the element on which a handler called a function?
<p>I usually never use this programming style, but thought I would give it a try just so I know whats up with it.</p> <p>Here is my input tag HTML: <code>&lt;input id="Read" type="checkbox" onclick="readClicked()" checked&gt;</code></p> <p>And my associated function:</p> <pre><code>function readClicked() { console.log(this); console.log($(this)); alert('Read Clicked!'); } </code></pre> <p>Is there anyway to refer to the element in which the handler that called readClicked() was called from inside the function? Something like:</p> <pre><code>function readClicked() { var caller = function.caller; var type = $(caller).attr('type'); } </code></pre>
javascript jquery
[3, 5]
2,581,355
2,581,356
What is the most elegant way to make this kind of string array change?
<p>If I have an array of string like:</p> <pre><code>var myStrArr=['book-in-my-house', 'chair-in-my-house', 'bed-in-my-house', 'TV-in-my-house']; </code></pre> <p>I would like to change <strong><em>myStrArr</em></strong> to <strong><em>herStrArr</em></strong> like:</p> <pre><code>var herStrArr=['book-in-her-house', 'chair-in-her-house', 'bed-in-her-house', 'TV-in-her-house']; </code></pre> <p>As you saw above, change every "<code>my</code>" to "<code>her</code>" in each string. What is the most elegant way to make this change in JavaScript?</p>
javascript jquery
[3, 5]
2,600,553
2,600,554
my array "is not a function" error message
<p>I am trying to store some DOM information into an Array so I can use it elsewhere.</p> <p>This works if I use a Variable, but if I try to use an Array I get "Arrayname is not a function" error message? I'm not sure why this would work in a Variable and not an array.</p> <p>This is the code I'm running:</p> <pre><code>function testmove(total) { for (var x=1; x&lt;=total; x++) { allstore(x) = jQuery('#block-views-items-block .views-row-1').children('div'); x++; } } </code></pre> <p>This works:</p> <pre><code>function testmove(total) { store1 = jQuery('#block-views-items-block .views-row-1').children('div'); } </code></pre> <p>Am I missing something/doing something wrong here?</p>
javascript jquery
[3, 5]
4,998,721
4,998,722
response.redirect doesnt work
<p>When control reaches response.redirect line then the following error is produced in browser. the url in response.redirect is correct.<br> The page isn't redirecting properly</p> <p>Firefox has detected that the server is redirecting the request for this address in a way that will never complete.</p> <pre><code>* This problem can sometimes be caused by disabling or refusing to accept cookies. </code></pre> <p>here is the code</p> <pre><code>using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class MasterPage : System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { } protected void imgbtnLogin_Click(object sender, ImageClickEventArgs e) { UserFunction objUser = new UserFunction(); UserProperties objUserProperties = new UserProperties(); IUserFunction iUserFunction = (IUserFunction)objUser; objUserProperties.UserName = txtUserName.Text; objUserProperties.Password = txtPassword.Text; string userName = txtUserName.Text; ; string password = txtPassword.Text; ; DateTime login = DateTime.Now; DateTime? logout = null; int UserId; string StartUpPage; bool success = iUserFunction.ValidateUser(objUserProperties, out StartUpPage); if (success) { Session["UserId"] = objUserProperties.UserId; Session["RoleId"] = objUserProperties.RoleId; Session["UserName"] = objUserProperties.UserName; Session["MyTheme"] = objUserProperties.Theme; iUserFunction.AddLoginHistory(objUserProperties.UserId, login, logout, 1); Response.Redirect(StartUpPage); } else { Label1.Text = "Wrong UserName/password."; //ScriptManager.RegisterStartupScript(this, this.GetType(), "ClientScript", "alert('Invalid Credential');", true); } } } </code></pre>
c# asp.net
[0, 9]
2,429,551
2,429,552
How to represent 2 parent child drop down in javascript?
<p>I have 2 drop down lists, when the user selects dropdown#1 then I need to update dropdown#2 with options that are relevant for the dropdown#1 selection.</p> <p>e.g.</p> <p>Dropdown#1 has car manufacturers: ford, toyota, honda</p> <p>Dropdown#2 will be cars for that specific manufacturer.</p> <p>How should I go about storing this data in javascript?</p> <p>I was hoping I could create a collection like some sort of dictionary or hash so I can populate each drop down easily.</p> <p>I have the actual data from the database, then on the server-side I will create the JavaScript I need to create this data structure.</p>
javascript jquery
[3, 5]
4,543,038
4,543,039
using closest().find().text()
<p>Hi guys i previously asked a question and got a good solution. here is the question:</p> <p><a href="http://stackoverflow.com/questions/2536892/jquery-how-to-find-an-element-which-is-comming-2-elements-before-current-element">http://stackoverflow.com/questions/2536892/jquery-how-to-find-an-element-which-is-comming-2-elements-before-current-element</a></p> <p>when im using the solution which i got :</p> <pre><code>paragrafheading.push($(this).closest('&gt; h3').find('&gt; h3').text()); </code></pre> <p>im getting only [object Object] instead of the element text</p>
javascript jquery
[3, 5]
242,901
242,902
JQuery traversal problem
<p>I am trying to select the DIV with the class 'container'.</p> <pre><code>&lt;a href="#" class="playButton"&gt;Start&lt;/a&gt; &lt;div class="overlay"&gt; &lt;div class="overlayClose"&gt;Close&lt;/div&gt; &lt;div class="container"&gt;Foo&lt;/div&gt; &lt;/div&gt; </code></pre> <p>Using variations of the js below, which fails. What is the smartest way to get this selection?</p> <pre><code>$('.playButton').click(function() { $('div').next('div').has('.container').css("background-color", "red"); }); </code></pre>
javascript jquery
[3, 5]
4,393,558
4,393,559
What is wrong with this javascript
<p>ARGH! What's wrong with this??</p> <pre><code>$(document).ready(function() { var monkeyTrouble = $('#monkeyTrouble').attr('rel'); if (monkeyTrouble = "banana") { alert("oooh oooh ahh ahhh"); } }); </code></pre>
javascript jquery
[3, 5]
2,848,038
2,848,039
Create an Event Handler whenever a new Node is added in treeview
<p>I want to write a custom class in which whenevr I add a node to treeview it should call an event. so that I can run it recursively.</p>
c# asp.net
[0, 9]
1,855,008
1,855,009
Detect specific devices within android application
<p>Is there a way of telling, within the application the spcific device model that the app is being run from. For example for it to be able to tell the difference if the app is running on a Nexus S or a HTC Desire or the Samsung Galaxy Tab?</p>
java android
[1, 4]
4,129,892
4,129,893
jQuery select child of closest element
<p>Basically I want to be able to select the div level2 parent from the child level4 div. My application does not has such classes, otherwise I'd just select level2 :)</p> <pre><code>&lt;div class="level1"&gt; &lt;div class="level2"&gt; &lt;div class="level3"&gt; &lt;div class="level4"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="level2"&gt; &lt;!-- this is hidden --&gt; &lt;div class="level3"&gt; &lt;div id="start" class="level4"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I start with <code>$('#start')</code> and search for the first parent which is visible, but I'm not seeing a way to return the child of that parent. Searching for <code>$('#start')</code> inside the parent seems very wasteful as I start with a sub child to begin with.</p> <pre><code>$('#start').closest(':visible') // returns level1 $('#start').closest(':visible').first() // returns the first level2. I can't just use second because the number of level2s can change. $('#start').closest(':visible').children().each(function(){ /* do some search to check it contains `$('#start')` }) // seems very wasteful. </code></pre> <p>Another way to look at what I'm trying to say would be; start in the middle, find the outside (the visible element), and move one element in.</p>
javascript jquery
[3, 5]
5,431,331
5,431,332
How can I get the difference between 2 dates in days, hours and minutes
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1968167/difference-between-dates-in-javascript">Difference between dates in JavaScript</a> </p> </blockquote> <p>How can I get the difference between 2 dates in hours, minutes and seconds? This is my code which isn't working:</p> <pre><code>var date = new Date(2012, 0, 21, 0, 0, 0, 0); window.setTimeout(function () { var now = new Date(); console.log(now); console.log(date.getTime() - now.getTime()); console.log(new Date(date - now)); }, 1000); </code></pre> <p>None of the console.log show proper difference between 2 dates.</p>
javascript jquery
[3, 5]
1,661,322
1,661,323
How to know if javac compiled cleanly using system() in python
<p>In python, how can I tell if a certain system() call is successful? In the program I am writing I need to know if a java program compiled correctly using javac, which is called using system() (in the python program). So I need to know if javac threw any exceptions, if there were any syntax problems with the java program, any problems at all at compile time for the java program. Essentially, the program asks the user for a dir, then asks for the java program name, then asks if it takes any arguments, then it compiles it with system('javac ' + str(javaFile) + '.java').</p>
java python
[1, 7]
4,447,649
4,447,650
How to clear all the textbox fields in a parent page using jquery
<p>Is their any way to clear all the textbox values in a parent form using jquery or javascript. Now i am clearing each fields using</p> <pre><code>var parentDoc1 = window.opener.document; parentDoc1.getElementById(id).value=""; </code></pre>
javascript jquery
[3, 5]
4,799,650
4,799,651
jQuery - has class that starts with
<p>What would be the best way to get all divs that have any class that starts with <code>input</code>? In other words, <code>a</code> and <code>b</code> should be returned from what's below, but not <code>c</code>.</p> <pre><code>&lt;div id="a" class="input1 foo"&gt;&lt;/div&gt; &lt;div id="b" class="foo input2"&gt;&lt;/div&gt; &lt;div id="c" class="xinput3 foo"&gt;&lt;/div&gt; </code></pre> <p>The ostensible way, which surprisingly was accepted <a href="http://stackoverflow.com/questions/4165183/jquery-match-element-that-has-a-class-that-starts-with-a-certain-string">here</a>, is to do <code>$("div[class^='input']");</code> but of course that misses <code>b</code>. And of course <code>$("div[class*='input']");</code> will give a false positive on <code>c</code>.</p> <p>The best I could come up with was this monstrosity</p> <pre><code>function getAllInputDivs() { return $("div").filter(function (i, currentDiv) { return $.grep($(currentDiv).attr("class").split(" "), function (val) { return val.substr(0, "input".length) === "input"; }).length &gt; 0; }); } </code></pre> <p>Is there a cleaner way? Here's a <a href="http://jsfiddle.net/KYx2Y/1/">working fiddle</a> of the above</p>
javascript jquery
[3, 5]
1,965,084
1,965,085
Detect scroll on bottom on iphone
<p>I want to detect if i'm at the bottom of a page. This works fine on any browser - but not on iPhone.</p> <pre><code>if ($(window).scrollTop() == ($(document).height() - $(window).height())){ alert('on bottom'); } </code></pre> <p>What i'm doing wrong?</p>
javascript jquery
[3, 5]
5,816,637
5,816,638
is there a security issue when using Jquery to develop asp.net web applications
<p>I'm new to web applications. I have developed a web application using ASP.net. After hearing about jquery and going through some examples, I changed the existing application and used jquery to do most of the ajax work. On the server side I used html handlers for db connections and data processing.</p> <p>Because I'm using jquery, my concern is my script is visible to users of the application. Will this be a security issue? Am i following a right path?</p>
asp.net jquery
[9, 5]
3,748,314
3,748,315
Any SDK function in Java to Push number unto a Stack and calculate the average?
<p>I tried to Google for an answer but I think I am using wrong keywords. What I am trying to do is - I have a collection of numbers (ints), and as I add new numbers I am computing the new average. I noticed that as my array grows, once I get to a certain count of elements (lets say 200), the calculation time becomes noticeable. I was wondering if there are any built-in SDK functions I can utilize to speed up my codes performance? I will be running the code on Android.</p> <pre><code>int[] numbers = new int[3]; private int average(int number){ //some buildin operation to push in array an int? for(int i=0; i &lt; numbers.length -1 ; i++){ numbers[i]=numbers[i+1]; } numbers[numbers.length -1] = number; ; //numbers[0] = numbers[1]; //numbers[1] = numbers[2]; //numbers[2] = number; int sum = 0; //any operation to get average? for(int i=0; i &lt; numbers.length ; i++) sum = sum + numbers[i]; //calculate average value double average = sum / numbers.length; return (int)average; } </code></pre>
java android
[1, 4]
5,266,867
5,266,868
How to Center Facebox
<p>I like to center facebox on a project im working on. when i added this code it will center</p> <pre><code> $(document).bind('close.facebox', function() { $(document).unbind('keydown.facebox') $('#facebox').fadeOut(function() { $('#facebox .content').removeClass().addClass('content') $('#facebox .loading').remove() $(document).trigger('afterClose.facebox') }) hideOverlay() }) </code></pre> <p>problem is it will load on top then move to center. is there anyway to make the facebox load on center? thanks.</p>
javascript jquery
[3, 5]
543,750
543,751
How to update a label when a dropdown is changed
<p>My page has a label and a drop down list, which has time zones in it. Is it possible to get the label text to change automatically to display the selected value from the drop down, every time the value in the times zones dropdown is changed? How would I go about doing it?</p>
c# asp.net
[0, 9]
5,805,304
5,805,305
When we use a thread, will it work as a parallel process or a serial process in C#?
<p>When we use a thread, will it work as a parallel process or a serial process in C#?</p>
c# asp.net
[0, 9]
3,873,387
3,873,388
allow third parties to change elements
<p>Take the <a href="http://demo.tutorialzine.com/2010/03/sponsor-wall-flip-jquery-css/demo.php" rel="nofollow">following plugin</a>- What would be the best way to actually allow third parties to make changes to the image,description and link elements - like allow each individual their own block ,as in membership or advertsing site?</p>
php jquery
[2, 5]
5,568,815
5,568,816
Session expired before timeout
<p>I set sessiontimeout in web.config file like following.</p> <pre><code>&lt;sessionState timeout="120" cookieless="false" mode="InProc" /&gt; </code></pre> <p>Some times above code working fine.But many times session expired after 10 to 15 minutes automatically.</p> <p>and this errors exists in every browser.</p> <p>when i run same application using .net on my local computer it working fine.</p> <p><strong>Please note that, i haven't create global.ascx file yet.</strong></p>
c# asp.net
[0, 9]
469,433
469,434
Employee Activity Monitoring Software?
<blockquote> <p>Right now I am working on EAMS (Employee Activity Monitoring Software), Includes following structure. Server (Monitor) -Client (nth) number</p> <p>Every client have some sort of services to be installed that will fetch his screen and browsing data and send to server using some port; Same at the server side we have similar kind of listener service that will handle the data posted by client service. I hope this define the application scope.</p> <p><strong>My Problem is:</strong> In which language do I start this project, I am well familiar with different languages, but what will be best choice for this kind of project. Also If I selects C#.NET for this is it be a good choice?</p> <p>Please Guide me. Although I knew this platform is not made for these kind of questions but I am much more interested in experts suggestions :)</p> </blockquote> <p>I am thinking to select C#.NET for this application. If any of you have some strong arguments for JAVA or C++.NET then please let me know. One thing more I need to ask what kind of design pattern will be suitable for such application, Creational Patterns OR Structural Patterns OR Behavioral Patterns.</p>
java php asp.net
[1, 2, 9]
2,888,488
2,888,489
How to switch activity with item specific data sent
<p>I've had a look around, and it might be because I'm not sure what I'm looking for, but I can't find out how to do something I presume should be quite easy with android.</p> <p>I have an array of data to display on the screen. This data is a class that holds a database key, name and image.</p> <p>I'm currently displaying this data as an ImageView and a TextView. I loop through the array and add a new row to a TableLayout containing the image and text.</p> <p>I'd like both the image and text to be clickable, changing to a new activity.</p> <p>This new activity needs to know the database key of the row clicked in order to display the correct data.</p> <p>Here's what I have so far:</p> <pre><code>private void fillSuggestionTable(TableLayout tabSuggestions, Suggestion[] arrToAdd) { for(int i = 0; i &lt; arrToAdd.length; i++) { /* Create a new row to be added. */ TableRow trSuggestion = new TableRow(this); trSuggestion.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)); /* Create objects for the row-content. */ ImageView imgDisplayPicture = new ImageView(this); ImageHandler.loadBitmap(arrToAdd[i].strImageURL, imgDisplayPicture); imgDisplayPicture.setLayoutParams(new LayoutParams(50,50)); TextView txtArtistName = new TextView(this); txtArtistName.setText(arrToAdd[i].strName); txtArtistName.setTextColor(Color.parseColor("#000000")); /* Add data to row. */ trSuggestion.addView(imgDisplayPicture); trSuggestion.addView(txtArtistName); /* Add row to TableLayout. */ tabSuggestions.addView(trSuggestion, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); } } </code></pre>
java android
[1, 4]
1,143,635
1,143,636
How do I make a list of items where each item has associated information in Android?
<p>How do I make a list of items where each item has associated information in Android?</p> <p>For example, I want to be able to have a list of countries and then be able to click on the country and find the population, language, w/e associated with that country.</p> <p>I found this the following link with shows how to make a simple list but not how to click on an item and get the information associated with the county. </p> <p><a href="http://developer.android.com/resources/tutorials/views/hello-listview.html" rel="nofollow">http://developer.android.com/resources/tutorials/views/hello-listview.html</a> </p> <p>How do I do this without making a database, which seems like overkill to me?</p>
java android
[1, 4]
3,300,615
3,300,616
does android sdk give any convenience methods for converting Shape to Path?
<p>the Canvas class does not take Shape as a parameter for any of its methods. There is no drawShape or clipShape, etc... So, I need to use Path instead. Does android sdk expose any way to convert Shape to Path or Path to shape? I haven't been able to find relationship any between the 2 classes...?</p> <p>Thank you</p>
java android
[1, 4]
1,733,453
1,733,454
Parsing Line Breaks in PHP/JavaScript
<p>EDIT: Ok, thanks for your help guys. Using zerkms' suggestion, I have managed to get <code>&lt;br&gt;</code> tags inserted instead of carriage returns, so it is displayed properly on the page and doesn't break the javascript. The problem is now that when the user clicks on this text, it becomes a textarea and is therefore inline editable. However, the text string now has the tags displayed in it, rather than just having the editable text over multiple lines.</p> <p>Any suggestions?</p> <p>ORIGINAL QUESTION: I have a text area in my PHP application where users can enter notes in a project. Sometimes this is displayed on the page via PHP and sometimes it is displayed via javascript. The problem is, if the note is across multiple lines (i.e. the user presses enter while entering notes in the text area), it causes the JS to fail. It's fine when it's being done by the PHP.</p> <p>The line of code in question is:</p> <pre><code>var editnotes='&lt;textarea class="desc_text" style="width:20em;" id="notes_editor"&gt;&lt;?php print $notes; ?&gt;&lt;/textarea&gt;'; </code></pre> <p>So, if the note is over multiple lines, the PHP builds the pager as:</p> <pre><code>var editnotes='&lt;textarea class="desc_text" style="width:20em;" id="notes_editor"&gt;This is a test note over multiple lines &lt;/textarea&gt;'; </code></pre> <p>And this obviously causes problems for the js. So my question is, what can I do to prevent this? As the code is being built by PHP before it even gets to the browser, I'm thinking that the best approach may be to parse it in the PHP so that the output is something more like this:</p> <pre><code>var editnotes='&lt;textarea class="desc_text" style="width:20em;" id="notes_editor"&gt;This is&lt;br/&gt;a test note&lt;br/&gt;over multiple lines&lt;br/&gt;&lt;/textarea&gt;'; </code></pre> <p>Will this work? How would I do it?</p> <p>Thanks</p>
php javascript
[2, 3]
3,910,326
3,910,327
how can I get asp.net aspx page name from javascript?
<p>Trying to get the aspx name from the current page from javascript?</p>
javascript asp.net
[3, 9]
144,448
144,449
override action in JavaScript / jquery
<p>In my requirement, a user can select multiple check-boxes. however after checking each check-box i need to call the url and pass selected checkbox value with time-delay of 3 seconds.This delay is required , so that user can select/de-select another checkbox , old action should be canceled and new selected value(s) should be passed.</p> <p>I know to call a function with delay , but dont know how to stop the last action with the new one. Please help.</p> <pre><code>setTimeout(function(){ call_me(action) },3000); function call_me(action) { var url = action $(location).attr('href',url); } </code></pre>
javascript jquery
[3, 5]
2,613,030
2,613,031
How To find Out if Element is Wrapped by jQuery?
<p>How can i find out if an Object is Wrapped by jQuery.</p> <pre><code>var obj = $('div'); if(obj is a jQuery wrapped object) { then do something } </code></pre> <p>I am quite new in the Javascript World.</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
3,352,200
3,352,201
How do i convert this code snippet to c#
<p>I am trying to figure out <a href="http://stackoverflow.com/questions/4747702/implementing-javascript-confirm-box-in-code-behind-on-drop-down-boxs-selected-in">how to display confirm box when drop down list's selected indexchanged</a> event is fired. </p> <p>Browsing thru some forum I came across the following solution but I dont know how I can use it as I am working in c#. How do I make it work? I am not even sure if this is really the solution to my problem. Some one please help.Thanks.</p> <pre><code>Public Sub ConfirmOnChange() 'Register the script block If Not IsStartupScriptRegistered("CSP-ddl-onchange") Then RegisterStartupScript("CSP-ddl-onchange", _ "&lt;script language=""JavaScript""&gt;" &amp; _ "var CSP_savedDDLID = " &amp; _ "document.getElementById('" &amp; _ ddl.ClientID &amp; "').value;" &amp; vbCrLf &amp; _ "function resetDDLIndex() {" &amp; vbCrLf &amp; _ " document.getElementById('" &amp; _ ddl_Status.ClientID &amp; "').value = CSP_savedDDLID;" &amp; _ vbCrLf &amp; _ "}" &amp; vbCrLf &amp; _ "&lt;/script&gt;") End If Dim msg As String = "'Do you want to change selection?';" ddl_Status.Attributes("onchange") = _ "if (!confirm('" &amp; msg.Replace("'", "\'") &amp; _ "')) resetDDLIndex(); " End Sub </code></pre>
c# javascript asp.net
[0, 3, 9]
5,611,138
5,611,139
ASP.NET save files from dynamically added FileUpload controls
<p>I'm building an ASP.NET UserControl where users of the website can upload several pictures at once. I'm doing it the old fashioned way by letting the user enter the amount of FileUpload controls wanted and then add them dynamically from C# to a asp:Panel control. </p> <p>While this works, the values/files from the FileUpload isn't stored for when the user clicks the "Save" button. How exactly do I go about this problem?</p> <p>My code for specifying the amount of FileUpload controls wanted:</p> <pre><code>protected void btnSubmitImageAmount_Click(object sender, EventArgs e) { int amountOfControls = Convert.ToInt32(txtImageAmount.Text); for (int i = 0; i &lt; amountOfControls; i++) { FileUpload fUl = new FileUpload(); Label lblLineBreak = new Label(); lblLineBreak.Text = "&lt;br /&gt;"; fUl.ID = i.ToString(); fUl.Visible = true; pnlUploadControls.Controls.Add(fUl); pnlUploadControls.Controls.Add(lblLineBreak); } } </code></pre> <p>Code for the Save button:</p> <pre><code>protected void btnCreateStory_Click(object sender, EventArgs e) { List&lt;Media&gt; images = new List&lt;Media&gt;(); foreach (Control ctrl in pnlUploadControls.Controls) { if (ctrl is FileUpload) { FileUpload fUl = (FileUpload)ctrl; Media media = UmbracoSave(fUl, storydDoc.Id); if (media != null) { images.Add(media); } } } } </code></pre> <p>Anyone got any hints of how to solve this problem? :)</p> <p>Thanks in advance!</p>
c# asp.net
[0, 9]
2,228,231
2,228,232
How to use shouldOverrideKeyEvent to trigger Javascript function
<p>I'm currently building a simpel app for Android with a webview that loads a page that should be controlled from the app. For this, I want to completly override the default keybehaviour, and just call a function with the keycode from the key that is pressed. </p> <p>For this, I've tried the following</p> <pre><code>public boolean shouldOverrideKeyEvent(BWWebviewClient view, KeyEvent event){ if ((KeyEvent = KeyEvent.KEYCODE_ENTER)){ webview.loadUrl("javascript:getKeyCode(KeyEvent)"); } return true; } </code></pre> <p>The problem with this is that KeyEvent in my ifstatement cannot be resolved. </p> <p>What I want to do is simple catch all keys, disable their default behaviour and call a JS function with the keycode as argument. </p> <p>Can anyone help?</p>
javascript android
[3, 4]
3,412,819
3,412,820
jQuery: sharing function between page code and document.ready code
<p>I have some nice dialogues defined as such in jQuery:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $( "#someDialog" ).dialog({ autoOpen: false, model: true, buttons: { "Do Something": function() { var cleanInput = sanitizeInput(input); // Do something with the clean input }, Cancel: function() { $( this ).dialog( "close" ); } }, close: function() { } }); function sanitizeInput(input) { // Some magic here return input; } }); &lt;/script&gt; </code></pre> <p>Somewhere in the page, unrelated to the dialog, I have an element that calls a function with a parameter:</p> <pre><code>&lt;a href="#" onclick="doSomething('wendy');"&gt;Wendy's stats&lt;/a&gt; </code></pre> <p>And the associated JavaScript:</p> <pre><code>&lt;script type="text/javascript"&gt; function doSomething(input) { var cleanInput = sanitizeInput(input); // Some code here } &lt;/script&gt; </code></pre> <p>I would like to reuse the sanitizeInput() function for this function as well. However, from outside the document.ready function, the dialog does not work. Putting the doSomething() function inside the document.ready function breaks it likewise. So where do I put the sanitizeInput() function such that both can use it?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
5,993,354
5,993,355
ASP.Net auto-generated Admin tool
<p>I need to create an administrative site for managing my web site's db. I don't want to build this myself, I simply want the framework in place so that I can add customization myself after it is in place.</p> <p>Django has a great auto-generated admin. What's an equivalent auto-generated admin site built under asp.net?</p>
c# asp.net
[0, 9]
1,317,538
1,317,539
How to find a form using jquery
<p>I have multiple forms on a page. How do I find a form by its name? I think in pure javascript it is something like document.forms['FormName'] .</p> <p>I want to do a form.submit. But I want to be able to select a form by its name.</p>
javascript jquery
[3, 5]
2,978,789
2,978,790
Window object as Global Variables Inside Function always undefined
<p>Hi I dont know what I'm missing but if its always says undefined.</p> <pre><code>function report_grid() { $.ajax({ type: "POST", url: "filter_option.php?action=filter", data: $('#form1').serialize(), async: false, success: function(rdata) { window.my_var = rdata } }) } $('#onscreen').click(function() { alert(my_var); return false; }) </code></pre> <p>All my searches to googles shows that this should work, any idea why its not working.</p>
javascript jquery
[3, 5]
2,218,295
2,218,296
The complexity of member looking up: Python Vs. Javascript
<p>I am curious about the complexity of Python and JS 's looking up: </p> <p>Python supports multi-inheritance, which affects the member lookup. Specifically, when referencing a member from an instance of a class, the process will start from the instance's dict, then to the class of the instance, then up to the super classes of the class of the instance, which for each super class, it has its own super class list..... which seems to end up with the complexity to be exponential (theoretically). </p> <p>While it seems that the JS's member lookup time is linear -- which just has to trace back to the prototype chain.</p> <p>Am I reasoning the right way? or I am missing something?</p>
javascript python
[3, 7]
3,269,294
3,269,295
Looping through two different selectors at the same time
<p>I am using JQuery to calculate some totals figures and I have run into a problem.</p> <p>Let's say I have two sets of inputs, each with a unique name.</p> <pre><code>$('[name="quantity\\[\\]"]') $('[name="price\\[\\]"]') </code></pre> <p>I want to cycle through each set of inputs at the same time so that I can check both for (!isNaN) and (length !== 0), and if the values are valid, I want to multiply them together and add to a running total.</p> <p>I know I can cycle through one selector using each(), but how can I cycle through two at the same time? is there an elegant way to accomplish this goal?</p>
javascript jquery
[3, 5]
100,896
100,897
How to stop jquery animate at onclick?
<p>I'm new in jquery, I don't know much about it, but I need it because I'm building a template...Here is situation, I have a div which I want to slide in to page ( from outside, top) when I click on link, and when I click anywhere else on the page to slide out... This is what I have:</p> <pre><code>var tmpl_name = '&lt;?php echo $this-&gt;template ?&gt;'; jQuery(document).ready(function() { jQuery('#link').click(function() { var topy = jQuery('#div'); topy.delay(0).animate({ top: parseInt(topy.css('top')) == 0 ? -topy.outerWidth() : 10 },500, 'easeInOutCirc', function() {jQuery(this);}); }); }); </code></pre> <p>...and it works well,when I click on link div slide in to page, but I don't know how to achieve when I click anywhere else on page to slide out the div, I have tried to add:</p> <pre><code>jQuery('body').click(function() { var topy = jQuery('#div'); topy.delay(0).animate({ top: parseInt(topy.css('top')) == 0 ? -topy.outerWidth() : -500 },1000, 'easeInOutCirc', function() {jQuery(this);}); }); </code></pre> <p>...but problem is when I click on link to slide in div, div goes in and out of page ( probably because link is also in body and this second part of code affects it too.</p> <p>Thanks for your time...Best regards </p>
javascript jquery
[3, 5]
5,822,996
5,822,997
Why isn't my text saving when i leave the activity?
<p>I have a notes app and basically i want it to save the text input and restore it when i return to the activity. But why isn't my code doing that? I tried onRestoreInstancestate and onRestore but it's not working. Any one know how i can save the text input after i exit the app? </p> <p>notes.java:</p> <pre><code>public class notes extends Activity{ /** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.notes); Button wg = (Button) findViewById(R.id.button3); wg.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Intent intent = new Intent(); setResult(RESULT_OK, intent); finish(); } }); } } </code></pre>
java android
[1, 4]
2,108,218
2,108,219
Changes not being saved back to database
<p>I am trying to connect to my NorthwindDataSet, when the user clicks the button I want the data to be saved back to the database. When I run the code below I get no errors but the data is not saved. I think I am connecting to the DataSet correctly and am not sure why this isn't saving back. </p> <pre><code>NorthwindDataSetTableAdapters.CustomersTableAdapter north = new NorthwindDataSetTableAdapters.CustomersTableAdapter(); NorthwindDataSet.CustomersDataTable northtable = north.GetData(); NorthwindDataSet northwindDataSet1 = new NorthwindDataSet(); NorthwindDataSet.CustomersRow newCustomersRow = northwindDataSet1.Customers.NewCustomersRow(); newCustomersRow.CustomerID = "5"; newCustomersRow.CompanyName = "Alfreds Futterkiste"; northwindDataSet1.Customers.Rows.Add(newCustomersRow); northwindDataSet1.Customers.AcceptChanges(); </code></pre>
c# asp.net
[0, 9]
5,468,379
5,468,380
changing the index positioning in InputStream
<p>I have a binary file which contains keys and after every key there is an image associated with it. I want to jump off different keys but could not find any method which changes the index positioning in input stream. I have seen the <code>mark()</code> method but it does not jump on different places.</p> <p>Does anybody have any idea how to do that?</p>
java android
[1, 4]
719,215
719,216
How to change the weight size of a fragment in android?
<p>Here is the xml-Layout of my fragment view</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:weightSum="100" &gt; &lt;fragment android:id="@+id/menuFragment" android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_weight="70" class="com.pack.Menufragment" &gt; &lt;/fragment&gt; &lt;fragment android:id="@+id/bodyFragment" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="30" class="com.pack.BodyFragment" &gt; &lt;/fragment&gt; &lt;/LinearLayout&gt; </code></pre> <p>Now I want to change the fragment weight size from the java not from XML, is there anyway to do this?</p>
java android
[1, 4]
54,640
54,641
Costs of Switching to Java
<p>I'm a C# dev and I have plans of starting to develop apps targeting Android, which of course means Java. I have heard good things about Mono for Android and the idea of reusing my skill set is appealing, however the licensing cost (for now) is a bit prohibitive to me. On the other hand, from what I can see, Java is very similar to C#, so I'm predicting that shifting my skills to it will be more or less easy (easier than shifting to Obj-C I guess). </p> <p>Am I wrong in assuming that?</p> <p>Are there any hidden costs I'm blind to?</p>
java c# android
[1, 0, 4]
1,245,135
1,245,136
Form submit using jquery & passing values
<p>I want to accomplish the following using jQuery:</p> <pre><code>frm_rooms.action="create_rooms.php?action=Save"; frm_rooms.submit(); </code></pre> <p>I tried following jQuery but it doesn't work:</p> <pre><code>$('#frm_rooms').submit(function(event) &lt;br/&gt;{ $.post("create_rooms.php", { action: "Save" } ); }); </code></pre>
javascript jquery
[3, 5]
4,735,351
4,735,352
JQuery Get current ID of Widget
<p>I have have the following</p> <pre><code>&lt;div id="dualList"&gt;&lt;/div&gt; </code></pre> <p>And I have written a plugin but for the sake of testing I have stripped it away. I am having problems with the plugin displaying the id of the div.</p> <pre><code>&lt;script&gt; (function($) { $.fn.DualList = function() { var thisControl = $(this); alert(thisControl.attr('id')); } })(jQuery); &lt;/script&gt; </code></pre> <p>And its bound on document on ready using <b>$("#dualList").DualList();</b></p> <p>Any ideas why the ID isnt echoing out?</p>
javascript jquery
[3, 5]
5,959,141
5,959,142
array empty on jquery?
<p>I'm trying to learn on making my first dynamic loader from scratch with jQuery (for learning purpose) here is where I got stuck:</p> <pre><code>&lt;script type="text/javascript"&gt; jQuery.learningdynamicloader= function(){ var js = []; var css = []; console.log(js,css); }; &lt;/script&gt; &lt;script&gt; $(document).ready(function() { $.learningdynamicloader(function(){ js = ['jquery','test']; css = ['css','test']; }); }); &lt;/script&gt; </code></pre> <p>My firebug log <code>js</code> and <code>css</code> returns nothing, it seems that there is a problem. After I Google is there any diffrence between <code>js = ['values']</code> and <code>js : ['values']</code> ? </p> <p>Thanks for looking.</p>
javascript jquery
[3, 5]
3,908,780
3,908,781
How can I databind to a string array?
<p>How can I databind a string array (<code>string[]</code>) to a <code>dropdownlist</code>?</p> <p>Does it implement <code>iEnumerable</code>?</p>
c# asp.net
[0, 9]
3,083,057
3,083,058
Javascript - Get Multiple textarea values with jquery
<p>I'm newbie with jQuery. I Want to get value from these two textarea, I have html like this and jquery below : </p> <p><strong>Html :</strong></p> <pre><code>&lt;pre&gt; &lt;a id="send-thoughts" href=""&gt;Click&lt;/a&gt; &lt;textarea id="message1" class="message"&gt;Hello&lt;/textarea&gt; &lt;textarea id="message2" class="message"&gt;World&lt;/textarea&gt; &lt;/pre&gt; </code></pre> <p><strong>jQuery:</strong></p> <pre><code>jQuery("a#send-thoughts").click(function() { var thought= jQuery("textarea.message").val(); alert(thought); });​ </code></pre> <p>Why only one value show up ? and how to get two value of textarea ?</p> <p><a href="http://jsfiddle.net/guruhkharisma/9zp9H/" rel="nofollow">http://jsfiddle.net/guruhkharisma/9zp9H/</a></p> <p>​</p>
php javascript jquery
[2, 3, 5]
162,238
162,239
filtering the records in the second grid according to the selection in the first in .Net
<p>which control can i use?, how to do this .Net?</p>
c# asp.net
[0, 9]
4,040,609
4,040,610
Best Way Of Getting Data In Separate Javascript File?
<p>Let me first describe the situation the best I can.</p> <p>So I am working in a PHP MVC framework. Inside the controller of a method I collect and format the data as it needs to be and I send it off to the view. The view page in turn uses that data but also includes separate javascript script files that also need to access the data the controller is passing to the view.</p> <p>What is the best way to make sure the data the controller is passing to the view is accessible to the other javascript files?</p> <p>Right now what I am doing is just creating a bunch of hidden for fields so that in my javascript I can just do:</p> <pre><code>$('selector').val(); </code></pre> <p>In order to access the data but I can't help to think that there might be a cleaner way to do this.</p>
javascript jquery
[3, 5]
4,714,777
4,714,778
unescape a string
<p>I've looked everywhere, it seems this would be common, and simple. I have a string from a database, "Ros%E9" What is the simplest way to convert it to "Rose" with an accented e?</p>
java android
[1, 4]
3,832,746
3,832,747
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 protected]&amp;returnxml=true" rel="nofollow">http://www.webcitation.org/archive?url=http://www.google.com&amp;[email protected]&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]
424,815
424,816
"Diferent" Parallax Scrolling effect
<p>I'm working in my new portfolio, and I want to do a effect like this, in the site:</p> <p><a href="http://nizoapp.com/" rel="nofollow">http://nizoapp.com/</a></p> <p>The effect of the iPhone and parts appearing from the sides when we scroll. It's a kind of parallax scrolling.</p> <p>I tried to search how to do but I can't find. So I "stole" the code saving the page and adapting the code but seems to have many unnecessary things.</p> <p>Someone know how can I do this?</p> <p>Thank you!</p>
javascript jquery
[3, 5]
1,980,294
1,980,295
JS Replace characters with link?
<p>If I have a block of text inside a div like:</p> <pre><code>&lt;div id='t1'&gt; This is a great testing string. Tomorrow grass is green. &lt;/div&gt; </code></pre> <p>and I want to replace all instance of the letter "g" with a link to google, like </p> <pre><code>&lt;a href='www.google.com'&gt;g&lt;/a&gt; </code></pre> <p>Is it possible to do this with just Javascript/jquery?</p>
javascript jquery
[3, 5]
1,608,799
1,608,800
two forms on one asp.net page
<p>I have an asp.net page with a nested master page. Parent master page has form tag like this:</p> <pre><code> &lt;form runat="server"&gt; ... .... &lt;/form&gt; </code></pre> <p>and in child master page. I have a side bar where I have another form ( not runat=server") like this:</p> <pre><code>&lt;form method="post" action="https://app.icontact.com/icp/signup.php" name="icpsignup" id="icpsignup3297" accept-charset="UTF-8" onsubmit="return verifyRequired3297();" &gt; &lt;input type="hidden" name="redirect" value="http://www.abconline.com/newsletter-sign-up.aspx"&gt; &lt;input type="hidden" name="errorredirect" value="http://www.icontact.com/www/signup/error.html"&gt; .... .... .... &lt;input type="submit" name="Submit" value="Get Deals"&gt; &lt;/form&gt; &lt;script type="text/javascript"&gt; var icpForm3297 = document.getElementById('icpsignup3297'); if (document.location.protocol === "https:") icpForm3297.action = "https://app.icontact.com/icp/signup.php"; function verifyRequired3297() { if (icpForm3297["fields_email"].value == "") { icpForm3297["fields_email"].focus(); alert("The Email field is required."); return false; } return true; } &lt;/script&gt; </code></pre> <p>but when I hit submit button, post back happens but javascript function is not called and form is not redirected to post url of child master page. It works fine if i use this form in a standalone page without master pages.</p> <p>Please suggest how to force form inside child master page to go to post URL ?</p> <p>Thanks.</p>
c# asp.net
[0, 9]
576,110
576,111
Dictionary object accessed by concurrent users in Asp.Net
<p>In Asp.Net page i have a static dictionary object where values can be added and retrieved, When 100's of concurrent users access the page is there any chance my dictionary object may get locked / throw error ?</p> <p>User can 1) Add new value if it does not exist 2) Retrieve existing value. They cannot modify / delete</p>
c# asp.net
[0, 9]
126,704
126,705
How to block form submission when the enter key or return key is pressed?
<p>I have a form that I use JQuery, I don't think I need to put code in this post, the question is pretty basic.</p> <p>But I would like to block the form from submitting when people press the Enter Key or the Return Key.</p> <p>At the same time, I have textareas, where the user will need to be able to press the Enter / Return keys.</p>
javascript jquery
[3, 5]
1,541,995
1,541,996
jQuery expression in PHP
<p>I have tested the following script is working in my PHP page:</p> <pre><code>&lt;script&gt; function calculate&lt;?=$performance_item_id;?&gt;(){ alert('&lt;?=$performance_item_id;?&gt;'); $.post('complete_calculate.php',{ tid: document.getElementById('performance_item_id&lt;?=$performance_item_id;?&gt;').value }, function(output){ $('#complete_percentage&lt;?=$performance_item_id;?&gt;').html(output); }); } calculate&lt;?=$performance_item_id;?&gt;() &lt;/script&gt; &lt;span id='complete_percentage&lt;?=$performance_item_id;?&gt;'&gt;&lt;/span&gt; </code></pre> <p>First, I would like to change the post value to something like <code>"$('.complete&lt;?=$performance_item_id;?&gt;').val();"</code>, that is, not get something from an id field, but gather values from several fields having the same class.</p> <p>Second, I would like to use a text box to hold the HTML output, while "<code>&lt;input type = "text" id='complete_percentage&lt;?=$performance_item_id;?&gt;' name = "complete_percentage[]" size = "5" value="0"&gt;</code>" is not working! Please help! Thanks!</p>
php javascript jquery
[2, 3, 5]
5,170,952
5,170,953
Jquery .change() to view currently assigned method
<p>Is there any way I can view the current method assigned to a selects change event. I have tried. </p> <pre><code>$('#select').change() </code></pre> <p>but that just returns me the change event. I don't really need to do this but would be very handy for debugging. Save me hunting through the code to find the method, this way I can simply search the text in the method and find the method quickly. </p>
javascript jquery
[3, 5]
5,117,923
5,117,924
JavaScript error no Object [object Object] has no method 'dialog'
<p>I have this page where I get that error: <a href="http://www.problemio.com/index_new.php" rel="nofollow">http://www.problemio.com/index_new.php</a> It isn't a page users see. It is a test page I am working on and I copied the general template from here: <a href="http://www.problemio.com/" rel="nofollow">http://www.problemio.com/</a></p> <p>For some reason the ladder doesn't get this error and the former does. I checked and I am pretty sure I am importing all the same libraries, so why does the new page give this error?</p> <p>Any ideas?</p>
javascript jquery
[3, 5]
2,238,515
2,238,516
window.open() not working in firefox to open new popup window using javascript
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/726761/javascript-open-in-a-new-window-not-tab">JavaScript open in a new window, not tab</a> </p> </blockquote> <p>Code</p> <pre><code>&lt;asp:Button ID="btnPopupWindow" runat="server" Text="Popup Window" OnClientClick="PopupWindow();" /&gt; </code></pre> <p>JavaScript</p> <pre><code>function PopupWindow() { testwindow = window.open("http://google.com", "Google", "menubar=0,addressbar=0, width=500, height=500"); testwindow.focus(); } </code></pre> <p>Using above code i can open new popup window in IE, but this code is not working in the firefox.<br> What is the problem with my code?</p>
javascript asp.net
[3, 9]
5,545,094
5,545,095
How can I write float value in python that can be read natively in Java?
<p>How can I write float value to file in python so that it can be later read in Java with <code>ObjectInputStream#readFloat</code>?</p> <p>I need high read performance, so I'd like to avoid parsing the float from String.</p>
java python
[1, 7]
763,451
763,452
jQuery how can you verify date formatted mm/dd/yyyy is not greater than current date today
<p>How do I verify in jQuery that a date entered on a input text box or value in html such as mm/dd/yyyy is not greater than todays date. Example would be "5/5/2011" would pass as true b/c its not greater than today "6/17/2011", but "5/5/3011" would be greater than today and should return false. Is there a simple function that can return true or false if a date in form "mm/dd/yyyy" is greater than todays date in javascript or jQuery?</p>
javascript jquery
[3, 5]
1,672,060
1,672,061
Problems simulating click of ASP.NET button
<p>I have some code like this</p> <pre><code>&lt;asp:Button ID="cancelDummyButt" runat="server" CausesValidation="False" Text="cancel" onclick="cancelDummyButt_Click" Enabled="True" /&gt; </code></pre> <p>(Javascript:)</p> <pre><code>buttid = '&lt;%=cancelDummyButt.ClientID.ToString%&gt;'; eltoclick = document.getElementById(buttid); eltoclick.click(); </code></pre> <p>The server-side code is not called. What is wrong? It goes OK until the "click". What is the best way to debug?</p> <p><em>(This is to get the right postback from an iframe within an updatepanel)</em></p>
asp.net javascript
[9, 3]
1,454,606
1,454,607
Merge two JavaScript objects
<p>I've got a big JavaScript object literal I am reusing with very few modifications each time. It would be good to make a variable containing most of the object, then reference that each time I need it.</p> <p>But how can I do that? I tried to do this, but it didn't work:</p> <pre><code>var settings = { legend: { enabled:false }, yAxis: { title: { text: 'Impact' } }, tooltip: { formatter: function() { return 'Impact: '+ this.y +' points' } }, credits: { enabled: false }, exporting: { enabled: false } }; jQuery(document).ready(function() { new Highcharts.Chart({ chart: { renderTo: 'chart', defaultSeriesType: 'column', width: 450 }, title: { text: 'Comparison of Impact for Male age 23' }, xAxis: { categories: [ 'Good brain', 'Good humor', 'Good will' ], }, series: [{ data: [5,2,8] }], settings // &lt;-- HERE }); }); </code></pre>
javascript jquery
[3, 5]
77,403
77,404
Table generation from Code Behind
<p>I know what my fault is, but not sure how to resolve. I am trying to generate an asp:table from Code Behind.</p> <p>The table should be 3 cells wide... I'll work on the row limit later.</p> <p>Here's my code:</p> <pre><code>GallaryImage g = new GallaryImage(); var images = g.GetAll(); photos.Style.Add("width","100%"); photos.Style.Add("border-style","none"); TableRow tr = new TableRow(); TableCell tc = new TableCell(); tr.Cells.Add(tc); tr.Cells.Add(tc); tr.Cells.Add(tc); int cntr = 0; TableRow row = new TableRow(); foreach (var image in images) { cntr++; TableCell cell = new TableCell(); Image i = new Image(); i.ImageUrl = image.fullThumbPath; cell.Controls.Add(i); row.Cells.Add(cell); if(cntr%3==0) { photos.Rows.Add(row); row.Cells.Clear(); } } if(row.Cells.Count &gt; 0) photos.Rows.Add(row); } </code></pre> <p>My problem is that I need to create a new row in the Foreach, only when I need the new row... i.e, when we have added 3 cells.</p> <p>I thought I could add the row to the table, and then clear the row to start a new row - but that's not working, as I just keep clearing the same row object... and therefore, never add multiple rows.</p> <p>Can someone assist with my logic here?</p>
c# asp.net
[0, 9]
1,741,942
1,741,943
Create javascript property like C# property
<p>Is it possible to create a property on a javascript object that behaves similar to a property in C#.</p> <p>Example: I've created an auto-sizing textarea widget using dojo. In order to get the "value" property out of my widget, I've hooked up to the onchange event and I'm setting a variable everytime the value of the textarea changes.</p> <p>Is there a way to accomplish this without hooking up to the onchange event.</p> <p><b>Edit</b></p> <p>In other words, is it possible to write something in JavaScript that behaves like getters and/or setters.</p>
c# javascript
[0, 3]
1,598,381
1,598,382
toggle highlight tr/td on live click, but don't toggle if clicking on input/select
<p>I hope someone can assist me, I think that it must be straight forward but I think I'm missing something... I've made a table that will highlight onclick or de-highlight if the same cell is clicked. This I don't have a problem with. What I'm having a problem with is that it still toggles if I click on an input:text or select element within the cell.</p> <p>Is there a simple way of adding a not clause in the selectors, or by seeing if select/input was clicked on within the below?</p> <pre><code>$("#grid td, #grid th").live('click', function(){ ... toggle highlight, image changes, link changes, etc, when conditions are met (currently works) ... }); </code></pre> <p>I thought maybe could use the <code>.not()</code> function, but I think that it may not toggle if I still click in the cell, but not clicking on input/select.</p> <p>Any help or assistance would be great!</p>
javascript jquery
[3, 5]
1,111,538
1,111,539
Delete a line in file (Android/java)
<p>In my app (Android) I create a file. To this file I add a line by line after some situation. Then I send a data to the server line by line. When all transmission is OK I erase the file, like this:</p> <pre><code>fos_kasowanie_pliku = openFileOutput(FILENAME, Context.MODE_PRIVATE); fos_kasowanie_pliku.write("".getBytes()); fos_kasowanie_pliku.close(); </code></pre> <p>Can I delete only 1 line (first one) after sending this to the server? I read that I should rewrite the file without this line. Is there a better solution?</p>
java android
[1, 4]
2,670,780
2,670,781
jQuery .toggle() breaking a line
<p>I'm working on <a href="http://beta.mobilityhosting.com/services/" rel="nofollow">http://beta.mobilityhosting.com/services/</a> and wanting to use jQuery's .toggle() function on the "Learn More..." links. I have it implemented on the first link but when the hidden content is revealed, a line is breaking.</p> <p>I cannot figure out how to prevent this. I just want all of the content below the link to descend. Thanks in advance for any replies.</p>
javascript jquery
[3, 5]
4,757,227
4,757,228
How to cancel navigation when user clicks a link?
<p>I'm trying to load some stuff using AJAX when a user clicks a link, but I want the link to actually go somewhere so that the app still works when javascript is disabled. Is there any way to just do something with javascript and cancel navigation when a link is clicked?</p> <p>What's the best practice? Can that be done, or do I need to replace the link using javascript or what?</p>
javascript jquery
[3, 5]
3,646,879
3,646,880
Get web page height through jQuery
<p>How can I get the height of viewable web page of browser with jquery? I have tried <code>$(window).height()</code> but it did not return accurate result.. Thanks..</p>
javascript jquery
[3, 5]
1,218,843
1,218,844
How to implement roles in web application
<p>I was create a website it runs perfectly. But I have one problem am having two folders, called <code>user</code> and <code>admin</code>. Both folders contain a home.aspx file. Suppose you are a user, not an admin, and you have logged in using a username and password.</p> <p>Given an URL like this: <code>http:localhost:8080/user/home.aspx</code>, suppose you go to addressbar and type <code>admin</code> instead of <code>user</code> means you can access the admin page with your session. </p> <p>How can I block the access to the admin page for regular users?</p>
c# asp.net
[0, 9]
309,775
309,776
speeding up the recursive function
<p>The function below, will change the <code>&lt;meta ... content="...densityDPI=250dpi" /&gt;</code> so the density DPI will be reduced 20dpi each time it loops.</p> <p>is there a way I can speed this up, so it does it in about 4 loops by comparing the ratio of previous values...? I think there should be a something before the <code>x++</code> the can change the 5 to something a little larger so that <code>$(window).width()==480</code> alot faster.</p> <pre><code>$(document).ready(function (){ $('meta[name="viewport"]').remove(); $('&lt;meta name="viewport" id="the_vp_special" content="width=320,target-densityDPI=250dpi"/&gt;').appendTo('head'); setTimeout(function (){ var x = 0; var changeDPI = function (curr){ x++; var sub = 5; if(x&gt;500) return false; var curr = curr?parseInt(curr):320; curr = curr-sub; var txt = $('&lt;meta/&gt;',{name:"viewport",id:"the_vp_special",content:"width=320,initial-scale=1,target-densityDPI="+(parseInt(curr))+"dpi"}); $('#the_vp_special').replaceWith(txt) if($(window).width()==480) {} else setTimeout(function (){ changeDPI(curr); },5); } changeDPI(250); }, 2500); }); </code></pre> <p>Please ask away, I will try to explain it better if this is not clear.</p>
javascript jquery
[3, 5]
4,658,357
4,658,358
Why doesn't $(this) work inside a javascript function?
<p>I've attached an onlick event to a function. I want to reference the element being clicked from inside the function so I can change its inner HTML, but why is it not working? Is there any other way to reference the clicked element?</p> <p><strong>HTML</strong> </p> <pre><code> &lt;div class="save_button" onclick="toggle_save_star(&lt;?php echo $listing-&gt;listing_id ?&gt;,'&lt;?php echo base_url()?&gt;')"&gt; &lt;?php if($listing-&gt;saved_element_id):?&gt; &lt;img src="&lt;?php echo site_url('images/core/icons/basic2/star1_16.png')?&gt;" /&gt; &lt;?php else:?&gt; &lt;img src="&lt;?php echo site_url('images/core/icons/basic2/star1_16_gray.png')?&gt;" /&gt; &lt;?php endif; ?&gt; &lt;/div&gt; </code></pre> <p><strong>Javascript Function</strong></p> <pre><code>function toggle_save_star(element_id, site_url) { var url = site_url+"AJAX/ajax_default/modify_saved"; var button = $(this); $.post(url,{action: 'toggle', element_id: element_id, type: 'listing' }, function(data) { if(data == 'saved') { $(button).html('&lt;img src="'+site_url+'images/core/icons/basic2/star1_16.png" /&gt;'); } else{ $(button).html('&lt;img src="'+site_url+'images/core/icons/basic2/star1_16_gray.png" /&gt;'); } }); } </code></pre>
javascript jquery
[3, 5]
3,324,270
3,324,271
Open excel file in asp.net
<p>I am trying to open a Excel(.xls) file from asp.net.The code i am using is given here.It is showing a save as dialog box which i don't want .Please help me !!!</p> <pre><code> Response.ContentType = "application/xls"; Response.Flush(); Response.WriteFile(fileName); Response.End(); </code></pre>
c# asp.net
[0, 9]
5,480,558
5,480,559
SMSManager and Pending Intent
<p>I have a question about an SMS app i am creating (learning purposes).</p> <p>On sending an SMS i would like to have a toast message appear once it has been deleivered (or not)</p> <p>Problem is once i have hit send i would like to close the activity but still have the toast message (in this case) appear giving me the info.</p> <p>As i am new to this i am not sure how to go about this. All i have done is wait for the information to come through, set up the message then close the activity.</p> <pre><code>private void sendSMS() { PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), PendingIntent.FLAG_NO_CREATE); deliverActivity = new BroadcastReceiver() { @Override public void onReceive(Context arg0, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: Toast.makeText(getBaseContext(), "SMS delivered", Toast.LENGTH_LONG).show(); finishActivity(); break; case Activity.RESULT_CANCELED: Toast.makeText(getBaseContext(), "SMS not delivered", Toast.LENGTH_LONG).show(); finishActivity(); break; } } }; registerReceiver(deliverActivity, new IntentFilter(DELIVERED)); SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(toNo, null, toSend.getText().toString(), deliveredPI, null); ContentValues values = new ContentValues(); values.put("address", toNo); values.put("body", toSend.getText().toString()); this.getContentResolver().insert(Uri.parse("content://sms/sent"), values); } private void finishActivity() { unregisterReceiver(deliverActivity); Intent intent = new Intent(); setResult(123, intent); finish(); } </code></pre> <p>Im sure this is possible somehow, even to pass it possibly to another activity.</p> <p>It probably sounds a bit pedantic but it allows me to learn new ways of doing things... so if anyone can point me in the right direction that'd be great.</p> <p>Thanks!</p>
java android
[1, 4]
739,572
739,573
Is it possible to create ASP.NET pages without the autogenerate javascript?
<p>As a test, I wanted to have an ASP.NET page rendered without the auto-generated javascript. Is this possible?</p>
asp.net javascript
[9, 3]
2,381,908
2,381,909
how to call java function from c++?
<p>Hello all how can i call java function from c++ application ( not using cmd methods.. ) Thanks </p>
java c++
[1, 6]
2,204,086
2,204,087
How to display a wait gif until image is fully loaded
<p>Most popular browsers, while rendering an image, they display it line-by-line top-to-bottom as it loads.</p> <p>I have a requirement that a wait gif should be displayed while the image is loading. When the image is fully loaded then it should be displayed instead of the wait gif.</p>
javascript jquery
[3, 5]
3,133,268
3,133,269
Reading large file using byte[] gives error
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6094306/hash-sha1-large-files-over-2gb-in-c-sharp">Hash SHA1 large files (over 2gb) in C#</a> </p> </blockquote> <p>I have a large file in size of terms and it gives me error "Exception of type 'System.OutOfMemoryException' was thrown."</p> <p>Anyone is having idea or solution for resolve this issue. Please help. Sample code....</p> <pre><code> private string GetSha1() { string filePath = txtFileName.Text; byte[] filebytes = System.IO.File.ReadAllBytes(filePath); byte[] hashValue; SHA1Managed hashString = new SHA1Managed(); string hex = ""; hashValue = hashString.ComputeHash(filebytes); foreach (byte x in hashValue) { hex += String.Format("{0:x2}", x); } return hex; } </code></pre> <p>I am getting exception at line below in above code....</p> <pre><code> byte[] filebytes = System.IO.File.ReadAllBytes(filePath); </code></pre> <p>The filePath is having file which is having size > 500MB.</p>
c# asp.net
[0, 9]
3,281,094
3,281,095
Adding break every 2 consecutive floated elements (nth:child)
<p>I created this fiddle so that you can see what i am trying to do easily. I would like to add that break after every 2 consecutive div elements (div.column) </p> <p>Fiddle example: <a href="http://jsfiddle.net/j5qS5/" rel="nofollow">http://jsfiddle.net/j5qS5/</a></p> <p>I tried:</p> <pre><code>$(".column:nth-child(2)").after('&lt;br /&gt;&lt;br /&gt;break&lt;br /&gt;&lt;br /&gt;'); </code></pre> <p>It seems to work after the 2nd child only, how can I make it consecutive and works for every 2 elements afterwards.. I hope it's simple :)</p> <p>Thanks in advance</p>
javascript jquery
[3, 5]
4,454,021
4,454,022
Use class names to load corresponding image paths
<p>How could I write javascript that iterates through a table, grabs the class, and then replaces with an image? So for example I have a table with columns that have numeric classes appended to them: </p> <pre><code>&lt;td class="images 12-345"&gt;&lt;/td&gt; &lt;td class="images 98-763"&gt;&lt;/td&gt; </code></pre> <p>These numbers coorelate with image names that I want to load with javascript after the rest of the query is finished processing. So the final product would look like :</p> <pre><code>&lt;td class="images 12-345"&gt;&lt;img src="http://site.com/12-345.jpg"&gt;&lt;/td&gt; &lt;td class="images 98-763"&gt;&lt;img src="http://site.com/98-763.jpg"&gt;&lt;/td&gt; </code></pre> <p>But not until everything is done loading. I would like to just have a placeholder graphic in there that is replaced with the correct image file after everything has processed.</p> <p>How would I iterate through these rows and then load the appropriate image to each cell? I was thinking first I could use the .images selector to retrieve each unique numeric class name and pass that into a variable. Then with that variable I could append it to the rest of the image path and place it back into its appropriate table cell. I would not want this to begin processing until the rest of the dom had finished loading and the original sql query had completed. Can I please have some advice on what would be the best way to write this. jQuery is an option for me.</p>
javascript jquery
[3, 5]
3,965,757
3,965,758
Is there a JavaScript way to do file_get_contents()?
<p>Here is the <a href="http://php.net/manual/en/function.file-get-contents.php" rel="nofollow">PHP documentation</a></p> <p>Here is how I would use it in an Ajax call, if I don't find a pure client way to do this.</p> <pre><code>$homepage = file_get_contents('http://www.example.com/'); echo $homepage; </code></pre> <p>Is there way to do this client side instead so I don't have to ajax the string over?</p>
php javascript
[2, 3]
1,841,486
1,841,487
Unable to use javascript with a php file
<p>I have some experience with javascript but I cant seem to get it working inside one particular .php file. </p> <p>I've tried placing the javascript code inside this php file and in an external js file. </p> <p>The .php file has 2,500 lines of code, I'm guessing I need to structure this code in order to get javascript working on it somehow. </p> <p>I'm running out of ideas :/ Any ideas</p>
php javascript
[2, 3]
3,843,423
3,843,424
Using JQuery to set 'dirty' elements back to original values
<p>I have a Javascript object that basically represents a Row in an .NET GridView. When a user clicks on any row in the grid, all the input elements in that row are 'enabled'.(ie 'Edit' mode). </p> <p>I run this code depending on which row is selected</p> <pre><code>$(":input", this._row).attr('disabled', true); or $(":input", this._row).removeAttr('disabled'); </code></pre> <p>So far so good. Now, I want to keep track of the values in that row before a user enters the 'Edit Mode', so i can restore the original values if they decide to click out of that row without saving any changes that they made.</p> <p>So i capture the original values in an array by doing this:</p> <pre><code>var $inputs = $(":input", this._row); var values = {}; $inputs.each(function(i, el) { values[el.name] = $(el).val(); }); </code></pre> <p>the 'values' array now looks like this:</p> <pre><code>ctl00$ContentPlaceHolder1$resultsGrid$ctl04$COMPONENT1 "56" ctl00$ContentPlaceHolder1$resultsGrid$ctl04$COMPONENT2 "98" ctl00$ContentPlaceHolder1$resultsGrid$ctl04$COMPONENT3 "08" ctl00$ContentPlaceHolder1$resultsGrid$ctl04$COMPONENT4 "200" </code></pre> <p>Great so far. The user may then modify these values, but decide not to save the changes. So i need to restore this row back to it's orignal values from the 'values' array. Can someone tell me the best way to do this? Im hoping it's something simple, but i'm no jquery expert, yet..</p> <p>thanks</p>
asp.net jquery
[9, 5]
1,061,255
1,061,256
JQuery: Hover function, how to add a delay
<p>I have some JQuery that pops up a JQuery Dialog (<a href="http://docs.jquery.com/UI/Dialog" rel="nofollow">http://docs.jquery.com/UI/Dialog</a>) box when you hover over an image like so:</p> <pre><code> $(document).ready(function() { $("img").hover(function() { $("#dialog").dialog(); }); }); </code></pre> <p>I have 2 questions 1. When i close the dialog and then hover over an image again the dialog dosn't reappear, how can i fix that 1. How can i pop up the box only if the user hovers over the image for a couple of seconds</p>
javascript jquery
[3, 5]
343,988
343,989
How to schedule function calls with JavaScript / jQuery
<p>I have a web application that scrapes data from a page on another domain. This data is updated at a specific time several times a week, lets say 2pm on a Wednesday and a Friday.</p> <p>I have a JS function which scrapes specific data from this page and stores it in a database. How do I go about scheduling this function to be called at specific times?</p>
javascript jquery
[3, 5]
900,565
900,566
'Neatest' way of adding javascript to a page footer in asp.net
<p>Whenever i want to add a javascript library programatically, say jquery for example, it generally involves making sure there is a <code>placeholder</code> at the footer of my page, then calling a codebehind method that will take a link to the src as a parameter and return an <code>htmlgeneric</code> control, which is then added to this <code>placeholder</code>.</p> <p>Is this still the neatest way to do it, even with .net 4.0 out?</p>
c# asp.net javascript
[0, 9, 3]
5,953,363
5,953,364
expand dropdown on focus jquery
<p>I am expanding the dropdown on focus which is same as clicking on the dropdown and selecting an option. </p> <pre><code> &lt;script type="text/javascript"&gt; $(document).ready(function () { $('#&lt;%= ddlNature.ClientID %&gt;').focus(function () { $('#&lt;%= ddlNature.ClientID %&gt;').attr('size', 6); }); $('#&lt;%= ddlNature.ClientID %&gt;').focusout(function () { $('#&lt;%= ddlNature.ClientID %&gt;').attr('size', 1); }); }); &lt;/script&gt; &lt;asp:DropDownList ID="ddlNature" runat="server" class="text" TabIndex="5"&gt; </code></pre> <p></p> <p>The dropdown expands on focus but the option selected from the dropdown does not get selected ie. the expanded dropdown does not function as dropdown. I am not getting the value selected when i inspect in the firebug.</p> <p>When I set AutoPostBack to true of the dropdownlist, I get the dropdown value but I don't want to refresh the page. </p> <p>Thanks,</p>
jquery asp.net
[5, 9]
4,285,863
4,285,864
jQuery - multiple event listeners for same button
<p>Say I have an button with an id:</p> <p><code>&lt;input id='someButton' /&gt;</code></p> <p>I want to attach an event listener on this button:</p> <pre><code>$('#form').on('click', '#someButton', function() { alert("My listener called"); </code></pre> <p>});</p> <p>However, unbeknownst to me, someone previously wrote an event listener for this very same button:</p> <pre><code>$('#form').on('click', '#someButton', function() { alert("Some other listener called"); }); </code></pre> <p>I encountered some code that effectively does the same thing as above, and it seems like the first listener registered is the one that is used. Am I correct in assuming jQuery will always call the first event listener registered on a specific id (and <em>only</em> that listener)?</p>
javascript jquery
[3, 5]
3,394,210
3,394,211
Java move <Preference> from one PreferenceScreen to another?
<p>I'm trying to do something similar to iOS editable UITableView. I have a list of "added items" if the user clicks on "Add new item" he is taken to a PreferenceScreen with multiple <code>&lt;Preference&gt;</code> elements, onclick I remove them from this screen and add it to the "Added list" (actually a <code>&lt;PreferenceCategory&gt;</code>), this is similar to iOS editable lists.</p> <p><img src="http://i.stack.imgur.com/7NNiD.png" alt="Click &quot;Add App&quot;, click on app to add to PreferenceCategory"></p> <p>This is my xml:</p> <pre><code>&lt;PreferenceScreen android:title="ALL APPS" android:key="app_list"&gt; &lt;/PreferenceScreen&gt; &lt;PreferenceCategory android:title="ADDED APPS" android:key="my_apps_list"&gt; &lt;/PreferenceCategory&gt; </code></pre> <p>I have tried uncountable times and I cannot get it to work. My recents attemp produce a very strange bug in which the preference is added but it's never removed from the prefernece screen. </p> <p>How can I get it done?</p> <hr> <p>This is what I am trying right now, addPreference() is called when a preference is clicked:</p> <pre><code>public void addPreference(Preference pref) { PreferenceScreen fullList = (PreferenceScreen) findPreference("app_list"); PreferenceCategory addedList = (PreferenceCategory) findPreference("my_apps_list"); addedList.addPreference(pref); fullList.removePreference(pref); } </code></pre> <p>For some reason this works only one time, afterwards it moves the preference to the <code>&lt;PreferenceCategory&gt;</code> but it doesn't remove it from the <code>&lt;PreferenceScreen&gt;</code>.</p>
java android
[1, 4]
5,482,063
5,482,064
How to find the number of HTML elements with a name that starts with a certain string in c#?
<p>I'm not sure if the topic describes my problem very well but I am creating some HTML elements (textboxes) on the fly with jQuery and I never know how many I will create (it loops through a database). I then want to get all the elements in the code behind and perform some actions (insert them into another database).</p> <p>I know I can use </p> <pre><code>string n = String.Format("{0}", Request.Form["hiddenField0"]).ToString(); </code></pre> <p>To get the first textbox but what if Idon't know how many textboxes I have created and want them all? Their name starts with hiddenField plus an incrementing number.</p> <p>Is there a way to loop through all elements that has a name that starts with a certain string?</p> <p>Thanks in advance</p>
c# asp.net
[0, 9]