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
2,191,570
2,191,571
Running queries, good design here?
<p>Sorry for posting so many nubbin questions on ASP.net, I'm getting the hang of it slowly.</p> <p>I execute queries on my pages as such (working):</p> <pre><code>&lt;%@ Import Namespace="System.Data" %&gt; &lt;%@ Import Namespace="System.Data.SqlClient" %&gt; &lt;script runat="server"&gt; // When the registration form is submitted protected void regSubmit(object sender, EventArgs e) { // No erros so far Boolean anyError = false; string errorMessages = ""; // Take all form values string username = txtUsername.Text; string password1 = txtPassword1.Text; string password2 = txtPassword2.Text; string emailAdd = txtEmail.Text; // Verify that username is unique using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["MyDbConn"].ToString())) { SqlCommand cmd = new SqlCommand("SELECT COUNT(*) FROM tblUsers WHERE username = '" + username + "'", cn); cn.Open(); SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection); rdr.Read(); int result = int.Parse(rdr[0].ToString()); //read a value } statusLabel.Text = username; } &lt;/script&gt; </code></pre> <p>My question is, is this the best practise, do I have to have a 'using' block and that inner structure for every query I run, or is there a simpler way of doing it? Also, do I need to close anything off or does the garbage man take care of it?</p> <p>In Classic ASP I would just have a </p> <pre><code>adoCon.execute("DELETE FROM TABLE") </code></pre> <p>or a </p> <pre><code>rsCommon.open("SELECT * FROM TABLE"), adoCon do until rsCommon.EOF rscommon.movenext loop rsCommon.close </code></pre> <p>Tallyho! Thank you for any help! Which seems a lot simpler and intuitive to me.</p>
c# asp.net
[0, 9]
3,482,441
3,482,442
call javascript alert from java class
<p>How to call javascript alert from java class</p>
java javascript
[1, 3]
1,978,545
1,978,546
using single quote or double quote
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/242813/when-to-use-double-or-single-quotes-in-javascript">When to Use Double or Single Quotes in JavaScript</a><br> <a href="http://stackoverflow.com/questions/3149192/difference-between-single-quotes-and-double-quotes-in-javascript">Difference between single quotes and double quotes in Javascript</a> </p> </blockquote> <p>When I started learning jQuery, I frequently found examples using single quote or double quote as jQuery selector:</p> <p><code>$('#myDiv');</code> or <code>$("#myDiv");</code></p> <p>They are basically the same. But which one is used prefer and fast execute please let me know.</p>
javascript jquery
[3, 5]
558,950
558,951
issue with sort data
<p>i am developing an app in which i get data from server and display in map. but before display it on map's balloon i have just sort data by one field name is "Destination" and there are method made na,e is ..GOTOSORT.... </p> <p>now problem is i got variables <code>s</code> with length 1 and there for the for loop are run only 1 time , but there are 42 data are come from webservices so please check it and tell me what is the problem</p> <pre><code>private void GOTOSORT() { Log.i(TAG, " SORT "); Map&lt;Float, Integer&gt; map = new TreeMap&lt;Float, Integer&gt;(); for (int i = 0; i &lt; lng_timeStamp.length; ++i) { map.put((float) lng_timeStamp[i], i); } Collection&lt;Integer&gt; indices = map.values(); System.out.println("indices" + indices); Integer s[] = (Integer[]) indices.toArray(new Integer[0]); Log.i(TAG, "s.length"+s.length); for (int i = 0, n = s.length; i &lt; n; i++) { System.out.println(s[i]); int_sort_MyhourGetTime[i] = int_MyhourGetTime[s[i]]; int_sort_MyMinGetTime[i] = int_MyMinGetTime[s[i]]; lng_sor_timeStamp[i] = lng_timeStamp[s[i]]; arr_sort_ServiceNumber[i] = arr_ServiceNumber[s[i]]; arr_sort_Destination[i] = arr_Destination[s[i]]; } </code></pre>
java android
[1, 4]
4,933,684
4,933,685
Why is "this.var" less efficient than "array.length"?
<p>When I watched the "<a href="http://sites.google.com/site/io/dalvik-vm-internals/" rel="nofollow">Dalvik VM Internals</a>" talk, I had a question about one of the slides about wise loops. Here is two of the seven loops on that slide:</p> <p>(4) for (int i = 0; i &lt; array.length; i++)</p> <p>(5) for (int i = 0; i &lt; this.var; i++) </p> <p>and the speaks said (4) is more efficient than (5). "array" is just an Array object.</p> <p>My question is what exactly does "this.var" do that makes it is more expensive than retrieving a member variable from an object?</p>
java android
[1, 4]
5,539,682
5,539,683
equivalent of php's returning References in javascript
<p>Is there a way to accomplish the same thing as <a href="http://fr.php.net/references.return" rel="nofollow">returning references</a> in php using javascript ?</p> <p>for example suppose i want to use a function to find to which variable a reference should be bound, in php i can use an ampersand before a function , how can i do something like this in javascript ?</p> <p><strong>EDIT</strong> : if not possible can i do something similar ? Thanks.</p>
php javascript
[2, 3]
2,206,365
2,206,366
Show a set number of <li>s and then hide them to reveal another set number of <li>s
<p>I am trying to create a carousel, using floated list items.</p> <p>When <em>Next</em> is pressed the current 4 visible <code>li</code>s are hidden and the next 4 shown for as many times as needed. Though, there may not always be another 4 to show, as in the case below there would only be 2 more to display.</p> <p>When <em>Prev</em> is pressed the current 4 visible <code>li</code>s are hidden and the previous 4 shown.</p> <p>It doesn't need to loop i.e. if <em>Next</em> is pressed enough times it will reach the end, it wont just start back from the beginning again.</p> <p><a href="http://jsfiddle.net/tw16/5NB6G/" rel="nofollow">http://jsfiddle.net/tw16/5NB6G/</a></p> <p><strong>HTML:</strong></p> <pre><code>&lt;div id="left"&gt;Prev&lt;/div&gt; &lt;ul&gt; &lt;li&gt;Test 1&lt;/li&gt; &lt;li&gt;Test 2&lt;/li&gt; &lt;li&gt;Test 3&lt;/li&gt; &lt;li&gt;Test 4&lt;/li&gt; &lt;li&gt;Test 5&lt;/li&gt; &lt;li&gt;Test 6&lt;/li&gt; &lt;/ul&gt; &lt;div id="right"&gt;Next&lt;/div&gt; </code></pre> <p><strong>jQuery/JavaScript:</strong></p> <pre><code>var listLength = $('ul li').length; var listCounter = 0; $("#right").click(function() { if (listCounter == listLength - 1) { $("ul li").show(400); listCounter = 0; } else { $('ul li').eq(listCounter).hide(400); listCounter++; } }); </code></pre> <p>Unfortunately, I haven't been able to adapt the code to the requirements above.</p>
javascript jquery
[3, 5]
2,778,993
2,778,994
javascript error when using google maps ASP.NET GoogleMaps User Control
<p>when i try to run the google maps on an asp .net page i get a javascript error saying that it doesnt like the key im using but i have the key from google</p> <p>can anyone help please?</p> <p>thanks</p> <p>Kevin</p> <p>edit this is the key that google provided ABQIAAAAcPBSoXRloZCu5tYnhpZBCBRrxSVjvAJ3kkmtcIQSxWeYirsDfxTECPvByIoh90G8hcPG55N3s_3E2g</p> <pre><code>&lt;cg1:GMap ID="gMap1" runat="server" Height="250px" Width="350px" enableServerEvents="true" Visible="False" serverEventsType="AspNetPostBack" /&gt; </code></pre>
c# asp.net javascript
[0, 9, 3]
5,966,866
5,966,867
Reading line from website
<p>I am making a little program thath will read data from website. String in the html file is already managed every info is divided with ; . Now i should read complete line here is example of this line:</p> <pre><code>14:47;24.02.12;18.7°C;18.7°C;285;0.5m/s; 6:48;17:37; Warm ;36;1.8;0.0; </code></pre> <p>So first how should i read them with HTTP Get or is there anything other? And then i would like to save each info, they are seperated with ; into a variable. And how should i cut each info from this line.</p>
java android
[1, 4]
3,864,472
3,864,473
replace a fragment from fragment
<p>I have ActivityFragment with two Fragment i can start a fragement from the ActivityFragment using :</p> <pre><code>FragmentTransaction transaction = getSupportFragmentManager() .beginTransaction(); transaction.add(R.id.center_layout, new MyFragment()); transaction.commit(); </code></pre> <p>my problem is when trying to replace <code>MyFragment()</code> by an other Fragment in <code>R.id.center_layout</code> from <code>MyFragment()</code> class </p> <p>i tried </p> <pre><code>FragmentTransaction transaction =this.getChildFragmentManager() .beginTransaction(); transaction.add(R.id.center_layout, client_Ajouter); transaction.commit(); </code></pre> <p>but i get </p> <pre><code>No view found for id 0x7f06000b (center_layout) for fragment Client_Ajouter </code></pre> <p>and thank you.</p>
java android
[1, 4]
5,512,021
5,512,022
Interfering jQuery scripts
<p>This DID work fine for a long time, then when i was tidying up some code today it stopped working and i can't see why...</p> <p>This code currently works:</p> <pre><code>&lt;script type="text/javascript" src="/sideswap/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/sideswap/jquery.sideswap.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(window).load(function() { $('#rotating-elements').sideswap({ next : '&lt;img src="/sideswap/next.png" /&gt;', previous : '&lt;img src="/sideswap/prev.png" /&gt;', transition_speed : 100, auto_run : true }); }); &lt;/script&gt; </code></pre> <p>This code used to work:</p> <pre><code>&lt;script src="/quotator/jquery-1.3.1.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="/quotator/quotator.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $("#quotes").quotator({ speed : 10000, json : "/quotator/quotator_quotes.js" }); }); &lt;/script&gt; &lt;div id="quotes"&gt; &lt;/div&gt; </code></pre> <p>The second script only works when placed lower down the page than the first, however it needs to be (and was before) in the sidebar higher up the page.</p> <p>I have no idea how i caused this!!</p>
php javascript jquery
[2, 3, 5]
1,838,253
1,838,254
Can't find the ASP.net ListView control
<p>I want to extend the <code>ListView</code> control:</p> <pre><code>using System; using System.Data; using System.Collections; using System.Web.UI; using System.Web.UI.WebControls; using System.ComponentModel; using System.Resources; using System.ComponentModel.Design; using System.Globalization; namespace My.WebControls { /// &lt;summary&gt; /// my ListView /// &lt;/summary&gt; [Designer(typeof(System.Web.UI.Design.WebControls.DataBoundControlDesigner))] public class MyListView : ListView { } } </code></pre> <p>But compiler does not see this control. I include the namespace <code>system.web.ui.webcontrols</code>. Do I have to check anything else? I use the framework 3.5.</p>
c# asp.net
[0, 9]
69,303
69,304
Going from C# to php
<p>I'm going to have to learn php soon, because I need it for a new job. Up until now, i've always programmed in C#. Are there things I should know about php that are strange or different from a C# perspective? Things to look out for?</p>
c# php
[0, 2]
4,063,934
4,063,935
How to access created enum in C# from code behind to aspx file
<p>Below is my code behind C# code:</p> <pre><code>namespace Test { public enum en { One, Two } } </code></pre> <p>How can I access this created enum in my aspx file? Like using the enum in this code:</p> <pre><code>&lt;% %&gt; </code></pre> <p>Thanks</p>
c# asp.net
[0, 9]
3,692,178
3,692,179
How do I prevent JQuery animate calls from getting queued up?
<p><strong>Background</strong></p> <p>I am working on a project that relies heavily on JQuery .animate(), it occasionally receives external updates via Socket.io that call animate(). When the window is open, everything runs fine and animate calls can run asynchronously.</p> <p><strong>Problem</strong></p> <p>However, when the browser is minimized or a different tab is open then reopened, all the animations that should have been run while it was closed are queued up and run in that they were received.</p> <p><em>Here is the animate call:</em></p> <pre><code>$(div).animate({ 'top': this.topPos(), 'right': this.rightPos() }, 100); </code></pre> <p>Is there a simple way to add on option to the animate() call or call some jquery function or should I just add the appropriate logic to the application?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
1,472,406
1,472,407
How to know click (Ok or Cancel) event from print pop-up of web browser
<p>In my application I am printing some data through a pop-up window. On loading the pop-up, the user will be prompted for to either print or cancel. I want to know which button is clicked (print or cancel) so that I can take some action based on the button clicked. The code and screenshot are given below.</p> <pre><code>public void Print(int Id) { StringBuilder sb = BadgeHelper.preparePrintableString(Id); string printWindowFunc = "function printWindow() {\n" + "var z = window.print();\n alert('Return: ' + z);\n" + "checkDocumentState();\n" + "}"; string checkDocumentStateFunc = "function checkDocumentState() {\n" + "if (document.readyState == 'complete') {\n" + "window.close();\n" + "}\n" + "else {\n alert('Else');\n" + "setTimeout('checkDocumentState()', 2000);\n" + "}\n"+ "}\n"; string startingHTMLCode = "&lt;html&gt;\n" + "&lt;head&gt;\n" + "&lt;script type='text/javascript'&gt;\n " + checkDocumentStateFunc + "\n" + printWindowFunc + "&lt;/script&gt;\n " + "&lt;/head&gt;\n" + "&lt;body onload='printWindow();'&gt;\n"; sb.Insert(0, startingHTMLCode); sb.Append("\n&lt;/body&gt;\n&lt;/html&gt;"); Response.Write(sb.ToString()); } </code></pre> <p><img src="http://i.stack.imgur.com/5rrUD.jpg" alt="enter image description here"></p>
c# javascript
[0, 3]
1,971,333
1,971,334
GridView take a Row
<p>net 4 and c#.</p> <p>I have a GridView, I would like take a Row when in Edit Mode in my code and find a control.</p> <p>Here my code, but does not work, it takes only the first row for the GridView.</p> <p>Any ideas?</p> <pre><code>protected void uxManageSlotsDisplayer_RowDataBound(object sender, GridViewRowEventArgs e) { switch (e.Row.RowType) { case DataControlRowType.DataRow: // Take Row in Edit Mode DOES NOT WORK PROEPRLY if (e.RowState == DataControlRowState.Edit) { Label myTest = (Label)e.Row.FindControl("uxTest"); } break; } </code></pre> <p>MY CODE EXAMPLES: <a href="http://stackoverflow.com/questions/5170261/gridview-row-in-edit-mode">GridView row in edit mode</a></p> <p>SOLUTIONS: After reading this: <a href="http://stackoverflow.com/questions/833490/asp-net-3-5-gridview-row-editing-dynamic-binding-to-a-dropdownlist">ASP.NET 3.5 GridView - row editing - dynamic binding to a DropDownList</a></p> <pre><code> protected void uxList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow &amp;&amp; (e.Row.RowState &amp; DataControlRowState.Edit) == DataControlRowState.Edit) { // Here you will get the Control you need like: Label dl = (Label)e.Row.FindControl("uxLblTest"); dl.Text = "xxxxxxxxxxxxx"; } } </code></pre>
c# asp.net
[0, 9]
1,460,635
1,460,636
jquery select link by name
<p>i can reference link with specific id with following code</p> <pre><code> $(document).ready(function(){ $("a#example_link_id").click(function(event){ var url = $(this).attr("href"); get_uid(url); //event.preventDefault(); }); }); </code></pre> <p>is it possible to use <code>$("a#example_link_id")</code> this by link name </p>
javascript jquery
[3, 5]
411,312
411,313
Why statements after while loop is not getting executed?
<p>The problem for me nothing gets executed after while loop? what's the issue with that? (The lines after the end of while loop never gets executed)</p> <pre><code>client = serverSocket.accept(); BufferedReader in = new BufferedReader( new InputStreamReader(client.getInputStream()) ); while ((line = in.readLine()) != null) { Log.i("line",line); line111 +=line; Log.i("line111",line111); } //Any code below this is not executed Log.i("shan","Shan"); </code></pre>
java android
[1, 4]
5,174,901
5,174,902
How can I create a single Android application that can handle the different screen resolutions seen on Android devices?
<p>How can I create a single Android application that can handle the different screen resolutions seen on Android devices? I want my application to adapt to the different available resolutions.</p>
java android
[1, 4]
2,083,028
2,083,029
Jquery .Stop() slowdown
<p><a href="http://jsfiddle.net/332tS/" rel="nofollow">http://jsfiddle.net/332tS/</a> When Using ".stop()" in Jquery, is it possible to make it slow to a halt THEN continue? instead of stopping on the spot.</p>
javascript jquery
[3, 5]
5,716,855
5,716,856
Prevent/stop auto anchor link from occurring
<p>I need to prevent the automatic scroll-to behavior in the browser when using link.html#idX and &lt;div id="idX"/&gt;.</p> <p>The problem I am trying to solve is where I'm trying to do a custom scroll-to functionality on page load by detecting the anchor in the url, but so far have not been able to prevent the automatic scrolling functionality (specifically in Firefox).</p> <p>Any ideas? I have tried preventDefault() on the $(window).load() handler, which did not seem to work.</p> <p>Let me reiterate this is for links that are not clicked within the page that scrolls; it is for links that scroll on page load. Think of clicking on a link from another website with an #anchor in the link. What prevents that autoscroll to the id?</p> <p>Everyone understand I'm not looking for a workaround; I need to know if (and how) it's possible to prevent autoscrolling to #anchors on page load.</p> <p><hr /></p> <h2><strong>NOTE</strong></h2> <p>This isn't <em>really</em> an answer to the question, just a simple race-condition-style kluge.</p> <p>Use jQuery's scrollTo plugin to scroll back to the top of the page, then reanimate the scroll using something custom. If the browser/computer is quick enough, there's no "flash" on the page.</p> <p>I feel dirty just suggesting this...</p> <pre><code>$(document).ready(function(){ // fix the url#id scrollto "effect" (that can't be // aborted apparently in FF), by scrolling back // to the top of the page. $.scrollTo('body',0); otherAnimateStuffHappensNow(); }); </code></pre> <p>Credit goes to <a href="http://stackoverflow.com/users/22419/wombleton">wombleton</a> for pointing it out. Thanks!</p>
javascript jquery
[3, 5]
2,567,547
2,567,548
alert gives [object NodeList]
<p>I have a function in Javascript &amp; jQuery .</p> <pre><code>dynamic_link = $j('#dynamic_link_add_btn').parent().parent().parent().parent() .children('tbody').html(); function add_tier (t,html_handle){ alert(html_handle); $j(t).parent().parent().parent().parent() .children('tbody').append(html_handle); } </code></pre> <p>It is called by <code>onclick="add_tier(this,dynamic_link)"</code>:</p> <pre><code>&lt;td class="a-right" colspan="4"&gt; &lt;button class="scalable add" type="button" id="dynamic_link_add_btn" onclick="add_tier(this,dynamic_link)"&gt; &lt;span&gt;Add Extra Links&lt;/span&gt; &lt;/button&gt; &lt;/td&gt; </code></pre> <h3>What is it?</h3> <p>Handles dynamic form fields (appending HTML, to be more precise).</p> <h3>How should it work?</h3> <p>It should add the HTML it gets from the <code>dynamic_link</code> variable to the designated place. It works fine with other rows. Rows have multiple input boxes and checkboxes.</p> <h3>What it does right now?</h3> <p>The alert gives out <code>[object NodeList]</code>.</p> <h3>What I have tried till now?</h3> <p>Iterated the <code>NodeList</code>. It doesn't return the HTML (I am not sure that it even does that task).</p> <p><strong>NOTE:</strong> The form is really a big one. There are many <code>dynamic_link</code> type variables which stores HTML. I have also compared character by character between the working and the not working LOC. </p> <hr> <p><strong>Edit</strong>: <code>$j</code> is just the <code>$</code> of jQuery. It's been defined with jQuery.noConflict.</p>
php javascript jquery
[2, 3, 5]
769,491
769,492
Storing String on array java
<p>I want to know if is it possible to Store a String variable on a String array? I cant explain it well but here is what i do:</p> <pre><code> String st1 = "",st2 = "",st3 = "",st4 = ""; String[] str = {st1,st2,st3,st4}; </code></pre> <p>Unfortunately when i use for loop the str gets the value of st1 and st2 and st3 ans st4 not the variable it self..</p> <p>This is what i want to do exactly on my mind.. Whenever a have a String array for example:</p> <pre><code>String[] containsValue = { "hi", "hello", "there" }; String strHi, strHello, strThere; String[] getContainsValue = { strHi, strHello, strThere }; for (int x = 0; x &lt; getContainsValue.length; x++) { getContainsValue[x] = containsValue[x]; } The value of: strHi = "hi" strHello = "hello" strThere = "there"; </code></pre> <p>Basically i want to transfer that value of containsValue[] to 3 String which is strHi, strHello, strThere that are stored in getContainsValue[]. Then use for loop to asign value to them came from containsValue[]. Is this posible? If so then can you give me some format how to do it? thanks..</p>
java android
[1, 4]
1,043,530
1,043,531
transfer data from a gridview to a database
<p>I have this code</p> <pre><code>private void BindSecondaryGrid() { DataTable dt = (DataTable)ViewState["SelectedRecords1"]; gridview3.DataSource = dt; gridview3.DataBind(); } </code></pre> <p>The selected records from the <code>gridview2</code> are saved there <code>ViewState["SelectedRecords1"]</code>.The columns are <strong>id, name, quantity, total</strong>. Then these records are saved in <code>gridview3</code> with </p> <pre><code>gridview3.DataSource = dt; gridview3.DataBind(); </code></pre> <p>Now i would like to get these values from gridview3 and store them in a table in my database with same columns of course.Is there a way to do that?</p>
c# asp.net
[0, 9]
5,533,732
5,533,733
Delay form submission until location is retrieved
<p>I have an application that attempts to get locations settings from the browser, this tends to take a little while so I want it to run when the page loads. However, if you click the submit button before the location callback has run, you have no location data. My question is simple, how do I wait for my location success callback to finish before submitting my form? (without something silly like a sleep statement).<br> Ideally I'd like to flash a busy indicator and wait for the data. Is this possible? I have the code to make a busy indicator visible, but am not sure how I can elegantly wait for the data to be available. </p> <pre><code>$(document).ready(function(){ var lat = ""; var lng = ""; var accuracy = ""; var locationFound = false; if(navigator.geolocation){ navigator.geolocation.getCurrentPosition(function positionSuccess(loc){ lat = loc.coords.latitude; lng = loc.coords.longitude; accuracy = loc.coords.accuracy; locationFound = true; }); }else{ alert("I'm sorry, your jerk browser doesn't support geolocation"); locationFound = true; } $('#locForm').submit(function(e){ $('#lat').val(lat); $('#lng').val(lng); $('#boundary').val($('#boundary-select').val()); } </code></pre>
javascript jquery
[3, 5]
1,380,514
1,380,515
Can I use .show() or .hide() with a switch 1/0 instead of an If statement
<p>I was just wondering if it was possible to do something like this in jQuery:</p> <pre><code>$('#MyDiv').show((MyVar==2?1:0)); // 1=show, 0=hide. </code></pre> <p>otherwise I'd have to write it like this everywhere.</p> <pre><code>if(MyVar==2?1:0){$('#MyVar').show();}else{$('#MyVar').hide();} </code></pre>
javascript jquery
[3, 5]
6,028,692
6,028,693
Remove decimal from jQuery
<p>I think this is probably an easy question, but I can't find any info on it.</p> <p>I need to divide <code>newHeight</code> by <code>9</code> and then multiple it by <code>16</code>, but I get a decimal. I need a way to remove that decimal, and I'm not sure how to do it. I thought in VB you could just use a <code>\</code> instead of <code>/</code> but that doesn't seem to work (I might be remembering wrong, anyway). </p> <p>Thanks for the help!</p>
javascript jquery
[3, 5]
4,662,569
4,662,570
How to run android emulator with sd card
<p>I download and build android 1.5r3 source. I did 'launch 1' and then 'make'.</p> <p>And when it is done, I run my emulator like out/host/darwin-x86/bin/emulator -sdcard sd256m.img</p> <p>But when I click 'Gallery', it said 'No Media Found'. I am sure the sd card i created (sd256m.img) has images in there.</p> <p>Can you please tell me why I don't see any images in the sd card?</p>
java android
[1, 4]
4,055,454
4,055,455
Where can I find a C# ASP.NET tutorial on how to make a simple content management system?
<p>More specifically, is there any tutorials on how to setup a login system, storing accounts, etc? Thanks guys.</p>
c# asp.net
[0, 9]
2,525,898
2,525,899
How to hide column and access it programatically in Gridview?
<p>I have a gridview which is bonded totally programatically . I want to hide some columns and also rich them to show them in the label.</p> <p>Here is my gridview :</p> <pre><code>&lt;Gridview ID=Gridview1 runat="server" &gt;&lt;/Gridview&gt; </code></pre> <p>I want to hide EmpID and UnitID . and want to show them in a label on the front-end side</p> <pre><code>EmpID EmpName UnitID UnitName -------------------------------- 1 jack 4 MyUnit </code></pre> <p>I am trying to use this code , but it is not working even gives me error</p> <pre><code> if (GridForUnits.Columns.Count &gt; 1) { GridForUnits.Columns[1].Visible = false; //GridForUnits.Columns[1].Visible = false; } </code></pre> <p>Any Help appreciate</p> <p>Thanks</p>
c# asp.net
[0, 9]
572,366
572,367
jQuery manipulation of duplicate tags
<p>Ok, this is a weird request, but I need to use jQuery to manipulate a bunch of tags that all have the same id and name.</p> <p>We're using Izenda AdHoc reporting controls, which has a query designer GUI. It gives you a select dropdown with a list of tables in it, and you can click a button and get another one, and another and another etc. to build your query.</p> <p>Every time you click for a new table it posts back to the server, and comes back with a new row in the table, with the same controls as the row above, including an identical select tag, with the same id and name attributes. How ASP.NET is generating this is beyond me.</p> <p>But I was using jQuery to modify the length of the dropdowns as they are too short. Strangely enough, even though they all have the same id, using jQuery like:</p> <pre><code>jQuery("#ctl00_ContentPlaceHolder1_queryBuilder_ctl101_jtc_Table").width(250); </code></pre> <p>will only change the first dropdown. I need to widen them all, but they all have the same ID. And there are lots of other select tags I <em>dont</em> want to touch.</p> <p>Any ideas?</p> <p>EDIT: Now that I think about it, I have no idea how this even works. The page poasts back, saves the datasources etc. everything seems to work, but I have no idea how ASP.NET tells one dropdown from another. But it does work.</p>
asp.net jquery
[9, 5]
5,364,338
5,364,339
Prevent multiple selection of a div
<p>I have multiple divs on my page.I want to copy selected text from div1 to div2 only.Selection on div2, div3, div4 should not get copied. If ctrl+A is pressed or multiple divs are selected at a time, copy should not happen.</p> <pre><code>//Validation for including text only from specified div $('#DocumentText').mouseup(function (e) { debugger; isSelected = true; flaginclude = 1; // e.stopPropagation(); }); $(document).mouseup(function (e) { debugger; if (flaginclude != 1) { e.stopImmediatePropagation(); isSelected = false; } flaginclude = 0; }); myfunction() { if(isSelected) { //logic to append selected text on div2 } } </code></pre>
javascript jquery
[3, 5]
3,097,147
3,097,148
QueryString containing \ coming through with \\
<p>I'm have a page which I sent a parameter through the query string.</p> <p>If I'm retrieving it with Request.QueryString["Format"] I'm having troubles with the type 'CD\DVD'. It's being returned as 'CD\\DVD'. It's important I get this as the right string.</p> <p>How do I avoid the extra backslash? Or even get rid of it later?</p>
c# asp.net
[0, 9]
6,009,976
6,009,977
increment variable using jquery
<p>I feel like this is a pretty basic thing, but I cant seem to find the solution. Im trying to increment a value after the loading of an IFRAME.</p> <p>the code looks like this:</p> <pre><code>var x=0; $(document).ready(function() { $('#iframe-2').load(function() { var x=x+1; }); $('#iframe-3').load(function() { var x=x+1; }); $('#iframe-4').load(function() { var x=x+1; }); $('#iframe-5').load(function() { var x=x+1; }); }); </code></pre> <p>What I want to do is give a number of loaded iframes that updates when an iframe completes its loading. The output code is like this currently:</p> <pre><code>&lt;script language="javascript"&gt; document.write(x + " Results"); &lt;/script&gt; </code></pre> <p>thanks a ton in advance for any help!</p>
javascript jquery
[3, 5]
1,524,392
1,524,393
why the javascript variable doesn't change among function?
<p>my problem with the following javascript function:</p> <pre><code>function ValidateDates() { var valid = false; birthD = $("#cp1_txtBirthDate").val(); initialD = $("#cp1_txtInitialDate").val(); var regexp = new RegExp("^([1-9]|(0|1|2)[0-9]|30)(/)([1-9]|1[0-2]|0[1-9])(/)((20|19|18)[0-9]{2})$"); if (birthD != "__/__/____" &amp;&amp; initialD != "__/__/____") { if (regexp.test(initialD) &amp;&amp; regexp.test(birthD)) { $.get("ValidateDates.aspx?BirthD=" + birthD + "&amp;InitialD=" + initialD, function (data) { if (data == 0) { valid = true; $("#Dates_span").html(""); } else { $("#Dates_span").html("*" + data); valid = false; } }); } } return valid; } </code></pre> <p>here when i check the variable valid i found it "false" even if its true, because the initial for it is false from the beginning of function so how to solve it and what is wrong?</p>
javascript jquery
[3, 5]
1,094,751
1,094,752
Value of hidden input returns blank when it clearly isn't
<p>Why can't I get the value from this input? See the image below:</p> <p><img src="http://i.stack.imgur.com/y5oEu.jpg" alt="enter image description here"></p>
javascript jquery
[3, 5]
2,599,979
2,599,980
How do I overlay a busy icon on an image?
<p>I've been looking through SO and Google trying to find a simple way to overlay a busy icon on an existing image. While applying filters and effects to images I'd like to let the user know it's being processed by showing a busy icon on top of the current image. </p> <p>Do I need to create some sort of overlay image that I show at the start of the process and hide after it's complete using jquery? </p> <p>Just looking for some ideas from people that might have done this already.</p>
php javascript jquery
[2, 3, 5]
3,934,161
3,934,162
Match a String in a Webpage along with HTML tags
<p>With below code, I am trying to match a text in a web page to get rid of html tags in a page. </p> <pre><code> var body = $(body); var str = "Search me in a Web page"; body.find('*').filter(function() { $(this).text().indexOf(str) &gt; -1; }).addClass('FoundIn'); $('.FoundIn').text() = $('.FoundIn').text().replace(str,"&lt;span class='redT'&gt;"+str+"&lt;/span&gt;"); </code></pre> <p>But it does not seems to work.. Please have a look at this and let me know where the problem is...<br> <a href="http://jsfiddle.net/m4vXx/" rel="nofollow">here</a> is the fiddle I have tried the below code instead.. </p> <pre><code>function searchText() { var rep = body.text(); alert(rep); var temp = "&lt;font style='color:blue; background-color:yellow;'&gt;"; temp = temp + str; temp = temp + "&lt;/font&gt;"; var rep1 = rep.replace(str,temp); body.html(rep1); } </code></pre> <p>But that is totally removing html tags from body...</p>
javascript jquery
[3, 5]
5,097,967
5,097,968
Add dynamically controls to asp placeholder in addition to controls which already exist in it
<p>Add dynamically controls to asp placeholder in addition to controls which already exist in it ? how to add them?</p> <p>for example - on page load I added to textboxs and labels to placeholder on button click I need to add additionally one more textbox.</p>
c# asp.net
[0, 9]
1,930,746
1,930,747
Loading jQuery multiple times in the same page
<p>I'm implementing a plug-in that's embeddable in different sites (a la Meebo, Wibiya), and I want to use jQuery. Problem is, the site I'm embedding to, may already have a jQuery script loaded.</p> <p>The question is, what's the best approach for this kind of problem:</p> <ol> <li><p>Should I just check if jQuery is already loaded and if so, use the original site's jQuery, otherwise load it myself? If I use this approach, am I not risking comaptibility problems (i.e. the site uses an old version of jQuery)?</p></li> <li><p>Should I load jQuery myself (whether it's already loaded or not) and call "jQuery.noConflict(true)" when it's finished loading? If so, how can I make sure that <em>my</em> jQuery has finished loading (hooking to the onLoad event doesn't seem to work all the time, and polling for "jQuery" won't work for obvious reasons)?</p></li> <li><p>Should I do something else?</p></li> </ol> <p>Thanks.</p>
javascript jquery
[3, 5]
5,574,356
5,574,357
How do I get a element to scroll into view, using JQuery?
<p>I have a html document with images in a grid format using <code>&lt;ul&gt;&lt;li&gt;&lt;img...</code>. The browser window has both vertical &amp; horizontal scrolling. </p> <p><strong>Question:</strong> When I click on a image <code>&lt;img&gt;</code> how then do I get the whole document to scroll to a position where the image I just clicked on is <code>top:20px; left:20px</code> ?</p> <p>I've had a browse on here for similar posts...although I'm quite new to JavaScript/JQuery and want to understand how this is achieved for myself.</p> <p>Any help would be Greatly Appreciated, Thanks</p>
javascript jquery
[3, 5]
193,070
193,071
add a textbox onclick dropdown value other in jquery?
<p>I am facing a problem with jquery.</p> <p>I have a div with 4 drop down list and I have an "add more" button.</p> <p>When I click on "add more" button, another instance of the same div is created just above the "add more" button. I did it via jQuery <code>append()</code> method and it is successfully working, but my problem is that the requirement says that when i select "Other" from the drop down a text box should open where I will fill the name which is not in the list.</p> <p>I can do this but when i click on "add more" and another instance is created, When I select "other" from the dynamically created listbox the text box is not created because their id becomes same and I know that id can not be same.</p> <p>Similarly, in rest of the dropdown happens. If i do it by class name then creates all the text box at a time. I do not want this. I hope you understood my problem. Please help me and give me a solution how to manage it.</p> <p>Thanks everybody and thanks stackoverflow.com</p> <p><strong>Update:</strong></p> <pre><code>$(document).ready(function() { alert('here'); var content=$("#course").html(); var content1=$("#emp").html(); alert(content); $("#add").click(function(){ var n=$("#course .count").length; if(n!=3){ $("#course").append(content); } if(n==2){ $("#add").hide(); } }); }); </code></pre> <p>my html is like</p> dropdown1 dropdown1 dropdown1 dropdown1 <p>add more button</p> <p>when i select dynamically generated dropdown by append()...the textbox for 'other' not appears means unable to handle event on dynamically generated div thanks </p>
php jquery
[2, 5]
1,799,523
1,799,524
How to add delay to a function
<pre><code>$(function(){ $('#slides_left').slides({ generateNextPrev: false, play: 5500 }); }); </code></pre> <p>How can I add a .delay() to the function above so that the starting time for the function is not onload rather to a specified time?</p> <p>sorry for my noobness in jQuery!</p> <p>Thanks! </p>
javascript jquery
[3, 5]
2,898,108
2,898,109
Converting string to variable name
<p>I have the following declarations:</p> <pre><code>int value1 =5 , value2 =10 ,value3; string calculate ="value1 + value2"; // dynamic string </code></pre> <p>I need to perform </p> <pre><code>value3 = convert.To int32(calculate ); </code></pre> <p>Is there any possible to compute dynamic variable assigning ...</p>
c# asp.net
[0, 9]
4,304,026
4,304,027
Easiest way to persist data on a PHP page
<p>I a web application that I am developing (being developed in PHP) when a user posts any request for service the user has to fill in a very length form.</p> <p>Once user fills in the form and submits it another page (confirmation page) is loaded in which all values filled in by user are show. I must point out that at this stage the data is not saved to MySQL yet. Now on this page the user can either save the service request or go back. </p> <p>My problem starts here. When the user <strong>goes back</strong>. All <strong>data</strong> filled in is <strong>lost</strong>. BTW User tend to use Browsers Back button instead of the back button provided on the confirmation page.</p> <p>How can is persist data filled in by user so that user can edit/make changes to data and again submit changed data.</p>
php javascript
[2, 3]
4,540,916
4,540,917
Getting a specific input from a specific form?
<p>I'm having difficulty grabbing a specific input from a specific form. Any tips?</p> <pre><code>&lt;form id ="frm_addtag-1"&gt; &lt;input type="text" name="tag" id="tag"&gt; &lt;/form&gt; &lt;form id ="frm_addtag-2"&gt; &lt;input type="text" name="tag" id="tag"&gt; &lt;/form&gt; &lt;form id ="frm_addtag-3"&gt; &lt;input type="text" name="tag" id="tag"&gt; &lt;/form&gt; </code></pre> <p>If frm_addtag-1 is submitted, I only want to grab the tag input from that form and not the other forms. </p> <p>When I do something like the below, it will return the tag inputs from any other the forms regardless of which form is submitted.</p> <pre><code>var tag = $("#tag"); var tag = tag.attr("value"); </code></pre>
javascript jquery
[3, 5]
5,787,619
5,787,620
How to implement this without refreshing the page?
<p>I don't know what this is called, so I recorded a video screenshot.</p> <p><a href="http://imageshack.us/clip/my-videos/809/qg7.mp4/" rel="nofollow">http://imageshack.us/clip/my-videos/809/qg7.mp4/</a></p> <p>I know it's javascript, but I have no idea what it's called, so I can't find a tutorial on how to replicate the process.</p> <p>Is there a ready made plugin for jquery/javascript like this?</p>
javascript jquery
[3, 5]
5,601,525
5,601,526
Executing Java programs through Python
<p>How do I do this?</p>
java python
[1, 7]
4,817,821
4,817,822
Android programming. Vibration/LED light Function
<p>Hi I have created a task reminder application. For example, you select a time of when to be reminded of a certain task, when that time comes, a notification comes up on the status bar.</p> <p>However I would like to implement a vibrating function and possibly an LED light function with the notification but I am not sure where to start? Does anyone know?</p> <p>Thanks. </p>
java android
[1, 4]
4,953,297
4,953,298
Resize script appends object, does it over and over again
<p>I have the following code in a JavaScript file:</p> <pre><code>$(document).ready(function() { detectscreen(); }); $(window).resize(function(){ detectscreen(); }); function windowWidth() { if(!window.innerWidth) { // user is being a git, using ie return document.documentElement.clientWidth; } else { return window.innerWidth; }} function detectscreen() { if (windowWidth()&gt;1280) { $('body').append('&lt;div id="gearsfloat"&gt;&lt;/div&gt;'); }} </code></pre> <p>Basically, what it does is append an object to the end of the document if the width is less than 1280 pixels, however what this does is append it every single time the page is resized.</p> <p>I don't think I can use the <code>once</code> function because it would only run it once and then the next time it is resized, it's dead. Anything I can do?</p> <p>&nbsp;</p> <p><i>NOTE</i>: I, in fact, DO want it to be checked on the resize of the page, but the effect is that it happens over and over again.</p> <pre><code>if (windowWidth()&gt;1280 &amp;&amp; !$('gearsfloat')) { $('body').append('&lt;div id="gearsfloat"&gt;&lt;/div&gt;'); } </code></pre> <p>The above (by Jason) <s>works</s> does <i>not</i> work but then it won't delete it when it gets less than 1280. Is there anything I can do?</p>
javascript jquery
[3, 5]
5,425,794
5,425,795
how to merge 2 arrays based on properties (not index)
<p>As we know that <code>jQuery.extend(true, obj1, obj2)</code> method for deep copying the object's properties from obj2 to obj1. In case of array, it copies the property based on index. But I need copying based on some property (e.g. id in my case) as per following example:</p> <pre><code>obj1 = [{id:"id1", name:"name1"},{id:"id2", name:"name2"}] obj2 = [{id:"id3", name:"name3"}{id:"id1", name:"name1_modified"}] </code></pre> <p><code>jQuery.extend</code> will return:</p> <pre><code>[{id:"id3", name:"name3"}{id:"id1", name:"name1_modified"}] </code></pre> <p>But I need output as:</p> <pre><code>[{id:"id1", name:"name1_modified"},{id:"id2", name:"name2"}{id:"id3", name:"name3"}] </code></pre> <p>is there any method/library to accomplish this?</p>
javascript jquery
[3, 5]
4,745,192
4,745,193
How to check input tag have only tag(<br/>) inside as value using jQuery
<p>Check input tag which have value only as <code>&lt;br/&gt;</code> tag inside as value using jQuery</p> <p>I am using an htmlEditor in my project, sometimes user just press enter key only in textarea field. It will get as <code>&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;</code> as value when saving. I want to avoid this tags when saving.</p> <p>How to validate this in jquery ?</p> <p>If any other characters like <code>&lt;br/&gt;Just &lt;br/&gt; Example &lt;br/&gt;</code> is present then I want to save it with break tag itself.</p>
javascript jquery
[3, 5]
3,823,502
3,823,503
Specifying a new source for the image tag at runtime in Javascript , jQuery
<p>Is it possible to change the src of a image at runtime using jQuery. I have created a fiddle. I am trying to load the image specified in the variable $newsrc when the button is clicked. I am not sure as to what should be specified an argument function changeImage(). I do not want to use anonymous function. </p> <p><a href="http://jsfiddle.net/bobbyfrancisjoseph/KMFj2/5/" rel="nofollow">http://jsfiddle.net/bobbyfrancisjoseph/KMFj2/5/</a></p>
javascript jquery
[3, 5]
2,367,734
2,367,735
How to Disable Browser from Saving Previous Data of TextBox in asp.net
<p>Sorry I didn't explain My problem correctly , My problem is that I have a TextBox with AutoComplete Extender and It's works but The browser save the text that i have Entered before so when i start writing to My text Box I have Two lists appear , one from the browser and one from the autocomplete </p> <p>I want to disable the browser list and keep the autocomplete list only</p> <p>If any one can help I will be thankful</p> <p>Thanks in Advance</p>
c# asp.net
[0, 9]
506,198
506,199
jQuery: Getting value from input array
<p>We have the following form:</p> <pre><code>&lt;form&gt; ... &lt;table width="100%" cellspacing="0" class="datagrid_ppal"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;th scope="row"&gt;Area 1 &lt;input name="config_line" type="hidden" value="0,5,50" /&gt;&lt;/th&gt; &lt;td class="gantt"&gt; &lt;/td&gt; &lt;td class="gantt"&gt; &lt;/td&gt; &lt;td class="gantt"&gt; &lt;/td&gt; ... &lt;/tr&gt; &lt;/tbody&gt; &lt;/table width="100%" cellspacing="0" class="datagrid_ppal"&gt; ... &lt;form&gt; </code></pre> <p>What we need is to get the first, second or third from the hidden input value. We have tried this and didn't work:</p> <pre><code> var value = $('th').children('input:hidden').val(); </code></pre> <p>Can anyone help us? We would really appreciate it.</p>
javascript jquery
[3, 5]
3,381,186
3,381,187
How can I format a number to the fixed locale?
<p>How can I insert to a string comma (,) after every 3 position starting from last? </p> <pre><code>input desired output 9876567846678 9,876,567,846,678 567 567 1234 1,234 </code></pre> <p>I used one method like first divide the whole string by three position and then while merging appending coma by three three position.</p> <p>Is there any better solution? Is there function available to do this trick in java? </p> <p><strong>Edit :</strong><br> LAS_VEGAS answer will format the number based on the locale. But i want to format it to a fixed locale ...<br> how can i do tht?</p>
java android
[1, 4]
3,226,682
3,226,683
Mapping object properties, excluding types
<p>What i currently use</p> <pre><code>public static void MapObjectPropertyValues(object e1, object e2) { foreach (var p in e1.GetType().GetProperties()) { if (e2.GetType().GetProperty(p.Name) != null) { p.SetValue(e1, e2.GetType().GetProperty(p.Name).GetValue(e2, null), null); } } } </code></pre> <p>I want to pass a third parameter, a generic list of types that i want to exclude from the mapping. For example strings and booleans. And check if <code>p</code> is of a type in the list. Any help is appreciated, thanks!</p>
c# asp.net
[0, 9]
4,360,794
4,360,795
How to login an app android via google account?
<p>I read some topics on this website. I can't understand it clearly. Can you help me step by step?</p>
java android
[1, 4]
839,335
839,336
using jQuery to find elements ordering when the elements are inside different parent elements
<p>I have something like this:</p> <pre><code>&lt;div&gt; &lt;ul id="ul_element_id"&gt; &lt;li&gt; &lt;a id="first"&gt;&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a id="second"&gt;&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a id="third"&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>Is there a quick way to figure out $('#first') is the first guy in relation to other elements?</p>
javascript jquery
[3, 5]
617,053
617,054
treeview loses checked values when click event is occured
<p>I have asp.net Treeview which is out side update panel of asp.net page,when i click on btnGet (which is also exists outside the update panel) it loses the checked value of treeview control. but it persist the values of other controls which are placed in update panel.</p> <p>to handle the control outside the updatepanel, I have used javascript.(functionality like enable or disable &amp; validation &amp; its text) </p> <p>How to persist treeview's checked values?</p> <p>any help would be greatful!</p> <pre><code>&lt;asp:Panel ID="treePanel" runat="server"&gt; &lt;table cellpadding="0" cellspacing="0"&gt; &lt;tr&gt;&lt;td&gt; &lt;asp:TreeView ID="treeViewS" runat="server" ShowCheckBoxes="All" ShowLines="True" &gt; &lt;/asp:TreeView&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;/asp:Panel&gt; &lt;table width="980" cellpadding="0" cellspacing="0" align="center"&gt; &lt;tr&gt;&lt;td&gt; &lt;asp:Button ID="btnGet" runat="server" Text="Get" ValidationGroup="GetValidationGrp" OnClick="btnGet_Click" OnClientClick="if (startGet()) return false;" /&gt; &lt;/td&gt;&lt;/tr&gt; &lt;table&gt; </code></pre>
javascript asp.net
[3, 9]
4,136,079
4,136,080
How can I take jquery id in session
<p>This is my jQuery code for taking id value when I click <code>itemslist</code> </p> <pre><code>$(document).ready(function() { $('.itemslist ul li').click(function() { $id = $(this).attr("class"); }); }); </code></pre> <p>But session is not taking that id value </p> <pre><code>session_start(); $_SESSION['catname'] = $id; $id= $_SESSION['catname']; session_destroy(); </code></pre> <p>Can any one please say the answer about this?</p>
php jquery
[2, 5]
3,038,782
3,038,783
ASP.NET page code affects page after build and then not after page refresh
<p>I am having an issue where if I hit build in visual studio and reload my (to see the changes to the backend) the page is correctly affected by the backend code. When I hit refresh again however, the page renders with just the front end without things like data inserted into fields from the backend. It is as if the backend never ran and I am just seeing what is from the front end. In debug mode, the code does in fact run through and the fields DO have a value (field.text has a value) but it is not reflected on the actual page.</p> <p>Any ideas?</p>
c# asp.net
[0, 9]
2,874,059
2,874,060
Detect finger drag using Javascript on touch phones?
<p>Is there a way to detect finger drags using Javascript on touch phones? I'm currently using jQuery and the mousemove() method doesn't appear to work on my Andorid phone.</p> <p><strong>EDIT:</strong> I suppose I should clarify that this is for a web application.</p> <p><strong>EDIT 2:</strong> I found a duplicate of my question a few moments ago: <a href="http://stackoverflow.com/questions/2264072/detect-a-finger-swipe-through-javascript-on-the-iphone-and-android">Detect a finger swipe through JavaScript on the iPhone and Android</a>. Although, it does not have an accepted answer.</p>
javascript iphone android
[3, 8, 4]
3,567,183
3,567,184
Why this js script does not work in asp.net after postback?
<p>I have this code:</p> <pre><code> if (Page.IsPostBack) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Javascript", "alert('test');jQuery('html, body').animate({ scrollTop: jQuery('.newslettersubscribe').position().top }, 'slow');",true); } </code></pre> <p>I don't understand why the scrolling to the div which is on the bottom of the page, does not work.</p> <p>Please note that <code>alert('test')</code> is appearing...</p> <p>For sure I have a div with class <code>newslettersubscribe</code> on my page.</p> <p><strong>UPDATE</strong>: - my js files are loaded using Script Manager:</p> <pre><code>&lt;asp:ScriptManager ID="ScriptManager1" runat="server" &gt; &lt;Scripts&gt; &lt;asp:ScriptReference Path="~/js/jquery-1.4.2.min.js" /&gt; &lt;asp:ScriptReference Path="~/js/cufon-yui.js" /&gt; &lt;asp:ScriptReference Path="~/js/helvetica_neue.js" /&gt; &lt;asp:ScriptReference Path="~/js/jquery.cycle.all.js" /&gt; &lt;asp:ScriptReference Path="~/js/default.js" /&gt; &lt;asp:ScriptReference Path="~/js/swfobject-2.1.js" /&gt; &lt;/Scripts&gt; &lt;/asp:ScriptManager&gt; </code></pre> <p>so I need to find a way to run this inline script AFTER these external js files were loaded...</p> <p><strong>UPDATE 2:</strong> After a chat discussion with dknaack we noticed that there was also an issue with <code>position</code>. I've replaced with <code>offset</code> at his recommandation and now it's working!!!</p> <p>Thanks a lot <strong>dknaack</strong> !</p>
jquery asp.net
[5, 9]
5,187,421
5,187,422
An unwanted object in the last cell of an array
<p>I'm using the following code on a parsed XML array: </p> <pre><code>$(this).find("cp_group").each(function() { $("select#comp_1").append('&lt;optgroup label="' + $(this).attr('label') + '"&gt;&lt;option&gt;' + $(this).find("cmp").map(function() { return $(this).text(); }).get().join("&lt;/option&gt;&lt;option&gt;") + $(this).append('&lt;/option&gt;&lt;/optgroup&gt;')); });​ </code></pre> <p>And i get an unwanted [object Object] in the last option of each option group as following:</p> <pre><code>&lt;select name="comp_1" id="comp_1"&gt; &lt;optgroup label="Combat"&gt; &lt;option&gt;Arme&lt;/option&gt; &lt;option&gt;Arts martiaux&lt;/option&gt; &lt;option&gt;Esquive&lt;/option&gt; &lt;option&gt;Feinte&lt;/option&gt; &lt;option&gt;Parade&lt;/option&gt; &lt;option&gt;Lutte[object Object]&lt;/option&gt; </code></pre> <p>I dont understand from where this [object Object] come from and I didn't achieve to not get it or to remove it. Thanks for you help.</p>
javascript jquery
[3, 5]
5,263,498
5,263,499
Javascript variable to PHP using Jquery AJAX
<p>I have the following javascript function</p> <pre><code>function success_callback(p) { lat = p.coords.latitude.toFixed(2); lon = p.coords.longitude.toFixed(2); } </code></pre> <p>Now I want to transfer both the variable to PHP using Jquery AJAX, I am pretty new to Jquery, I am not able to figure out how to do it. I want to transfer the variables to the same PHP file where this JS code resides. Is that possible ?</p>
php jquery
[2, 5]
5,413,581
5,413,582
Turn jQuery into vanilla JS - Insert p element after h1
<p>Any ideas on how I would convert this jQuery to vanilla JS:</p> <pre><code>$('.section &gt; h1').after('&lt;p&gt;This paragraph was inserted with jQuery&lt;/p&gt;'); </code></pre> <p>I am new to jQuery and even newer to vanilla JS.</p> <p>This is as far as I got:</p> <pre><code>var newP = document.createElement('p'); var pTxt = document.createTextNode('This paragraph was inserted with JavaScript'); var header = document.getElementsByTagName('h1'); </code></pre> <p>Not sure where to go from here?</p>
javascript jquery
[3, 5]
1,954,103
1,954,104
calling js file from aspx
<p>I have a aspx page and a js file, am accessing the js file for some functions, say for example I have some autocomplete boxes in my aspx page and for that am accessing the js file for every autocomplete box, and finally when I click the save button, the saveFunction in my js file should be fired, for this I just made my Save button as simple html button as</p> <pre><code>&lt;button type="button" onclick="saveRecords()"&gt;Save&lt;/button&gt; </code></pre> <p>at the end of my aspx page am calling the js file as</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { pageInit(); }); </code></pre> <p></p> <p>and in the pageInit of my js file I refer my saveRecords function as</p> <pre><code>function pageInit() { saveRecords(); </code></pre> <p>}</p> <p>the problem here is whenever I run my application the saveRecords function is hitting first.....how can I avoid this, and call this function only when I hit Save button...can anyone help me here....</p>
jquery asp.net
[5, 9]
2,690,682
2,690,683
Interop c++ struct in c# variable string size
<p>i transfer over ipc a struct from unmanaged into managed code. Is it possible to transfer a string without set a constant size or fill the rest auf the bytes into the last member of the struct ?</p> <p><strong>c++ struct</strong></p> <pre><code>typedef union { struct { int id; string Data; }; char bytes[]; } SocketData; </code></pre> <hr> <p><strong>c# struct</strong></p> <pre><code> [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct SocketData { public int id; public string Data; } </code></pre> <hr> <p><strong>Convert bytes to struct</strong></p> <pre><code>public static object RawDeserialize(byte[] rawData, int position, Type anyType) { var rawsize = rawData.Length; //if (rawsize &gt; rawData.Length) // return null; var buffer = Marshal.AllocHGlobal(rawsize); Marshal.Copy(rawData, position, buffer, rawsize); var retobj = Marshal.PtrToStructure(buffer, anyType); Marshal.FreeHGlobal(buffer); return retobj; } </code></pre>
c# c++
[0, 6]
4,310,712
4,310,713
javascript get variable open in new window
<p>I have standard text links which all say "Full View". When clicked these links send out php in this form: <a href="http://mysite.com/fullview.php?myimage=30" rel="nofollow">http://mysite.com/fullview.php?myimage=30</a></p> <p>Basically there's thumbnailed images and text links that say full view. I'd like for fullview.php to capture the myimage variable, and display it as a full sized image. Meaning, a blank page (fullview.php) displaying the image. Sounds likes javascript to me.</p> <p>How do you put the javascript into fullview.php to capture the variable and display it as a full sized image?</p> <p>myimage=30 can be any number example: myimage=942</p> <p>Thanks for any help, Darrell</p>
php javascript
[2, 3]
3,706,388
3,706,389
adding .live to click functions in jquery
<p>We have an app that uses a lot of jquery stuff and we're adding up all our scripts in an init.js file which has a lot of <code>.live("click"), .live("hover")</code> etc, stuff plus some <code>if($(".classname").length)</code> etc.</p> <p>I have a suspicion it MIGHT be slowing down our pages unnecessarily(some pages don't need some scripts). But what is a more elegant solution to this? We certainly won't like a separate file for each page that needs it, that's a pain to maintain. Is there any other way to achieve this?</p>
javascript jquery
[3, 5]
4,237,435
4,237,436
Getting JavaScript variable in embeded C# code
<p>I am trying to write a simple <em>for</em> in JS which uses an element from a list declared in C# code behind. Actually there is a problem here: <code>['i']</code> - compiler doesn't know what is <code>i</code>. </p> <p>How can I write this for properly? </p> <pre><code>for (var i = 0; i &lt; '&lt;%= poz.Count %&gt;'; i++) { var Latitude = '&lt;%= poz['i'].Latitude %&gt;'; } </code></pre>
c# javascript asp.net
[0, 3, 9]
16,844
16,845
click event on a div should not be triggered by it's children
<p>Let's say I have the following Code:</p> <pre><code>&lt;div id="parent"&gt; &lt;div id="child"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>Now I attach an onClick event to the parent div:</p> <pre><code>$('#parent').click(function() { ... }); </code></pre> <p>Is there an easy way to stop the event from triggering when I click on the child div? I don't want to do something like</p> <pre><code>$('#child').click(function() { return false; }); </code></pre> <p>because the child div could contain links...</p> <p>Thanks!</p>
javascript jquery
[3, 5]
961,204
961,205
inArray returns -1 in each loop with stirngs
<p>I have two arrays containing string values (newValues and oldValues). I iterate over the oldValues array with jquery each and check the value against the newValues array. However even if the value exists in the newValues array, it is only found if I do a toString first. IE Debugger Console howerver says, that this is already a string (and thats what I expect too).</p> <p>Code:</p> <pre><code>$(oldValues).each(function () { // always fails (debug snapshot taken here) if (jQuery.inArray(this, newValues) === -1) { // ... } }); </code></pre> <p><img src="http://i.stack.imgur.com/2MMGZ.jpg" alt="IE F12 Debugger Console"></p> <p>Why do I have to do a toString first, even when <em>this</em> is already of type string? Has this something to do with the jquery each? </p> <p>All similar questions I've found had to do with type mismatch, but this isn't the case here, right?</p>
javascript jquery
[3, 5]
5,464,318
5,464,319
JQuery: Check value of input
<p>How can I check if the number entered in the input-field is higher of even as th value in my 'min' field?</p> <pre><code> &lt;tr&gt; &lt;td&gt;Steeeeaak&lt;/td&gt; &lt;td&gt;&lt;input type="hidden" name="amount_5_min" value="10"/&gt; &lt;input type="text" name="amount_5" size="4" value="10"/&gt;&lt;/td&gt; &lt;td&gt;-&lt;/td&gt; &lt;td&gt;&lt;a href="/item/delete/eventId/2/hash/a8b5dzp9rks7164wh30j2anqh13w/itemId/5"&gt;Verwijder&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p>As you can see the first part of the name of both fields are the same ... Any possibilities here? I do a submit at the end of the form, so I guess I have to do something on submit?</p> <p>Thx!</p>
javascript jquery
[3, 5]
4,456,049
4,456,050
JQuery sortable table with child rows - is it possible?
<p>I'm currently displaying data about customers in a sortable table using JQuery. It's not a problem to allow the dragging and dropping of rows in the table. However, the challenge is that I have code in place to allow a row to expand and show the [non-sortable] child rows. After child rows are visible in the table, it is still possible to drag and drop the parent in a different location, but of course the child-rows stay where they are!</p> <p>I've created an example in JSFiddle to clarify the issue:</p> <p><a href="http://jsfiddle.net/GMUbj/65/" rel="nofollow">http://jsfiddle.net/GMUbj/65/</a></p> <p>Note: table rows that have "sub-row" in the class, are child elements, and rows that have a class of "toSort" are sortable parent rows.</p> <p>In the above example, "Business Analysis" and "Project Manager" are parent rows that have both been expanded, their children are visible. It is possible to drag and drop those rows (it's quirky, and you might have to try a few times, but it does work!).</p> <p>I've tried numerous new approaches to try and remedy this, including using div and span to try and group my elements. The behavior I'm after is something like this:</p> <p><a href="http://jsfiddle.net/PM6nv/16/" rel="nofollow">http://jsfiddle.net/PM6nv/16/</a></p> <p>.. and I've tried to alter my code to do something like what we have above in the unordered lists, but it usually breaks the table sorting ability.</p>
javascript jquery
[3, 5]
2,284,562
2,284,563
How to slideTo() only if the loadmore button is clicked using jQuery?
<p>In my script I load some posts from external RSS feeds. I have a "load more" button that when it is clicked, calls the <code>loadfeed()</code> function and shows some 10 more posts.</p> <p>When this happens, there is a <code>slideTo()</code> that slides the browser to the first of the new posts list.</p> <p>In addition to the "load more" button, I have a timer that checks for any new posts of those feeds. This happens every 3 minutes.</p> <p>As I said, if you click on the "load more" button, the page is moved with the first new post on the top of your screen. The problem here is that this sliding happens also if you clicked once the "load more" button, you read the articles, and as you read the 3 minutes are passed, you slide back to the first post of the new list you loaded. More specific, when you load (from the default 20) +10 more posts, you will be slided to the 21st post after 3 minutes.</p> <p>So my question here it is how to avoid this?</p> <p>this is the #loadmore button that calls loadfeed()</p> <pre><code>$("#loadmore").click(function() { cap += 10; loadfeed(); }); </code></pre> <p>and this is a part of loadfeed() that handles sliding. I have an if statement for the sliding to happen after the default 20 posts. Without this you will be slide to the 11 post after 3 minutes and no "load more" is clicked.</p> <pre><code>if (cap &gt; 20) { $(".p" + (cap-9)).slideto({ slide_duration : 'slow' }); } </code></pre>
javascript jquery
[3, 5]
1,805,771
1,805,772
PHP jQuery value problem
<p>I have problem to send value from php to jQuery script.</p> <p>PHP looks like that:</p> <pre><code>echo "&lt;a id='klik' value='".$row['id']."' onclick='help()' href='http://www.something.xx/tag/".$row['link']."'&gt;".$row['name']."&lt;/a&gt;&lt;br&gt;"; </code></pre> <p>and script jQuery:</p> <pre><code>function help(){ var j = jQuery.noConflict(); var zmienna = j('#klik').val(); alert(zmienna); j.post('licznik.php',{id:zmienna}, function(data) { alert(data); }); } </code></pre> <p>licznik.php</p> <pre><code> $p=$_POST; $id=$p['id']; echo $id; $wtf = "UPDATE tag_content SET wyswietlenia=wyswietlenia+1 WHERE id='$id'"; $result = mysql_query($wtf); </code></pre> <p>And as I tested, it has problem at the begining (alert(zmienna); doesn't work, shows nothing). How to fix it? Thx for help and if u want more informations (like more code etc.) let me know.</p>
php javascript jquery
[2, 3, 5]
2,736,360
2,736,361
sending javascript variable value to php within the same page
<p>I just want to know if sending value of a javascript to php is possible. here is the simple code of what i am trying to say.</p> <pre><code>&lt;script language="javascript" &gt; var id = "data" &lt;/script&gt; &lt;?php $getthevalueofid = var id; ?&gt; </code></pre> <p>thanks!</p>
php javascript
[2, 3]
1,664,848
1,664,849
how do i make .load work when i append a variable to the url?
<p>I want to append the clicked href to my url string of my .load method and load in a specific portion of the page i've called, unfortunatley when I append the variable a lot of elements seem to be duplicated on my page?</p> <p>Basically I want my .load method to look like .load('http://localhost/folio1.html #inner');</p> <p>But my current code loads in all of the folio1.html page:</p> <p>Snippet from object wcd:</p> <pre><code>instance.selectors.banner.load('http://localhost/'+url+'#inner'); $('a').on('click', function(e){ var url = $(this).attr('href'); wcd.toggleBanner(url); e.preventDefault(); }); </code></pre> <p>Can someone advise how I append the url variable to the .load url and only retrieve the content in #inner?</p>
javascript jquery
[3, 5]
1,339,217
1,339,218
how to convert binary string data into String in android
<p>Can anybody give me some clue that how to convert binary string into a string(english). I have tried and googled so much but couldn't find an answer.</p> <p>Here is my code:</p> <pre><code>InputStream iStream = getApplicationContext().getResources().openRawResource(R.raw.map); InputStreamReader input; String line = ""; //char character[] = null; //String res = ""; input = new InputStreamReader(iStream); BufferedReader bf = new BufferedReader(input); Log.i("Helloo i am above variable", "Variable"); try { line = bf.readLine(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Log.i("hello helloo", line.toString()); </code></pre> <p>Thanks in advance.</p>
java android
[1, 4]
1,042,994
1,042,995
JQuery function not found
<pre><code>// also tried function getDeletedDates() var getDeletedDates = function() { var s = new Array(); $(".deleted").each(function(i, e) { s.push($(e).attr("data-day")); }); }; $(function() { $("#delete_send").click(function() { alert("drin"); $.ajax({ url: "delete.php", type: "POST", data: ({deleteDates : getDeletedDates()}), dataType: "json", success: function(msg){ alert(msg); }, beforeSend: function(){ alert("Lösche folgende Urlaubstage: "+ getDeletedDates().join(", ")); }, error: function(x, s, e) { alert("Fehler: " + s); } } ); }); }); </code></pre> <p>But i come into <code>beforeSend</code>() he always says "<code>getDeletedDates</code>() undefined" Why is this, i declared the function in global scope?</p> <p>thanks in advance.</p>
javascript jquery
[3, 5]
1,297,870
1,297,871
Always run application within ASP.NET and external web hosting
<p>I'm creating a ASP.NET .NET 4.0 website and part of this site requires that there is an "always running" application. Normally I would create a Windows Service for this, but the site will be hosted within a shared hosting environment, and unless I get a virtual server, then this isn't a possibility.</p> <p>My first thought was to have a thread running in the background that would do this and it would be created on Application_Start and destroyed on Application_End. I've looked around and this seems like it could be an option, but I would of course have to hit the site in order to cause the Application_Start to be called and if the associated AppPool is recylced, then this process would have to be repeated (so I believe?!?).</p> <p>Within a normal ASP.NET website does these seem possible?</p>
c# asp.net
[0, 9]
5,026,995
5,026,996
Keeping a value consistent In jQuery on function when run on multiple items at the same time
<p>I'm writing a module that has multiple questions users can chose to answer. Each has their own submit button that causes the data to be posted to my application, displays the results, and then removes the form. I was able to get this piece working perfectly but if I add a button that allows the users to submit all the forms at once it submits the form data correctly but the results get appended to the last question (the items are getting the correct data). This is the javascript/jQuery code that I'm using:</p> <pre><code>// setup the save answer click handler $(document).on('click', '.saveAnswer', function(event){ event.preventDefault(); // get the form form = $(this).closest('form'); $.ajax({ async:true, type: 'POST', url: form.attr('action'), data: form.serialize(), success: function(data){ // append the text to the bottom of the answers form.closest('.question').find('.answers').append('&lt;li&gt;' + data + '&lt;/li&gt;').hide().slideDown(500); form.slideUp(500,function(){ form.remove(); }); } }); }); // setup the save all answer click handler $(document).on('click', '.saveAll', function(){ $('.saveAnswer').trigger('click'); }); </code></pre> <p>If I change the <code>async</code> value to false then it works correctly but none of the animations work and the page seems to freeze for a second until all the answers are submitted.</p> <p>After some debugging I found that the <code>form</code> variable gets overwritten each time the function is run. Is there a way to prevent this from happening?</p>
javascript jquery
[3, 5]
5,197,803
5,197,804
Making Synchronous xmlhttp request in code behind
<p>I am attempting to send XML to a URL and read the response, but the response is coming back empty every time. I think this is because its being processed Asynchronously and so the receiving code hasn't had a chance to complete by the time I read the response. In Javascrpt I would use</p> <pre><code>xmlhttp.Open("POST", url, false); </code></pre> <p>to send a request Synchronously. How can I achieve it in C#?</p> <p>My code is currently</p> <pre><code>HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url); objRequest.Credentials = CredentialCache.DefaultCredentials; objRequest.Method = "POST"; objRequest.ContentType = "text/xml"; Stream dataStream = objRequest.GetRequestStream(); byte[] bytes = new byte[UpliftJobXMLString.Length * sizeof(char)]; System.Buffer.BlockCopy(UpliftJobXMLString.ToCharArray(), 0, bytes, 0, bytes.Length); dataStream.Write(bytes, 0, bytes.Length); dataStream.Close(); HttpWebResponse response = (HttpWebResponse)objRequest.GetResponse(); System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream()); string respString = System.Web.HttpUtility.HtmlDecode(sr.ReadToEnd()); //always empty </code></pre> <p>Thanks</p>
c# asp.net
[0, 9]
5,102,686
5,102,687
Why this code dont work on chrome?
<p>i have this javascript code for my thumbnail scroller, it works perfect on firefox! but on chrome it does't work...</p> <pre><code> $(window).load(function(){ var $gal2 = $("#gallery_holder2"), galWW = $gal2.outerWidth(true), galSW = $gal2[0].scrollWidth, wDiff = (galSW/galWW)-1, // widths difference ratio mPadd = 20, // Mousemove Padding damp = 40, // Mousemove response softness mX = 0, // Real mouse position mX2 = 0, // Modified mouse position posX = 0, mmAA = galWW-(mPadd*2), // The mousemove available area mmAAr = (galWW/mmAA); // get available mousemove fidderence ratio $gal2.mousemove(function(e) { mX = e.pageX - $(this).parent().offset().left - this.offsetLeft; mX2 = Math.min( Math.max(0, mX-mPadd), mmAA ) * mmAAr; }); setInterval(function(){ posX += (mX2 - posX) / damp; // zeno's paradox equation "catching delay" $gal2.scrollLeft(posX*wDiff); }, 10); }); </code></pre> <p>How can i fix it?</p>
javascript jquery
[3, 5]
4,352,652
4,352,653
How to get the whole HTML table values on a click
<p>Here I am getting the table single tr values in the click of that tr . What I need is to get the whole table tr values in a single button or div click.Here is the code which I am using from this <a href="http://forums.asp.net/t/1652535.aspx" rel="nofollow">http://forums.asp.net/t/1652535.aspx</a></p> <pre><code>http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js" $(function () { var message = $('#message'); var tr = $('#tbl').find('tr'); tr.bind('click', function (event) { var values = ''; var tds = $(this).find('td'); $.each(tds, function (index, item) { values = values + 'td' + (index + 1) + ':' + item.innerHTML + '&lt;br/&gt;'; }); message.html(values); }); }); </code></pre> <p>and</p> <pre><code> &lt;form id="form1" runat="server"&gt; &lt;table id="tbl" style="border: solid 1px black"&gt; &lt;tr&gt; &lt;td&gt; 1 &lt;/td&gt; &lt;td&gt; a &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 2 &lt;/td&gt; &lt;td&gt; b &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; 3 &lt;/td&gt; &lt;td&gt; c &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;br /&gt; &lt;div id="message"&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>Any suggestion?</p>
c# jquery asp.net
[0, 5, 9]
413,777
413,778
How to build an literal array from list object?
<p>I have the list object that I'm passing using json. How can I convert it to array like you can see below using jquery or javascript?</p> <pre><code>List&lt;MyItem&gt; items = new List&lt;MyItems&gt;(); items.Add(new (){ItemName = "Apple", ItemCount = 5}); items.Add(new (){ItemName = "Tomato", ItemCount = 3}); items.Add(new (){ItemName = "Banana", ItemCount = 8}); items.Add(new (){ItemName = "Avokado", ItemCount = 5}); items.Add(new (){ItemName = "Potato", ItemCount = 9}); items.Add(new (){ItemName = "Onion", ItemCount = 1}); </code></pre> <p>Array</p> <pre><code>var raw_data = [['Apple', 5], ['Tomato', 3], ['Banana', 8], ['Avokado', 5]]; </code></pre>
c# javascript jquery
[0, 3, 5]
1,950,363
1,950,364
How to parse XML file from sdcard using Dom
<p>I want to parse xml file from sdcard. i used DOM concept. here i attached the code </p> <pre><code>InputStream filename = null; Document obj_doc = null; DocumentBuilderFactory doc_build_fact = null; DocumentBuilder doc_builder = null; filename = new FileInputStream("/sdcard/filename.xml"); doc_build_fact = DocumentBuilderFactory.newInstance(); doc_builder = doc_build_fact.newDocumentBuilder(); obj_doc = doc_builder.parse(filename); NodeList obj_nod_list = null; if (null != obj_doc) { org.w3c.dom.Element feed = obj_doc.getDocumentElement(); obj_nod_list = feed.getElementsByTagName("MyTag"); } </code></pre> <p>I dont know how to get a String from xml file. can anyone guide me to get a string variable from xml. </p>
java android
[1, 4]
3,338,800
3,338,801
Remove all attributes
<p>Is it possible to remove all attributes at once using jQuery?</p> <pre><code>&lt;img src="example.jpg" width="100" height="100"&gt; </code></pre> <p>to</p> <pre><code>&lt;img&gt; </code></pre> <p>I tried <code>$('img').removeAttr('*');</code> with no luck. Anyone?</p>
javascript jquery
[3, 5]
980,213
980,214
Android onFocusChanged function never called
<p>I have created a custom button in extending <code>View</code> class as specified in this tutorial:</p> <blockquote> <p><a href="http://kahdev.wordpress.com/2008/09/13/making-a-custom-android-button-using-a-custom-view/" rel="nofollow">http://kahdev.wordpress.com/2008/09/13/making-a-custom-android-button-using-a-custom-view/</a></p> </blockquote> <p>But I have a problem with the function <code>onFocusChanged()</code> which is never called. </p> <p>This is my code:</p> <pre><code>public class CustomButton extends View { ... public CustomButton(Context context, Car car) { super(context); setFocusable(true); setBackgroundColor(Color.BLACK); setOnClickListener(listenerAdapter); setClickable(true); } @Override protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) { if (gainFocus == true) { this.setBackgroundColor(Color.rgb(255, 165, 0)); } else { this.setBackgroundColor(Color.BLACK); } } ... } </code></pre> <p>In fact, when I click on my custom button nothing happens... With the debugger, I can see that the function is never called. And I don't know why.</p> <p>So, had I forgotten a step ? Is there another thing I have missed ?</p>
java android
[1, 4]
2,692,154
2,692,155
how to get columns in one row using jquery
<p>I am trying to get columns inside row. But I only want to get those columns who does not have class element. How can I do this?</p> <p><strong>Code:</strong></p> <pre><code>update_data: function() { $('#add').click(function() { var uid = $('input[name="id"]').val(); var fname = $('input[name="firstname"]').val(); var lname = $('input[name="lastname"]').val(); var email = $('input[name="email"]').val(); var phone = $('input[name="phone"]').val(); var table_rows = $('table tbody tr'); table_rows.each(function(i) { if (i == uid - 1) { var tr = $(this); //.children("td"); $(tr).each(function(i) { if (!tr.children("td").hasClass("element")) { console.log(tr.children("td")); } }); } }); }); }​ </code></pre>
javascript jquery
[3, 5]
5,960,988
5,960,989
Android Custom Listview
<p>I went through tutorials and searched, but still I can't understand how the,</p> <pre><code>getView(int position, View convertView, ViewGroup arg2) </code></pre> <p>method works when extends <code>BaseAdapter</code> to create a custom listView in my android application. Therefore I cant Edit the Custom list view exactly I want.</p> <p>I need to know when this method invokes and the meanings of the parameters.</p> <p>If someone can explain the following method its great. Thanks</p> <pre><code>@Override public View getView(int position, View convertView, ViewGroup arg2) { ViewHolder holder; LayoutInflater inflater = context.getLayoutInflater(); if (convertView == null) { convertView = inflater.inflate(R.layout.listitem_row, null); holder = new ViewHolder(); holder.txtViewTitle = (TextView) convertView.findViewById(R.id.textView1); holder.txtViewDescription = (TextView) convertView.findViewById(R.id.textView2); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.txtViewTitle.setText(title[position]); holder.txtViewDescription.setText(description[position]); return convertView; } </code></pre>
java android
[1, 4]
5,191,005
5,191,006
how to write data in to pdf using c#
<p>using <code>Pdfsharp</code></p> <pre><code> PdfDocument document = new PdfDocument(); document.Info.Title = "Title"; // Create an empty page PdfPage page = document.AddPage(); // Get an XGraphics object for drawing XGraphics gfx = XGraphics.FromPdfPage(page); // Create a font XFont font = new XFont("mationHC39M", 6); </code></pre> <p>here its taking font from cilent system..i want add the font from server.. this would be <code>Server.MapPath(Request.ApplicationPath) + "\\Content\\mationHC39M.ttf</code> how to put this path in the above code...</p> <p>or how to add font from this path....</p>
c# asp.net
[0, 9]
2,228,146
2,228,147
How do I add an attribute to a link inside a textarea?
<p>How do I add an attribute to a link inside a textarea?</p> <p>Here is my code:</p> <p><strong>HTML</strong></p> <pre><code>&lt;textarea id="text"&gt;&lt;a href="/" id="link"&gt;Click here&lt;/a&gt;&lt;/textarea&gt; &lt;a href="#" id="add_attr"&gt;Add attribute&lt;/a&gt; &lt;a href="#" id="remove_attr"&gt;Remove attribute&lt;/a&gt; </code></pre> <p><strong>JavaScript, JQuery</strong></p> <pre><code>$(document).ready(function() { $('#add_attr').click(function() { var value = $('#text').val(); //add attribute `class="name"` to the link inside the textarea return false; }); $('#remove_attr').click(function() { var value = $('#text').val(); //remove attribute `class="name"` from the link inside the textarea return false; }); }); </code></pre>
javascript jquery
[3, 5]
5,936,303
5,936,304
Android: Running multiple activities
<p>I have developed a simple android application, which when started opens a Timer. User is given two buttons, start/ pause. This is working fine. What i want to do is to add a way to support multiple timers when a user swipes his finger on the screen. When he swipes from left to right, a new timer should show up, but the previous timer should not stop. This is a way to add multiple timers. Also, when he swipes from right to left, i want a previous timer to show.</p> <p>This is what i have done so for. I have a timer activity. I have added a touch event on it. When, a person swipes his finger, i get the co-ordinates and decide whether its from left to right or right to left. This funtionality is working fine, as i can see the appropriate log messages.</p> <p>The problem is when im trying to load Timer Activity. It just loads the previous Activity and doesnt really create a new one (I figured this from the timer). Is there any way to do it?</p>
java android
[1, 4]
4,952,162
4,952,163
Attach an handler to the click event on a 'a' tag is firing even if I don't click
<p>I have this code to listen the click on a 'a' tag:</p> <pre><code>$(document).ready(function () { $(document).on("click", $("#addEvent"), addEvent); }); addEvent: function () { alert("Test"); } &lt;div style="width: 100%; text-align: right;margin-left: -8px; margin-top:-40px;"&gt; &lt;a id="addEvent" href="#" &gt; &lt;span class="t-icon t-add"&gt;&lt;/span&gt; Add item &lt;/a&gt; &lt;/div&gt; </code></pre> <p>When I load the page where this code is located, the alert message is displayed immediatly after the page have been loaded even if I don't click on the 'a' tag.</p> <p>What can cause this behavior?</p> <p>I'm using Firefox 14 and jquery 1.7.</p> <p>Thank you.</p>
javascript jquery
[3, 5]
2,708,441
2,708,442
jquery - queue event until ajax call finishes
<p>im working with rails and jquery here. </p> <p>When the email field loses focus (blur), i call server to verify if it is valid (email format and unique). If it is valid, i update a hidden input value to true and false if it is not valid.</p> <p>Then user clicks (focus) on another email field, if the first email is invalid (hidden input false) i disable this field and send some alert message.</p> <p>My problem is, user types an email on the first email field, it is a valid email so on blur i update the hidden field but if the user clicks on the second email field just after typing the first email, the focus event on the second field is triggered before the hidden input gets updated and the second email field is disabled wrongly.</p> <p>basically i need to queue the focus event until the ajax call is finished</p> <p>Sorry its a little confusing to explain, if someone understand what i said, is there a workaround?</p>
javascript jquery
[3, 5]
1,176,852
1,176,853
window.showModalDialog is not working
<p>I have the following code to showModalDialog popup:---</p> <p>.aspx code is:-</p> <pre><code>function ShowPopup(path) { window.showModalDialog(path, '', 'dialogWidth:700px; dialogHeight:530px; Center:yes'); } </code></pre> <p>My aspx.cs code is:--</p> <pre><code>switch (e.CommandName.ToLower()) { case "sendenquiry": string path = string.Format("/BusinessBazaarAspx/PopUps/Enquiry.aspx?c={0}", id); ScriptManager.RegisterClientScriptBlock(gvLatestCompanies, GetType(), "mykey2", string.Format("ShowPopup('{0}')", path), true); break; </code></pre> <p>But my Modal Popup is not visible...</p> <p>Help me to get rid of this problem.</p> <p>Thankx</p>
javascript asp.net
[3, 9]