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,339,654
3,339,655
Multi Level Filter using in a CheckBox using JavaScript
<p>I have a check box list which filters the results. with Options :</p> <blockquote> <p>Spa(7) <br/>Bar(3) <br/>Spa/Bar(4)</p> </blockquote> <p>The values in brackets(7,3,4) respectively indicates the total Rooms having the mentioned facility. When I select Spa, then my desired list should display only 7 results(I have 7 rooms with Spa Facility) When I select Bar, then my desired list should display only 3 results(I have 3 rooms with BarFacility) When I select Spa/Bar, then my desired list should display only 4 results(I have 4 rooms with Spa/Bar)</p> <p>If I select Spa/Bar and Spa both then I should get only 4 results. If I select Spa/Bar and Bar both then I should get only 3 results.</p> <p>The problem I am facing : When i am selecting Spa/Bar and Spa , then I am getting 7 results.</p> <p>Code :</p> <pre><code> var selectedthemes = themes.split(','); var hotelThemes = ''; var isThemeExist = false; for (var j = 0; j &lt; e.HTName.length; j++) { if (e.HTName[j].HTName != null &amp;&amp; typeof (e.HTName[j].HTName) != 'undefined') hotelThemes += (hotelThemes != "" ? "," : "") + $.trim(e.HTName[j].HTName.toLowerCase()); } for (var i = 0; i &lt; selectedthemes.length; i++) { if (hotelThemes.indexOf($.trim(selectedthemes[i].toLowerCase())) &gt;= 0) { isThemeExist = true; } else { return false; } } return isThemeExist; </code></pre>
javascript jquery
[3, 5]
3,010,826
3,010,827
php/python date conversion
<p>Guys, I have a python script which builds up a MySQL table with timestamps that look like: </p> <pre><code>2011-04-18 09:54:45 </code></pre> <p>To interface with this MySQL table, I need a php script to match updates. If I run this in PHP:</p> <pre><code>$todaysdate = date(DATE_RFC822); print $todaysdate; </code></pre> <p>returns:</p> <pre><code>Mon, 18 Apr 11 09:57:57 -0400 </code></pre> <p>How do I get php to return 2011-04-18 09:54:45 style result? instead of a RFC822?</p> <p>Thanks!</p>
php python
[2, 7]
6,006,778
6,006,779
Writing a cookie from a static class
<p>I have a static class in my solution that is basically use a helper/ultility class.</p> <p>In it I have the following static method:</p> <pre><code>// Set the user public static void SetUser(string FirstName, string LastName) { User NewUser = new User { Name = String.Format("{0}{1}", FirstName, LastName) }; HttpCookie UserName = new HttpCookie("PressureName") { Value = NewUser.Name, Expires = DateTime.Now.AddMinutes(60) }; } </code></pre> <p>User is a simple class that contains:</p> <pre><code> String _name = string.Empty; public String Name { get { return _name; } set { _name = value; } } </code></pre> <p>Everything works up until the point where I try to write the cookie "PressureName" and insert the value in it from NewUser.Name. From stepping through the code it appears that the cookie is never being written.</p> <p>Am I making an obvious mistake? I'm still very amateur at c# and any help would be greatly appreciated.</p>
c# asp.net
[0, 9]
5,378,220
5,378,221
jQuery error callback on ajax call if server is down
<p>I am using jQuery and I am making AJAX request from the many methods available to me. I am testing error callback condition and so far so good.</p> <p>If I bring the server down then firebug shows the request in RED which means it was an error. However error callback is not getting called. Is this expected ? Or should jQuery's error callback should be invoked when server is disconnected.</p> <p>If the expected behavior is that jQuery's error callback will not be called then how will you notify users that server is down?</p>
javascript jquery
[3, 5]
3,161,181
3,161,182
HTML encode asp.net tree view nodes
<p>I would like to know how to html encode nodes in a asp.net treeview control? I have a requirement that requires the nodes to have items that accepts "&lt;" ">" symbols.</p> <p>The code sample below is what I'm currently using as a treenode.</p> <pre><code>public class SampleTreeNode : TreeNode { public SampleTreeNode(string text, string value) : base(HttpUtility.HtmlEncode(text), value) { } } </code></pre> <p>The problem with this is that when I put it a node with text "". It displays the text as "&lt;Test&gt;" instead of "". I'm not sure if this is the best place to put the encode command.</p>
c# asp.net
[0, 9]
5,378,697
5,378,698
Problem using Javascript to redirect to a URL with a query string
<h3>Javascript</h3> <pre><code>&lt;script type="text/javascript"&gt; function Edit(id) { if(confirm("Are you sure to edit?")==true) { location.href='employee_set.php&amp;edit='+id; } } &lt;/script&gt; </code></pre> <h3>PHP</h3> <pre><code>&lt;?php if(isset($_GET["edit"])==false) { echo "no response"; } else { echo "link success"; } ?&gt; </code></pre> <p>My problem is the Javascript is OK. The location href example. <a href="http://localhost/employee_set.php&amp;edit=30" rel="nofollow">http://localhost/employee_set.php&amp;edit=30</a> ...</p> <p>The PHP code is not working. Error is not found.</p>
php javascript
[2, 3]
1,562,880
1,562,881
Javascript onbeforeunload- Show an image on Exit
<p>I am using following code so that if user closes the browser button it shows a confirmation box, whether to stay on page or not.</p> <p>What I want to do is if someone closes the browser it should show an image, with "yes" or "no" options. When "yes" is clicked it should close the browser and if "no" is clicked it shouldn't close the browser. The Image has to be shown in the same window not in any popup. Is it possible to do it or am I expecting too much from JavaScript?</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;script type="text/javascript"&gt; var exit=true; function confirmExit() { if(exit) { window.location.href = "?p=exit"; } if(exit) return "Wait! Don't Leave Empty Handed!\n\nThank you for taking the time to check out our offer! Before you go we have a complimentary crash to help you succeed. Click the 'Cancel' or 'Stay On This Page' button if you're interested!"; } &lt;/script&gt; &lt;/head&gt; &lt;body onbeforeunload="return confirmExit()"&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript jquery
[3, 5]
3,624,228
3,624,229
get closest() with attr()
<p>How can you get the closet with an attribute?</p> <pre><code>$('tr[data-order]:closest', $(this)).css({background:'red'}); </code></pre> <p>I need to get the parent <code>tr</code> with attriute <code>data-order</code> </p>
javascript jquery
[3, 5]
285,111
285,112
Connection refused exception
<p>I am getting this exception:</p> <pre><code>org.apache.http.conn.HttpHostConnectException: Connection to http://www.google.es refused at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:158) at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149) at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121) at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:561) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732) at sdf.main(sdf.java:17) Caused by: java.net.ConnectException: Connection refused: connect at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:123) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148) ... 8 more </code></pre> <p>The code I am running is this one:</p> <pre><code>public class sdf { static String url = "http://www.google.es"; public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader( new DefaultHttpClient().execute(new HttpGet(url)) .getEntity().getContent())); String line; while ((line = br.readLine()) != null) { System.out.println(line); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } </code></pre> <p>It doesn't matter what's the value of url, it won't work.</p> <p>What am I doing wrong?</p>
java android
[1, 4]
133,773
133,774
Regular Expression for (dd-mm-yyyy) not working properly
<p>I have a RegularExpressionValidator in my ASP.Net page</p> <p>I am using it for checking the valid date including leap year against the TextBox Control.</p> <p>The code is:</p> <pre><code>&lt;asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Enter Valid Date" Display="Dynamic" Font-Bold="true" ForeColor="Red" ValidationExpression= "^(((0[1-9]|[12]\d|3[01])(-|\/)(0[13578]|1[02])(-|\/)((19|[2-9]\d)\d{2}))|((0 [1-9]|[12]\d|30)(-|\/)(0[13456789]|1[012])(-|\/)((19|[2-9]\d)\d{2}))|((0[1-9]|1 \d|2[0-8])(-|\/)02(-|\/) ((19|[2-9]\d)\d{2}))|(29(-|\/)02(-|\/)((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579] [26])| ((16|[2468] [048]|[3579][26])00))))$" ControlToValidate="txtbdate"&gt; &lt;/asp:RegularExpressionValidator&gt; </code></pre> <p>All dates are checked fine but the date : 09-09-2000 cannot be checked..</p> <p>Please help..</p> <p>Thanks in advance.</p>
c# asp.net
[0, 9]
1,268,729
1,268,730
reading / updating array of arrays object in javascript / jquery
<p>I am trying to do the following but I am not sure how to do it. I have a grid (like excel) where the user will enter information. The grid has columns like "empno", "paycode", "payrate", "hours" etc. The user will enter a separate record in the grid for each paycode for each employee in the system. so the grid will look like the following</p> <blockquote> <pre><code>empno paycode payrate hours 1 R 25.00 40.00 2 R 12.00 40.00 3 R 15.00 18.00 1 v 25.00 12.00 2 PTO 25.00 18.00 </code></pre> </blockquote> <p>Below this grid I will have two grids. One that displays "Employee totals" and one that displays "Totals by paycode". so as the user enters the data in the grid, I am planning to add / update the values into a two dimensional array. Then when the user clicks on a particular record on the grid, I will read the empno from that record and display the employee totals by binding the array to the html table. As you can see the data entered by the user might not be in the order of empno. The user might first enter the data for paycode "R", then paycode "V" etc.</p> <p>Please let me know your ideas.</p>
javascript jquery
[3, 5]
2,607,082
2,607,083
How can I intercept the audio stream on an android device?
<p>Let's suppose that we have the following scenario: something is playing on an android device (an mp3 par example, but it could be anything that use the audio part of an android device). From an application (android application :) ), I would like to intercept the audio stream to analyze it, to record it, etc. From this application (let's say "the analyzer") I don't want to start an mp3 or something, all I want is to have access to the audio stream of android.</p> <p>Any advice is appreciated, it could a Java or C++ solution.</p>
java c++ android
[1, 6, 4]
3,256,453
3,256,454
master and content pages and jquery
<p>I want to use jQuery in my ASP.NET 3.5 website that uses master pages and content pages. How do I do document ready() functions for the child pages for those that will use jQuery ? Where do I put the code?</p> <p>I figured the jQuery declarations should go in the master page, but don't know how to make sure any jQuery calls go into the HEAD of the resolved page.</p>
asp.net jquery
[9, 5]
1,029,971
1,029,972
How do i deactivate highlights on MapHilight?
<p>I have run into a problem that i cannot seem to figure out how to do and was hoping that you might have some insight.</p> <p>im working on this page: <a href="http://rrpcompliance.com/map/html/" rel="nofollow">http://rrpcompliance.com/map/html/</a></p> <p>note: right now the only states i am focusing on are washington and idaho i would like the user to only be able to select one state at a time currently for instance, you can select washington and idaho both</p> <p>for the life of me i cannot figure out how to tell the maphilight script to deactivate the other state after a new one has been clicked</p>
javascript jquery
[3, 5]
4,290,172
4,290,173
Using Python to grab output from a C++ program (thru cout)
<p>I have the following code in Python</p> <pre><code>import subprocess import time info = subprocess.STARTUPINFO() info.dwFlags |= subprocess.STARTF_USESHOWWINDOW info.wShowWindow = subprocess.SW_HIDE t1 = time.clock() h = subprocess.Popen([r"C:\Users\MyName\Desktop\test.exe"], startupinfo=info) h.communicate() t2 = time.clock()-t1 print "Return Code:", h.returncode print "Duration:", t2 </code></pre> <p>This works great if I am looking for the program's return code but what if I want to grab things that the program simply cout's to the screen and manipulate them as variables in Python?</p>
c++ python
[6, 7]
421,047
421,048
Why am I losing my characters from my html string when trying to add html dynamically using javascript
<p>I have a page that I am trying to dynamically add some links to. The links are getting added to the page fine, but the '[' and ']' at either end of the line are getting dropped. The code from my .js file is:</p> <pre><code>var html = "[ &lt;a href='#'&gt;Change&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href='#'&gt;Remove &lt;/a&gt; ]"; $(html).appendTo("#id123"); </code></pre> <p>The result I want is:</p> <pre><code>[ &lt;a href='#'&gt;Change&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href='#'&gt;Remove&lt;/a&gt; ] </code></pre> <p>The result I'm getting is:</p> <pre><code>&lt;a href='#'&gt;Change&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href='#'&gt;Remove&lt;/a&gt; </code></pre> <p>If I wrap the line in a <code>&lt;span&gt;</code> tag like so:</p> <pre><code>var html = "&lt;span&gt;[ &lt;a href='#'&gt;Change&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href='#'&gt;Remove &lt;/a&gt; ]&lt;/span&gt;"; $(html).appendTo("#id123"); </code></pre> <p>it renders as expected. I set a breakpoint on the code and checked the html var right before the .appendTo and it contains the '[' and ']'.</p> <p>Anyone know why this is happening? Are '[' and ']' special character that need escaped and I'm just forgetting that fact?</p>
javascript jquery
[3, 5]
2,708,702
2,708,703
PHP/Javascript: Restart Form Button Isn't Working, Code Insde
<p>Basically I want a confirmation box to pop up when they click the button asking if they sure they want to restart, if yes, then it destroys session and takes them to the first page. Heres what i got...</p> <pre><code>echo "&lt;form id=\"form\" name=\"form\" method=\"post\" action=\"nextpage.php\"&gt;\n"; echo " &lt;input type=\"button\" name='restart' value='Restart' id='restart' onclick='restartForm()' /&gt;"; </code></pre> <p>and for the script...</p> <pre><code>&lt;script type=\"text/javascript\"&gt; &lt;!-- function restartForm() { var answer = confirm('Are you sure you want to start over?'); if (answer) { form.action=\"firstpage.php\"; session_destroy(); form.submit(); } else alert ('Restart Cancelled'); } // -- &lt;/script&gt;"; </code></pre> <p>EDIT: Note that pressing the button brings up the confirm box, but if you click okay nothing happens sometimes. Sometimes if u click cancel it still submits the form (To the original action)</p>
php javascript
[2, 3]
1,548,399
1,548,400
Is there a c++ wrapper that compile php into a c++ program?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1090124/convert-php-to-c-code">Convert PHP to C++ code</a> </p> </blockquote> <p>Is there a c++ wrapper that compile php into a c++ program?</p> <p>I want to program something for the steam distribution platform but they require it be programmed in c++. I don't know how to program in c++ but I do know how to program in php.</p> <p>If possible I'd like a compiler/wrapper that will let me compile a php script into a c++ program.</p> <p>It should be able to run c++ in the php script.</p> <p>Maybe a "&lt;?c++ &nbsp; ?&gt;" tag for running c++ code?</p> <p>I'm not asking anyone to make I am asking if there is a free one that does what I want.</p>
php c++
[2, 6]
2,976,962
2,976,963
JSON failing to parse when strings contain HTML markup
<p>Why does this ajax fail when html tags are added to the json, if the <code>&lt;br /&gt;</code> is not there then is works. The only work around that I can think of is by encoding the text.</p> <p>Do you know why or /and have any other suggestions.</p> <p>Thanks</p> <pre><code> $.ajax({ type: "POST", url: "/url", //data: { "myText" : '[{ "a": "test1", "b": "test2"}]' },//works data: { "myText": '[{ "a": "&lt;br /&gt;dfgdfgdfgdfgdgd", "b": "test2"}]' },//causes error dataType: 'json', success: function (data) { alert("pass"); }, error: function () { alert("error"); } }); </code></pre>
javascript jquery
[3, 5]
3,004,570
3,004,571
How to ask for confirmation to delete checklist items?
<p>I have some dynamically generated checklist-items. When user deletes them, confirmation box should appear. How can i do that ?</p> <pre><code>protected void btndelete_Click(object sender, EventArgs e) { try { string conn = ConfigurationManager.ConnectionStrings["sqlconn"].ConnectionString; SqlConnection con = new SqlConnection(conn); con.Open(); check: if (CheckBoxList1.SelectedItem != null) { foreach (ListItem l in CheckBoxList1.Items) { if (l.Selected) { SqlCommand cmd = new SqlCommand("Drop Table " + l, con); cmd.ExecuteNonQuery(); Label4.ForeColor = Color.Red; Label4.Text = " PaperSet Deleted successfully"; CheckBoxList1.Items.Remove(l); papersetlist.Items.Remove(l); Psetlist.Items.Remove(l); goto check; } } } con.Close(); } catch (System.Exception ex) { MessageBox.Show(ex.Message); } } </code></pre> <p>This is delete button event code.</p>
c# javascript asp.net
[0, 3, 9]
510,519
510,520
Spellchecker not working when text contains an url
<p>I am using one free spellchecker named pure javascript spell checker.But right now if somebody enters a url(starting with http://) in the text area and then do a spell check in that case its showing error in Firefox but in IE its working fine.So is there any way in javascript to escape an entire url from the user inputted text ?</p>
javascript jquery
[3, 5]
3,311,366
3,311,367
modify click event script to be more specific
<p>I have to the following function that I would like to modify so that it only binds the click event to all href's that = /ShoppingCart.asp?ProductCode="whatever" (whatever = whatever is in there") but not if it is specifically /ShoppingCart.asp?ProductCode="GFT". It must also check or convert a gft or Gft to upper case to check for those as well. So basically it has to check for any variation of the case of GFT. If it finds a "GFT" do not bind the click event.</p> <pre><code>function sacsoftaddtocart() { if (location.pathname == "/SearchResults.asp" || location.pathname == "/Articles.asp" || location.pathname.indexOf("-s/") != -1 || location.pathname.indexOf("_s/") != -1) { $("a[href^='/ShoppingCart.asp?ProductCode']").click(function () { var href = $(this).attr('href'); addToCart3(href); return false; }); } } </code></pre>
javascript jquery
[3, 5]
498,259
498,260
How to detect when the Battery's low : Android?
<p>I want to close my app when the battery level of the device gets low. I have added following codes in manifest.</p> <pre><code> &lt;receiver android:name=".BatteryLevelReceiver" &lt;intent-filter&gt; &lt;action android:name="android.intent.action.ACTION_BATTERY_LOW" /&gt; &lt;action android:name="android.intent.action.ACTION_BATTERY_OKAY" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; </code></pre> <p>And following code in receiver</p> <pre><code>public class BatteryLevelReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Toast.makeText(context, "BAttery's dying!!", Toast.LENGTH_LONG).show(); Log.e("", "BATTERY LOW!!"); } } </code></pre> <p>I am running the app on emulater and changing the battery level using telnet. It changes the battery level but not showing any toast or logs. </p> <p>What am I missing?? Any help is appreciated! Thank you.</p>
java android
[1, 4]
1,133,104
1,133,105
cant pass php variables to javascript
<p>I'm trying to pass a php variable to a javascript function via the onClick attribute.Heres the piece of code that I have tried but its not working php Section:</p> <pre><code>&lt;li id="' . $todo1 . '" class="items"&gt;' . $todo1 . '&lt;button onclick="ajaxdelete(' . $todo1 . ')"&gt;Delete&lt;/button&gt;&lt;/li&gt; </code></pre> <p>Javascript function</p> <pre><code>&lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; &lt;script language="JavaScript" type="text/javascript"&gt; function ajaxdelete(x){ var todo = x; var hr = new XMLHttpRequest(); var url = "ajaxtododelete.php"; var vars = "todo="+todo; hr.open("POST", url, true); //Random Ajax stuff } </code></pre>
php javascript
[2, 3]
5,875,886
5,875,887
Wait until function is loaded
<p>How can I in jQuery test when a javascript function is fully loaded? I would like to use a gif, which displays loading, while the javascript function loads, and hide it when the function is fully loaded?</p>
javascript jquery
[3, 5]
3,453,050
3,453,051
How to get the <html> tag HTML with JavaScript / jQuery?
<p>Using <code>$('html').html()</code> I can get the HTML within the <code>&lt;html&gt;</code> tag (<code>&lt;head&gt;</code>, <code>&lt;body&gt;</code>, etc.). But how can I get the actual HTML of the <code>&lt;html&gt;</code> tag (with attributes)?</p> <p>Alternatively, is it possible to get the entire HTML of the page (including doctype, <code>&lt;html&gt;</code>, etc.) with jQuery (or plain old JavaScript)?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
3,279,601
3,279,602
Disable the asp button after first click because it save multiple records in slow connection
<pre><code>&lt;asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" Text="Update" CssClass ="btn" ToolTip="Update" Width="58px" /&gt; </code></pre> <p>`This is my code for button, want to use javascript..help plz</p>
c# javascript
[0, 3]
365,189
365,190
Two jquery datepicker instances in one control ASP.NET
<p>I have two text boxes that use the datepicker plugin on the same page.</p> <p>I use the code below to set attributes for each by using their cssclasses, however the minDate for datepickerLatest does not seem to work on the calendar. It works fine for datepickerEarliest</p> <pre><code>&lt;asp:TextBox runat="server" ID="tbEarliestDate" CssClass="datepickerEarliest"&gt;&lt;/asp:TextBox&gt; </code></pre> <p></p> <pre><code>$(".datepickerEarliest").datepicker({ dateFormat: 'dd/mm/yy', changeMonth: true, yearRange: '-100:+10', changeYear: true, maxDate: '17/08/2012' }); $(".datepickerLatest").datepicker({ dateFormat: 'dd/mm/yy', changeMonth: true, yearRange: '-100:+10', changeYear: true, minDate: '21/06/2012' }); </code></pre> <p>Any help appreciated.</p>
jquery asp.net
[5, 9]
314,898
314,899
android : External jar files adding?
<p>I'm trying to add some external jar files in my project. Anyone tell me how to add external jar files to current project? Thanks in Advance.</p>
java android
[1, 4]
1,371,580
1,371,581
Looking for asp.net 3D surface charts
<p>I need something to create 3D surface charts in ASP.Net. Could anyone recommend a 3rd party component set? I also do not want to use Giga Soft's, Nevron's, or ComponentOne's components. I am open to non-free solutions.</p>
c# asp.net
[0, 9]
3,631,293
3,631,294
Holding Information in Android App
<p>I've only just started to write in Java on Android, so please bear with me.</p> <p>I have some settings I want to hold in my app, normally I would have used an xml file. Trouble is i'm not sure how to load it into the xml parser to read it. </p> <p>I thought I might be able to drop it into /res/values/Info.xml and open it from there but it does'nt find the file.</p> <p>I have also read that people are starting to use a SQLite database to hold information in, is this more the standard way to go?</p> <p>thanks a lot</p> <p>Luke </p>
java android
[1, 4]
1,018,596
1,018,597
Fastest way to traverse a DOM element tree in Javascript / JQuery
<p>I am trying to traverse a DOM select element that looks like this:</p> <pre><code>&lt;select&gt; &lt;option value='1'&gt;Text 1&lt;/option&gt; &lt;option value='2'&gt;Text 2&lt;/option&gt; &lt;option value='3'&gt;Text 3&lt;/option&gt; &lt;option value='4'&gt;Text 4&lt;/option&gt; . . . &lt;option value='n'&gt;Text n&lt;/option&gt; &lt;/select&gt; </code></pre> <p>Such that <code>n</code> is greater than 10000 elements. What is the most efficient way to get the contents of this DOM? </p>
javascript jquery
[3, 5]
95,406
95,407
Is there a way to fire jQuery's live() or delegate() without a user event?
<p>I am trying use jQuery to poll dynamic DOM nodes, created outside of the jQuery object (with Google Maps API methods). I can do this easily by, for example, binding delegate() to a click event. However, I need to poll the DOM, without any additional user actions (user should not have to click), as part of a function that runs onload. Does anyone know of a way to accomplish this?</p> <p>Edit: I'm using the Maps API to write add a bunch of markers at load. I can do this without any problems, but I need to loop through the HTML the Maps API writes with jQuery and append child nodes. delegate() and live() can this, but the only way I know how to fire delegate() or live() is by binding it to an user event. I'm trying to fire off something like jQuery's delegate with each iteration of my Maps API function, without the user doing anything.</p>
javascript jquery
[3, 5]
3,182,454
3,182,455
Loop with Deferred objects and promises
<p>I have the following code </p> <pre><code> $.when(tableInsert("index.php/get/sync/riesgos", insert_riesgo, evalua.webdb.db, callback)).then(function(){ update_records("riesgos"); $.when(tableInsert("index.php/get/sync/estancias", insert_estancia, evalua.webdb.db, callback)).then(function(){ update_records("estancias"); $.when(tableInsert("index.php/get/sync/riesgosestancias", insert_riesgoestancia, evalua.webdb.db, callback)).then(function(){ update_records("riesgosestancias"); }); }); }); </code></pre> <p>I am trying to find how to integrate it inside of a for loop or a $.each loop, so that it waits for the promise to be done before the next iteration. At first it looks like three calls would be easier to be nested, but this is only a piece of code, the nested calls count 15 now!</p>
javascript jquery
[3, 5]
4,343,013
4,343,014
AndroidManifest.xml errors
<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android"&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name"&gt; &lt;activity android:name=".hba1c" android:label="@string/app_name" android:screenOrientation="portrait"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; </code></pre> <p> </p> <p>I'm trying to learn Java and need some help with AndroidManifest.xml </p> <p>My little hello world project is working code-wise, but I'm confused with making changes to the manifest. Specifically, in the code above package name is "com.android" and in data/app my app shows up as com.android-1.apk. When I try to change it to something like com.jocala or com.jocala.hba1c I get package R does not exist errors through my compile, which fails.</p> <p>What changes do I need to make? Anything else here that is glaringly bad?</p> <p>I am working using ant,vi and the linux console. No eclipse.</p>
java android
[1, 4]
5,105,668
5,105,669
Return an integer from OnClickListener to outside the function (Android, Java)
<p>So hey guys I want to return an integer to outside my OnClickListener function:</p> <pre><code> hello.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { int choice = 1; } }); if (choice == 1) { //Do stuff here } </code></pre> <p>Sorry for this newbie question, but I've got no idea how to solve this... Thanks</p>
java android
[1, 4]
1,483,628
1,483,629
how to navigate the users to Login.aspx even if i set HomePage.aspx as the start page?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/549/the-definitive-guide-to-forms-based-website-authentication">The Definitive Guide To Forms based Website Authentication</a> </p> </blockquote> <p>how to navigate the users to Login.aspx even if i set HomePage.aspx as the start page for my application? I dont want any unauthorized user to access my application until i authenticate him.</p>
c# asp.net
[0, 9]
710,618
710,619
How can I access ListViewDataItem from an ItemTemplate without using code behind?
<p>I'm trying to access <code>ListViewDataItem</code> from inside an <code>ItemTemplate</code> in an ASP.NET C# page that does not have code behind.</p> <p>the page is very simple and does not have any code on it. it is dynamicaly binds to a datasource on page and shows a list of data. </p> <p>Thanks</p>
c# asp.net
[0, 9]
5,042,037
5,042,038
getElementById issue
<p>I have got this button:</p> <pre><code>&lt;input type="button" value="Rep" id="rep" name="rep" class="rep" style="width:50px" onclick="triggerLabel(1);this.disabled=true;addRep(&lt;?php echo $comment_id; ?&gt;);"/&gt; &lt;script type="text/javascript"&gt; function triggerLabel($commentID) { var $theID="#"+$commentID; var $label=document.getElementById($theID).value; alert($label); } &lt;/script&gt; </code></pre> <p>The alert isn't triggered. I want to obtain the commentID and convert it to a string.. And I want that string to represent my element ID. The alert works, it retrieves #25. That's the id that I gave one of my labels..</p> <pre><code>echo '&lt;label id="'.$comment_id.'"&gt;'.$avatarRep.'&lt;/label&gt;'; </code></pre> <p>It should retrieve that label, but unfortunately it fails..I get this:</p> <blockquote> <p>Error: document.getElementById($theID) is null Source File: <a href="http://localhost/PoliticalForum/Thread/thread.php?threadID=15&amp;page=1" rel="nofollow">http://localhost/PoliticalForum/Thread/thread.php?threadID=15&amp;page=1</a> Line: 246</p> </blockquote> <p>What do I do?</p> <p>That's how the label html control looks like when I view the source page:</p> <pre><code>&lt;label id="25"&gt;6&lt;/label&gt; </code></pre> <p>UPDATE: I updated my answer. Take a look:</p> <pre><code>var $label=document.getElementById($commentID); $label.value=9999; </code></pre> <p>The 9999 isnt inserted into the table..why?!?</p> <p>UPDATE 2: This doesnt work:</p> <pre><code>document.getElementById($commentID).value="88888"; </code></pre> <p>The label isnt changed.</p>
javascript jquery
[3, 5]
1,150,778
1,150,779
Is putExtra the only way of passing data to a new Activity?
<p>I have created a SettingsActivity for my app. In this <code>Activity</code> I am using the <code>SharedPreferences</code> class to do handle the user editable preferences.</p> <p>While setting up the <code>SharedPreferences</code>, I have to load them in the <code>onCreate</code> of my main activity and then again in the SettingsActivity. The probably was that both calls to the <code>getXXXX()</code> methods require defaults and I figured that it would not be good to hard-code the default values into both places because I would imagine it would be problematic in the future if I ever changed them.</p> <p>Which is the best/most popular (or accepted standard) of doing this?</p> <ul> <li><p>Create a global variables class in which I import into each activity and define my default constants in there?</p></li> <li><p>Use <code>putExtra</code> and <code>getExtra</code> to pass the data from the main activity to the settings activity?</p></li> </ul> <p>Any other suggestions?</p>
java android
[1, 4]
4,633,024
4,633,025
JQuery .show() not working for div inside an already referenced div
<p>show() does not work</p> <p><a href="http://jsfiddle.net/Pppy6/5/" rel="nofollow">http://jsfiddle.net/Pppy6/5/</a></p> <pre><code>&lt;div class="hello" id="hello"&gt;2&lt;div class="ola" id="ola"&gt;showMe!&lt;/div&gt;&lt;/div&gt; .ola { display:none }​ $('#hello').text(parseInt($('#hello').text()) + 1); $('#ola').show(); </code></pre>
javascript jquery
[3, 5]
4,133,207
4,133,208
Convert php code to Java/android
<p><a href="http://pastebin.com/Cz8gbxs8" rel="nofollow">http://pastebin.com/Cz8gbxs8</a></p> <p>is there a way to convert this php code, to a java code?</p> <p>Thanks, anyway</p>
java php android
[1, 2, 4]
974,016
974,017
Trigger event on a page when a popup window is closed
<p>Page <em>x</em> creates a pop-up window (page <em>y</em>). When page <em>y</em> is closed, I need an event to trigger on page <em>x</em>.</p> <p>Any help is appreciated. Thanks.</p>
javascript jquery
[3, 5]
1,852,894
1,852,895
Exchanging data from web
<p>I am creating a program which calculates the solar radiations received on earth. The program is complete and working. I have made it specifically for my city, but I want to generalize it for the whole world. Only one thing is standing between me and my goal:</p> <pre><code>double Hm[] = { 4.38, 5.18, 5.93, 6.65, 6.67, 6.40, 5.44, 5.27, 5.62, 5.24, 4.5, 4.11 }; </code></pre> <p>This data is the only thing I want to generalize. These values are for my city only. I want to take Longitude and Latitude as an input and then this input goes to the NASA website, extract only the data I want and return those values in an array as shown above. How can I do that?</p>
java android
[1, 4]
2,368,050
2,368,051
jQuery - find the specified components on the form
<p>I'm searching for <code>inputs</code> on my form and adding them to the <code>inputs</code> variable: </p> <pre><code>var inputs = $(this).parents("form").eq(0).find(".input:visible:enabled"); </code></pre> <p>How can I extend this search of the other components like <code>select</code>. So, add the <code>inputs</code> and <code>selects</code> in the order in which they were found on the <code>form</code>? </p> <p>Something like</p> <pre><code>var inputs = $(this).parents("form").eq(0).find(".input:visible:enabled OR .select"); </code></pre>
javascript jquery
[3, 5]
1,212,176
1,212,177
Null Reference Exception is thrown sometimes
<pre><code>&lt;script language="javascript"&gt; res = "&amp;res="+screen.width+"x"+screen.height+"&amp;d="+screen.colorDepth top.location.href="Login.aspx?action=set"+res &lt;/script&gt; Source Error: An unhandled exception was generated during the execution of the current web request,Information regarding origin and location exception can be identified using the exception stact trace below. Stack trace: [Null ReferenceException: object reference not set to an instance of an object.] page_Load(object sender EventArgs e)+143 and next from System.Web </code></pre> <p>Based on screen resolution iam setting a login web page. How do I avoid null reference exception?</p>
javascript asp.net
[3, 9]
2,610,107
2,610,108
Binding a dropdown with year
<p>I have to bind a drop down box with years starting from 2008 to current year in C#. How can I achieve it. </p>
c# asp.net
[0, 9]
2,063,609
2,063,610
Why do jQuery samples often omit script type?
<p>For example <a href="http://jqueryui.com/datepicker/">here</a> the code goes like this:</p> <pre><code>&lt;html lang="en"&gt; &lt;head&gt; &lt;!-- whatever --&gt; &lt;script&gt; $(function() { $( "#datepicker" ).datepicker(); }); &lt;/script&gt; &lt;/head&gt; &lt;!-- whatever --&gt; </code></pre> <p>Note that <code>&lt;script&gt;</code> should have contained <code>type</code> attribute (perhaps set to <code>"text/javascript"</code>) but it is not present here.</p> <p>This is not the only example I've seen. Such code makes Visual Studio editor unhappy - it underlines <code>&lt;script&gt;</code> and says there should be a <code>type</code> attribute. It also makes me curious big time.</p> <p>Why is <code>type</code> often omitted? What happens if I add <code>type="text/javascript"</code> - will jQuery break or something? </p>
javascript jquery
[3, 5]
2,220,459
2,220,460
For Loop with doubles and arrays and Lists
<p>What is the correct syntax to iterate through an array of doubles and add the weights to the values List? The following fails, I've tried all types of combinations but the correct one?</p> <pre><code>private double[] weightArray =new double[] {200,215,220,215,200}; List&lt;double[]&gt; values = new ArrayList&lt;double[]&gt;(); for (int i = 0; i &lt; weightArray.length; i++) { // i indexes each element successively. values.addAll(new double[] weightArray[i]); } </code></pre> <p>TIA</p> <p>Here is an edit and some additional information. I appreciate all of the answers, my apologies for not clearly stating the question. Below is working code. (Android chart rendering...)</p> <pre><code> List&lt;double[]&gt; values = new ArrayList&lt;double[]&gt;(); values.add(new double[] {15,15,13,16.8,20.4,24.4,26.4,26.1,23.6,20.3 }); values.add(new double[] { 10, 10, 12, 15, 20, 24, 26, 26, 23, 18 }); values.add(new double[] { 5, 5.3, 8, 12, 17, 22, 24.2, 24, 19, 15 }); values.add(new double[] { 5, 5, 5, 5, 19, 23, 26, 25, 22, 18}); </code></pre> <p>I want to load these values from a database. They are hard coded in my example. How do I fill the required arrays with numbers? i.e. How do you fill the values.add method using either a for loop or a foreach loop? </p> <p>The values List is used in the following signature:</p> <pre><code>Intent intent = ChartFactory.getLineChartIntent(context, buildDataset(titles, x, values), renderer, "Test Chart"); </code></pre> <p>TIA</p>
java android
[1, 4]
5,694,308
5,694,309
Calling javascript after dom is finished
<p>We use an outside system to serve ads on our site. Currently in our header files, we have some js which uses jquery to insert the data to our ad holder which is a div that appears on every page, i.e.</p> <pre><code>$("#adSpot").prepend('put my ad here'); </code></pre> <p>Our third party ad system just started using Google Ad Server another system to serve ads so now have given us some JS to call. I'd like to use our header files and not have to touch every file but I'm not having luck inserting js that is then executed so:</p> <pre><code>$("#adSpot").prepend('GA_googleFillSlotWithSize("ca-pub-981", "Page_1", 468, 60)'); </code></pre> <p>Basically, I'd like to use the header file so when the page is loaded, it injects this js code into the div where we want the image placed and then the js is executed so the image will appear in the spot. Now it does push the code to the div but the js isn't executed.</p> <p>Thanks!</p>
javascript jquery
[3, 5]
1,519,791
1,519,792
Using .wrap() for each x amount of objects
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3366529/wrap-every-3-divs-in-a-div">Wrap every 3 divs in a div</a><br> <a href="http://stackoverflow.com/questions/3475594/jquery-use-wrap-to-wrap-multiple-elements">jQuery - use wrap() to wrap multiple elements?</a> </p> </blockquote> <p>Lets say I have 4 divs, as below:</p> <pre><code>&lt;div class="section"&gt;1&lt;/div&gt; &lt;div class="section"&gt;2&lt;/div&gt; &lt;div class="section"&gt;3&lt;/div&gt; &lt;div class="section"&gt;4&lt;/div&gt; </code></pre> <p>I would like to use <code>$('.section' [increments of 2] ).wrap('&lt;div class="row"&gt;&lt;/div&gt;')</code> so each 2 <code>div.section</code>'s will be wrapped with <code>div.row</code>, so the end result would look like this:</p> <pre><code>&lt;div class="row"&gt; &lt;div class="section"&gt;1&lt;/div&gt; &lt;div class="section"&gt;2&lt;/div&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div class="section"&gt;3&lt;/div&gt; &lt;div class="section"&gt;4&lt;/div&gt; &lt;/div&gt; </code></pre> <p>How is this done?</p>
javascript jquery
[3, 5]
1,635,862
1,635,863
Why parent element is undefined in Firefox only when onerror event of IMG tag is called?
<p>I am trying to unhide a DIV element if my extension in Firefox is not installed. </p> <p>For this purpose i am using the following technique.</p> <p>This doesn't work in Firefox. it says</p> <p><strong>ExtensionNeeded is undefined.</strong> </p> <p>I get the alert though. Please have a look at my code.</p> <pre><code>&lt;div style="display: none;" class="alert alert-error" id="ExtensionNeeded"&gt; &lt;img style="visibility: hidden; font-family: arial;" onerror="this.src='';alert('hello'); ExtensionNeeded.setAttribute('style','display:none;');" id="ffExt" src=""&gt; &lt;a onclick="ExtensionNeeded.setAttribute('style','display:none;');" data-dismiss="alert" class="close" id="CloseButton"&gt;×&lt;/a&gt; &lt;h4 class="alert-heading"&gt; Browser Extension Needed&lt;/h4&gt; &lt;p&gt; SmartSignin needs browser extensions to work. Download the extensions by clicking on the button below &lt;/p&gt; &lt;p&gt; &lt;a onclick="window.location=('../Installer_files/release.xpi');ExtensionNeeded.setAttribute('style','display:none;');" class="btn btn-danger" id="ExtensionDownload" href="#"&gt;Download Extension!&lt;/a&gt; &lt;a onclick="ExtensionNeeded.setAttribute('style','display:none;');" class="btn" id="DownloadLater" href="#"&gt;Download Later&lt;/a&gt; &lt;/p&gt; &lt;/div&gt; </code></pre> <p>Please help. I am picking my hair out on this.</p>
javascript asp.net
[3, 9]
3,634,880
3,634,881
Mimic ASP.NET web forms encryption method using php
<p>I've tried searching a lot but so far everything seems to be about hashing.</p> <p>I have a database with users created using the .net web forms framework. In web.config it is set to the encryption method to store users' passwords. I also see a validation and decryption key.</p> <p>If I have access to these encrypted values in PHP, how can I encrypt a user given password to match against the stored encrypted copy?</p> <p>Thanks, Mike</p>
php asp.net
[2, 9]
3,291,753
3,291,754
How to iterate over two arrays in jQuery
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/617735/simultaneously-iterating-over-two-sets-of-elements-in-jquery">Simultaneously Iterating Over Two Sets of Elements in jQuery</a> </p> </blockquote> <p>I have two variables:</p> <pre><code>var $distance = $(".distance"); var $classification = $(".classification"); </code></pre> <p>For each non-empty item of the <code>$distance</code> collection I want to check if the corresponding <code>$classification</code> item is not empty. How do I do this?</p>
javascript jquery
[3, 5]
275,085
275,086
error in c# code of time zone info
<p>i am not using any java script. my code is:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { System.Collections.ObjectModel.ReadOnlyCollection&lt;TimeZoneInfo&gt; TimeZoneColl = TimeZoneInfo.GetSystemTimeZones(); DropDownList2.DataSource = TimeZoneColl; DropDownList2.DataBind(); } } protected void Button1_Click(object sender, EventArgs e) { string d = DateTime.Now.ToString(); string sel =DropDownList2.SelectedValue; Label1.Text = d; TimeZoneInfo tst = TimeZoneInfo.FindSystemTimeZoneById("Norway Standard Time"); Label1.Text = tst.ToString(); //TimeZoneInfo timeinfo = TimeZoneInfo.FindSystemTimeZoneById(sel); //Label3.Text =timeinfo.ToString(); try { DateTime tstTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, tst); Label3.Text = tstTime.ToLongTimeString(); } catch (Exception E) { Console.WriteLine("Error" + E); } } </code></pre> <p>but there is an error in selection of zone in getzone found by id. here the zone can be selected in format of(tokyo standard time) but i want to select it from drop down list. so the drop down list contains the Other format.</p>
c# asp.net
[0, 9]
2,580,143
2,580,144
close and reset height and width to its original sizes on "close" click
<p>I have this html:</p> <pre><code>&lt;div class="box"&gt; &lt;div class="info"&gt; &lt;p&gt;..some content..&lt;/p&gt; &lt;a href="#" class="close"&gt;Close&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="box"&gt; &lt;div class="info"&gt; &lt;p&gt;..some content..&lt;/p&gt; &lt;a href="#" class="close"&gt;Close&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Since I don't know .box height as it will expand and its height will depend on .info content, i run this:</p> <pre><code> $('.box').each(function() { $(this).data('height', $(this).height()); }); </code></pre> <p>When I click "close" once .box has expanded, I should be able to close expanded .box and reset its height and width to its original sizes before it was expanded.</p> <p>I tried to run this, which is inside another function and it doesn't get the correct height:</p> <pre><code>$(".close").click(function (e) { e.preventDefault(); $(".info").empty(); $(".box").width(251); $(".box").data('height'); }); </code></pre> <p>Anyone?</p>
javascript jquery
[3, 5]
5,814,457
5,814,458
How to concatenate path to base url when a url redirects?
<p>I'm making a request to:</p> <p><code>http://www.baseaddress.com/path/index1.html</code></p> <p>According to the arguments I sent, I'm getting a redirect to one of this two: <code>http://www.baseaddress.com/path2/</code><br> OR <code>http://www.baseaddress.com/path/index2.html</code></p> <p>The problem is that the respond returns only: <code>index2.html</code> or <code>/path2/</code></p> <p>for now I check if the first char is <code>/</code>, and concatenate the URL according to this. Is there a simple method for doing this without string checking?</p> <p>the code:</p> <pre><code>url = new URL("http://www.baseaddress.com/path/index1.php"); con = (HttpURLConnection) url.openConnection(); ... some settings in = con.getInputStream(); redLoc = con.getHeaderField("Location"); // returns "index2.html" or "/path2/" if(redLoc.startsWith("/")){ url = new URL("http://www.baseaddress.com" + redLoc); }else{ url = new URL("http://www.baseaddress.com/path/" + redLoc); } </code></pre> <p>do you think this is the best method?</p>
java android
[1, 4]
3,727,220
3,727,221
jquery not seeing new html loaded into dialogue box
<p>I am having some trouble with getting jquery to recognize classes/ids of content that has been loaded into a dialogue box. All the jquery code (including the code that deals with the as yet unloaded classes) is loaded before the dialogue box is created, however the html that eventually goes into the dialogue box is created on the fly. I know it is going to get certain classes but don't know the rest of the code/content hence the reason I am loading it from the database. If I put the html on the page with the clickable class rather than the dialogue box it works, but I obviously don't want to do that. I was thinking this is a DOM problem since the class that jquery is going to be listening for is not on the page until AFTER the dialogue box is created (the dialogue box itself is also created by a click on another item - this has to happen this way as people may or may not want to get the dialogue box with the info from the database in it up). Any help in explaining and possibly finding a solution for this is much appreciated.</p>
javascript jquery
[3, 5]
480,734
480,735
passing asp.net class object in javascript in ajax call
<p>I am having the below code in my project </p> <pre><code>$.ajax({ type: "POST", url: "Alerts.aspx/TestMethod", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: OnSuccess, error: OnError }); </code></pre> <p>now I want to pass the "this" or me(vb.net) as parameter in data object how to pass the current class object.</p> <p>can any one help me </p> <p>I tried <code>data: "{obj:"&lt;%=Me%&gt;"}",</code></p> <p>but it is not working can anyone help ...</p>
javascript jquery asp.net
[3, 5, 9]
5,916,395
5,916,396
Loading data using jQuery
<p>I have a list of states in a drop down menu (<code>select</code>). I have a page for each state. Each page has the state abbreviation as a name, for example: <strong>Alabama</strong> is <code>al.htm</code>. I want to load the contents of <strong>htm</strong> depending on the selection of the state name; and the same for each state. In other words, if I select <strong>New York</strong>, I should see the information in <strong>ny.htm</strong>. </p> <p>To load the data that is in different pages?</p>
javascript jquery
[3, 5]
5,850,201
5,850,202
Webservice Android
<p>I have a asp.net Webservice which returns me XML. What should i use in Android and how to parse? </p>
asp.net android
[9, 4]
5,086,365
5,086,366
error Incorrect syntax near
<p>I had Registration form and I had in this form text box for username ,and when I test the web form I added this user in text box user name (Kaz'em) and I had this error</p> <p>(Incorrect syntax near 'em'. Unclosed quotation mark after the character string ''.)</p> <pre><code>public bool RegisteredUser() { bool Return = false; SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ElarabyGroup"].ConnectionString); SqlCommand cmd = new SqlCommand("Select Count(UserName) From [Registeration] Where [Registeration].UserName = '" + RegisteredUserName + "'", con); con.Open(); if (int.Parse(cmd.ExecuteScalar().ToString()) &gt; 0) Return = true; con.Close(); return Return; } </code></pre>
c# asp.net
[0, 9]
2,056,021
2,056,022
gridview inside datalist row_data_bound
<p>I have a datalist that contains a gridview inside its itemtemplate. on the item-data_bound of the datalist i assign a certain datasource to the datagrid of that item then i add an eventhanlder for the row_data_bound of the grid.then i bind the grid. Attach it to the grid: gv.RowDataBound += new GridViewRowEventHandler(gv_RowDataBound); and declare and implement the eventhandler. The problem is the row_data_bound of the grid is not firing. Can anyone help?</p>
c# asp.net
[0, 9]
1,096,927
1,096,928
Comparison between Javascript objects
<p>I have made a simple accordion for my site using jQuery... It worked great, but I've recently started working on a change where if you click the currently opened segments title (the clickable area to slide up/down), it should close the current section.</p> <pre><code>var sideMenu = { activated: {}, setup: function() { $('.menu-category-heading').bind('click', function() { sideMenu.slideMenu($('ul', $(this).parent())); }); }, slideMenu: function(menuObj) { if (sideMenu.activated == menuObj) { $(sideMenu.activated).slideUp(400); sideMenu.activated = null; console.log('same'); } else { $(sideMenu.activated).slideUp(400); menuObj.slideDown(500); sideMenu.activated = menuObj; console.log('new'); } } } </code></pre> <p>For some reason the comparison is never working... it does if I add $(menuObj).attr('id') and the same for activated. But this is not ideal as not all items will have an id attribute. </p> <p>Any suggestions as to make the object comparison work? Or any other tips?</p> <p>Thank you!</p>
javascript jquery
[3, 5]
5,793,354
5,793,355
getting values from price range slider jquery
<pre><code>&lt;meta charset="utf-8"&gt; &lt;title&gt;jQuery UI Slider - Range slider&lt;/title&gt; &lt;link rel="stylesheet" href="jquery.ui.all.css"&gt; &lt;script src="jquery-1.7.1.js"&gt;&lt;/script&gt; &lt;script src="jquery.ui.widget.js"&gt;&lt;/script&gt; &lt;script src="jquery.ui.mouse.js"&gt;&lt;/script&gt; &lt;script src="jquery.ui.slider.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" href="demos.css"&gt; &lt;script&gt; $(function() { $( "#slider-range" ).slider({ range: true, min: 0, max: 500, values: [ 75, 300 ], slide: function( event, ui ) { $( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] ); } }); $( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) + " - $" + $( "#slider-range" ).slider( "values", 1 ) ); $( "#minValue" ).val( ui.values[ 0 ] ); $( "#maxValue" ).val( ui.values[ 1 ] ); }); &lt;/script&gt; </code></pre> <p></p> <p> Price range: </p> <p>" /> " /></p> <p></p> <p>1)How i can get the min &amp; max values. 2)when slider sliding how i read that values from this code; 3)Is there any fuction is needed for reading the min &amp; max values</p>
php jquery
[2, 5]
3,167,879
3,167,880
Javascript IE Redirection Loop (with some PHP)
<p>For some reason, the following causes a redirection loop in IE, but not in Chrome or Firefox.</p> <pre><code>&lt;?php if (isset($_POST['a']) OR strlen($_POST['a'])&gt;0) { die($_POST['a']); } ?&gt; &lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="fpjs2.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name="fbif" id="fbif" action="checkcookie.php" method="POST"&gt; &lt;input type="hidden" name="a" value="" /&gt; &lt;/form&gt; &lt;script&gt; var ec = new MyObject(); ec.get("fbuid", function(value) { document.fbif.a.value=value; document.fbif.submit(); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The script is called checkcookie.php and it checks for the existence of a cookie (that's not the issue, don't go on about that or try to advise me on how best to do it) then posts this back to the same script. The PHP at the top should detect if something has been posted or not, if so then only display the post variable and exit (don't load the rest of the script).</p> <p>On Chrome and Firefox this works perfectly. On IE it redirects endlessly. So it seems that IE is not posting the variable but only reloading itself over and over.</p>
php javascript
[2, 3]
3,187,781
3,187,782
How to add forms inputs in an unordered list element
<p>I'm dynamically generating an asp form, and I would like to add the <strong>label</strong> and <strong>input</strong> elements inside a list.</p> <p>For example, I would like to end up with something like:</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;label for="input"/&gt;&lt;input id=input"/&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>To do this, I create a Label object and a TextBox object, then assign the AssociatedControlId property of the Label to link these. But I cannot add any of these in a ListItem, nor can I add these in the Controls collection of BulletedList...</p> <p>Any ideas would be greatly apreciated.</p>
c# asp.net
[0, 9]
2,911,678
2,911,679
Passing values from one page to another page in JS
<p>I have one query on JavaScript.</p> <p>How we can pass values from one page to another page?</p> <p>I am working with ASP.NET. My requirement is, I need to validate the user, whether his session expired or not. If the session expired then I need to show a pop up with two textboxes to enter his credentials.</p> <p>In which case I was unable to do that in ASP.NET. So though of doing with the help of JS. But not getting ideas.</p> <p>I know we can pass values from one page to another using querystring. But as per the security purpose that is not to be used in my app.</p> <p>Please help me out.</p> <p>Thanks in Advance.</p>
javascript asp.net
[3, 9]
4,753,424
4,753,425
ASP.NET how to get file name in specific folder on server
<p>I have this website which I am coding in ASP.NET - C#.</p> <p>My problem is that I have image boxes, but the user can upload images with any name. Now each image box has its own folder, and at any point, there can be only one file in that folder, which is a .JPG file. </p> <p>the path looks like this:</p> <pre><code>Server.MapPath("img/home/1/here can be any jpg file with any name eg. whateverPic.jpg") </code></pre> <p>So, when uploading the file, the name can change at any time... then the problem comes when I want to display the image in the picture box.</p> <p>All I want to do is to get the file name in folder img/home/1/.... and then I can just set the source of the picturebox to that name.</p> <p>How can I get that filename in that specific folder?</p>
c# asp.net
[0, 9]
1,715,185
1,715,186
How to properly manage contexts for an android application(non-activity classes)
<p><strong>Similar posts that do not have the answer i'm looking for.</strong> </p> <p><a href="http://stackoverflow.com/questions/987072/using-application-context-everywhere">Using Application context everywhere?</a></p> <p><a href="http://developer.android.com/reference/android/app/Application.html" rel="nofollow">http://developer.android.com/reference/android/app/Application.html</a></p> <p><a href="http://stackoverflow.com/questions/2002288/static-way-to-get-context-on-android">Static Way to get Context on android?</a></p> <p><a href="http://stackoverflow.com/questions/1026973/android-whats-the-difference-between-the-various-methods-to-get-a-context">Android - what&#39;s the difference between the various methods to get a Context?</a></p> <p><strong>Description of problem:</strong></p> <p>I have a set of utility classes, some of which write files. Others may use databases, etc. The point being that more than one of my utility classes need *<em>Context</em>*s. One trivial example is reading from the strings.xml via context.getString(r.strings.id). </p> <p>I think in most cases I'd like to avoid singletons. Unless absolutely necessary i'll go with a singleton. This has been solved and posted on one of the links. I personally consider them an ati-pattern. Just a personal choice. I understand that your application context by definition is a singleton object. There is only one application for each app-context. I am open to go with the option described above if it is the only way.</p> <p><strong>Question:</strong></p> <p>How can my utility classes get acces to my app context such that I can simply do new MyContext(). This context needs to have a reference to the app resources. I think this is called applicationContext() when called from an activity. Ideally this would be a cheap operation. </p> <p>Thank you.</p> <p><strong>Edit:(clarification)</strong> I'm writing a service that an application is going to bind itself to. I think this should not affect the answer. Thanks again.</p>
java android
[1, 4]
4,491,873
4,491,874
How can I insert a new row into a grid view control?
<h1>Duplicate:</h1> <blockquote> <p><a href="http://stackoverflow.com/questions/594088/how-to-insert-row-in-grid-view/">How can I insert a new row into a grid view control?</a></p> <p><a href="http://stackoverflow.com/questions/181158/how-to-programmatically-insert-a-row-in-a-gridview">How to programmatically insert a row in a GridView?</a></p> </blockquote> <p>I want to insert a new row when I click a button control. </p> <p>I want all the buttons to be located on the side of the grid control and when I click the <code>new</code> button to add a new empty record, it should fill the row with data after I click save and add it to a DB table.</p> <p>I don't want to choose a data source to bind to the grid control.</p>
c# asp.net
[0, 9]
4,501,369
4,501,370
Asp.net login script
<p>i'm new to asp.net, i'm writing a login &amp; registration script for learning database application. But the script seems not work. it stills can add duplicated username. Here is the script</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Configuration; public partial class Registration : System.Web.UI.Page { static string temp; protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["earchConnectionString"].ConnectionString); con.Open(); string cmdStr = "Select count(*) from [user] where UserName='" + TextBoxUN.Text + "'"; SqlCommand userExist = new SqlCommand(cmdStr, con); int temp = Convert.ToInt32(userExist.ExecuteScalar().ToString()); con.Close(); if (temp == 1) { Response.Write("User Name Already Exist....&lt;br /&gt; Please Choose Another User Name."); } } } protected void Submit_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["earchConnectionString"].ConnectionString); con.Open(); string insCmd = "Insert into [user] (UserName, Password, EmailAddress, FullName, level) values (@UserName,@Password,@EmailAddress, @FullName, @level)"; SqlCommand insertUser = new SqlCommand(insCmd, con); insertUser.Parameters.AddWithValue("@UserName", TextBoxUN.Text); insertUser.Parameters.AddWithValue("@Password", TextBoxPass.Text); insertUser.Parameters.AddWithValue("@EmailAddress", TextBoxEA.Text); insertUser.Parameters.AddWithValue("@FullName", TextBoxFN.Text); insertUser.Parameters.AddWithValue("@level", level.SelectedValue.ToString()); try { insertUser.ExecuteNonQuery(); con.Close(); //Response.Redirect("Login.aspx"); Label1.Text = temp; } catch (Exception er) { Response.Write("Something wrong"); } finally { //Any Special Action You Want To Add } } } </code></pre> <p>Any can detect the problems?</p> <p>thanks</p>
c# asp.net
[0, 9]
4,662,798
4,662,799
C# reference type behaviour
<p>I have some confusion with reference type following is the test example please tell me how it will works</p> <pre><code>class TestClass { public int i = 100; } class MyTestClass { public void Method() { int i = 200; var testClass = new TestClass(); testClass.i = 300; Another(testClass, i); Console.WriteLine("Method 1:" + testClass.i); Console.WriteLine("Method 2:" + i); } public void Another(TestClass testClass, int i) { i = 400; testClass.i = 500; testClass = new TestClass(); //If we have set here again testClass.i = 600; what should be out putin this case Console.WriteLine("Another 1:" + testClass.i); Console.WriteLine("Another 2:" + i); } public static void Main() { MyTestClass test = new MyTestClass(); test.Method(); Console.ReadLine(); } } </code></pre> <p><em><strong></em>**<em>*</em></strong><em>EDIT</em><strong><em>*</em>**<em>*</em>**</strong> What should be the Output of this,and how many times the Object of the TestClass() will created during execution.</p>
c# asp.net
[0, 9]
5,931,819
5,931,820
Where is the Component Initialize Method in Asp.NET 3.5
<p>I want to create my own naming convention for page events rather than AutoEventWireUp but I couldn't find Component Initialize methods any where ? Should I override it ? But in which class it is defined ?</p> <p>Thanks...</p> <p><strong>Edit :</strong></p> <p>For example : I don't want to use <code>Page_Load</code> but <code>LoadThisPage</code> naming. So It should be like </p> <pre><code>Load += new LoadThisPage(sender,e); </code></pre> <p>I was expecting a <code>InitializeComponent</code> method where I can initialize page,controls etc. events handlers...But it turned out to be <code>Constructor</code> function :)</p> <p>So what confused me is I thought there should have been a method like <code>InitializeComponent</code> which does things for me already created by Designer itself so I thought I could define my own event handler names within this method by overriding it in the say <code>Default.aspx.cs</code> .</p> <p>But the answer was simple :) Thanks...</p>
c# asp.net
[0, 9]
2,115,560
2,115,561
how to edit column value before binding to gridview after retriving from database?
<p>After i retrieved a set of datatable from database, i need to edit the rows value before binding to the gridview. for example, a set of datatable is retrived from database. </p> <p>eg: [userid], [userEmail] --> 1 , [email protected]</p> <p>i would like to change "[email protected]" to "james" then bind it to gridview. Every rows of [userEmail] will be separated with the mail extension (@hotmail.com) ... how should i do..?</p>
c# asp.net
[0, 9]
3,591,606
3,591,607
How can I prevent a jquery animation from firing when a selectbox is active
<p>The following jsfiddle demonstrates the problem. In Firefox, hover over 'highlight stories' and try to select from the second drop-down: the containing ul animates closed and it is impossible to select an option. It is also possible to get into a flickering loop by selecting from the top select box and moving the mouse down slightly.</p> <p>I can remove the mouseleave event by doing something like this:</p> <pre><code>$('.selector').click(function(){ $('nav ul li').unbind('mouseleave'); }); </code></pre> <p>But this obviously prevents the hover animation from firing correctly. Can anyone suggest a more elegant solution?</p> <p><a href="http://jsfiddle.net/codecowboy/mDUa9/8/" rel="nofollow">http://jsfiddle.net/codecowboy/mDUa9/8/</a></p>
javascript jquery
[3, 5]
5,403,095
5,403,096
How to handle both Quick Search Box results and recent suggestions for search?
<p>I'm trying to implement both <a href="http://d.android.com/guide/topics/search/adding-recent-query-suggestions.html" rel="nofollow">recent suggestions</a> and <a href="http://d.android.com/guide/topics/search/adding-custom-suggestions.html" rel="nofollow">custom suggesions</a> in global search in the same application. They both use the same path in the provider so it doesn't seem like it is possible to return different results for them. For example just recent searches for suggestions and real search results in the Quick Search Box.</p> <p>Any idea on how to do this?</p>
java android
[1, 4]
2,976,325
2,976,326
Why is Javascript called Javascript, if it has nothing to do with Java?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2018731/why-is-javascript-called-javascript-if-it-has-nothing-to-do-with-java">Why is JavaScript called JavaScript, if it has nothing to do with Java?</a> </p> </blockquote> <p>Why Javascript is called Javascript (there is no relation between Java and Javascript) why its not called HTMLScript or XMLScript. Any historical reason for this?</p>
java javascript
[1, 3]
1,198,008
1,198,009
What is the difference between....?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1626010/what-is-the-difference-between-container1-and-container2-fin">What is the difference between $(&ldquo;<em>&rdquo;, $(&ldquo;#container1&rdquo;)) and $(&ldquo;#container2&rdquo;).find(&ldquo;</em>&rdquo;)?</a> </p> </blockquote> <p>What is the difference between </p> <p><code>jQuery('.classname', this.frame)</code> and <code>this.frame.find('.classname')</code> ?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
4,876,022
4,876,023
NamingEnumeration in c#
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/7334055/rewriting-java-code-to-c">Rewriting Java code to c#</a> </p> </blockquote> <p>does anyone know the equivelent of: <code>NamingEnumeration answer = ctx.search</code> in c#. The following is a piece from java code that i am struggling to rewrite into c#</p>
c# java
[0, 1]
1,582,197
1,582,198
Convert Feb 17, 2012 to 17/02/2012 with jQuery
<p>I have this code:</p> <pre><code>var Date = "Feb 17, 2012"; </code></pre> <p>How can I convert it to</p> <pre><code>Date = "17/02/2012" </code></pre> <p>using jQuery?</p>
javascript jquery
[3, 5]
5,008,439
5,008,440
Creating visual designs for android applications
<p>I've been on and off with Android development but one thing that has confused me is how do you do custom looking interfaces? I'm not exactly sure as to what terms to look for or how it is done. I've not found any working examples either.</p> <p>What terms should I look for to learn how this is done?</p>
java android
[1, 4]
428,191
428,192
Trying to use jQuery.load() to upload http:// file
<p>I'm trying to load html page from server into another page on the same server, using jquery.load() method. This is the code:</p> <pre><code>&lt;div id="mydiv"&gt; &lt;script type="text/javascript" &gt; $('#mydiv').load('http://www.myurl.com/ns/pagename.html'); &lt;/script&gt; &lt;/div&gt; </code></pre> <p>It's not loading... I tested it locally, loading it on side other page and it was fine...Also html page works fine by itself... What am I doing wrong??</p> <p>Thanks in advance for any hint.</p>
javascript jquery
[3, 5]
1,276,544
1,276,545
jQuery get previous month from php
<p>I have made this script that get's the month and the year from calendar.php and I would like when I click the link previous month to get the previous month but also when month number reach 1 make the year - 1. How can I do something like that? </p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script&gt; $(function() { get_data(); }); function get_data(a, b) { $.get('calendar.php', { month: a, year: b }, function(response) { $el = $('&lt;div&gt;&lt;/div&gt;').attr('class', 'data').html(response); $('#datas').prepend($el); height = $el.height()+'px'; $el.css({'opacity': 0, 'display': 'block', 'height': '0px'}).animate({height: height }, 500, function() { $(this).animate({opacity: 1}, 500); }) }); } &lt;/script&gt; &lt;style&gt; #datas { overflow: hidden; } .data { display: none; } &lt;/style&gt; &lt;body&gt; &lt;a href="#" OnClick="get_data(9, 2012);" &gt; Previous month&lt;/a&gt; &lt;div id="datas"&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
php jquery
[2, 5]
2,447,134
2,447,135
passing hidden field values to javascript function
<p>is it possible to get the value of the hidden field that is defined in the gridview to the javascript function so I have a gridview that has a linked button defined in it. If the user clicks on the link button, I am invoking a javascript function. I want the hidden field values in the javascript function. </p> <p>also, I was wondering if it is possible to pass multiple values in one hiden field and then split them later in the javascript function.</p> <p>any help will be appreciated. I don't want to go to code behind and then invoke the javascript function from there.</p>
javascript asp.net
[3, 9]
4,004,203
4,004,204
How to embed a jquery library in javascript?
<p>I have a jquery library code in jquery.xyz.js . I have an html file which uses the fucntion defined in jquery.xyz.js in this manner . </p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; document.write("This is my first JavaScript!"); $(function(){ $("ul#xy01").xyz(); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>But the jquery is not running , which I am assuming because I havent loaded the jquery properly onto the html page . So how do I do it ?</p>
javascript jquery
[3, 5]
5,533,748
5,533,749
textbox value set in javascript is not avaliable in serverside page load event
<p>I have following situation.I have set a textbox value by calling a JavaScript function from serverside.The textox value is assigned perfectly but it is not on server side it is showing blank. This is my code.</p> <pre><code>Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then Page.ClientScript.RegisterStartupScript(Me.GetType(), "set", "setValue();", True) TextBox1.Text = txt.Text End If End Sub </code></pre> <p>and This is my javascript function.</p> <pre><code> &lt;script type="text/javascript"&gt; function setValue() { document.getElementById("&lt;%=txt.ClientID %&gt;").value = "Hello World"; } &lt;/script&gt; </code></pre> <p>and here is my mark up</p> <pre><code>&lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:TextBox ID="txt" runat="server"&gt; &lt;/asp:TextBox&gt; &lt;asp:TextBox ID="TextBox1" runat="server"&gt; &lt;/asp:TextBox&gt; &lt;asp:Button ID="btnClic" runat="server" Text="Click Me" /&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>The first texbox value is assigned perfectly.but it was not showin on second textbox.</p>
javascript asp.net
[3, 9]
3,569,557
3,569,558
Get the suffix of a dynamically selected id within a hover method
<p>I have the following JQuery selector with a hover method attached to it:</p> <pre><code>$("a[id^='foo']").hover( function () { $(this).css("color", "#eeeeee"); }, function () { $(this).css("color", "#ffffff"); } ); </code></pre> <p>However, I want to alter a td decoration underneath the links with the 'foo' prefixes on their id's, which have a 'bar' prefix. For clarification: foo1, foo2, foo3 and bar1, bar2, bar3. How can I figure out what id is currently in effect and use its corresponding suffix within the same hover method? </p> <p>Technically in semi-pseudo code I want to achieve this result</p> <pre><code>$("a[id^='foo']").hover( function () { $(this).css("color", "#eeeeee"); // var x = charAt($(this).id.length-1) // $("#bar"+x).css("color", "#eeeeee"); }, function () { // ... } ); </code></pre> <p>I tried variations with $this.id, but I get undefined values.</p> <p>Thanks for the help!</p>
javascript jquery
[3, 5]
3,072,050
3,072,051
how to get stored procedure's batches query in different dataset
<p>I'm trying to fetch all the data from one stored procedure for different different Dataset in a single page.</p> <pre><code>CREATE PROCEDURE [dbo].[usp_Details](@status int, @Id int) AS begin Select u.Id,u.FName,u.ImageName,u.ImagePath,u.Sex FROM [User] as u where u.Id IN (SELECT MyId as Id FROM Friends WHERE FriendId=@Id AND FriendStatus=0) Select Points,FName from [User] where Id=@Id SELECT ImagePath from [User] where Id=@Id end GO </code></pre> <p>Now, how I can bind datatable/dataset for individual query. Example: query1 for dataset1, query2 for dataset2, query3 for dataset3</p> <p>If this is not possible then which is the best way to avoid connecting database each time for fetching different tables.</p>
c# asp.net
[0, 9]
4,803,293
4,803,294
Bind a handler to an object
<p>How can I bind a handler to an object so that when it is changed a function will occur? You can do this with elements like this: <code>$(element).change(function() { alert("something changed"); });</code>, but as far as I can see there isn't a similar way for objects, so what could I do?</p>
javascript jquery
[3, 5]
4,006,708
4,006,709
setInterval doesn't work?
<pre><code>var until = $("#time").html(); function updateTime() { $("#time").html( date("d", until) + " day(s)&lt;br /&gt;" + date("h", until) + " hour(s)&lt;br /&gt;" + date("i", until) + " minute(s)&lt;br /&gt;" + date("s", until) + " second(s)" ); } setInterval("updateTime(until)",1000); </code></pre> <p>Everytime I run this, I get this error:</p> <blockquote> <p>Uncaught ReferenceError: until is not defined (anonymous function)</p> </blockquote> <p>I can't see whats wrong. I've tried to google a lot, but every page that I find, says that <code>setInterval()</code> is right.</p>
javascript jquery
[3, 5]
5,145,223
5,145,224
how to set text an integer and get int without getting error
<p>This is the code i used in getting the intent for integer. The String get intent works fine and displays well but when i put the integer i get a force close error. I might be doing something wrong here. This is the code:</p> <pre><code>package kfc.project; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.widget.EditText; import android.widget.TextView; public class productdetail extends Activity{ @Override protected void onCreate(Bundle bundle) { // TODO Auto-generated method stub super.onCreate(bundle); setContentView(R.layout.productdetail); //stuff to get intent Intent receivedIntent = getIntent(); String productName = receivedIntent.getStringExtra("name"); int productCalories = receivedIntent.getIntExtra("calories",0); /*Intent intent = new Intent(ProductListView.this, productdetail.class); intent.putExtra("name",product.getName()); intent.putExtra("calories", product.getCalories()); intent.putExtra("serving size", product.getServingSize()); intent.putExtra("fat", product.getFat()); intent.putExtra("saturated fat", product.getSaturatedFat()); intent.putExtra("trans fat", product.getTransFat()); intent.putExtra("cholesterol", product.getCholesterol()); intent.putExtra("sodium", product.getSodium()); intent.putExtra("carbs", product.getCarbs()); intent.putExtra("fiber", product.getFiber()); intent.putExtra("sugar", product.getSugar()); intent.putExtra("protein", product.getProtein()); intent.putExtra("vitamina", product.getVitaminA()); intent.putExtra("vitaminc", product.getVitaminC()); intent.putExtra("calcium", product.getCalcium()); intent.putExtra("iron", product.getIron());*/ Bundle extras = getIntent().getExtras(); String name = extras.getString("name"); if (name != null) { TextView text1 = (TextView) findViewById(R.id.servingsize); text1.setText(productName); } //int calories = extras.getInt("calories"); TextView text1 = (TextView) findViewById(R.id.calories); text1.setText(productCalories); /* Intent intent = getIntent(); String str = intent.getStringExtra("name");*/ } } </code></pre>
java android
[1, 4]
891,855
891,856
The name 'txtinput1' does not exist in the current context
<p>First off , I know the question looks very similar to the question <a href="http://stackoverflow.com/questions/1316757/cant-access-control-id-in-code-behind">here</a></p> <p>But somehow the fixes suggested there arent working for me. So here goes. I have the following code in my aspx page :</p> <pre><code> &lt;asp:TextBox ID="txtinput1" runat="server" Width="200px" ontextchanged="txtinput1_TextChanged"&gt;&lt;/asp:TextBox&gt; </code></pre> <p>But when I try the following code in my code behind:</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { StemService.ServiceClient myClient = new StemService.ServiceClient(); string input = txtinput1.Text; } </code></pre> <p>I get the error saying that 'txtinput1' does not exist in the context. For sake of completion here's my default.aspx <a href="https://gist.github.com/KodeSeeker/5217410" rel="nofollow">https://gist.github.com/KodeSeeker/5217410</a>.</p> <p>P.S. Im a C# <strong>noob</strong>, so I may be missing something obvious.</p> <p>EDIT: Designer.cs <a href="https://gist.github.com/KodeSeeker/5217484" rel="nofollow">https://gist.github.com/KodeSeeker/5217484</a></p> <p>EDIT 2: Default.aspx.cs: <a href="https://gist.github.com/KodeSeeker/5217517" rel="nofollow">https://gist.github.com/KodeSeeker/5217517</a></p>
c# asp.net
[0, 9]
5,827,296
5,827,297
How to remove <li></li> from ul?
<p>how to remove a particular <code>&lt;li&gt;&lt;/li&gt;</code> from the ul list? i am adding it dynamically... and i need to remove it when the user click on clear. how can i do that?</p>
javascript jquery
[3, 5]
1,419,125
1,419,126
Creating a drop down alert field on top of the page
<p>I am building a voting system for my site and I want to set it up to have a 300px drop down bar on top of page saying "Thank you for Voting" when the button is clicked. Anyone have a suggestion on how to do this?</p>
javascript jquery
[3, 5]
1,264,351
1,264,352
Reverse Geocoding works in Debug mode but not in Run Mode
<p>I have a pretty strange situation related to geocoding in Android. I have a class where I find latitude and longtitude information and translate this into address info using location based services.</p> <p>Application is working fine in Debug mode where x,y pair is translated to Address information but when I run application in Run Mode (When I run it usual way) translation is always NULL.</p> <p>Did you face such situation before? If yes, what can cause such issue?</p> <p>Code snippet for latitude, longtitude pair </p> <pre><code> mostRecentLocation = locationManager.getLastKnownLocation(locationProvider); if(mostRecentLocation != null) { //Update with New Location lat = mostRecentLocation.getLatitude(); lng = mostRecentLocation.getLongitude(); currentLocationURL = "http://maps.google.com/?q=" + lat + "," + lng; //Construct URL } else { currentLocationURL = "No Location Found"; } </code></pre> <p>Translation of X,Y to Address information,</p> <pre><code> addresses = gc.getFromLocation(lat, lng, 1); StringBuilder sb = new StringBuilder(); if (addresses.size() &gt; 0) { Address address = addresses.get(0); for (int i = 0; i &lt; address.getMaxAddressLineIndex(); i++) sb.append(address.getAddressLine(i)).append("\n"); sb.append(address.getLocality()).append("\n"); sb.append(address.getPostalCode()).append("\n"); sb.append(address.getCountryName()); addressString = sb.toString(); </code></pre>
java android
[1, 4]
3,097,173
3,097,174
javascript validation in a form
<p>I am having trouble getting this validation to work. I am validating that a selectbox has been chosen and not left on the default option within my form.</p> <p><strong>Form:</strong></p> <pre><code>&lt;label for="reason"&gt;How can we help?&lt;/label&gt; &lt;select name="reas"&gt; &lt;option value="Please Select"&gt;Please Select&lt;/option&gt; &lt;option value="Web Design"&gt;Web Design&lt;/option&gt; &lt;option value="branding"&gt;Branding&lt;/option&gt; &lt;option value="rwd"&gt;Responsive Web Design&lt;/option&gt;&lt;span id="dropdown_error"&gt;&lt;/span&gt; &lt;/select&gt; </code></pre> <p><strong>Onclick event:</strong></p> <pre><code>$(document).ready(function(){ $('#contactForm').submit(function(){ return checkSelect(); }); }); </code></pre> <p><strong>Function:</strong></p> <pre><code>function checkSelect() { var chosen = ""; var len = document.conform.reas.length; var i; for (i = 0; i &lt; len; i++){ if (document.conform.reas[i].selected){ chosen = document.conform.reas[i].value; } } if (chosen == "Please Select") { document.getElementById("dropdown_error").innerHTML = "No Option Chosen"; return false; } else{ document.getElementById("dropdown_error").innerHTML = ""; return true; } } </code></pre> <p>I also get this error in the console:</p> <pre><code>Uncaught TypeError: Cannot set property 'innerHTML' of null </code></pre> <p>I am really new to javascript, so, I am learning and trying some simple examples at the moment, but I cannot see what is causing this not to validate.</p> <p>Any help appreciated</p>
javascript jquery
[3, 5]
4,239,599
4,239,600
How to send app request in iphone/php webservices to facebook in using query string
<p>I want to send request by simple query string but I have problems with getting notification on facebook. Also when I send the request and I pass the id of receiver in (to) parameter then I get the request on my own id.</p> <p>How could I send the app request and get the notification on facebook ?.</p> <p>I use php webservices for iphone so please do not write pop type. Please, use query string concept so i will pass it in curl.</p>
php iphone
[2, 8]
5,205,749
5,205,750
Start Java Platform from C#
<p>I have a windows application that uses WebBrowser in wich users can watch some flash animations and java applets. </p> <p>I would like to start java platform on aplication start (even the user is not needing it), so user is not waiting for the platform to start, when he wants to look at the applets.</p> <p>Any idea?</p>
c# java
[0, 1]
946,596
946,597
Run .exe on client system from server-side c# code
<p>I want to run an exe on client system from my c# asp.net website. When I use <code>Process.Start()</code> it throws an error:</p> <blockquote> <p>The requested operation requires elevation.</p> </blockquote> <p>How do I set permissions to run that exe?</p>
c# asp.net
[0, 9]