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,231,264
2,231,265
Could not determine a MetaTable
<p>I have simple application with FormView and SQLDataSource. When I check "Enable dynamic data support" I get following error:</p> <blockquote> <pre><code>Could not determine a MetaTable. A MetaTable could not be determined for </code></pre> <p>the data source 'SqlDataSource1' and one could not be inferred from the request URL. Make sure that the table is mapped to the dats source, or that the data source is configured with a valid context type and table name, or that the request is part of a registered DynamicDataRoute.</p> </blockquote> <p>Any ideas?</p>
c# asp.net
[0, 9]
36,237
36,238
See if Input Has Spaces with jQuery
<p>I'm trying to write a function that reads a inputs value, and determines if a space has been used in it's creation. I'm not trying to trim anything -- just see if it would have needed the ability to trim.</p> <p>I'm not even sure where to begin on this, so I don't have any code to look at. Please help if you can!</p> <p>I was trying this solution but it doesn't seem to work (I don't think I'm using .has() correctly)</p> <pre><code>if ($('#id').val().has(" ")) { alert('has spaces') } </code></pre>
javascript jquery
[3, 5]
621,960
621,961
How to resolve Object reference not set to an instance of an object.
<p>Beating my head against the wall on the error Object reference not set to an instance of an object. See code below. The offending line is marked with &lt;!--->>>>>>></p> <pre><code>string htmlOutput = " "; htmlOutput += "&lt;h3&gt;employee: " + employee.lastName + ", " + employee.firstName + " (" + thisForm.employeeID + ")&lt;/h3&gt;" + "&lt;h3&gt;Submitted To: " + thisForm.boss + "&lt;/h3&gt;" + if (job1.JRN != "" || job1.JRN != "INVALID") { &lt;!---&gt;&gt;&gt;&gt;&gt;&gt;&gt;htmlOutput += "&lt;hr /&gt;&lt;h4&gt;Job 1&lt;/h4&gt; " + "&lt;h3&gt;" + database.getjobName(job1.JRN) + " (" + job1.JRN + ")&lt;/h3&gt;"; htmlOutput += "&lt;h3&gt;Date of Last Attendance: " + job1.month + " " + job1.day + ", " + job1.year + "&lt;/h3&gt;"; htmlOutput += "&lt;h3&gt;Pass/Fail: " + job1.passFail + "&lt;/h3&gt;"; } </code></pre>
c# asp.net
[0, 9]
4,271,879
4,271,880
How to set the scrollbar to move at last line in multiline textbox?
<p>I am using asp.net. How to set the scrollbar to move at last line in multiline textbox at client side?</p>
javascript jquery asp.net
[3, 5, 9]
1,013,259
1,013,260
Launch camera activity with alternate permissions
<p>I'd like to launch the camera activity and have it dump subsequent pictures into my private app storage. Since the camera doesn't have write permission to that directory, it can't save any of its pictures there.</p> <p>I could make my private app storage world writable, but that defeats the purpose of having it be private.</p> <pre><code>@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(this.getBaseContext().getDir(PHOTOHUNT_DIRNAME, MODE_PRIVATE), "filename"))); startActivityForResult(cameraIntent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE); } </code></pre> <p>Something like the above would be idea. Obviously this doesn't work for the reasons stated above.</p>
java android
[1, 4]
3,007,961
3,007,962
getting the entire file code on the page while using include/ include_once/ require_once
<p>While using include / include_once / require_once of the form <code>include 'filename.js'; </code></p> <p>I get the entire code of the file displaying on the page. What am i doing wrong?</p>
php jquery
[2, 5]
1,865,418
1,865,419
How to show a div when Click on text box in asp.net. using jquery
<p>I tried like this </p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $('#divID').hide(); $('#txtInsertComments').Onfocus(function () { $('#divID').show(); }); }); &lt;/script&gt; //Asp.net Design &lt;asp:TextBox ID="txtInsertComments" runat="server" Text="Demo"&gt;&lt;/asp:TextBox&gt; &lt;div runat="server" id="divID"&gt; This is Div &lt;/div&gt; </code></pre> <p>but still not working... please help me out ... </p>
javascript jquery asp.net
[3, 5, 9]
4,683,616
4,683,617
C#/asp.net geting error when sending data from one page to another
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/12768674/send-data-from-one-page-to-another-in-c-sharp-asp-net">Send data from one page to another in C# ASP.Net</a> </p> </blockquote> <p>Hi I am trying to send data from one page to another in asp.net I found various methods of doing so and am gona try a few to se how they work but I seem to be getting an error on my first attempt.Here is my code:</p> <pre><code>&lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;br /&gt; &lt;asp:Button ID="Button1" runat="server" Text="Go" PostBackUrl="~/Default2.aspx" /&gt; &lt;br /&gt; </code></pre> <p>I am sending the data from Default.aspx to Default2.aspx. At the Default2.aspx in the Page_Load method I wrote this to retrieve the data:</p> <pre><code> if (Page.PreviousPage != null) { string txtBox1 = ((TextBox)Page.PreviousPage.FindControl("TextBox1")).Text; } </code></pre> <p>From what I read on MSDN this should work but I must be missing something because when I pres the button to send the data and Default2.aspx loads I get an error page that looks like this:</p> <p><img src="http://i.stack.imgur.com/ZMIxh.png" alt="enter image description here"> <img src="http://i.stack.imgur.com/qS95j.png" alt="enter image description here"></p>
c# asp.net
[0, 9]
3,133,582
3,133,583
jQuery code not executing - iPhone
<p>Im using jquery in webview basically im calling jquery method inside the html string loaded inside the webview. problem is webview is loaded properly but method is getting executed. i tried putting breakpoints it's hard to see the execution inside the string.</p> <p>Thanks in advance.</p>
jquery iphone
[5, 8]
5,647,099
5,647,100
Jquery html() not not working
<p>I have a simple js function: </p> <pre><code> function changeContent(id, content) { $(id).html(content); } </code></pre> <p>which gets called on ajax callback. id is an id of a div, and $(id) does indeed find it.</p> <p>On Chrome I get an unhandled exception that HTMLDivElement doesn't contain method html(), while on IE8 and FF simply nothing happens, although when viewing in degub, .html() does appear in the dynamic method list.</p> <p>What am I doing wrong?</p> <p>EDIT: No, I'm not passing the id with #. I've tried that, it returned null, now it actually returns something. Is there another problem??</p> <p>EDIT again: seems I was doing something else wrong. I've put the # back, now it works.</p>
javascript jquery
[3, 5]
2,084,278
2,084,279
Convert scalar variable to array containing variable in javascript
<p>How would one convert <code>5</code> to <code>[5]</code> in JavaScript? I have a method that uses jQuery's <code>$.inArray</code> and I would like it to work if someone just passes in a scalar variable by converting to an array with one entry, which would be the scalar.</p>
javascript jquery
[3, 5]
452,033
452,034
convert string data array to list
<p>i have an string data array which contains data like this</p> <pre><code>5~kiran 2~ram 1~arun 6~rohan </code></pre> <p>now a method returns an value like string [] data</p> <pre><code> public string [] names() { return data.Toarray() } public class Person { public string Name { get; set; } public int Age { get; set; } } List&lt;Person&gt; persons = new List&lt;Person&gt;(); string [] names = names(); </code></pre> <p>now i need to copy all the data from an string array to an list and finally bind to grid view </p> <pre><code>gridview.datasoutrce= persons </code></pre> <p>how can i do it. is there any built in method to do it</p> <p>thanks in advance</p> <p>prince</p>
c# asp.net
[0, 9]
4,121,821
4,121,822
remembering what $(this) is
<p>I have the following script which changes a jquery made object's color to blue:</p> <pre><code>$(".objects_list").live('click', function(event) { $(this).css("color", "blue"); }); </code></pre> <p>How do I remember what $(this) is so I can change the color again but from a different function or from an event of a different object?</p>
javascript jquery
[3, 5]
618,928
618,929
jQuery validation and check all together
<p>I make a jquery validation, problem is here that this part from code first(first click on button) check selectbox and second(second click on button) fields. how can it fix as that check all together with one click on button?</p> <p><strong>Exampel(see full code):</strong> <a href="http://jsfiddle.net/JfPaN/" rel="nofollow">http://jsfiddle.net/JfPaN/</a></p> <pre><code>$('.submit').submit(function () { if (required_selectbox() == false || required_valid() == false) { return false; } }); </code></pre>
javascript jquery
[3, 5]
572,032
572,033
change font style in c#
<p>hi there I want to change the font style of a label in an aspx page, through choosing options provided by a dorpdownlist. None of these methods work. I know I might be on the right path, but just can't seem to get it right. Please enlighten me. Thanks In my code behind:</p> <pre><code>public void button1_Click(object sender, EventArgs e) { var select= drop1.SelectedItem.Value; if(select == "Times New Roman") { // I tried doing all of these: label1.Font= new Font("Times New Roman", label1.Font.Size); //or label1.Font.Name ="Times New Roman"; //or Label new1 = new Label("Times New Roman"); Label1.Font= new1; } } </code></pre>
c# asp.net
[0, 9]
1,987,021
1,987,022
addView equivalente but adding Preference to PreferenceScreen?
<p>I had recently had to do add a view to a LinearLayout programatically, I have to do the same for a for a PreferenceScreen but I don't know how. This is how it was done for a LinearLayout:</p> <pre><code> LayoutInflater localLayoutInflater = (LayoutInflater)getBaseContext().getSystemService("layout_inflater"); View myView = localLayoutInflater.inflate(R.layout.custom_layout, null); final PreferenceScreen ll=(LinearLayout)findViewById(R.id.linearlayoutID); ll.addView(myView); </code></pre> <p>How can I do the same to add a preference to a PreferenceScreen?</p> <hr> <p>EDIT:</p> <p>This is what I've done so far:</p> <pre><code>Preference preference = new Preference(this); preference .setTitle("WHATEVER"); preference .setSummary("Summary"); preference .setKey("your_key"); </code></pre> <p>I managed to create a preference and store it in list1, I think it's ok so far, but now I need to figure out how to append it inside <code>&lt;PreferenceScreen id="@+id/list"&gt;</code>?</p>
java android
[1, 4]
2,974,529
2,974,530
Show hide image by generated id
<p>I have this code that generates a group ID with javascript. It's shown here: <a href="http://jsfiddle.net/LwtvK/5/" rel="nofollow">http://jsfiddle.net/LwtvK/5/</a>. Now instead of it writing the text "Group id : X", I want it to control an image that gets shown. There are 7 group id's and 7 images</p> <pre><code> &lt;div data-role="content" id="pictures"&gt; &lt;img src="images/image1.jpg" alt="image" id="pict1"&gt; &lt;img src="images/image2.jpg" alt="image" id="pict2"&gt; &lt;img src="images/image3.jpg" alt="image" id="pict3"&gt; &lt;img src="images/image4.jpg" alt="image" id="pict4"&gt; &lt;img src="images/image5.jpg" alt="image" id="pict5"&gt; &lt;img src="images/image6.jpg" alt="image" id="pict6"&gt; &lt;img src="images/image7.jpg" alt="image" id="pict7"&gt; &lt;/div&gt; </code></pre> <p>Now when the group id is 5, I want the 'Continue' button to hide images 1, 2, 3, 4, 6 and 7 and show image 5. I was thinking of doing something like </p> <pre><code> function show_img(id) { if(id=='1') { $("#pict1").hide(); $("#pict2").show(); } else if(id=='2') { $("#pict2").show(); $("#pict1").hide(); } return false; } </code></pre> <p>But that would result in a lot of retyping and I'm not really sure how to get it to work. So, does anyone know how I can get the generated group ID to show the right image when the button is clicked?</p>
javascript jquery
[3, 5]
5,808,382
5,808,383
javascript\jquery: Event that fires when textbox changes
<p>I'm looking for a jquery/simple javascript (not some other library) solution that set an event to a textbox that will fire when the textbox being changed? (not after blur)<br> I need it to fire no matter how it was changed (keyboard char key/tab/enter or mouse paste) And I need it to be fired one time only.</p>
javascript jquery
[3, 5]
5,422,557
5,422,558
Uncaught TypeError in Chrome and Safari when referencing the name of a dropdown in JavaScript
<p>The following code only seems to work in IE. In Chrome or Safari, I get the following error:</p> <p>The console error I get in Chrome is:</p> <blockquote> <p>Uncaught TypeError: Property 'choosetext' of object # is not a function </p> </blockquote> <p>Here's the code:</p> <pre><code>function LoadPageText(){ document.location.href = "editpage.asp?file="+document.form.file.value+"&amp;text="+document.form['choosetext'](document.form['choosetext'].selectedIndex).value; } </code></pre> <p>How do I resolve this error for Safari and Chrome?</p>
javascript jquery
[3, 5]
3,490,093
3,490,094
How to print div inner html
<p>I have aspx page and some html in div control. I am trying to print the html, after print the page i got url in the page bottom and title of the page on the uppaer side. but I want to print only div inner html. please help.</p>
javascript asp.net
[3, 9]
143,973
143,974
Jquery deferred from callback of ajax calls
<p>I'm trying to write an procedure that does something after 2 objects are returned as a result of the callback of an ajax function.</p> <p>I know the classic example of using Jquery when():</p> <pre><code>$.when($.get("http://localhost:3000/url1"), $.get("http://localhost:3000/url2").done(//do something)); </code></pre> <p>But in my case, I don't want to trigger the when on the execution of the ajax function, I want the when to trigger from the callback from the execution of the ajax function. Something like:</p> <pre><code>$.get("http://localhost:3000/url1", function(data){ function(){ //do something with the data, and return myobj1; } }); $.get("http://localhost:3000/url2", function(data){ function(){ //do something with the data, and return myobj2; } }); $.when(obj1, obj2).done(function(){ //do something with these 2 objects }); </code></pre> <p>But of course, that doesn't work. Ideas?</p>
javascript jquery
[3, 5]
793,157
793,158
Best way to block on a socket for data
<p>What is the efficient way of blocking on the socket for data after opening it.The method i used is to call read on input stream (this is a blocking call that waits till some data written to this socket).</p> <pre><code>//Socket creation SocketForCommunication = new Socket(); InetSocketAddress sAddr = new InetSocketAddress("hostName", 8800); SocketForCommunication.connect(sAddr,10000); is = new DataInputStream(SocketForCommunication.getInputStream()); os = new DataOutputStream(SocketForCommunication.getOutputStream()); //Waiting on socket using read method for data while(true) { int data = is.read(); if(data == HEADER_START) { processPackage(is); } } </code></pre> <p>Here problem is read can timeout.Is there a way to register a callback that gets called when data available to read on socket.?</p>
java android
[1, 4]
2,286,800
2,286,801
Uniquely identify a file without downloading
<p>So the base project is this... </p> <p>I am trying to write a server application that will download and hash files off of a website. </p> <p>The reason for this is so that I can blacklist particular files that are re-uploaded under different names or provide further descriptions as to what a file really is. These files are 0.1KB - 10.00MB and many. If I could detect within a reasonable ballpark figure a file is already hashed I could return the hash rather then download the entire file and send the results. </p> <p>My temporary solution is a JavaScript add-on that does it on the spot. This causes temporary freezes and is too redundant for my liking. My goal is to make this good enough to share with the public; The current method is far from. </p> <p>My skill set in programming is very wide yet not professional or polished in any individual so a library or examples are highly appreciated. </p> <hr> <p>A snip-it of my java-script code is this... </p> <pre><code> $('.tablesorter tbody tr').each(function(index) { var href = 'http:' + $(this).find("td a:eq(0)").attr('href'); var MD5 = ""; $.get(href, function(data) { MD5 = calcMD5(data); $(".tablesorter tbody tr:eq("+index+") td:eq(3)").text(MD5); }); }); </code></pre> <p>This works great, does what it needs to. However I'd like to have a server do this so that a file only needs to be hashed a single time. </p>
php javascript python
[2, 3, 7]
2,899,062
2,899,063
JQuery: How to select table rows but not the rows of the table inside the cell
<p>So I have a table, and there are tables within the cell too, like this:</p> <pre><code>&lt;table id='table1'&gt; &lt;tr&gt; &lt;td&gt;xyz&lt;/td&gt; &lt;td&gt; &lt;table&gt;&lt;tr&gt;&lt;/tr&gt;&lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;/tr&gt; &lt;tr&gt;&lt;/tr&gt; &lt;tr&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre> <p>How do I use jquery to select those only directly under "table1", but not those under the inside table?</p>
javascript jquery
[3, 5]
5,320,973
5,320,974
How to automatically click a link when the website loads
<p>I am trying to figure out how to make an anchor link clicked when the website is visited. I would be grateful if someone can help me, here's a demo code, you can match the id for my ease thank you.</p> <pre><code>&lt;body&gt; &lt;a id='deepakkamat' href='http://mywebpage.com'&gt; This is my webpage &lt;/a&gt; &lt;/body&gt; </code></pre> <p>So i want to know any JavaScript code to make the link clicked when the page loads. Thank you in advance.</p>
javascript jquery
[3, 5]
2,401,384
2,401,385
Finding position of cursor with window scroll
<p>Is there any way to find the cursor is at the top of a HTML element with window scroll function. </p> <p>EDIT: I have to call the below script to suspend the window scroll function if the cursor is at the top of one div:</p> <pre><code>document.addEventListener('DOMMouseScroll', function(e){ console.log(e); e.stopPropagation(); e.preventDefault(); e.cancelBubble = false; return false; }, false); </code></pre>
javascript jquery
[3, 5]
4,920,185
4,920,186
Grabbing asp.net controls in javascript
<p>I have a page where it is getting overwhelmed with code like:</p> <pre><code>var textBox = $get("&lt;%=textState.ClientID%&gt;"); </code></pre> <p>This requires me to have my JavaScript inside the page instead of nicely tucked in a js file. <strong>Is there a better approach to this?</strong></p> <p>document.getElementById doesn't work because then I end up with code like this:</p> <pre><code>var textBox = document.getElementById("originDestinationControl_textState"); </code></pre> <p>or</p> <pre><code>var textBox = document.getElementById("ctl00_ContentPlaceHolder_originDestinationControl_textState"); </code></pre> <p>depending on where I am referencing these controls (inside master pages and/or usercontrols)</p>
asp.net javascript
[9, 3]
2,225,175
2,225,176
How to organise jquery code
<p>I discoverd my jquery code is a mess, right now it doesnt follow any type of logic build up. I have lots of ajax calls, nested functions, dom manipulations, plugin calls in my main js file.</p> <p>Lot of calls are fired on every page, what is a no-no, and get the undefined error on a few pages because some functions or calls fire on every page, and thats not supose to.</p> <p>How to organize the code? I have read a lot of articles about prototypical and pseudo classical inheritance but they just explain how things works, like how you can inherit 'Person' from 'Human' or something like this. How can I actually use it in real life? </p>
javascript jquery
[3, 5]
5,828,980
5,828,981
Show another div if earlier div height<300px
<p>I am working on dynamic page where height of the page is concern.</p> <p>So, What I want is if height of <code>&lt;div id="a"&gt;</code> <strong>&lt; 300px</strong> , <strong>Then only show</strong> new <code>&lt;div id="b"&gt;</code></p> <p>How can I achieve this ?</p> <p>Thanks.</p> <ul> <li>Mandar</li> </ul>
javascript jquery
[3, 5]
1,007,551
1,007,552
Filtering table rows with Jquery
<p>I have a table showing registered users and the rows of this table can be filtered according to Status (active/inactive users or both) or User Type (admin/user or both). In order to make sure all of the table rows are filtered according to both criteria, I have PHP generate a 'info' attribute for each table row. Info can be one of four things:</p> <ul> <li>Active Admin </li> <li>Active User</li> <li>Inactive Admin</li> <li>Inactive User</li> </ul> <p>This made it easy to filter out the user rows according to the options selected in the two filter drop-downs. </p> <p>What I'm trying to figure out is how to filter them when <strong>Both</strong> is selected for one of the filter drop-downs--I know there's a more efficient way to do this than running six if statements every time one of the drop-downs is changed. </p> <p>Here's my code: </p> <pre><code>function toggleAll(){ var selectedString = $('#userStatusDropDown').val() + ' ' + $('#userTypeDropDown').val(); switch (selectedString){ case 'Both Both': $('#tableUsers tr').show(); break; default: $('#tableUsers tr:gt(1)').hide(); $('#tableUsers tr[info="'+selectedString+'"]').show(); } } $(document).ready(function(){ toggleAll(); // admin/user drop down changes $('#userTypeDropDown').change(function(){ toggleAll(); }); // active/inactive drop down changed $('#userStatusDropDown').change(function(){ toggleAll(); }); }); </code></pre>
javascript jquery
[3, 5]
4,897,780
4,897,781
Getting select info from SQLiteDB?
<p>I have an SQLiteDB, in one of the tables, I have a column for date (formatted as 3-1-2011) and a column for quantity. I want to grab the quantity for all results in the specified month. So if my table is looking like this:</p> <pre><code>1-28-2011 9 2-2-2011 2 2-5-2011 6 2-12-2011 3 2-20-2011 6 3-1-2011 12 </code></pre> <p>How might I go about grabbing just the values from the rows in February and adding them up?</p>
java android
[1, 4]
1,351,481
1,351,482
Help! Ajax not getting an external page content?
<p>I want to extract the source code of a webpage which is hosted by other website, but the problem is that O get an empty response, I tried to pull the source of multiple websites but the problem is from my code:</p> <pre><code>$(document).ready(function(){ $.get('http://www.xxxx.com', function(xdata) { alert("content: "+xdata); }); }); </code></pre> <p>Is there any mistake?</p> <p>Note: when I try to get the source of a local page, it works, but I don't know why it doesn't for an external one</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,646,808
3,646,809
Explanation of two argments for jQuery .each() method
<p>In the following jQuery, the <code>.each()</code> method takes two arguments: <code>'ul li a'</code> and <code>menu</code>. What do these two arguments mean?</p> <pre><code>var menu = $('.menu'); $('ul li a', menu).each(function() { $(this).append('&lt;span /&gt;'); }); </code></pre> <p>HTML:</p> <pre><code>&lt;div class="menu"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Edit Profile&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Account Settings&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Appear Offline&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Logout&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
2,657,950
2,657,951
Project 'PrjName' is missing required library: 'libs/android-viewbadger.jar' PrjName
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/12928623/project-prjname-is-missing-required-library-e-arul-android-libs-android-vie">Project ‘PrjName’ is missing required library: ‘E:/arul/Android/libs/android-viewbadger.jar’ PrjName</a> </p> </blockquote> <p>In Android project got error as Project <code>PrjName</code> is missing required library: <code>/libs/android-viewbadger.jar</code> <code>PrjName</code> </p> <p>Do we need to download <code>android-viewbadger.jar</code>? or have that contained in <code>android-sdk</code>?</p>
java android
[1, 4]
344,360
344,361
Find the Jquery version using normal Javascript
<p>Is there any way to find the version of Jquery using normal plain javascript. I know to do this using JQuery itself by using the following code.</p> <pre><code>jQuery.fn.jquery; </code></pre> <p>or</p> <pre><code>$().jquery; </code></pre> <p>But this wont works for me beacuse I am not allowed to use Jquery code. Please suggest any alternative methods using only plain javascript.</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
4,467,253
4,467,254
How to pass my php variables to javascript
<p>I have a dynamic dropdown. That populates the second drop down. My javascript is not taking my variables when I change my selection when I tested with one php variable. Am new to this</p> <p>Javascript:</p> <pre><code>&lt;script type="text/javascript"&gt; function populate(s1,s2){ var s1 = document.getElementById(s1); var s2 = document.getElementById(s2); s2.innerHTML = ""; if(s1.value=="&lt;?php echo $car; ?&gt;"){ var optionArray=[" ","camero Camaro","convette Convette"]; } else if(s1.value=="Dodge"){ var optionArray=[" ","avanger Avanger","challenger Challenger"]; } else if(s1.value=="Ford"){ var optionArray=[" ","mustang Mustang","fiesta Fiesta"]; } for (var option in optionArray){ var pair = optionArray[option].split(" "); var newOption = document.createElement("option"); newOption.value = pair[0]; newOption.innerHTML = pair[1]; s2.options.add(newOption); } } &lt;/script&gt; </code></pre> <p>PHP file:</p> <pre><code>&lt;select name="slct1" id="slct1" onchange="populate(this.id,'slct2')"&gt; &lt;option value=""&gt;&lt;/option&gt; &lt;option value="&lt;?php $car = 'Chevy';echo $car; ?&gt;"&gt;Chevy&lt;/option&gt; &lt;option value="Dodge"&gt;Dodge&lt;/option&gt; &lt;option value="Ford"&gt;Ford&lt;/option&gt; &lt;/select&gt; &lt;hr /&gt; &lt;select id="slct2" name="slct2"&gt; &lt;/select&gt; &lt;hr /&gt; </code></pre>
php javascript
[2, 3]
1,869,572
1,869,573
How can i debug jquery object
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2948262/debug-javascript">Debug Javascript</a> </p> </blockquote> <p>Every now and then i have one jquery object and i am not able to find whats inside it. I had to try many combinations like see the class name , id and other attributes to see what is that variable and sometime by hiding it.</p> <p>Is there any proper way of debugging the jquery object to see whats inside it?</p>
javascript jquery
[3, 5]
4,240,245
4,240,246
Data underlyng e GridView
<p>I have a GridView. At event _RowDataBound I need take the underlying value from every single Field (ex let immagine FirstName), apply some logic to it, and display the field modify to a Textbox.</p> <p>My problem is I do not the syntax to get the values connected with the e.Row.DataItmem for a single row.</p> <p>Any idea how to do it? Please provide me an example of code. I posted this question in past but without understanding the answer. Thanks</p> <pre><code>switch (e.Row.RowType) { // In case type of row is DataRow (a data row of GridView) case DataControlRowType.DataRow: // What I add here? break; } </code></pre>
c# asp.net
[0, 9]
4,067,518
4,067,519
The art of programming: Java vs C#
<p>Throughout my university career I used Java to code projects until I started working which is where I had to delve into the C# realm. Though the .Net library is fairly extensive I can't help but feel that there is something missing in C# as compared to Java. I would like to know if Java is any better than C# or vice versa from the experts out there. What would you use to develop both complex and fairly trivial applications? What are some of the advantages and disadvantages of using these 2 technologies over the other?</p>
c# java
[0, 1]
1,447,411
1,447,412
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]
1,830,695
1,830,696
.fadein not working on server (working locally)
<p>FadeIn is not working when I upload it to my server, yet it is working on my local machine?</p> <pre><code>&lt;script&gt; $("qfade").click(function () { $("h2").fadeIn(1000); }) &lt;/script&gt; </code></pre> <p>called here</p> <pre><code>&lt;li class="sup"&gt; &lt;qfade&gt;&lt;a href="#stuff"&gt;things&lt;/a&gt;&lt;/qfade&gt; &lt;/li&gt; </code></pre> <p>You can view the whole code here: <a href="http://williamhockey.com" rel="nofollow">http://williamhockey.com</a></p>
javascript jquery
[3, 5]
94,566
94,567
On enter key move to next cell down in a table
<p>I am trying to create a form where, if you press enter key on the serial column, the cell below becomes selected. Can someone please solve the correct jquery formula for this task?</p> <p>I am trying </p> <pre><code>$('.serial').keypress(function(e) { console.log(this); if (e.which == 13) { $(this).nextAll('#serial').first().focus(); e.preventDefault(); } }); </code></pre> <p><a href="http://jsfiddle.net/tYFcH/4/" rel="nofollow">http://jsfiddle.net/tYFcH/4/</a></p>
javascript jquery
[3, 5]
2,588,502
2,588,503
Writing for iphone and android... are any of the js api worth it?
<p>as we're all aware, there is a a stinking iphone so what is the best way to go about making a cross-phone app as long as those are the only two phones you care about no one buys bb anymore</p> <p>p.s. I don't want to argue phone sales... just what js lib works REALLY well for both and more than just links... tell me your experience.</p>
javascript iphone android
[3, 8, 4]
3,038,361
3,038,362
Move div rather than Remove()
<pre><code> $(settings.widgetSelector, $(settings.columns)).each(function () { var thisWidgetSettings = iNettuts.getWidgetSettings(this.id); if (thisWidgetSettings.removable) { $('&lt;a href="#" class="remove"&gt;CLOSE&lt;/a&gt;').mousedown(function (e) { /* STOP event bubbling */ e.stopPropagation(); }).click(function () { if(confirm('This widget will be removed, ok?')) { $(this).parents(settings.widgetSelector).animate({ opacity: 0 },function () { $(this).wrap('&lt;div/&gt;').parent().slideUp(function () { $(this).remove(); iNettuts.savePreferences(); }); }); } return false; }).appendTo($(settings.handleSelector, this)); } </code></pre> <p>Basically right now this code when 'close' is clicked it removes the content completely. What i would rather do is move it to a different div. I was reading about prependTo. I thought this would be as simple as changing:</p> <pre><code>$(this).remove(); </code></pre> <p>To:</p> <pre><code>$(this).prependTo('.dock'); </code></pre> <p>But doesn't seem to be that simple. This just removes it still. <a href="http://pastebin.com/u64XXAQ5" rel="nofollow">Full Code</a></p>
javascript jquery
[3, 5]
4,836,866
4,836,867
How to work with JSON
<p>Okay I'm really sorry if this question has been asked, but I can't seem to find any good help on this. </p> <p>I coded myself a little API for my android app using PHP and Codeigniter. It works through GET requests, so I'll send it some info and it'll return something. When I send it a login request, I want it to validate the user data, and if correct return the user's credentials (uid, email, etc). All of this information can either be returned as formatted XML or a JSON array. My question is which would be easier to work with in Java, and can you help me with a quick example?</p> <p>Any help is much appreciated.</p> <p>EDIT:</p> <p>Requested Code</p> <pre><code> // Parse JSON array JSONObject obj = (JSONObject) JSONValue.parse(response); String uid = (String) obj.get("uid"); String email = (String) obj.get("email"); </code></pre>
java android
[1, 4]
2,108,468
2,108,469
How to pass a php variable($total) i have, to an External Javascript as in input?
<p>I have a php file with a variable $total as one of its variable.</p> <p>AS part of my project I have to print a table of results. I call an external javascript whenever i display the table, something like this </p> <pre><code>echo "&lt;script src='course.js' language='JavaScript'&gt;&lt;/script&gt;"; echo "&lt;table border='1'&gt;"; echo "&lt;tr&gt;"; echo "&lt;td&gt;&lt;td&gt;"; </code></pre> <p>Each row of this table has a checkbox, and i call the script file to check whether the number of checked boxes is not more than 8, for which i need the $total variable which is the total number of rows in the table</p> <p>My course.js file looks like this (assuming $total)</p> <pre><code>var count = 0; for(i=1;i&lt;=$total;i++) { if(document.getElementByTag('course."i"').checked==true) count++; } if(count==8) { for(i=1;i&lt;total;i++) { document.getElementById('course."i"').disable=true; } } } </code></pre>
php javascript
[2, 3]
5,304,397
5,304,398
display info for each drop down option
<p>I have 2 jQuery drop down menus. The content of the second drop down is dependent on the value chosen from the first.</p> <p>The code is on this link <a href="http://jsfiddle.net/5tmwg/" rel="nofollow">http://jsfiddle.net/5tmwg/</a></p> <p>sample of the script in the header tag</p> <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" defer="defer"&gt; function cascadeSelect(parent, child){ var childOptions = child.find('option:not(.static)'); child.data('options',childOptions); parent.change(function(){ childOptions.remove(); child .append(child.data('options').filter('.sub_' + this.value)) .change(); }) childOptions.not('.static, .sub_' + parent.val()).remove(); } $(function(){ cascadeForm = $('.cascadeTest'); orgSelect = cascadeForm.find('.orgSelect'); terrSelect = cascadeForm.find('.terrSelect'); locSelect = cascadeForm.find('.locSelect'); cascadeSelect(orgSelect, terrSelect); cascadeSelect(terrSelect, locSelect); }); &lt;/script&gt; </code></pre> <p>What I want to do is display a div that has info on each option. I lack experience in javascript and jQuery so please explain in details, thanks in advance.</p>
javascript jquery
[3, 5]
2,377,546
2,377,547
Using Javascript (DOM) with ASP.NET
<p>I have an asp.net page with several list boxes.</p> <p>I would like to include some javascript on the page that allows a user to drag individual list elements from one box to another.</p> <p>On a normal web page, the script to do this is reasonably simple, however, with the element IDs generated by ASP.NET, I don't know what identifiers to have my script look up?</p> <p>Any thoughts on how to do something like this?</p>
asp.net javascript
[9, 3]
992,122
992,123
Sort dropdown list by text rather than value
<p>I have dropdown list as follow:</p> <pre><code>&lt;select id="DropdownID"&gt; &lt;option value="1"&gt;Ccc&lt;/option&gt; &lt;option value="2"&gt;Aaa&lt;/option&gt; &lt;option value="3"&gt;Bbb&lt;/option&gt; &lt;/select&gt; </code></pre> <p>but i want dropdown elements sorted by text not value, in alphabetical order:</p> <pre><code>&lt;select id="DropdownID"&gt; &lt;option value="2"&gt;Aaa&lt;/option&gt; &lt;option value="3"&gt;Bbb&lt;/option&gt; &lt;option value="1"&gt;Ccc&lt;/option&gt; &lt;/select&gt; </code></pre> <p>I fill it on this way:</p> <pre><code>Dictionary&lt;int, string&gt; myDataDictionary = new Dictionary&lt;int, string&gt;(); // (...) DropdownID.DataSource = myDataDictionary; DropdownID.DataTextField = "value"; DropdownID.DataValueField = "key"; DropdownID.DataBind(); </code></pre> <p>Even if values in dictionary are sorted correctly, in dropdown they are always ordered by value.</p> <p>How to sort items in dropdow by text rather than by value ?</p>
c# asp.net
[0, 9]
177,928
177,929
How can I retain a GridViewRow value?
<p>My <code>GridView</code> is loaded with data from my database in a <code>DataSet</code>, which corresponds to <code>Label</code>s inside the <code>GridView</code>.</p> <p>When users click the <code>Select</code> button on a <code>GridViewRow</code>, the button fills a <code>TextBox</code> outside the <code>GridView</code> from the selected row's column value.</p> <p>After editing values in the <code>TextBox</code> outside my <code>GridView</code>, the user can click a button to move the new value from the <code>TextBox</code> back to the <code>GridView</code> (but not to the database).</p> <p>My problem is: when I select the next row and do the same action, it clear the previous newly-added row data. It doesn't retain the previous row data.</p> <p>I know it can be done by <code>ViewState</code> or <code>Session</code>, but it didn't work for me.</p>
c# asp.net
[0, 9]
593,419
593,420
jQuery $(this).attr("href"); driving my crazy
<p>So i'm trying to make a section fade out before following a link like so</p> <pre><code>&lt;a class="fadelink" href="path/to/file"&gt;Hello&lt;/a&gt; &lt;script type="text/javascript"&gt; $("a.fadelink").click(function(e){ e.preventDefault(); $("#content").fadeTo(400,0,function(){ window.location.href = $(this).attr("href"); }); }); &lt;/script&gt; </code></pre> <p>Problem is, jQuery keeps returning me with "undefined" and 404's the redirect.</p>
javascript jquery
[3, 5]
5,891,994
5,891,995
How can I make a function act like a callback
<p>How can I make <code>shwOpts.show("fast");</code> to act when <code>removeHighlight()</code> is done?</p> <p>I thought if I put an anonymous function as an argument in the other it will act as a callback. This didn't work.</p> <pre><code>removeHighlight : function(f) { // remove previous highlight. var highlight = $('#openid_highlight'); if (highlight) { highlight.replaceWith($('#openid_highlight a')[0]); } }, moreOptsLink = $("#more-options-link").click(function () { moreOptsLink.detach(); openid.removeHighlight(function(){$("#show-more-options").show("fast");}); //shwOpts.show("fast"); openid.setPref("showMoreOpenIdOptions", !0) }); </code></pre>
javascript jquery
[3, 5]
5,492,962
5,492,963
How does returning activity result works?
<p>Im searching through the Android Developer's manual but I cant find an answer to my question - how exactly the system handles the returning of a particular Activity's result to another application? They both run in separate instances of Dalvik VM - so if I understand it corretly: I have an activity A, that needs a result (some data) from activity B. So A calls an IntentForResult and the system starts the activity B, activity B retrieves the data (now comes the part that interests me) and then B returns the data to system and system returns the data to activity A? Thanks for explanation.</p>
java android
[1, 4]
2,362,787
2,362,788
Why does my "plugin" execute only once?
<p>This is my first attempt to write a jQuery plugin, this one is supposed to fade out the body, switch class, then make the body reappear and let the user switch class back. Unfortunately at this point it can't switch class more than once. How to fix it?</p> <pre><code>(function($) { $.fn.flashClass= function(classId, element){ element="body"; //overriden for testing purpose $(this).click(function() { $(element).fadeOut("slow", function() { $(element).toggleClass(classId); }); $(element).fadeIn("slow", function() { $(element).scrollTop(height); }); }); }; })(jQuery); </code></pre> <p>EDIT: </p> <p>At the end of the day, It turned out that I've pasted the wrong snippet with scrollTop callback of undefined variable <em>height</em>. After removing it and switching <code>.click</code> to <code>.on</code> , function works like a charm. However I am still interested why it worked only once.</p>
javascript jquery
[3, 5]
3,567,175
3,567,176
How can I focus on a given table's row using javascript/jquery?
<p>Having a big html table with many rows that does not fit on the screen, do you know how to focus on a given row with javascript/jquery avoiding the need to scroll down?</p>
javascript jquery
[3, 5]
1,420,172
1,420,173
Extract an image from a video hosted on a web site
<p>I need to extract an image/thumbnail from a video hosted on some website. For exemple, the host could be youtube.com or whatever.com and i want to extract an image for a precise frame, i.e 2:12. </p> <p>I have the direct URL for the video. I searched and found how to do it for youtube or vimeo, they provide xml or json with a path to the thumbnail. However i can't find how to do it for a web site that doesn't provide those informations.</p> <p>Ive downloaded FFmpeg, but it doesn't seem to offer to extract an image from a video hosted on some web site.</p> <p>Any other tool or any idea to make a tool myself ?</p> <p>Thanks</p>
c# asp.net
[0, 9]
983,483
983,484
scroll multiple divs bound to window scroll event
<p>i have the following situation: a div on a page which is displayed as a warning after 10 minutes. after 10 minutes at which point the div is visible it must scroll up and down as the user scrolls the page. Also, i have a user control which can get loaded and be a part of the page which also has a div which scrolls. In a situation where the 2 divs are present on the same page, only the user control div scroll bind is getting called. So when the page is rendered there exists 2 spots where the following logic is being applied for the scrolls:</p> <p>$(this).bind('scroll', function(){...});</p> <p>The logic for the scrolls works fine, it is just the issue of what happens when both divs are present and both need to scroll with the page. Can anyone point me in the right direction of how to have each respective div attached to the scroll event and allow for their own offset values, etc?</p>
asp.net jquery
[9, 5]
1,967,418
1,967,419
Disable HTML Markup In "Preview Article"
<p>I have a problem displaying a "preview" of a text on my website. Let's assume it's an article and I only want to display the first 50 letters of the article (people will have to click 'read more' to read the rest), that I have accomplished but my issue now is that it displays the text as HTML.</p> <p>So, what I do is the following:</p> <pre><code>&lt;td&gt;&lt;%# Eval("Description").ToString().Crop(50, true) %&gt;&lt;/td&gt; </code></pre> <p>This line above displays the Description and then calls my TextService.cs to crop the text to 50 letters, as below:</p> <pre><code>public static string Crop(this string text, int length) { return Crop(text, length, false); } public static string Crop(this string text, int length, bool removeBreak) { if (removeBreak) text = text.Replace("&lt;br /&gt;", " "); return (text.Length &gt; length) ? string.Format("{0}...", text.Substring(0, length)) : text; } </code></pre> <p>But if I edit my article to a big fat text, then it will be visible in the preview box. How can I display the "preview text" as plain text without any HTML?</p> <p>I hope it all makes sense - otherwise feel free to ask questions.</p>
c# asp.net
[0, 9]
4,751,554
4,751,555
Need help to use this
<p>Can any one please make it simple or clear to me how the coder has used (this) here in the last line:</p> <pre><code>@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Set up click listeners for all the buttons View continueButton = findViewById(R.id.continue_button); continueButton.setOnClickListener(this);&lt;----------------------------------- } </code></pre>
java android
[1, 4]
4,950,974
4,950,975
JQuery: any browsing divs plugin
<p>Imagine i have a grid of 5x5 divs and the first one is selected with class="selected"</p> <p>there is any plugin ready so i can use my keyboard arrows to navigate left/right up down in that grid?</p>
javascript jquery
[3, 5]
5,959,336
5,959,337
What is the best way keep track of your identifiers for your Jquery and CSS?
<p>This is more of an organisation question concerning Jquery.</p> <p>Using the following simple example:</p> <pre><code>&lt;a href="#" class="click"&gt;click me&lt;/a&gt; &lt;script&gt; $(document).ready(function(){ $('.click').on('click',function(){ alert('Clicked!'); }); }); &lt;/script&gt; </code></pre> <p>Now multiply this by a 1000 on your website, it can quickly get messy. You also can forget which classes you attributed for Jquery or for your CSS. I usually try to avoid mixing both, so I add my classes for CSS and others for the Jquery, in case I change I the layout or use that section somewhere else, ... I can change the CSS. But how to do you remember which one is for CSS or Jquery? Do you name your classes "JSclassName" or something like that?</p> <p>Let me know if I'm not clear and thanks for your help.</p>
javascript jquery
[3, 5]
4,656,258
4,656,259
javascript one letter function names in jQuery
<p>I noticed that the production version of jquery has one-letter function and variable name and was wondering how they achieve that. are there tools to create a production level javascript file from the one use during development? I am having a hard time figuring out how they make sure there are no mistakes, especially for an open source project that big. </p>
javascript jquery
[3, 5]
4,794,382
4,794,383
User generated page? Android
<p>First off, if this is a dumb question, I apologize ahead of time but I cannot seem to find what I need through searching online so I figured I would just ask...</p> <p>Secondly as a little background info... I'm quite new to Android Development, and actually Java in general. No formal training or prior experience till about a month ago when I decided to give it a try. I am self teaching myself as I go through websites such as this one and a book I found for development of Android apps. </p> <p>Okay, I am attempting to develop myself an app for school to keep a list of all my classes, and assignments for each of them. I have the DB created, the page to add a class through edit text and have the list view setup to populate from the DB. So what I am looking for now is how to make it so when I click on a class from the list view it will open a page that is specific to that class. </p> <p>I'm unsure of what I am looking for would be generally referred to or called so I'm struggling trying to search for examples. I know you can create a dialog and am assuming it is generally the same coding wise but having to background I am lost since I don't know what to look for.</p> <p>If this wasn't specific enough of a description of what I am looking for please let me know where I need to clarify my question.</p> <p>Take care,<BR> Josh</p>
java android
[1, 4]
2,970,662
2,970,663
Get IP address of user computer in C#
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/735350/how-to-get-a-users-client-ip-address-in-asp-net">How to get a user&#39;s client IP address in ASP.NET?</a> </p> </blockquote> <p>I have a application in which i have to get IP address of user who accessing my site. My site is hosted on Go Daddy hosting server. I have tried several codes(which are listed below) but it seems they are not working.</p> <pre><code>HttpContext.Current.Request.UserHostAddress.ToString(); Request.UserHostAddress.ToString(); Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; Request.ServerVariables["REMOTE_ADDR"]; HttpContext.Current.Request. Server Variables["HTTP_X_FORWARDED_FOR"]; </code></pre> <p>I have been working on this since last 3 days but i could not find any good solution. Any good solution for this.</p> <p>Please help me to do this.</p> <p>Thank you.</p>
c# asp.net
[0, 9]
2,190,587
2,190,588
setImageresource in android - how to use it for many pictures in a loop
<p>it is a rather simple question. I have 5 imageViews and 5 images in drawable folder. ImageViews are named <code>imageView1</code>...<code>imageView5</code> and images are named <code>image1</code>...<code>image5</code></p> <p>I want how can I write the following elegantly:</p> <pre><code> imageView1.setImageResource(R.drawable.image1) imageView2.setImageResource(R.drawable.image2) imageView3.setImageResource(R.drawable.image3) imageView4.setImageResource(R.drawable.image4) imageView5.setImageresource(R.drawable.image5) </code></pre> <p>As you understand, there are not just 5 imageViews, but there are many more and I want to write it in a loop. I am having problems because <code>R.drawable.imageX</code> is integer not string.</p>
java android
[1, 4]
497,478
497,479
Using jQuery filter() to get all matched .val()
<p>I have a number of textfields and I need to select the values of those textfields whose values are not equal to their <code>title</code> attribute.</p> <p><strong>Problem:</strong> With my attempt, the jQuery code below simply selects the value of the first matched textfield. How do I get all matched textfields' values?</p> <p><strong>jQuery Code</strong></p> <pre><code>var inputs = $(".input").filter(function() { return $(this).val() != $(this).attr('title'); }).val(); console.log(inputs); </code></pre>
javascript jquery
[3, 5]
3,728,343
3,728,344
jQuery wait till function is executed
<p>I'm trying to call 2 functions. The first function includes a jQuery effect. The second function (in this case is a jQuery effect), but may only execute if the first function is executed (and finished). Can someone help me out? Thanks!</p> <p>Fox example: <a href="http://jsfiddle.net/fNH2u/1/" rel="nofollow">http://jsfiddle.net/fNH2u/1/</a></p> <pre><code>function hideSecond(){ $("#second").hide("slow"); } $("#first").click(function(){ hideSecond(); $(this).hide("fast"); }); </code></pre> <p>and the HTML:</p> <pre><code>&lt;div id="first"&gt; first &lt;/div&gt; &lt;div id="second"&gt; second &lt;/div&gt; </code></pre> <p>The function I want to call does more than just that jQuery effect. This is just an example. Putting the 2 functions together is not really what I'm looking for.</p>
javascript jquery
[3, 5]
4,395,602
4,395,603
Change button background on touch
<p>i want to change the green background of a button when this is touched without using OnTouchListener. i have this situation: i put some butons in a layer, then the layer in another layer, and the last layer in onother layer. when i touch the button the background is changing(i m using OnTouchListener right now) but if i drag the finger outside of the button and then get it out of the screen the background of the button remains the image from the state when it s touch(otherwise if i click the button and the the finnger off the button it is k the background is changing) </p>
java android
[1, 4]
785,692
785,693
Best way to Connect to SQL server 2000 with ASP 4.0 on .NET 4.0 build
<p>Can I do this using SqlClient or do I have to use the ODBC route > ? I get error's in VS but from reading through the other post it appears to be an IDE specific problem. </p>
c# asp.net
[0, 9]
47,594
47,595
submitting form with two buttons
<p>I have 2 buttons in HTML form. And both of them should submit the form. I would need to capture which button has been clicked so i can use it to perform different actions based on which button was clicked.</p> <p>I am able to submit the form with both the buttons but how would i capture which button was clicked in the php file .</p> <pre><code>&lt;INPUT type="button" name="submit" class="button" class="element_2" value="firstbutton"&gt; &lt;INPUT type="button" name="submit1" class="button" class="element_2" value="second button.. "&gt; </code></pre> <p>i am using post method in Jquery to submit the form. How can i check which HTML button was clicked in server side php script</p>
php jquery
[2, 5]
3,035,228
3,035,229
Send commands between two computers over the internet
<p>I wish to control my computer (and usb devices attached to the computer) at home with any computer that is connected to the internet. The computer at home must have a program installed that receives commands from any other computer that is connected to the internet. I thought it would be best if I do this with a web interface as it would not be necessary to install software on that computer. For obvious reasons it would require log in details.</p> <p><strong>Extra details</strong>: The main part of the project is actually a device that I will develop that connects to the computer's usb port. Sorry if it was a bit vague in my original question. This device will perform simple functions such as turning lights on etc. At first I will just attempt to switch the lights remotely using the internet. Later on I will add commands that can control certain aspects of the computer such as the music player. I think doing a full remote desktop connection to control my device is therefore not quite necessary. Does anybody know of any open source projects that can perform these functions?</p> <p>So basically the problem is sending encrypted commands from a web interface to my computer at home. What would be the best method to achieve this and what programming languages should I use? I know Java, Python and C quite well, but have very little experience with web applications, such as Javascript and PHP.</p> <p>I have looked at web chat examples as it is sort of similar concept to what I wish to achieve, except the text can be replaced with commands. Is this a viable solution or are there better alternatives?</p> <p>Thank you</p>
java php javascript python
[1, 2, 3, 7]
877,747
877,748
Slide div from x,y to x,y?
<p>When someone click on my fields on my virtual game, i get my current left and top cordinates with this:</p> <pre><code> function moveDiv(fromSeat, toSeat){ var fromTop = $('#seat-' + fromSeat).css("top"); var fromLeft = $('#seat-' + fromSeat).css("left"); var toTop = $('#seat-' + toSeat).css("top"); var toLeft = $('#seat-' + toSeat).css("left"); /** Move a div from point {"fromTop", "fromLeft"} =&gt; {"toTop", "topLeft"} **/ } </code></pre> <p>I am stuck here, i tried to make a $('...').animate({}); but could not get it working. I want div "#test" to move from point {"fromTop", "fromLeft"} => {"toTop", "topLeft"}</p>
javascript jquery
[3, 5]
247,679
247,680
Know how of Cross Domain Request in Jquery
<p>Can anyone please explain how jquery handles cross domain requests? I understand the theory that it does via script using src attribute as url. But i was trying to test the same thing in plain javascript . I need to know the sequence of activities to be done for a post request. at what stage the data is sent and script element is constructed ? I am tired of asking the same at different forums where i got to see links explaining CORS. i need a to-do solution here. Thanks</p> <p>PS: sorry if i am asking too much :)</p>
javascript jquery
[3, 5]
302,687
302,688
Is there a way to increment time using javascript?
<p>So I am storing times as '01:30:00'. I have a start time and a date time dropdown. I want the dropdown to be set to the start time + 1hr. Is there a way to add the time via javascript or jquery?</p> <p>Here's my current code:</p> <pre><code>$(".start_time").change(function(){ $(".end_time").val($(this).val()); }); </code></pre>
javascript jquery
[3, 5]
50,838
50,839
Which PHP-template to load depends on javascript support
<p>I have the following scenario:</p> <p>A multiple step registration procedure. Let's say it's 4 steps, and each step depends on previous input. This could be solved with or without Javascript.</p> <p>Without JS: A "proceed"-button is attached to each step With JS: The next part is automatically revealed to the user when previous step is done. (No "proceed"-button exists.</p> <p>The problem is: How do my template engine know which one to present? With or without proceed buttons? You can not just try to test a JS-block of code to determine if it is enabled before PHP loads the template.</p> <p>One way I've worked out is the possibility that the initial load of the visit sends an ajax-request to a file on the server which only purpose is to set $_SESSION['JS_ENABLED'] = 1 or something like that.</p> <p>I don't like this. The HTTP request for that file might very well fail leaving the site in belief that the visitor has JS disabled.</p> <p>I think I need a new approach. Please enlighten me =)</p>
php javascript
[2, 3]
5,617,633
5,617,634
jquery append works well for facebook fb:comment-counts but html() is not rendering fb:comment
<p><strong>URGENT REQUIRED</strong></p> <p><strong>using this code to load contents dynamically:</strong></p> <pre><code>function lastAddedLiveFunc() { $('div#lastPostsLoader').html(''); $.get("{/literal}{$baseurl}/{literal}indexmore.php?page="+tpage).done(function(data) { if (data != "") { $(".col-1").html( $(".col-1").html() + data ) ; } $('div#lastPostsLoader').empty() }); </code></pre> <p>this is working fine,but when i use append instead of html() ,it doesnt render fb:comments on dynamically loaded post.I have to use html() for my vote function to work you may refer my last question:[link] <a href="http://stackoverflow.com/questions/15759974/jquery-load-more-content-on-scroll-sometimes-dont-execute-javascripts">Jquery load more content on scroll ,sometimes don&#39;t execute javascripts</a></p>
javascript jquery
[3, 5]
4,446,620
4,446,621
Where can I find a plugin that will zoom in and out a div's content with a slider?
<p>Are there any plugins that allows zooming in and out a div and it's content via a slider?</p> <p>Thanks</p>
javascript jquery
[3, 5]
642,641
642,642
Send POST array
<p>i wish to send some data as array from my iphone app to server</p> <p>When i was posting single variables before i was sending the post as an NSString </p> <pre><code>NSString *post =[[NSString alloc] initWithFormat:@"userName=%@&amp;accountID=%@&amp;", username,accId]; NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:url]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody:postData]; </code></pre> <p>Now i wish to send an array of these usernames and accountIds, how do i send an NSArray in a POST and then in php on my server how can i retrieve it?</p> <p>Thanks</p>
php iphone
[2, 8]
1,373,115
1,373,116
jQuery plug-in to remap numeric keypad
<p>Is there a jQuery plug-in to remap the "dot" key in the numeric keypad? The purpose is to make it print a decimal separator, rather than a dot, in languages that use commas or other characters. I'd like to mimic the behaviour of some desktop applications like MS Excel.</p> <p>(It's okay to hard-code the output character.)</p>
javascript jquery
[3, 5]
699,845
699,846
Has anyone implemented/imitated the new gawker/lifehacker/gizmodo Layout in Javascript
<p>I'd like to implement the same layout as Gawker sites; <a href="http://lifehacker.com/" rel="nofollow">lifehacker</a> and <a href="http://gizmodo.com/" rel="nofollow">gizmodo</a>.</p> <p>If anyone can suggest a good starting point.</p> <p>--I use JupiterIt JavascriptMVC extensively.</p>
javascript jquery
[3, 5]
3,303,424
3,303,425
Simple android and ASP.NET mix
<p>I write an android application that send text data to asp.net webserver. I'm using next code to sent data via Http:</p> <pre><code>try { URL url = new URL(serverUrl); connection = (HttpURLConnection)url.openConnection(); connection.setDoInput(true); connection.setDoOutput(true); connection.setUseCaches(false); // Enable POST method connection.setRequestMethod("POST"); connection.setRequestProperty("Connection", "Keep-Alive"); connection.setRequestProperty("Content-Type", "text/plain; charset=utf-8"); output = new DataOutputStream(connection.getOutputStream()); String finalUri = sendedUrl.replace("gaburl", ""); output.writeChars(finalUri); //Toast.makeText(context, finalUri, 1000).show(); output.flush(); output.close(); } catch(Exception e) { Toast.makeText(context, e.toString(), 5); } </code></pre> <p><strong>How I can receive and display data sending by</strong> <code>output.writeChars(finalUri)</code> <strong>method in ASP.NET application ?</strong> This process should executing like descripe bellow:</p> <p>1)We have asp.net forms that are a target of sender's android method desripe earlier;</p> <p>2)Forms should read string data that sent to it and display it.</p> <p>Help please </p>
c# android asp.net
[0, 4, 9]
4,513,853
4,513,854
LinkButton does not invoke on click()
<p>Why doesn't this work?</p> <pre><code> &lt;script src="Scripts/jquery-1.3.2.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $('.myButton').click(); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:LinkButton id="ttt" runat="server" PostBackUrl="~/Default.aspx" CssClass="myButton"&gt;Click&lt;/asp:LinkButton&gt; &lt;/div&gt; &lt;/form&gt; </code></pre>
asp.net jquery
[9, 5]
4,801,667
4,801,668
Copy to clipboard using jquery for all browsers
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1390953/how-to-select-all-text-in-a-textbox-and-copy-it-to-clipboard-using-javascript-jq">How to select all text in a textbox and copy it to clipboard using JavaScript/jQuery?</a><br> <a href="http://stackoverflow.com/questions/1539641/copy-text-to-the-clients-clipboard-using-jquery">Copy text to the client’s clipboard using jQuery</a> </p> </blockquote> <p>I need a javascript, jquery function for copy to clipboard functionality. I know following code but it works in IE only:</p> <pre><code>holdtext.innerText = copytext.innerText; Copied = holdtext.createTextRange(); Copied.execCommand("Copy"); </code></pre> <p>I see some tutorials which are suggestion some swf files. I have used some of them like <a href="http://www.steamdev.com/zclip/" rel="nofollow">http://www.steamdev.com/zclip/</a> but it is not working.</p> <p>Please suggest solution to it.</p>
javascript jquery
[3, 5]
4,393,826
4,393,827
Is is possible to transform all js alert messages in modal window?
<p>I'm working on an old site and i would avoid searching&amp;replacing and i was wondering if it is possible to reaplce all alert massages function </p> <pre><code>alert('some msg'); </code></pre> <p>with a jquery modal window...</p> <p>i'm not asking how to do the modal window but if i can create a protoype to replace the function alert..</p> <p>thanks</p>
javascript jquery
[3, 5]
1,614,470
1,614,471
Access web.config key from codebehind
<p>I have a key in the web.config file like:</p> <pre><code>&lt;add key="MailFrom" value="[email protected]"/&gt; </code></pre> <p>I need to access it in the code behind.How to do this in c#?</p>
c# asp.net
[0, 9]
2,642,719
2,642,720
adding messagebox in ASP.NET
<p>How would I add a javascript MessageBox in ASP.NET in the code behind pages using C#.</p> <p>I have something like this in mind although I still cant get it quite right.</p> <pre><code>if (success == false) { HttpContext.Current.Response.Write("&lt;SCRIPT LANGUAGE=""JavaScript""&gt;alert('User name already exists')&lt;/SCRIPT&gt;"); } </code></pre> <p>Kind regards</p>
c# javascript asp.net
[0, 3, 9]
3,756,784
3,756,785
Create another div and variable onChange using jQuery
<p>below is a code that gets the value of the selected option and shows the php file in the div. How can I add another file and another div (secondfile) to be displayed ?</p> <pre><code>$('#firstresult').empty().addClass("loading") .load(val + '.php', { value: val }, function(){ $("#firstresult").removeClass("loading"); })); $('#secondresult').empty().addClass("loading") .load(val + 'b.php', { value: val }, function(){ $("#secondresult").removeClass("loading"); </code></pre>
php javascript jquery
[2, 3, 5]
4,942,417
4,942,418
Add onClick Action Listener for dynamically created CheckBox
<p>I am creating CheckBoxes Dynamically in an Android Class <strong><em>(Not Activity)</em></strong>. So I need to add <code>onClick</code> Action Listener to my checkboxes, how to implement this.</p> <p>I am using following code.</p> <pre><code>public class DataBaseAdapter extends SQLiteOpenHelper { ...//onCreate and onUpdate ... ... public TableLayout getAllAlarmList(Context con) { TableLayout tb = new TableLayout(con); TableRow[] tr = new TableRow[maxCount]; //maxCount is the number of rows CheckBox[] check = new CheckBox[maxCount]; //maxCount is the number of rows in the database. for(int i=0;i&lt;maxCount;i++) { tr[i]=new TableRow(con); check[i]= new CheckBox(con); //con is Context class passed as argument. check[i].setText(Integer.toString(i)); check[i].setId(100+i); // I have to add onClick Action Listener here. tr[i].addView(check[i]); tb.addView(tr[i]); } return tb; } } </code></pre> <p>For this I am also keeping a track of the ids of the checkboxes.</p>
java android
[1, 4]
4,860,280
4,860,281
Scrolling div within bounds
<p>I have div with images inside it and need to scroll it left and right. I,ve managed to get the scrolling to work, but now I need it to stay in the displayable area. I need to use jQuery</p> <pre><code>$('#next').click(function() { $('#slides').animate({left: '-=80',}, 2000, function() {}); }); $('#prev').click(function() { $('#slides').animate({left: '+=80',}, 2000, function() {}); }); </code></pre> <p>The two "buttons" is used to scroll. How do I get the slides' position.left to stay between 0 and -1120 ?</p> <p>This will be the bottom of my slideshow. The large images will be at the top. How do I change the z-index of a div ?</p>
javascript jquery
[3, 5]
4,456,468
4,456,469
Programatically press the Power button to lock the screen
<p>On Android, I see that to make action like as press Back button, we use:</p> <pre><code>super.onBackPressed(); </code></pre> <p>I want make action like as press Power button, but I can not find the method to do that. I searched on Google and this site but do not received a useful result.</p> <p>How can I display the lock screen with Keyguard when I press the button on my activity?</p>
java android
[1, 4]
5,156,399
5,156,400
Clicking a div that opens a corresponding div
<p>I am dynamically creating a div class for a set of divs. The class corresponds with the class of another set of divs (also dynamically generated). I gave them the same class so as to be able to click on the div that displays by default and have the corresponding div appear (which is not displayed by default). The setup would be something like this with divs 'foo' being displayed and 'bar' being hidden</p> <pre><code>&lt;div id="foo" class="one"&gt;1&lt;/div&gt; &lt;div id="foo" class="two"&gt;2&lt;/div&gt; &lt;div id="foo" class="three"&gt;3&lt;/div&gt; &lt;div id="bar" class="one"&gt;One&lt;/div&gt; &lt;div id="bar" class="two"&gt;Two&lt;/div&gt; &lt;div id="bar" class="three"&gt;Three&lt;/div&gt; </code></pre> <p>I dont know how to put this in jQuery. I know it is going to be a click function, I'm just not sure how to grab a class where I'm not sure what the value is. Any help is really appreciated!</p>
php jquery
[2, 5]
1,336,221
1,336,222
How fast is Javascript compared to Java?
<p>Are there any tests that compare Javascript's performance with Java's?</p> <p>UPDATE: Since everyone is asking why the hell this question, here is some context :)</p> <p>As you all know - I hope - Javascript nowadays doesn't only reside in the web client but also in the web server with node.js.</p> <p>It could also be run in mobile phones and dekstops with appcelerator and phonegap.</p> <p>It could also be used substantially in the web browser to make the user experience first class like with desktop applications.</p> <p>But Java could do these things too, running applets on the web client, and on mobile phones. It's also a language for the backend with many frameworks to choose between.</p> <p>Since each one of them could almost/entirely replace each other in the mentioned area, I want to know the performance difference between them, for every case I described:</p> <ul> <li>Client: Java Applets vs Javascript</li> <li>Server: Java EE vs Javascript with Node.js + Express</li> <li>Mobile phones: Java ME vs Javascript with Phonegap / Appcelerator</li> <li>Desktop: Java SE vs Javascript with Phonegap / Appcelerator</li> </ul> <p>I hope the context is more clear now.</p>
java javascript
[1, 3]
5,805,006
5,805,007
jQuery - Very simple issue i cant sort out (class's and an alert)
<p>I think this may be my most embarrassing question to date.</p> <p>Why does this not work? Ive been staring at this for around half an hour now and im starting to get desperate</p> <p><a href="http://jsfiddle.net/FU6Jb/" rel="nofollow">http://jsfiddle.net/FU6Jb/</a></p> <p>My HTML</p> <pre><code>&lt;a class="closedialog" href="#"&gt;Close&lt;/a&gt; </code></pre> <p>My JavaScript</p> <pre><code>$(document).ready(function() { $("a.closedialog").click(function() { alert("Test") }); }); </code></pre>
javascript jquery
[3, 5]
3,353,564
3,353,565
How to return error from webmethod?
<p>suppose i am going to call aspx page method decorated with webmethod. so i need to know that how to return error from my webmethod as a result jquery error portion will be invoked and show the error detail?</p> <p>below is a sample code by which i am calling my aspx method.</p> <pre><code>$.ajax({ type: "POST", url: "./Default.aspx/GetData", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: AjaxSucceeded, error: AjaxFailed }); [WebMethod] public static string GetData() { } </code></pre> <p>so please help in terms of code that how to return error from my webmethod as a result jquery error portion will be invoked and show the error detail...guide me in detail. thanks</p>
jquery asp.net
[5, 9]
2,881,637
2,881,638
how to set image height and width?
<p>i want one information how will we set constant image height and width using javascript means if we set height 50 and width 65 so only that much size image will insert if user start to insert more than condition one alert message will come iam write code but it not work </p> <pre><code> if((obj.FileUp.value.width&gt;67)&amp;&amp;(obj.FileUp.value.height&gt;380)) { alert("Height of image should not be more than 67 And Width of image should not be more than 380"); return false; //alert(obj.FileUp.width) } </code></pre>
javascript asp.net
[3, 9]
5,717,024
5,717,025
What is the difference between loading JS in FF & IE
<p>I am currently working on a heavy web page. This page contains 5 tabs &amp; each tab contains a gridview &amp; multiple server controls. When i work in Edit mode I fetch data from database for all tabs using Ajax request &amp; fill the controls using Jquery. This works fine in mozilla but IE 6 takes time to fill the controls because i think mozilla FF fills the controls sequentially but IE fills all controls asynchronously &amp; displays when all controls are filled what is the best way to fill the controls in IE 6 faster way? </p>
jquery asp.net
[5, 9]
2,203,367
2,203,368
asp.net error as "Too many characters in character literal"
<p>I am calling a javascript on index change of a DropDownList, i do as follows</p> <pre><code>&lt;asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="toggleVisibility('Button1');"&gt; </code></pre> <p>I get the error during compiling as for the above line of code</p> <pre><code>Too many characters in character literal </code></pre> <p>Can anyone help me solve this issue?</p>
javascript asp.net
[3, 9]
3,792,494
3,792,495
scriptmanager.registerstartupscript not working on scriptManager.RegisterPostBackControl buttonclick
<p>Actually I wanted to display the Loading message when I m fetching data from backend and putting in .CSV file, when I was using HttpContext, I was getting error - </p> <pre><code>Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. </code></pre> <p>To avoid the above error I wrote the script in the PageLoad(see below),and now I m not getting the above error but the hide() is not working. I have given the code below.</p> <p><strong>CODE</strong>:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page); scriptManager.RegisterPostBackControl(this.btnDownloadReport1); } protected void btnDownloadReport_OnClick(object sender, EventArgs e) { GetPCNMEReportInCSV(); ScriptManager.RegisterStartupScript(this, typeof(string), "script", "$('.loading').hide();", true); } </code></pre>
jquery asp.net
[5, 9]
3,199,039
3,199,040
Alert after checked input checkbox
<p>I want after click on link <code>append</code> html input checkbox in a class, after it when clicked on input checkbox getting alert <code>is checked</code>.</p> <p>I tried as following code but dont work for me:</p> <p><strong>DEMO:</strong> <a href="http://jsfiddle.net/HsveE/" rel="nofollow">http://jsfiddle.net/HsveE/</a></p> <h1>HTML</h1> <pre><code>&lt;a href="#" id="ho"&gt;Click Me&lt;/a&gt; &lt;div class="hi"&gt;&lt;/div&gt; </code></pre> <h1>jQuery</h1> <pre><code>$('#ho').on('click', function(e){ e.preventDefault(); $('.hi').append('&lt;input type="checkbox" id="isAgeSelected"/&gt;'); }) $(".hi input[type=checkbox]").on('click',function () { alert('is checked') }) </code></pre> <p>How can fix it?</p>
javascript jquery
[3, 5]
5,417,639
5,417,640
Content Provider Example using two android applications
<p>I want to insert or delete the values in another <code>android</code> applications database from my current <code>android</code> application. I searched a lot. Everybody saying that use <code>content provider</code> its not used with two applications all used with in a application. At last i come to the conclusion that its impossible to access the database of the other application from current application.</p>
java android
[1, 4]