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
732,792
732,793
What is causing a nullreference exception in this code?
<p>I try to add a new "Order" to my Session. I begin create a session in my Global.aspx file under Session_Start:</p> <pre><code>Session.Add("Cart", new WebShopData.Order()); </code></pre> <p>At my login page i make a new Session:</p> <pre><code> Session["userID"] = "User"; ((Order)Session["Cart"]).UserID = userID; </code></pre> <p>Then at my shop page i want to add stuff to the session:</p> <pre><code> if ((Order)Session["Cart"] != null) ((Order)Session["Cart"]).OrderRow.Add(new OrderRows({ArticleID = 2, Quantity = 1) }); </code></pre> <p>At this last line i get att nullreference exception. Why could that be?</p> <hr> <p>Here are my two classes:</p> <pre><code> public class Order { public List&lt;OrderRows&gt; OrderRow { get; set; } public string Address { get; set; } public string City { get; set; } public string Zip { get; set; } public int UserID { get; set; } } public class OrderRows { public int ArticleID { get; set; } public int Quantity { get; set; } public override string ToString() { return string.Format("Artikel: {0}, Antal: {1}.\n", ArticleID, Quantity); } } </code></pre>
c# asp.net
[0, 9]
3,888,930
3,888,931
What's the equivalent of "has_key" in javascript?
<pre><code>if dictionary.has_key('school'): </code></pre> <p>How would you write this in javascript?</p>
javascript python
[3, 7]
5,675,554
5,675,555
Show table cell on table row mouseover
<p>I have a table that looks something like this.</p> <pre><code>&lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Foo&lt;/th&gt; &lt;th&gt;Bar&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr class="data"&gt; &lt;td&gt;Info here&lt;/th&gt; &lt;td&gt;&lt;a href"/url_here" class="edit"&gt;Edit&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr class="data"&gt; &lt;td&gt;More here&lt;/th&gt; &lt;td&gt;&lt;a href"/url_here" class="edit"&gt;Edit&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>I want to show the Edit link when you mouse over any of the rows inside of the . I have tried a few methods of doing this, but keep hitting the same problem. Assuming I'm just thinking about this the wrong way.</p> <p>This is what I currently Have.</p> <pre><code>$('a[class*=edit]').hide(); $('tr[class*=data]').bind("mouseover", function(e) { $(e.target).closest('a[class*=edit]').addClass("selected"); $('a[class*=selected]:first').show(); }).mouseout(function() { $('a[class*=selected]').hide(); $('a[class*=edit]').removeClass("selected"); }) </code></pre> <p>Problem with the existing code is it's not adding the selected class unless you hover directly over the edit link. Like I mentioned above I need it to add the selected class when you mouse over anywhere in the that row. I also only want it to display the edit link for that specific row.</p> <p>Any help would be really appreciated been pulling my hair out for a couple hours and I know it is probably something stupid. Thanks!</p>
javascript jquery
[3, 5]
2,194,038
2,194,039
PasswordStrength Extender Not showing text description
<p>I am trying to implement the passwordstrength feature in my web app. But, the text descriptions don't appear, only "xx character left". What is wrong with my code?</p> <pre><code>&lt;tr&gt; &lt;td&gt; &lt;asp:Label ID="Label6" runat="server" Text="Password"&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:TextBox ID="txtPassword" runat="server" TextMode="Password" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;asp:PasswordStrength ID="txtPassword_PasswordStrength" runat="server" Enabled="True" TargetControlID="txtPassword" PreferredPasswordLength="10" TextCssClass="TextIndicator_TextBox1" RequiresUpperAndLowerCaseCharacters="True" HelpStatusLabelID="Label10" TextStrengthDescriptions="Poor;Weak;Average;Strong;Excellent" StrengthIndicatorType="Text" PrefixText="Strength:" MinimumLowerCaseCharacters="0" MinimumNumericCharacters="0" MinimumSymbolCharacters="0" MinimumUpperCaseCharacters="0" DisplayPosition="RightSide" /&gt; </code></pre>
c# asp.net
[0, 9]
1,688,836
1,688,837
how to set button to be visible only after i made changes in 2 dropdownlists in javascript
<p>in aspx file I have </p> <pre><code>&lt;asp:DropDownList ID="DropDownList1" runat="server" &gt; &lt;/asp:DropDownList&gt; &lt;asp:DropDownList ID="DropDownList2" runat="server"&gt; &lt;/asp:DropDownList&gt; &lt;asp:Button ID="load_data" runat="server" Text="&lt;%$ Resources : load_data %&gt;" onclick="load_data_class_Click" Visible="False"/&gt; </code></pre> <p>Now I want to set button to be visible only after i made changes in 2 dropdownlists in javascript</p> <p>how to do this?</p>
javascript asp.net
[3, 9]
5,065,030
5,065,031
an object reference is required for the nonstatic field method or property
<pre><code>[System.Web.Services.WebMethod] public static void GetCurrentTime(string name) { string strFileName = "D://Data.csv"; string connectionstring = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\;Extended Properties='text;HDR=Yes;FMT=Delimited';"; OleDbConnection connection = new OleDbConnection(); connection.ConnectionString = connectionstring; OleDbCommand command = new OleDbCommand(); command.CommandType = CommandType.Text; command.Connection = connection; if (name != "") { command.CommandText = "select * from " + System.IO.Path.GetFileName(strFileName);// +" where F=" + txtmtcn.Text; connection.Open(); DataTable dt = new DataTable(); dt.Load(command.ExecuteReader()); dt.Columns[5].ColumnName = "MTCN"; dt.DefaultView.RowFilter = " MTCN =" + name; dt = dt.DefaultView.ToTable(); TxtSenderFirstName.Text = dt.Rows[0][7].ToString(); connection.Close(); } } </code></pre> <p>i get Error "an object reference is required for the nonstatic field method or property" how will i access my text box controls and populate data in them.</p>
c# asp.net
[0, 9]
5,257,941
5,257,942
How to open another form in codebehind using javascript
<p>I have following code in button click Response.Write("window.open('Contact.aspx')");</p> <p>The above code is working.but if use</p> <pre><code>String s = "Contact.aspx"; Response.Write("&lt;script type=text/javascript&gt;window.open('"+s+"')&lt;/script&gt;"); </code></pre> <p>The above code shows error as 'Too many literals'.Can anybody help to remove this error.</p>
c# asp.net
[0, 9]
5,674,896
5,674,897
move event handler with jQuery
<p>I have an issue which is driving me crazy and as a last resort I am placing a question here.</p> <p>I want to move the onclick event from an element to the onfocus event of the same element and I am using the following code:</p> <pre><code>$("#theElement").bind("focus", {}, $("#theElement").data("events").click); $("#theElement").unbind("click"); </code></pre> <p>Maybe you have guess it. IT DOES NOT WORK.</p> <p>How do I make this work? I am getting a "fn.apply is not a function" message in the following piece of code from jquery 1.3.2:</p> <pre><code>proxy: function( fn, proxy ){ proxy = proxy || function(){ return fn.apply(this, arguments); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++; // So proxy can be declared as an argument return proxy; } </code></pre> <p><strong>EDIT:</strong> I'm sorry, I should have mentioned. This comes from a plugin which does some stuff when clicking an element. I want to make the same thing when the element gets focus not when it is cliked so the simplest solution I thought off was this since I can't modify the code for the plugin.</p> <p><strong>EDIT:</strong> Found the problem. It is similar to what @sje397 posted in his answer, not</p> <pre><code>$('#theElement').data('events').click[0] </code></pre> <p>but</p> <pre><code>$('#theElement').data('events').click[3] </code></pre> <p>For some reason, even if only one event is registered the thing ends up as 3 (the guid in that piece of code from jquery).</p>
javascript jquery
[3, 5]
5,681,762
5,681,763
RSA decrypt in ANdroid
<p>I am using RSA modulus and encrypting a data with modulus and trying to decrypt it with private key of RSA ..i m using RSA/ECB/PKCS1Padding at the decrypt end </p> <p>Thnx in advance </p>
java android
[1, 4]
3,725,095
3,725,096
Keyup event firing, change event not
<p>I am building a bunch of controls dynamically. </p> <p>Essentially I am attaching a keyup to the textbox to detect when up/down is pressed in a table to move between cells. I am also watching for when the input field changes, because I then add that control to an array for posting back when the user hits save.</p> <p>This works when I tab between controls or click from one control to the next. However, If I use the arrow keys as coded to move between fields, the change event does not fire.</p> <p>My event handling code looks like this:</p> <pre><code>$('input[id^="reo_"]').bind('change', function () { rowDetailChange($(this)); }); $('input[id^="reo_"]').bind('keyup', function (e) { processKeyUp($(this), e); }); </code></pre>
javascript jquery
[3, 5]
3,359,775
3,359,776
Android icon sometimes open new app sometimes brings up old app, help!
<p>I have an android app which i have written, which exhibits some strange behaviour. </p> <p>When i have an app open, say with three acitivties in the stack</p> <p>A - B - C</p> <p>where a is the entry point and C is the currently viewed activity, if i press the home button and reselect the icon for my app sometimes i see A, which on pressing the back button i can see the task now contains the activities </p> <p>A - B - C - A</p> <p>and sometime it just reopens the app in the last state</p> <p>A - B - C</p> <p>which is what i want to happen. Could anyone inform me of why the inconsitant behaviour is happening. On both cases i press the icon strait after exiting the app via the home key. </p> <h1>Thanks for any help!</h1> <p>ps i have also asked this question on anddev <a href="http://www.anddev.org/viewtopic.php?p=32699#32699" rel="nofollow">here</a></p>
java android
[1, 4]
2,373,803
2,373,804
jQuery - how to check if two elements are the same?
<p>I need to pass an element to a function and then match that specific element while traversing parent. The catch (for someone clueless like me) is that this element doesn't have an id. In the following example, I want every element to turn pink except the one clicked on that should turn yellow</p> <pre><code>function colorize(element) { element.parent().find('span').each(function() { if ($(this)===element) { // the problem is this is always false $(this).css('background','yellow'); } else { $(this).css('background','pink'); } }); } $('span').click(function() { colorize($(this)); }); </code></pre>
javascript jquery
[3, 5]
4,169,204
4,169,205
Submit username and password javascript (not a form)
<p>I have a popup which asks the user for login information, which means two input text fields for password and username. </p> <p>Now as I will be verifying the information using ajax I didn't wrap the elements on a because form always needs a php action, correct? or am I missing something?</p> <p>So I'd like to know if there is a fancier way to check if the user pressed enter, in order to submit the login information, than checking each time a key is pressed, with keydown, if it's the enter key. </p> <p>Thanks in advance</p>
javascript jquery
[3, 5]
5,913,826
5,913,827
Click event when not clicking on an element
<p>Maybe I'm, just tired but I have a right click menu that I want to close when the user clicks anywhere else than the menu. But I cant figure out how to make it disappear when the user clicks on something else.</p> <p>Here is the code for showing the menu:</p> <pre><code>// If mouse click on was pressed $('#content_list table tr').bind('mouseup', function(event) { // if right click if(event.which == 3) { showRightClickMenu(event); } event.preventDefault(); event.stopPropagation(); }); </code></pre> <p>And this is what I got for hiding the menu</p> <pre><code>// If mouse click outside document $(document).bind('blur', function(event) { hideRightClickMenu(); event.stopPropagation(); }); // If mouse click not on the menu $('*:not(#rightClickMenu *)').bind('mousedown keydown', function(event) { hideRightClickMenu(); event.stopPropagation(); }); </code></pre> <p>The first bind checks if the user clicks outside the document and the second bind checks if the user clicks on everything except the menu. But the second one doesn't really work. If I click on the menu the menu is hidden.</p> <p>Shouldn't be so hard imo... Anyone got any ideas?</p>
javascript jquery
[3, 5]
3,004,330
3,004,331
Jquery Selector in Horizontal Accordion
<p>I'm Trying to build a simple horizontal accordion that will eventually contain more complex data (iframes)... The problem is that I want the size of each accordion tab to be specific to the data it contains, so I'm trying to edit what's already out there (Some tabs are larger than others). When a user hovers over any tab I want to expand that tab to 50% (regardless of its previous size). All that is working fine, but the problem is I can't figure out how to go back to the tabs ORIGINAL width after mouseout. Right now I have the panels shrinking to 10% to illustrate the problem. If you cycle through the page then reload you will see what i mean. Any ideas?</p> <p><a href="http://www.brianvargo.com/test.html" rel="nofollow">http://www.brianvargo.com/test.html</a></p>
javascript jquery
[3, 5]
4,146,638
4,146,639
how to UnSelect all rows in GridView - asp.net?
<p>how to UnSelect all rows in GridView - asp.net ?</p> <p>if i select one row in GridView and make any refresh, how to unselect this row ?</p> <p>thanks</p>
c# asp.net
[0, 9]
3,375,958
3,375,959
Multiple classes extending Application
<h1>two classes extend Application</h1> <ul> <li>One class I've registered in the Manifest and am using as an <code>Application</code> is meant to be </li> <li>Second class is my utilities class. It does lots of I/O and has a few helper methods. For I/O you need context (getAssets etc), so I reluctantly extended Application.</li> </ul> <p><em><strong>Note:</em></strong></p> <blockquote> <p>Everything is working as it should.</p> </blockquote> <p><em><strong>My Question:</em></strong></p> <p>Are there any drawbacks of using multiple Application classes? Is this even advised?</p> <p><strong>A few thoughts:</strong></p> <ul> <li>Like what would happen if I had onCreate and other callback methods defined in both the classes? </li> <li>How do I register them both in the manifest even? etc </li> </ul> <p>PS: I know I can just use a field to store context in the second class.</p>
java android
[1, 4]
5,102,341
5,102,342
responsive design via an iframe
<p>The responsive design on site that is viewed via an iframe does not appear to work. I would like change the width css of the child so that it fits correctly</p> <p>This is what I have tried:</p> <pre><code>&lt;script type='text/javascript'&gt; $(document).ready(function(){ $("##frameDemo").contents().find("body").css("width","100px"); }); &lt;/script&gt; &lt;iframe src="http://www.domain.com?ID=#getincentiveID()#" width="80%" height="100" id='frameDemo'&gt;&lt;/iframe&gt; </code></pre>
javascript jquery
[3, 5]
3,185,341
3,185,342
how send a contain of a file block by block through ASIFormDataRequest?
<p>i implemented a code using ASIFormDataRequest to upload a file to server </p> <p>my code goes like this:</p> <pre><code> NSURL *url = [NSURL URLWithString:@"someurl"]; NSString *filePath = [[NSBundle mainBundle] pathForResource:@"medelix.db" ofType:nil]; NSData *myData = [NSData dataWithContentsOfFile:filePath]; ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; [request setPostValue:@"file" forKey:@"serverIP"]; [request setData:myData withFileName:@"Data.txt" andContentType:@"application/octet-stream" forKey:@"uploadedfile"]; // [request setProgressDelegate:self]; [request setDelegate:self]; [request setDidFinishSelector:@selector(postFinished:)]; [request setDidFailSelector:@selector(postFailed:)]; [request startAsynchronous]; NSData *newStringData = [request responseData]; NSString *x = [[[NSString alloc] initWithData:newStringData encoding:NSUTF8StringEncoding] autorelease]; NSLog(@"result text from server is %@", x); </code></pre> <p>my server side PHP is :</p> <pre><code>&lt;?php $target_path = '/Applications/XAMPP/xamppfiles/htdocs/myupload/'; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?&gt; </code></pre> <p><strong>Bug I found while running :request responseData does not gave any thing</strong> </p> <p><strong>Now i wants to send a Block of data to server through ASIFormDataRequest,until the file contain is not finished (sending file contain chunk by chunk ).</strong></p> <p>can any body suggest me with a piece of code that how to send data chunk by chunk using ASIFormDataRequest?</p>
php iphone
[2, 8]
2,607,398
2,607,399
How to remember the username and password in c# using cookie
<p>Am new in c# and i've created a login form with two fields username and password also remember me checkbox.. first time user logged in the form with checked the remember me checkbox.. can u guide me how to generate the users password automatically in password field from cookie when the user logged in next time using c#?? </p>
c# asp.net
[0, 9]
4,331,365
4,331,366
Detect when HTML has finished loading AND rendering on the page
<p>Is it possible to detect when HTML has finished loading AND rendering on the page? If so, how?</p> <p>The page consists of HTML, calls to ajax, receives data back from ajax calls, lots of javascript stuff and some images too. I would like to detect when everything has finished. What I can't do is stick a function call at the end, because I don't know when the end is.</p> <p>For example, the page has lots of ajax style elements which users can pick and choose from, i.e. user 1 might have a different number of elements than user 2 and even in a different order.</p> <p>So what I can't do is use the last function to simulate the end of HTML rendering, because I won't know which function will be the last function.</p>
javascript jquery
[3, 5]
4,619,423
4,619,424
Looping through data in Javascript, combining new id's with old
<p>Many times I'm having to loop through data and add the new to the old, but I can never seem to get it right.. Here's what I have now, basically trying to concatinate together the previous number from the new number, ultimately building a comma delimited string of numbers:</p> <pre><code> function showItems(){ if(prev_numbers == undefined){ var prev_numbers = ''; }else{ prev_numbers = prev_numbers; } numbers = Math.floor(Math.random()*101); values = numbers +','+ prev_numbers; // Here is where some code would be that makes use of comma delimited numbers alert(values); prev_numbers = values; } setInterval(showItems, 1000); </code></pre>
javascript jquery
[3, 5]
5,175,787
5,175,788
What is a good project / way for an out of practice C++ developer to get back into it?
<p>Like many people here, I started my programming experience with the good ol' green screen BASIC that you get when you booted an Apple II without a disk. I taught myself C++ in my teens, and even took a class on it in college, but as soon as I discovered .NET and C#, I dropped C++ like a bad habit. Now, (many) years later, I'm interested in getting back into C++ development - thank the iPhone for that - and I have to admit, I feel a little daunted. Having to deal with pointers, ATL, macros, etc. seems a bit overwhelming at times when you've been in managed .NET land for a long time. </p> <p>What are some good resources or weekend type projects I could do to ease me back into C++? I'm not interested in debating the relative merits between platforms, stacks, but I would be interested in hearing about <em>objective</em> comparisons between different development platforms, although keep in mind I'm a Windows guy.</p> <p>If anyone wants to change the tags around, feel free - I wasn't quite sure how to tag this.</p> <p>TIA!</p>
c++ iphone
[6, 8]
342,461
342,462
Are those dangerous idioms/usages in C++ avoidable in C#?
<p>In this Herb Sutter's article '<a href="http://www.gotw.ca/publications/advice97.htm" rel="nofollow">Write What You Know, and Know What You Write</a>', he warns about the dangerous idioms in C++.</p> <pre><code>T&amp; T::operator=( const T&amp; other ) { if( this != &amp;other ) { this-&gt;~T(); new (this) T(other); } return *this; } </code></pre> <p>Does C# solve this kind of dangerous cases? Is C# a better programming language than C++ in terms of having less dangerous idioms?</p>
c# c++
[0, 6]
5,760,682
5,760,683
Required fields one of two fields
<p>I am writing in asp.net c#.</p> <p>I want a control similiar to RequiredFieldValidator except I want one of two fields to be required. I found an excellent example for two text fields but in my case one field is a check box and the other is an text box. If the check box is not checked the text box must be entered. </p> <p>Any thoughts? </p>
c# javascript asp.net
[0, 3, 9]
2,290,988
2,290,989
How to get current date directly from internet in asp.net (not system date)?
<p>I am developing an app with booking engine. So basically I need a date from internet. </p> <pre><code>System.DateTime.Now </code></pre> <p>I have used this but it returns me current (local) system date. I don't want system date because it can be changed at client's end. So I am looking for Internet (UTC) date.</p>
c# asp.net
[0, 9]
1,453,779
1,453,780
Jquery simple menu
<p>I need to create a menu same as this one:</p> <p><a href="http://www.girard-perregaux.com/collection/univers-en.aspx?type=1" rel="nofollow">http://www.girard-perregaux.com/collection/univers-en.aspx?type=1</a></p> <p>Click on collections then on manufacturer, then again on manufacturer to close. As you can see first it slides down, then after that it just change links without again sliding up and down, untill you click on same open element.</p> <p>I first tried this:</p> <pre><code>$('ul.sub-menu').hide(); $('.sf-menu').children('li').click(function(){ $(this).children(".sub-menu").slideToggle('slow'); $('ul.sub-menu').hide(); </code></pre> <p>its working but its sliding up and down every time you click on menu, and not just changing list items. So I figured out I need to somehow target child li elements instead of ul. Also if you click between parrent list items, it needs to switch like on that menu, but if i click again on same open list item, it needs to close(slide up.)</p> <p>Many thanks for this as I spent half a day trying to figure it out. Also how to target children li, i tried this:</p> <pre><code>$('.sf-menu').children('li').click(function(){ $(this).children(".sub-menu li") </code></pre> <p>but nothing.</p>
javascript jquery
[3, 5]
3,728,556
3,728,557
How to stop default music player while I'm running my music app
<p>I'm creating a music player app.</p> <p>If in background the default music player is running and if I use my app to play music, both runs simultaneously.</p> <p>Is there a way to stop background music player.</p> <p>Thanks</p>
java android
[1, 4]
5,004,470
5,004,471
How to show a conditional checkbox in DataList
<p>I need to show a checkbox in the DataList <strong>if</strong> a particular column in the binded Data Source is having a particular value.</p> <p>Means look for a particular value. if exist then show checkbox else dont show.</p>
c# asp.net
[0, 9]
4,952,737
4,952,738
How to get controls depending upon the iteration count?
<p>I want to get clientId dynamically depending upon the iteration count e.g</p> <pre><code>var clientID = "&lt;%=NumericTextBox" + 1 + ".ClientID %&gt;"; var id = document.getElementById(clientID); </code></pre> <p>but if i try to use above statements to get the control it throws ";expected", ")exppected" errors what is the proper way of getting the control?</p>
javascript jquery asp.net
[3, 5, 9]
952,648
952,649
Slide 4 documents at a time
<p>I found image slider which slides a single image at a time.</p> <p>Can anyone please help me how to slide 4 documents or images at a time.</p> <p><img src="http://i.stack.imgur.com/dkpcq.png" alt="enter image description here"></p> <p>Is there any plugins available in jquery.</p> <p>I am using Javascript and jQuery.</p> <p>Thanks in advance.</p>
php javascript jquery
[2, 3, 5]
5,241,505
5,241,506
Page_ClientValidate returns false but none of the validators have errors
<p>I am using Page_ClientValidate for validations.</p> <p>It returns false even there is no invalid inputs.</p> <pre><code> function PageValid() { var valid = Page_ClientValidate('save'); alert(valid); if (valid == true) { $('.mydiv').hide(); } } </code></pre> <p>Here 'save' is the validation group. Please help me guys.</p> <p>Thanks, Rajbir</p>
javascript asp.net
[3, 9]
2,969,372
2,969,373
Advice for C# programmer writing Python
<p>I've mainly been doing C# development for the past few years but recently started to do a bit of Python (not Iron Python). But I'm not sure if I've made the mental leap to Python...I kind of feel I'm trying to do things as I would in C#.</p> <p>Any advice on how I can fully take advantage of Python?</p> <p>Or any tips\tricks, things to learn more about, things to watch out for?</p>
c# python
[0, 7]
3,127,619
3,127,620
Not Adding Record with "Space"
<p>I'm using direct url to a record in my database, but my problem was, when the records contains " " or "space" it didn't save. for example:</p> <blockquote> <p>name = "Lebron" this is working.</p> <p>name = "Lebron James" </p> </blockquote> <p>this will not work because of the space between first and last name. Did anyone already encountered this type of error?</p>
c# asp.net
[0, 9]
3,844,286
3,844,287
convert a php string array into a js array in js
<p>I have an array from data that's retrieved from AJAX (which it comes from MVC-view-cakephp). I want to refill the array into combobox. Array looks like this:</p> <pre class="lang-none prettyprint-override"><code>Array ( [266] =&gt; Andy Employee II [26] =&gt; Annette Oliveira [214] =&gt; Edwina Umeyor [39] =&gt; Eva Britton [193] =&gt; Leigh Otterson [68] =&gt; Louise Edelston [71] =&gt; Margaret Williams [97] =&gt; Simon Harris ) </code></pre>
php javascript
[2, 3]
2,910,688
2,910,689
Why does my Javascript return [object HTMLScriptElement] instead of expected text?
<p>I am having similar issues from</p> <p><a href="http://stackoverflow.com/questions/2222417/unable-to-run-an-external-javascript-using-a-bookmarklet">unable to run an external javascript using a bookmarklet</a>.</p> <p>But I am executing my JavaScript inside a Java application via injecting script headers into the current DOM loaded via Java application.</p> <p>This problem seems to occur randomly. Some cases it returns <code>[object HTMLScriptElement]</code> and other times returns the text...</p> <p>When I <code>alert()</code> the object, it returns text! </p> <p>I have tried <code>return String(hi);</code> but still no effect.</p> <pre><code>function returnsomeText(){ var hi = someArray.join(':'); alert(hi); //returns text:text:text:text as expected. return hi; //returns [object HTMLScriptElement] } </code></pre> <p>I am very confused to as what is causing this problem! If JavaScript returns <code>[object HTMLScriptElement]</code> then my Java application cannot process the text.</p> <p>This question is in more detail here:</p> <p><a href="http://stackoverflow.com/questions/4732618/exception-in-thread-awt-eventqueue-0-java-lang-nullpointerexception-when-trying">Exception in thread &quot;AWT-EventQueue-0&quot; java.lang.NullPointerException when trying to execute Javascript</a></p>
java javascript
[1, 3]
1,064,824
1,064,825
Text being updated in real time
<p>I need some text to be updated in real time depending on choices from dropdown boxes.</p> <p>Here's an example: <a href="http://www.thatsoftwareguy.com/swguy_demo_1.3.7/index.php?main_page=product_info&amp;cPath=65&amp;products_id=183" rel="nofollow">http://www.thatsoftwareguy.com/swguy_demo_1.3.7/index.php?main_page=product_info&amp;cPath=65&amp;products_id=183</a></p> <p>I know how to get an input box automatically updated, using the NAME and ID - but how do you give normal text a NAME and ID?</p>
php javascript
[2, 3]
5,113,890
5,113,891
about "static function" in c++,what is corresponding feature in Java
<p>about "static function" in c++,what is corresponding feature in Java</p> <p>Thank you</p>
java c++
[1, 6]
3,218,227
3,218,228
Jquery Focus on input field
<p>I have this code working on a page that literally just has 20 input fields each named and id'ed 1 through 20.</p> <p>If I set the variable id to the next id. E.g current fields id +1 then it will focus on that field. But at the moment when you click out of the current input it will not focus back onto the one you were last typing in if the number entered is over 10, but the alert will fire.</p> <p>Any help is appreciated.</p> <pre><code>$(":input").focusout(function(){ var input = $(this).val(); var id = $(this).attr('id'); if(input &gt; 10){ alert('You must enter a number between 0 and 10 '+id); $("#"+id).select(); } }); </code></pre>
javascript jquery
[3, 5]
5,879,690
5,879,691
Delete everything inside a tag but another tag jquery
<p>I have this piece of html </p> <pre><code> &lt;div id="Cart"&gt; &lt;p&gt; You have &lt;strong&gt;1&lt;/strong&gt; item in your cart. Your sub total is &lt;strong&gt;$35.00&lt;/strong&gt;. &lt;/p&gt; &lt;/div&gt; </code></pre> <p>I need to be able to get the information between the <code>&lt;strongs&gt;</code> and delete everything else, is that possible with jquery? I tried <code>$("#Cart strong:not()")</code> But didn't select anything, I thought maybe placing the info in a variable, deleting everything with .remove and reprinting the variables but I don't really know how to do that, can someone help me?.</p> <p>The information between the strong is dynamic, I believe all the other is in a php file that I dont have access to... maybe filtering the words and removing them? Any advice will be welcome :)</p>
javascript jquery
[3, 5]
2,829,135
2,829,136
Ringtone playing too long
<p>I'm using a RingtoneManager with RingtonePreference. When I use the default Ringtone, there is no problem, but when i use a configured Ringtone, it's playing for minutes... I don't know if the song's duration is minutes or if it plays in a loop... </p> <p>here my code:</p> <pre><code>private static void playNotificationSound(Context context) { RingtoneManager rm = new RingtoneManager(context); String ringtone = MySharedPreferences.ringtone(context); Uri uri = null; if(ringtone == null) uri = RingtoneManager .getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); else uri = Uri.parse(ringtone); if (uri != null) { Ringtone rt = RingtoneManager.getRingtone(context, uri); if (rt != null) { rt.setStreamType(AudioManager.STREAM_NOTIFICATION); rt.play(); } } } </code></pre> <p>I use it to play a song with a notification and I don't want the phone to play for 5minutes... </p>
java android
[1, 4]
1,903,116
1,903,117
What should I do for devloping a great project?
<p>I am going to start a new project as a project trainee. And my project is making a job-portal site. And I have done some work with winform but I am a newbie to asp.net,css,html and java script. And my expection is to make this project is very very great at all, and I am ready to work a lot and lot to make this project successfull. Amd reason to make good project is learning. </p> <ol> <li>Now I want to know that how should I start ?</li> <li>What should I do first ?</li> <li>Which things I should keep in my mind by doing this project ?</li> <li>Which structure I should follow ?</li> <li>Should I use mvc (I dont know more about mvc) ?</li> <li>How my database should be ?</li> <li>Which database I should use as a backend ?</li> <li>Which facilities should be provided to the user for more user freindliness ?</li> <li>What shoud I use for validation like javascript or ajax or regex ?</li> <li>Will there be a need of providing reporting services, if yes what should I use to do that ?</li> <li>And how can I know that what will be there at the side of admin and at the side of the employers as we can know at the side of the job seeker ? </li> <li>Give me other suggestions that this website should include as a functionality. </li> <li>Should my database has normalization ? </li> <li>How can I know more and requirement about this project ?</li> </ol> <p>I am asking these type of number of questions because I want to learn as possible as more. And want to involve as possible as more functionalities in this project. And second reason for knowing the answers of above question is I can come to know that which thing I should follow like one question is which database I should use then as an answer of this question I can come to know that which database is more used in the industry and is required to learn first. Thanks...</p>
c# asp.net
[0, 9]
3,938,046
3,938,047
iPhone Date Field - Change Date Format
<p>I have this field that asks for a date in an iPhone HTML App:</p> <pre><code>&lt;input type="date" name="DepartureDate" id="DepartureDate" placeholder="Date" value="" class="bookingField" /&gt; </code></pre> <p>This script:</p> <pre><code>var ddate1 = $('#DepartureDate').val(); alert(ddate1); </code></pre> <p>returns this value: 2012-12-01 (when I select this date of course). Now can I can convert "ddate1" to look like 01/12/2012 ? </p>
javascript jquery iphone
[3, 5, 8]
1,327,848
1,327,849
Implementing Voting Up and Down Arrows
<p>I am looking for a method in which allows a user to press up and down on two sets of arrows like the ones here and a number gets implemented within. When user presses on the up arrow they get a positive number and when the user presses down they get a negative number exactly like the ones here. </p> <p>Are there any examples like this online? I have looked at the jQuery libraries and could not find anything. </p> <p>How can this be done?</p>
jquery asp.net
[5, 9]
3,749,682
3,749,683
How do I tie in my image handler with an image control?
<p>I've been looking around and reading about handlers, but I don't fully understand how to implement them for my situation.</p> <p>I want display a screenshot from the user's clipboard. I already have code that retrieves the image from the clipboard into a bitmap format. This is what I have:</p> <pre><code>var dataobj = new DataObject(); dataobj = (DataObject)Clipboard.GetDataObject(); System.Drawing.Image img = dataobj.GetData(DataFormats.Bitmap) as System.Drawing.Image; original = (System.Drawing.Image)img.Clone(); img = resizeImage(img, new Size(670, 500)); String s = "c:/Temp/temp.png"; img.Save(s, ImageFormat.Png); Image1.ImageUrl = s; Image1.DataBind(); </code></pre> <p>My problem was that I am not able to save the images to the hard disk.</p> <p>My first question is will an image handler help me in this situation?</p> <p>if it will, how do I modify that code and tie it into my image handler with this code:</p> <pre><code>public class getmyimage : IHttpHandler { public void ProcessRequest(HttpContext context) { HttpResponse r = context.Response; r.ContentType = "image/png"; // Write the requested image r.WriteFile("temp.png"); } public bool IsReusable { get { return false; } } } </code></pre>
c# asp.net
[0, 9]
5,612,379
5,612,380
How to remove text (without removing inner elements) from a parent element using jquery
<p>Imagine that I have something like the following (modified from <a href="http://viralpatel.net/blogs/jquery-get-text-element-without-child-element/" rel="nofollow">http://viralpatel.net/blogs/jquery-get-text-element-without-child-element/</a>)</p> <pre><code>&lt;div id="foo"&gt; first &lt;div id="bar1"&gt; jumps over a lazy dog! &lt;/div&gt; second &lt;div id="bar2"&gt; another jumps over a lazy dog! &lt;/div&gt; third &lt;/div&gt; </code></pre> <p>How can I remove just (only text) "first", "second" and "third" from DOM without affecting any of the child elements. </p>
javascript jquery
[3, 5]
4,922,284
4,922,285
javascript test if URL relative or absolute and not mailto:
<p>I have tables with buttons/links/email with mailto: and have written a default double click function which on double click of the row will direct the user to the last link in the table. </p> <p>99% of tables will have the Edit button in the last column.</p> <pre><code>$('table:not(.noDoubleClick) tr td').dblclick(function() { var linkEl = $(this).parents('tr').find('td:last-child a'); if(!linkEl.length){ return false; } if (linkEl.attr('href') &amp;&amp; linkEl.attr('onclick') === undefined &amp;&amp; !linkEl.hasClass("popme")) { document.location = linkEl.attr('href'); } else { linkEl.click(); } }); </code></pre> <p>This works fine until I have a rare table where the last column is a email address with a mailto. </p> <p><strong>Q:</strong> How could I check if the href is relative/absolute link only. So that this would exclude mailto: and any other links which are not standard URLs.</p> <p>I know I could do something like this: <code>linkEl.attr('href').substring(0, 7) == "mailto:"</code> to test specifically for mailto but is there a better way of doing this without a load of IFs testing for the different protocols to be excluded. </p> <p>Update with working solution from @epascarello:</p> <pre><code>$('table:not(.noDoubleClick) tr td').dblclick(function(e) { var linkEl = $(this).parents('tr').find('td:last-child a'); var linkElHref = linkEl.attr('href'); // Check if has href and http protocol if(!linkElHref.length || this.protocol.indexOf("http") !== 0){ e.preventDefault(); return false; } if (linkElHref &amp;&amp; linkEl.attr('onclick') === undefined &amp;&amp; !linkEl.hasClass("popme")) { document.location = linkElHref; } else { linkEl.click(); } }); </code></pre>
javascript jquery
[3, 5]
5,205,420
5,205,421
onclick is still giving me problems
<p>Been looking at this for a while and even posted another question and got half the answer but the error still persists expected ';' character 392</p>
php javascript
[2, 3]
5,015,525
5,015,526
how do i change contents of a div within a div?
<p>What I am trying to do is change the contents of a div within a div. I can't seem to access it.</p> <p>dialog is the parent while dialogChange is the child.</p> <p>When I do:</p> <blockquote> <p>$("#dialog").text("New Text");</p> </blockquote> <p>It'll replace everything within the parent, dialog. </p> <p>But when I do:</p> <blockquote> <p>$("#dialogChange").text("New Text");</p> </blockquote> <p>Nothing changes. </p> <p>So how can I access the child within a parent?</p>
javascript jquery
[3, 5]
351,944
351,945
Extend the DropDown for Item ToolTip,Asp.net,C#
<pre><code>i need to extend the DropDownList For adding toolTip For DropDown Item On mouseOver. </code></pre> <p>If(Dropdown size is samller than Dropdownlist item then it will be useful for seeing the item as tool tip)</p> <p>For that i came to know, We need to create ServerControl project in VS2008 but i dont know how to add a property like ItemToolTip </p> <p>which need to be worked as (DataTextField, DataValueField in drop down list) in that class .</p> <p>tell me any link for ServerControl project sample which resembles my requirement.</p> <p>I tried using below code but dropdown property itself not working..</p> <p>namespace DropDownItemToolTip</p> <p>{</p> <pre><code>[DefaultProperty("Text")] [ToolboxData("&lt;{0}:ServerControl1 runat=server&gt;&lt;/{0}:ServerControl1&gt;")] public class ServerControl1 : System.Web.UI.WebControls.DropDownList { [Bindable(true)] [Category("Appearance")] [DefaultValue("")] [Localizable(true)] public string Text1 { get { String s = (String)ViewState["Text"]; return ((s == null) ? "[" + this.ID + "]" : s); } set { ViewState["Text"] = value; } } protected override void RenderContents(HtmlTextWriter output) { output.Write(Text1); } } </code></pre> <p>}</p> <p>Send me any sample project link, which done like this.. </p> <p>Thanks &amp; Regards </p>
c# asp.net
[0, 9]
524,574
524,575
Is there an overview of element selection methods in jQuery?
<p>I wonder if there's a good overview with examples that shows all the different ways of accessing html elements with jQuery.</p>
javascript jquery
[3, 5]
1,153,546
1,153,547
PHP code to modify a URL
<p>My current code is:</p> <pre><code>$scripturl.'main.php?i='.$app_id.'&amp;s='.$app_secret."&amp;n=".$n, 'response_type' =&gt; 'code')); </code></pre> <p>I want to add <code>&amp;display=touch</code> to the end of the result URL, like so:</p> <pre><code>status_update%2Cuser_birthday%2Cpublish_stream&amp;response_type=code&amp;display=touch </code></pre> <p>If I add it in the above code like this: <code>'response_type' =&gt; 'code&amp;display=touch'</code></p> <p>The result URL shows up like this:</p> <pre><code>status_update%2Cuser_birthday%2Cpublish_stream&amp;response_type=code%26display%3Dtouch </code></pre> <p>It converted <code>&amp;</code> to <code>%26</code> and <code>=</code> to <code>%3D</code>. How do i add <code>&amp;display=touch</code> without triggering that effect?</p>
php javascript
[2, 3]
3,819,920
3,819,921
Android OnDraw() and update with Timer
<p>I'm trying to make a game in Android that once a user presses start, there will be objects flying across the screen. I think I need to link my OnDraw() function with a timer so that the objects' positions can be updated. </p> <p>Currently, I am following a code sample I found online that prints out the text continuously. However, I can't import java.awt.event.ActionEvent and ActionListener. Eclipse is giving me a "The import java.awt.event cannot be resolved". Is there an Android equivalent to ActionEvent? Or is this done some other way? Thank you.</p> <pre><code>import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Timer; public class TimerSample { public static void main(String args[]) { ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { System.out.println("Hello World Timer"); } }; Timer timer = new Timer(500, actionListener); timer.start(); } } </code></pre>
java android
[1, 4]
3,979,496
3,979,497
asp image button refreshes page
<p>Hi My web page has lots of imageButtons, which refresh the page on click. How do I prevent this?</p> <pre><code> var imageButton = new ImageButton(); imageButton.ImageUrl = "Styles/unClicked.png"; imageButton.ID = "btn" + questionName; imageButton.OnClientClick = ("javascript:button_pressed()"); </code></pre>
c# asp.net
[0, 9]
4,168,833
4,168,834
Double Jquery Slider UI to output integers after first input
<p>Hopefully I can explain this clearly.</p> <p>I'm looking to have a two sliders, and the output on the second slider depends on the first sliders output.</p> <p>Firstly, the user sets a price on the first slider, then the user uses a second slider to set the number of customers allowed to purchase and item, the second slider should output only whole numbers from the calculation.</p> <p>For example. Price is set to £50. Then second slider should then output 1,2,5,10,25,50 as these are the only whole numbers from the calculation.</p> <p>I'm stumped! </p>
php jquery
[2, 5]
3,044,726
3,044,727
Download file after time from page load?
<p>i have an exe url that i want to download after 2 sec from page load: like this:</p> <pre><code> var handle = 0; function Download() { window.location = "exeUrl"; clearInterval(handle); } $(document).ready(function () { handle = setTimeout('Download()', 5000); }); </code></pre> <p><strong>NOW</strong>: My problem is window.location will reload the page and download function will be recall?</p>
javascript jquery
[3, 5]
935,125
935,126
How to get lazy evaluation of files in java as DirectoryInfo.EnumerateFiles() method of IEnumerable in C#
<p>In C# when you use DirectoryInfo.EnumerateFiles() method of IEnumerable interface, you can start enumerating the collection of names before the whole collection is returned.How to get this in java?</p>
c# java
[0, 1]
5,434,634
5,434,635
C++ vs C# for GUI programming
<p>I am going to program a GUI under windows (will be about 10,000 line code with my estimates) and don't know C# or C++ (QT library) to choose for my needs. Please help me to choose.</p>
c# c++
[0, 6]
324,421
324,422
How do I dynamically create a TextView with specified attributes?
<pre><code>&lt;TextView android:id="@+id/online_message" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:text="Onliners:" /&gt; </code></pre> <p>I want to create a <code>TextView</code> the same as the above by:</p> <pre><code>android.widget.TextView.TextView(Context context, AttributeSet attrs) </code></pre> <p>But how do I specify the <code>attrs</code> so that it represents the same attributes as the above?</p> <p><a href="http://stackoverflow.com/a/4796124/104015">This answer</a> is close , but is there a way to read ONLY the attributes(no <code>TextView</code> tag in xml) and parse as <code>AttributeSet</code>?</p> <p><strong>UPDATE</strong></p> <p>I'm seeking of a way to construct <code>AttributeSet</code> programatically.</p>
java android
[1, 4]
1,269,184
1,269,185
Can't get the object
<p>I am working in Slider concept in MVC. My code in ascx file is,</p> <pre><code> $(function () { alert('a'); var List = $('select#ScaleList').selectToUISlider().next(); alert(List); fixToolTipColor(); }); &lt;%=Html.DropDownList("CList", null, "-Select Scale-", new { id = "ScaleList", Style = "display:none" })%&gt; </code></pre> <p>In firefox, the above code is working fine. In IE, I can't get the object for <code>"$('select#ScaleList').selectToUISlider().next();"</code>......It's showing Invalid argument.</p> <p>How to get this...</p>
javascript jquery
[3, 5]
3,304,513
3,304,514
Check if all values of array are equal
<p>I need to find arrays where all values are equal. What's the fastest way to do this? Should I loop through it and just compare values?</p> <pre><code>['a', 'a', 'a', 'a'] // true ['a', 'a', 'b', 'a'] // false </code></pre>
javascript jquery
[3, 5]
1,132,056
1,132,057
Find gridview from parent ascx control using client side code
<p>I have a user control call parent.ascx and i load inside a child.ascx. In the child control i have a gridview and i want to access it using javascript from parent ascx control. I am using the following code but it doesnt found it. Any help?.</p> <pre><code> var grid = document.getElementById("&lt;%= child_grdrisk.ClientID %&gt;"); alert(grid.rows.length); </code></pre>
javascript asp.net
[3, 9]
2,533,501
2,533,502
Browse path shows c:\fakepath\filemae.................... how to get exact file path
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4851595/how-to-resolve-the-c-fakepath">how to resolve the C:\fakepath ?</a> </p> </blockquote> <p>Hi Am using a Jquery to browse a file from hard disk when i select a file, am getting its path as fakepath like below .... any idea how to display the exact file path in text box....?</p> <p><img src="http://i.stack.imgur.com/ySWji.png" alt="enter image description here"></p> <p>Thank you......</p>
javascript jquery
[3, 5]
2,131,343
2,131,344
Android: Pipe channels
<p>How can i use a pipe channel to open and read a file on android? Can anyone give me an example?</p>
java android
[1, 4]
1,758,424
1,758,425
Fastest way to set a css property?
<p>I'm busy creating a resizer, but on reloading it first switches from 100% until loading the cookie and setting the width to something fixed:</p> <pre><code>//set width from cookie, unfortunately we need todo this on docready because #main-container is not done rendering -_- var width = $.cookie("width"); // Set the user's selection for the left column if (width != null) { if (width == "fluid") { alert("fluid!"); $('#main-container').addClass('width-fluid'); } else { $('#main-container').addClass('width-fixed'); } } else { $('#main-container').addClass('width-fixed'); }; </code></pre> <p>Any ideas?</p> <p>Thanks,</p> <p>Dennis</p>
javascript jquery
[3, 5]
3,771,747
3,771,748
How do I get the previous HTML text prior to a node?
<p>UPDATE:<br> Someone asked: <em>for what purpose would I want to do this?</em><br> I'm trying to get the string index of a selected node server side, and since I have to account for repetition of small selections / nodes, I figure getting all html prior to the selected node on the client side would help in being the most accurate way to get the index.</p> <p>lets say I have html like this:</p> <pre><code>&lt;tag&gt; &lt;child&gt; &lt;subchild&gt; &lt;/subchild&gt; &lt;/child&gt; &lt;/tag&gt; </code></pre> <p>and I "select" subchild. I want to get all preceeding HTML as text** prior to that node.. so, in this case that would be:</p> <pre><code>&lt;tag&gt; &lt;child&gt; </code></pre> <p>is there a slick, easy way to do that?</p> <p>** I specify "as text" because, using jQuery / modern browsers, incomplete tags would become valid, as jQuery tries to make sure things don't break. Since I would not doing DOM manipulation with this information, I don't need valid HTML syntax.</p>
javascript jquery
[3, 5]
3,579,148
3,579,149
Sending an array as a server tag's property
<p>I am wondering if it's possible to send an array of strings to a tag's property</p> <pre><code>&lt;SampleTag:Form runat="server" ID="sampleform1" Items={item1,item2,item3,item4} &gt; &lt;/SampleTag:Form&gt; </code></pre> <p>This doesn't work since it sends "{item1,item2,item3,item4}" as a string to the class.</p>
c# asp.net
[0, 9]
5,630,705
5,630,706
Get device/model information from Android via Python
<p>Good day all!</p> <p>Hoping one of you Gurus can help me out with this issue.</p> <p>I am currently writing an app in Python which pulls device manuals from their websites and creates a User Manual shortcut for it to be launched.</p> <p>So far so good, but in the long run I would like to set it up to pull the manufacturer/model number from the Android OS and search according to the specific model.</p> <p>The problem? I can't for the life of me find anything Pythonic that can pull such information from the system? From searching Google, I was able to find out that in native languages, they can access android.os.Build to obtain such information but I cannot figure out how to access this via Python?</p> <p>Any suggestions would be greatly appreciated!</p>
android python
[4, 7]
2,011,311
2,011,312
Iphone C# development
<p>I wanted to use monotouch, but unfortunately I don't have $400 to spend.</p> <p>So I found xmlvm <a href="http://www.xmlvm.org/" rel="nofollow">http://www.xmlvm.org/</a> and I it seems It can crosscompile .net bytecode to objective c.</p> <p>But, I'm not sure, are there any wrappers? What else would I need to start developing for the iphone using xmlvm??</p>
c# iphone
[0, 8]
3,063,119
3,063,120
Textbox losing value after postback
<p>My page is a registration page, where a user enters an e-mail address and password. Here is my click event:</p> <pre><code>protected void btnRegister_Click(object sender, EventArgs e) { MembershipCreateStatus createStatus = MembershipCreateStatus.ProviderError; MembershipUser user = Membership.CreateUser(txtUsername.Text, txtPassword.Text, txtEmail.Text, null, null, true, out createStatus); if (createStatus != MembershipCreateStatus.Success) { cvUser.IsValid = false; cvUser.ErrorMessage = "Invalid"; } else Response.Redirect("Home"); } </code></pre> <p>Here is my page:</p> <pre><code>&lt;asp:ValidationSummary ID="vs" runat="server" /&gt; &lt;asp:TextBox ID="txtUsername" runat="server" /&gt; &lt;asp:TextBox ID="txtEmail" runat="server" /&gt; &lt;asp:TextBox ID="txtPassword" runat="server" TextMode="Password" /&gt; &lt;asp:Button ID="btnRegister" runat="server" OnClick="btnRegister_Click" /&gt; &lt;asp:CustomValidator ID="cvUser" runat="server" ControlToValidate="txtEmail" /&gt; </code></pre> <p><code>cvUser</code> is a custom validator on my page that I'm using so that the error message will show up on my <code>ValidationSummary</code>.</p> <p>So the problem occurs when the user creation fails. I set <code>cvUser.IsValid</code> to false so that the error will show, and then the page reloads. Only when the page reloads, all the data in my textboxes is gone.</p> <p>Is there a way to maintain that data?</p>
c# asp.net
[0, 9]
5,616,465
5,616,466
defining a shape xml element in drawable?
<p>I dropped the following into the drawable directory in my Android 1.5 project:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gradient"&gt; &lt;gradient android:startColor="#FFFF00" android:endColor="#FFFFFF" android:angle="270"/&gt; &lt;corners android:radius="0dp" /&gt; &lt;/shape&gt; </code></pre> <p>I get </p> <pre><code>java.lang.ClassNotFoundException at com.android.ide.eclipse.adt.internal.resources.manager.ProjectClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(Unknown Source) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:198) at android.view.BridgeInflater.onCreateView(BridgeInflater.java:99) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:562) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:122) at android.view.LayoutInflater.inflate(LayoutInflater.java:385) </code></pre> <p>etc etc etc in my Eclipse console. </p> <p>I also get the same ClassCastError in my logcat when I try to run the thing in my emulator, setting that drawable to be the background on a linear layout.</p> <p>Any ideas?</p>
java android
[1, 4]
1,655,541
1,655,542
Replacement of the complex character string
<p>The string is "hi\how \ r\ u\" and need to replace "\" with the space.</p> <p>String stringToModify = "hi\how \ r\ u\";</p> <p>stringToModify = stringToModify .replace("\\", "");</p> <p>System.out.println(stringToModify ); </p>
java android
[1, 4]
208,313
208,314
Android VideoView cannot play video
<p>I am trying to play video in Android. My widget is Kindle Fire so Android version is 2.3.4. Here is my code:</p> <pre><code>super.onCreate(savedInstanceState); setContentView(R.layout.video); Uri uri = Uri.parse(getIntent().getExtras().getString(VIDEO_URI)); MediaController mediaController = new MediaController(this); VideoView videoView = (VideoView) findViewById(R.id.videoView); videoView.setMediaController(mediaController); videoView.setVideoURI(uri); videoView.requestFocus(); videoView.start(); </code></pre> <p>It shows dialog box with title </p> <p>"Cannot play video" </p> <p>and message </p> <p>"An error occured while trying to play your video. The video may have been interrupted or is an unsupported format. Please try again."</p>
java android
[1, 4]
343,136
343,137
Why can't I stop this js click event propogation
<p>I'm trying to override a click handler by intercepting the event in an inline handler and stopping propagation (propogation disabling code taken from <a href="http://stackoverflow.com/a/5108218/165673">here</a>). </p> <p>The following code not only doesn't stop the propagation, it's not even firing the inline handler. I can't tell what's wrong.</p> <p>fiddle: <a href="http://jsfiddle.net/trKN4/3/" rel="nofollow">http://jsfiddle.net/trKN4/3/</a></p> <p><strong>HTML:</strong></p> <pre><code>&lt;a onclick='stopIt(event);'&gt;do it&lt;/a&gt;​ </code></pre> <p><strong>JS:</strong></p> <pre><code>function disableEventPropagation(event) { if (event.stopPropagation){ event.stopPropagation(); } else if(window.event){ window.event.cancelBubble=true; } } function stopIt(event) { disableEventPropagation(event); alert('dont do it'); } $(function() { $('a').click(function(e){ alert('im doing it'); }); }); </code></pre>
javascript jquery
[3, 5]
2,051,610
2,051,611
auto-refreshing div with jquery
<p>how exactly do you make an auto-refreshing div with javascript (specifically, jQuery) ? I knew about the setTimeout method, but is it really a good practice ? Is there a better method ?</p> <pre><code>function update() { $.get("response.php", function(data) { $("#some_div").html(data); }); window.setTimeout("update();", 10000); } </code></pre> <p>Thanks before.</p>
javascript jquery
[3, 5]
3,221,645
3,221,646
How to look for all the rows in a rowspan and set a class to all the rows
<p>I have a table </p> <pre><code>&lt;table border="1"&gt; &lt;tr&gt; &lt;td rowspan="2"&gt;September&lt;/td&gt; &lt;td&gt;Jim&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Dave&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;October&lt;/td&gt; &lt;td&gt;Fred&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>using the code I am able to apply the class Red to the first row of the rowspan only, i.e, only Jim is being highlighed red and not Dave. I also want Dave to have the class Red...Please note I want to apply the class per row and not per cell.</p> <pre><code>var fullRowNumCells=1; $('#table tr').each(function(){ if( $(this).find('td').length==fullRowNumCells){ if($.trim($(this).find('td:first').html()!='')) { $(this).addClass("red"); } } }); </code></pre>
javascript jquery
[3, 5]
4,638,372
4,638,373
How to make Android Buttons show animation on itself when clicked
<p>I'm trying to make a Button that will play a animation-list when pressed.</p> <p>I have made a animation.xml shown here:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;animation-list xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:drawable="@drawable/one" android:duration="500" /&gt; &lt;item android:drawable="@drawable/two" android:duration="500" /&gt; &lt;item android:drawable="@drawable/three" android:duration="500" /&gt; &lt;item android:drawable="@drawable/four" android:duration="500" /&gt; &lt;/animation-list&gt; </code></pre> <p>Also for the onClick function:</p> <pre><code>b_button.setBackgroundResource(R.drawable.animation); AnimationDrawable frameAnimation = (AnimationDrawable) b_button.getBackground(); frameAnimation.setOneShot(true); frameAnimation.start(); </code></pre> <p>When I press the button, the animation would be played, however, for just once, after when I press it the second time, it will not play. Furthermore, how do I change the button back to it's original state? Meaning the grey default look of the button.</p> <p>Any help is appreciated, Thanks in advance</p>
java android
[1, 4]
4,972,744
4,972,745
Parser Error Debugging VS2008
<p>When I create new VS2008 asp.net application it builds fine. But when I start debugging I get below error in browser. I've rebuilt the app. The Inherits clause of the markup page matches the class in the code-behind C#. Any clues?</p> <pre><code>Server Error in '/' Application. -------------------------------------------------------------------------------- Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not load type 'WebApplication3._Default'. Source Error: Line 1: &lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication3._Default" %&gt; Line 2: Line 3: &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; Source File: /Default.aspx Line: 1 -------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4927 </code></pre>
c# asp.net
[0, 9]
291,639
291,640
Cannot implicitly convert type 'System.Uri' to 'System.Collections.Generic.List<string>' ERROR
<p>I am using HTML Agility to get all the images since image dont always have absolute path i am trying to do following. But line marked below in the code generates error</p> <p>Cannot implicitly convert type 'System.Uri' to 'System.Collections.Generic.List' </p> <p>I am not sure how to fix this i tried so many option but keep on getting one or the other error</p> <pre><code>List&lt;String&gt; imgList = (from x in doc.DocumentNode.Descendants("img") where x.Attributes["src"] != null select x.Attributes["src"].Value.ToLower()).ToList&lt;String&gt;(); List&lt;String&gt; AbsoluteImageUrl = new List&lt;String&gt;(); foreach (String element in imgList) { AbsoluteImageUrl = new Uri(baseUrl, element); //GIVES ERROR } </code></pre>
c# asp.net
[0, 9]
3,863,504
3,863,505
Could someone give me an example of image uploader from URL?
<p>I am using this Image Upload and Cropping with PHP and Jquery: <a href="http://www.9lessons.info/2011/06/image-upload-and-cropping-with-php-and.html" rel="nofollow">9lessons.info</a> Maybe someone can give me please PHP script or link to script that allows me upload image from URL?</p>
php jquery
[2, 5]
1,979,584
1,979,585
How to get the number of jQuery elements returned from a matched condition?
<p>I have a jQuery filter on a set of elements that check to see which items are under the value of 90 and over 100. What I want to do is also get the number of items that match those conditions and eventually save them for output somewhere else on the page: </p> <pre><code>$("#dtarget li").filter(function() { if (parseInt(this.innerText) &lt; 90) { $(this).css("color","red"); } else if (parseInt(this.innerText) &gt; 100) { $(this).css("color","gold"); } }); </code></pre> <p>I'm new to jQuery and Javascript, so be easy. </p>
javascript jquery
[3, 5]
1,505,629
1,505,630
How to close the browser using C#?
<p>When my Login button is clicked, if the login was successful I'd like to close the browser.</p> <pre><code>protected void btnLogin_Click(object sender, AuthenticateEventArgs e) { if (isAuthenticated) { // close the browser } } </code></pre> <p>I'm not using AJAX so this happens on code behind.</p> <p>How to send a command (or a javascript call) to the browser to close itself using C# and perhaps using Response... object?</p> <p>thanks,</p> <p>UPDATE on the Answer (it closes without warning):</p> <pre><code>const string scriptKey = "closeBrowser"; if (!ClientScript.IsClientScriptBlockRegistered(scriptKey)) { ClientScript.RegisterClientScriptBlock(this.GetType(), scriptKey, "javascript:setTimeout('parent.Shadowbox.close();', 1000);", true); } </code></pre>
c# javascript jquery asp.net
[0, 3, 5, 9]
2,612,886
2,612,887
how to convert english number to chinese in java
<p>I have to convert english number to chines number. but as chinese number system is different than english. I there any way to convert english number getting at run time to convert in to chinese.</p> <p>Thank You. Vikram </p>
java android
[1, 4]
4,729,140
4,729,141
How to communicate with a car via Android smartphone?
<p>I want to start an app to be used by an Android smartphone to send information to a car. One example would be to unlock the car, but that is not precisly what I want to do is just an example. My question is, how can I communicate with the car? I am thinking of using a webservice, don't know if this would be adecuate for the prototype.</p> <p>I would appreciate some links, or info to point me in the right direction to enable a communication of some sort with the car, that is adding a modem to the car or something, I don't know much about how to be able to communicate. </p> <p>Is there a way to communicate in a longer distance, that is not using bluetooth, since bluetooth is for short distances?</p> <p>Thanks!</p>
java android
[1, 4]
2,733,888
2,733,889
Dynamically add rows to columns
<p>I am adding rows dynamically to a table. The table already has a row consisting of column headers like date, day etc.</p> <pre><code>for(var i=0; i&lt;=fix;i++){ var cols = 5; var tr = $('&lt;tr&gt;'); $('&lt;td name=Date"+i+" id=Date_"+i+"&gt;&lt;/td&gt;').appendTo(tr); $('&lt;td id=day_"+ i+"&gt;"+theday +"&lt;/td&gt;').appendTo(tr); for (var c = 0; c &lt; cols; c++){ $('&lt;td&gt; &lt;input type=text name=value_"+i+" id=value"+i+"&gt;&lt;/td&gt;').appendTo(tr); } tr.appendTo($('#tbl&gt; tbody:first')) } </code></pre> <p>I want to fill the 'td's with some vlaues stored in variable. But if i write</p> <pre><code>$('&lt;td name=Date"+i+" id=Date_"+i+"&gt;"+var+"&lt;/td&gt;').appendTo(tr); </code></pre> <p>where var is a variable, Its value does not appear. Instead the whole string is displayed. How can i prefill then with some variable values ?</p>
javascript jquery
[3, 5]
4,390,679
4,390,680
Defining ConnectionString in asp SqlDataSource
<p>I have my database connectivity which I define under <code>&lt;appSettings&gt;</code> in <code>web.comfig</code>:</p> <pre><code>&lt;appSettings&gt; &lt;add key="ConnStr" value="Data Source=dsk-159\SQLEXPRESS;Initial Catalog=master;Integrated Security=True"/&gt; &lt;/appSettings&gt; </code></pre> <p>But the problem is that I am unable to access it from my aspx page as I am trying like this</p> <pre><code>&lt;asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="&lt;%$ ConnectionStrings:goldsConnectionString %&gt;" SelectCommand="SELECT distinct TechnologyId , [TechnologyName], [ChildId] FROM [TreeTable] where childid is null AND technologyid in(@hid1)"&gt; &lt;SelectParameters&gt; &lt;asp:ControlParameter ControlID="hid1" Name="hid1" DefaultValue="23" /&gt; &lt;/SelectParameters&gt; </code></pre> <p>In place of <code>&lt;connectionStrings&gt;</code> I want to define it in <code>&lt;appSettings&gt;</code> </p> <p>Plesae tell the correct syntax.</p>
c# asp.net
[0, 9]
2,002,558
2,002,559
populate 2nd dropdownlist based on selection of first dropdownlist
<p>I want to populate 2nd dropdownlist based on selection of first dropdownlist like first dropdownlist select country and 2nd dropdownlist populates cities related to that country in asp.net C# wothout reloading the whole page. How can i do? <code>Dropdownlist</code> is fetching data database by executing query. Any idea?</p>
c# asp.net
[0, 9]
26,967
26,968
How to know when a download has finished?
<p>Is there a way to tell if when a download has finished? That is, we allow users to download a report in PDF format. It takes about 3 - 5 seconds to start downloading and in this time, from click to end of download, show a wait state icon so that the user doesn't click multiple times.</p> <p>Thanks! Eric</p>
javascript jquery
[3, 5]
1,418,090
1,418,091
Android:how to iterate an ArrayList<String> in different thread
<p>I need to iterate an ArrayList of String in a different thread, I don't need to add or delete items, just to iterate.</p> <p>How can I do it?</p>
java android
[1, 4]
2,446,499
2,446,500
Problem with jQuery - error when trying to find 2 tags
<p>I have the following DOM structure:</p> <pre><code>/*:DOC += &lt;div id='testDiv' class='testDivClass'&gt;&lt;div id='innerTestDiv'&gt;&lt;/div&gt;&lt;/div&gt;&lt;span id='testSpan' class='testSpanClass'&gt;&lt;span id='innerTestSpan'&gt;&lt;/span&gt;&lt;/span&gt; </code></pre> <p>Now I tried to run jQuery select against them as follow. The first one returned alright, but the second one failed:</p> <pre><code>// works var result = $('#testDiv')[0]; alert(result.id); // failed: id is null or not an object var result2 = $('#testSpan')[0]; alert(result2.id); </code></pre> <p>I tried selecting id instead of class and got the same results.</p> <p>My question is: how can I get the second select to work? Is there some sort of invisible iterator/pointer in jQuery which I need to reset to the beginning of the DOM before the second select?</p> <p>Thanks.</p> <p>EDIT: Ok this is the official "does not work" version. testDiv matched, but testSpan did not, hence I got an error saying id is null or not an object error in the second alert.</p> <p>UPDATE: I did a test by swapping testDiv and testSpan in the html. Now BOTH select failed.</p> <p>UPDATE2: I have changed the html back to what it used to look like. I'm using JsTestDriver to write up the test, but it is actually not calling anything at the moment. The actual html looks messier than this (more nested tags). I'm trying to get this simplified version to work first. It appears that jQuery was able to get into the first select, whether it'll be span or div, but couldnt get out of it to do the second select. I've replaced jQuery.js and jsTestDriver.jar to no avail.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
4,237,876
4,237,877
Open save as dialog on newly opened window
<p>How in JS/jQuery do I pop open the "Save As" dialog for a newly opened window. Basically I am scraping some data off of a web page. As such I am opening a new window via:</p> <pre><code>dataWindow = window.open('blank','dataWindow'); </code></pre> <p>I then write the output to the blank window but I want to automatically pop open the "Save As" dialog to save the content of the window to a file (text/csv). How would I do this. I tried:</p> <pre><code>dataWindow.document.execCommand("saveAs",true,".txt"); </code></pre> <p>but it doesn't seem to do anything.</p>
javascript jquery
[3, 5]
3,146,007
3,146,008
How to display users in a balanced treeview on webpage using javascript or jquery
<p>I am having different users with roles</p> <p>I want to display the in hierarchical way</p> <p>such as follows</p> <p>also i want to show each users information on right click such as details their devices etc</p> <p><img src="http://i.stack.imgur.com/egnE4.png" alt="hierarchy"></p> <p>I came across many jquery plugin whis show tree view ...</p> <p>but not found the balanced tree view </p>
javascript jquery
[3, 5]
2,445,633
2,445,634
Using a constant variable in C++
<p>I have a C++ file in my C++ project in Visual Studio. The C++ file has a snippet wherein some applications are run using <code>system</code></p> <pre><code>system("Files\\tx1"); system("Files\\tx2"); system("Files\\tx3"); system("Files\\tx4"); </code></pre> <p>I want to replace the "Files" constant with some constant variable which can be changed at a single place. Something like what we wuld do in C# with app.config files etc.<br/> Directly hardcoding a constant is not a good practice. C++ project doesn't have settings file unlike C# projects. So, any suggestions what I should do in this case?</p>
c# c++
[0, 6]
3,280,977
3,280,978
change border/color onFocus
<p>I tried to make script which changes color of border-bottom of div after having focus on </p> <pre><code>&lt;input type="text"&gt; </code></pre> <p>and then changing back to default color after clicking somewhere else.</p> <p>This is what i tried:</p> <p>Css:</p> <pre><code>.div1 {border-bottom:1px solid #ccc;} </code></pre> <p>Javacript: </p> <pre><code>function inputFocus(){ $(".div1").css("border-bottom","1px solid #ffba00"); }; </code></pre> <p>Html: </p> <pre><code>&lt;input type="text" onFocus="inputFocus();"&gt; </code></pre> <p>The first part (changing color on focus) works fine, however after clicking somewhere else (not having focus on input) it doesnt change back to normal style as set in css file.</p> <p>any idea what im doing wrong?</p>
javascript jquery
[3, 5]
5,433,592
5,433,593
Adding data to element so jQuery can use it
<p>I'm looking for an elegant way to add data to an element on server side so that jQuery/JavaScript can use it. I also do not want to make too many calls to server so data must be there upfront.</p> <p>Scenario example. Server side (PHP), I create a list of user images. To this, I want to add name, surname, age, etc.<br /> When clicking on the images, jQuery must then do something with this data.</p> <p>Possibilities I've considered:<br /> Have the data as href, then on click, get the href and return false.<br /> Have the data as classes. </p> <p>Are there any better ways?</p>
php jquery
[2, 5]
5,545,917
5,545,918
JQuery: How to stop child onclick event while still triggering the parent onclick event
<p>I wonder how can I stop child onclick event while still triggering the parent onclick event. For example the following structure:</p> <pre><code>&lt;div id="parent"&gt; &lt;div id="child1"&gt;&lt;/div&gt; &lt;div id="child2"&gt;&lt;/div&gt; &lt;div id="child3"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>if I click "child1" for example, the onclick event for "child1" will not be triggered, however, the onclick event for "parent" will still be triggered.</p> <p>Thank you very much!</p>
javascript jquery
[3, 5]
4,632,878
4,632,879
StringTokenizer not working
<p>I have a string as </p> <p><code>str=123|apple|apple|apple|dog$</code></p> <p>i like to seperate string using "|" character.</p> <pre><code> String str = "123|apple|apple|apple|dog$"; StringTokenizer strString = new StringTokenizer(str..nextToken(), "|"); int i; while (strString.hasMoreElements()) { if (i == 0) str1 = Loginstring.nextToken(); else if (i == 1) str2 = Integer.Loginstring.nextToken(); else if (i == 2) { str3 = Loginstring.nextToken(); break; } i = i + 1; } </code></pre> <p>but it exit on first loop onwards(that means it exit from loop if i more than 1),, really i dont know y its happens, whats wrong with it</p>
java android
[1, 4]
2,769,541
2,769,542
Searchbox is unspecific
<p>hey, i try to write a code that users give the possibility to search words in a textarea. my problem is that the regex does not work. </p> <p>as example: if i have "hello stackoverflow" in the textarea and the user search "hello" he recieve on 1 hit and this is correct, but if he search "hello lorem ipsum" he also recieve 1 hit.</p> <pre><code> regex = new RegExp($("input.search").val(), 'g'); counter = $("textarea").val().match(regex).length; </code></pre> <p>what is wrong with the code?</p>
javascript jquery
[3, 5]
3,709,368
3,709,369
How to synchronize jQuery dialog box to act like alert() of Javascript
<p>I am currently working on developing custom dialog box to be used with my application using jQuery. The problem is that the call to create dialog is asynchronous i.e. the line of code after it is executed before it is displayed. Here is what I have done, I have created a function DisplayConfirm() which when called creates a modal dialog. I want to use it like the following:</p> <pre><code>if(DisplayConfirm()){ //do this else // do that </code></pre> <p>But I cannot because the line of code written after DisplayConfirm() is executed before the dialog is even created. How can I synchronize this operation so that I don't have to use callback functions?</p>
javascript jquery
[3, 5]
1,282,937
1,282,938
Visual web part dynamic controls findcontrol in dynamic created control not works
<p>I have a problem with dynamic controls. In Button1 postback I created several TextBox controls like that:</p> <pre><code>TableCell c = new TableCell(); TextBox tb = new TextBox(); tb.ID = "RTB_"+re; c.Controls.Add(tb); </code></pre> <p>On button2 postback I would like to get a thesis controls input data, but I did not get anything that could be a fault and of course I need rebuild these controls</p> <pre><code>foreach (string ctl in page.Request.Form.AllKeys) { try { TextBox text = page.FindControl(ctl) as TextBox; if (text != null) { string t = text.Text; } } catch { } } </code></pre> <p>How can I get and put new values in my controls?</p>
c# asp.net
[0, 9]