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
871,132
871,133
jQuery/javascript - list box item deselect/show/hide not working in IE?
<p>I have the following javascript/jquery code, the purpose of which is to -</p> <ol> <li>Deselect a previously selected item from the list, if the selected item value exists in an array</li> <li>Hide/display each list item dependent on whether they exist in the array</li> </ol> <p></p> <pre><code>var list = $(row).find("select &gt; option") var selectedValue = $(row).find("select &gt; option:selected") if (selectedValue) { if ($.inArray(selectedValue[0].value, dependencyListItemValues) == -1) { alert('deselect'); $(selectedValue).attr("selected", false); } } $(list).each(function () { var value = this.value; if (value != "") { if ($.inArray(value, dependencyListItemValues) &gt; -1) { alert('show'); $(this).show(); } else { alert('hide'); $(this).hide(); } } }); </code></pre> <p>This is working fine in chrome and firefox, but not in IE9. When running in IE, the alert lines are hit, but the following lines seemingly do nothing:</p> <pre><code>$(selectedValue).attr("selected", false); $(this).show(); $(this).hide(); </code></pre> <p>Do I need to use alternative code so this will work in IE?</p>
javascript jquery
[3, 5]
2,140,783
2,140,784
Strange issue with checking if( double > double)
<p>Here is my code</p> <pre><code> /** * Remove a file or software * @param filename name such as MyApp.apk * @return boolean true if executed */ private boolean isNewer(File toinst) { boolean isnew = false; //String[] commands = new String[]{"ls /system/app/app_*"}; String[] commands = new String[]{"cd /system/app" , "ls | /system/bin/busybox grep app"}; String currentapk; // check that our app is already on there and what version try{ currentapk = doCommand(commands).get(2); } // if there isn't one of our app on LIKELY ONLY IN THE CASE OF FIRST INSTALL catch(Exception ex) { isnew = true; } // get the version number of the one to install double toinstnum = getNumberFromName(toinst.getName()); // get the version number of the one on the device currently double currentinstnum = getNumberFromName(currentapk); // if the toinstall version is larger return true if(toinstnum &gt; currentinstnum) { isnew = true; } else { isnew = false; } return isnew; } </code></pre> <p>This method looks at what <code>app_No</code> is on the device and sees if the one I am inputing is new.</p> <p>This gets to line <code>if(toinstnum &gt; currentinstnum)</code> showing both as <code>2.0</code> then the code will jump back up to the <code>Catch(Exception ex)</code> and set it to true instead of continuing.</p> <p>Can anyone see where I have made a mistake? how is <code>2.0 &gt; 2.0</code> throwing an Exception.</p>
java android
[1, 4]
2,889,106
2,889,107
Can't find folder or file created with Android App with windows file exlorer
<p>I'm creating a directory and a text file on the sdcard in one of my apps because I want to be able to move it to my computer for analysis. But I can't find the folder or the file I'm creating on my sdcard using the file browser on my computer. I CAN find and read the file using my phones file manager but not using the file browser in windows. So the file and folder are succesfully created and I can write to the file, I can also find and read the file using the file manager on my phone but I can't find either directory or file using my computer.</p> <p>I have a uses permission for the application to allow it to write to external storage.</p> <p>This is the code I use to create the file and directory.</p> <pre><code>String fileName = "testFil.txt"; String path = Environment.getExternalStorageDirectory().getAbsolutePath()+"/PulsApp"; File appDirectory = new File(path); appDirectory.mkdirs(); File file = new File(path, fileName); try { file.createNewFile(); } catch (IOException e) { } </code></pre> <p>Does anyone know what the problem is and how to fix it? I really need to be able to write files to my sdcard so I can transfer them to my computer.</p> <p>I am completely baffled by this problem since all the research I've done point to that everyone else is doing the same thing.</p>
java android
[1, 4]
1,063,300
1,063,301
Replacing a small chunk of a larger string
<p>So I've got the following code written to go through every Anchor, get it's href, and if it contains the old address, attempt to replace the old base with the new one. While there's obviously an issue long before this code with the site, i need a quick and dirty solution to this problem, so this code is what I'm going for.</p> <p>So, the code below doesn't work. .Replace apparantly needs a full match, so it would find "foo" in the sentence "foo is good" but not "foo" in "fooIsGood".</p> <pre><code>$('a').each(function() { var addressSwitch = $(this).attr("href"); if (addressSwitch){ var test = addressSwitch.indexOf("http://www.oldaddress.com"); if ( test == 0){ addressSwitch.replace("http://www.oldaddress.com/", "www.newaddress.com"); $(this).attr("href" , addressSwitch); } } }); </code></pre> <p>So, what would work?</p> <p>Thanks in advance!</p>
javascript jquery
[3, 5]
5,637,057
5,637,058
How can I divide a dataset equally into two parts?
<p>I'm programming on Asp.net and C#.</p> <p>I have a Dataset which is populated by records from database. On my design page, I have two Datagrids.</p> <p>How can I equally divide the records inside the Dataset so they can be bound to two separate datagrids?</p>
c# asp.net
[0, 9]
5,890,129
5,890,130
Can I call another PHP script and pass $_GET variables?
<p>I currently call a PHP script from javascript and return the json data. This works great from the client. I need to make the same call to the PHP script from inside another PHP file. Can this be done?</p> <p>My current jquery call looks like this:</p> <pre><code>$.post('functions/get_testdata.php?type='+Type, function(data) { .... }); </code></pre> <p>From inside another PHP script I'd like to call: </p> <pre><code>'functions/get_testdata.php?type='.$type </code></pre> <p>I could just copy the contents of get_testdata to my other PHP page but I'd like to maintain just one code block for this. </p> <p>Any thoughts or am I missing the obvious?</p>
php jquery
[2, 5]
3,211,121
3,211,122
how can i use javascript caching ?
<p>i wanna add cache to my javascrip array. how can i add cache this;</p> <pre><code> Page.ClientScript.RegisterArrayDeclaration("Ilan", "'" + carName+ "'"); Page.ClientScript.RegisterArrayDeclaration("Ilan", "'" + where+ "'"); Page.ClientScript.RegisterArrayDeclaration("Ilan", "'" + item["Mark"].ToString() + "'"); Page.ClientScript.RegisterArrayDeclaration("Ilan", "'" + item["modelyili"].ToString() + "'"); Page.ClientScript.RegisterArrayDeclaration("Ilan", "'" + carType+ "'"); </code></pre>
c# javascript asp.net
[0, 3, 9]
1,792,143
1,792,144
An example of javascript__dopostback
<p>Please provide an example of calling the <code>__doPostBack</code> function.</p>
c# javascript asp.net
[0, 3, 9]
4,670,378
4,670,379
Why can't I access properties with dot notation?
<p>I'm new to javascript. Here's what I'm looking at: </p> <p><img src="http://i.stack.imgur.com/NMi5h.png" alt="enter image description here"></p> <p>Within my code, I'm trying to access those properties. I've tried the following: </p> <pre><code>result.id result["id"] result.CardId result.cardId </code></pre> <p>All of which return null. Any idea how I can access these properties? </p> <p>Here's the full code: </p> <pre><code>// Step 1: Get test side (this fnc is re-used several times) function getTestSide(succeed) { var msgPrefix = 'GET' + testMsgBase; $.ajax({ type: 'GET', url: testUrl, success: function (result) { onCallSuccess(msgPrefix); okAsync(result.id === testSideId, "returned key matches testSide Id."); if (typeof succeed !== 'function') { debugger; start(); // no 'succeed' callback; end of the line return; } else { debugger; succeed(result); }; }, error: function (result) { onError(result, 'whoops'); } }); }; </code></pre>
javascript jquery
[3, 5]
4,390,764
4,390,765
ASP.NET File Download problem
<p>In our application we often have a button that will perform a post back, get data, convert it into excel/PDF, and stream it to the client via Response.Write or Response.BinaryWrite. This works perfectly fine when we are in a popup or not.</p> <p>We just implemented a new feature that creates a msg file. However, we are getting an error when streaming to the client (same code as before) - "Internet explorer cannot open this site". We redirect to another page with a query string parameter stating which file to get the bytes for and stream it to the client. </p> <p>Has anyone experienced this before? This feature works fine on the dev machines but in staging (Server 2003, IIS 6) it's broken and throwing this error</p>
c# asp.net
[0, 9]
3,685,578
3,685,579
javascript in asp.net
<p>Hai Friends I n my case i am reterieving some datas from the backend in that one patricular column in the gridview should be hidden.it should not shown in the screen.in case if is use visible="false" the datas not showing in when clicking the event the text box how to do this pls help me.</p> <h2>source code:</h2> <pre><code>&lt;asp:BoundField DataField="GLAC_NAME" HeaderText="A/cNo"&gt; &lt;ItemStyle Width="200px" /&gt; &lt;/asp:BoundField&gt; </code></pre> <p>this particular column i have to hidden should not shown to the user </p> <h2>code begin:</h2> <pre><code>protected void GridLedger_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onMouseDown", "var str = document.getElementById('" + e.Row.ClientID + "').cells[1].innerText; document.getElementById('"+TextBox1.ClientID+"').value = str;"); } } catch (System.Exception ex) { throw ex; } } </code></pre> <p>here is the code begin in this what i should mention in cell value</p>
c# asp.net
[0, 9]
2,771,002
2,771,003
How can I select with jQuery elements that have been included using Javascript?
<p>So I have a menu that gets added using this function:</p> <pre><code>function loadContent() { $(".navbar").load("navigation.html"); } </code></pre> <p>navigation.html looks like this:</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href="home.html" class="first"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="calendar.html"&gt;Calendar&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="profile.html"&gt;Profile&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="charts.html" class="last"&gt;Energy Charts&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>but when I try to select something in that menu and add a class, let's say:</p> <pre><code>$('.navbar a').addClass('activeState'); </code></pre> <p>it doesn't work in Chrome, I think because the DOM needs to be refreshed or something, I really don't know...</p>
javascript jquery
[3, 5]
3,606,602
3,606,603
Using javascript/jquery to submit a form upon the loading of a page
<p>I wrote an array to pass variables in the GET to a search page. The search page only has 4 fields but I'm only passing the most important variables, first name and last. Here is the array:</p> <pre><code>&lt;?php echo "&lt;td&gt;&lt;a href='" . matry::base_to('test/trace', array('first'=&gt;$patient-&gt;first , 'last' =&gt;$patient-&gt;last)) . "'&gt;&lt;ul class='controls'&gt; &lt;li id='check_orders'&gt;&lt;`span class='symbols'&gt;L&lt;/span&gt;&lt;span class='label'&gt;Skip Trace&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt;&lt;/a&gt;&lt;/td&gt;";?&gt; </code></pre> <p>When the page loads i'm just echoing the _GET to pre populate the first and last input fields on that page.. </p> <p>What I'm looking for is a script that will execute the search with the first and last name fields populated as that page loads automatically. Additionally, when the search is executed it's populating in an iframe. (forgot about that part)~!</p> <p>I tried using: </p> <pre><code>&lt;script&gt;document.getElementById('stack').submit();&lt;/script&gt; &lt;form action='http://xxxx.yyyyyyy.com/stuffhere' name='es' target="my_iframe" id="stack"&gt; </code></pre> <p>with no avail. </p>
php javascript jquery
[2, 3, 5]
702,978
702,979
Looping all text fields in a form and convetring to decimal/currency
<p>I have 12 fields in a form and I'd like to loop through all these 12 text fields and convert the value in those fields to decimal/currency. These 12 (Jan to Dec) fields are numeric (currency US$) only.</p> <p>And in the end, show in another field:</p> <pre><code>txtPendingBalance.value = TotalValue.text - (Sum(Field1..12)) </code></pre> <p>What's the best way doing it? jQuery? pure js?</p> <p>Thanks</p>
javascript jquery
[3, 5]
4,657,190
4,657,191
How to switch between 2 CSS colors with jQuery?
<p>I want a string of text to change color from default to #c30 when I click a button somewhere on the page, and it changes back to default when I click the button again.</p> <p>My code looks like this:</p> <pre><code>$("#button").click(function() { var anno = $(#text); if (anno.css('color') == '#c30') { anno.css('color', ''); } else { anno.css('color', '#c30'); } }); </code></pre> <p>But it doesn't seem to work on FF3. Works in IE though. Any idea?</p>
javascript jquery
[3, 5]
1,105,291
1,105,292
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]
5,333,922
5,333,923
how to make an plugin that will allow users to view previously uploaded ppt,.xls,.pdf,.doc etc
<p>I require a script or something that I can plugin to my webpage that will allow users to view previously uploaded ppt,.xls,.pdf,.doc etc in some sort of a slide show format with prev page,next page, embed and download capabilities. How can i achieve this? I am using .net, What java script should i use with dot net code?</p>
javascript asp.net
[3, 9]
952,353
952,354
How to transfer a variable to a external js file in javascript?
<p><strong>Case 1:</strong> I have passed a variable to a external js file like this</p> <pre><code>&lt;script type="text/javascript"&gt; var data1, data2, data3, data4; function plotGraph() { var oHead1 = document.getElementsByTagName('HEAD').item(0); var paramScript = document.createElement("script"); paramScript.type = "text/javascript"; paramScript.setAttribute('data1', data1); paramScript.setAttribute('data2', data2); paramScript.setAttribute('data3', data3); paramScript.setAttribute('data4', data4); oHead1.appendChild(paramScript); var oHead = document.getElementsByTagName('HEAD').item(0); var oScript = document.createElement("script"); oScript.type = "text/javascript"; oScript.src = "js/graph.js"; oHead.appendChild(oScript); } &lt;/script&gt; </code></pre> <p><strong>Case 2:</strong> I even tried passing it like this using jquery</p> <pre><code>&lt;script type="text/javascript"&gt; function plotGraph() { var data1, data2, data3, data4; $.getScript("js/graph.js"); } &lt;/script&gt; </code></pre> <p>In the first case which is working but i had to create global variables… I dont want this…</p> <p>In the second case which is not working has local variables which are not recognized in the js file..</p> <p>How shall i do it? Any suggestions?</p>
javascript jquery
[3, 5]
358,504
358,505
Python error No JSON object could be decoded
<p>Windows 7 - Python26 - IDLE - Android SDK - Hello World</p> <p>AVD for the host emulator loaded</p> <pre><code>import android droid = android.Android() droid.makeToast("ssssssss") Traceback (most recent call last): File "&lt;pyshell#2&gt;", line 1, in &lt;module&gt; droid.makeToast("ssssssss") File "C:\Python26\android.py", line 58, in rpc_call return self._rpc(name, *args) File "C:\Python26\android.py", line 49, in _rpc result = json.loads(response) File "C:\Python26\lib\json\__init__.py", line 307, in loads return _default_decoder.decode(s) File "C:\Python26\lib\json\decoder.py", line 319, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Python26\lib\json\decoder.py", line 338, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded </code></pre> <p>Have looked everywhere to find an answer to this.</p> <p>Anybody know what is causing this?</p>
android python
[4, 7]
916,411
916,412
Add Session Value to HiddenField placed in web control
<pre><code>&lt;asp:HiddenField ID="mypostID" runat="server" Value=""/&gt; </code></pre> <p>I wanted to ask if I could do something like:</p> <pre><code>&lt;asp:HiddenField ID="mypostID" runat="server" Value="&lt;% Response.Write(Session["ïd"])%&gt;"/&gt; </code></pre> <p>I cannot access the session from the user control code behind but if I put a Respose.Write on the page itself it shows the session value.</p> <p>Thanks</p>
c# asp.net
[0, 9]
5,733,442
5,733,443
jquery resize window to fit contents
<p>I have a simple popup window that shows 300x300px picture, I set up the size of the window to be 350x350px, but depending on the browser I either get scroll bars or extra white space. Is there some jquery function that would resize the browser window just to fit the content without any scroll bars or white space, no matter what browser?</p>
javascript jquery
[3, 5]
5,214,105
5,214,106
Java/C++ performance
<p>Hello guys I've started learning Java and I've heard something about it's slowness. For an experiment I wrote two programms in C++ and Java which seem to be equal</p> <pre><code>import java.util.*; class Java { public static void main(String args[]) { long beg = System.currentTimeMillis(); for (int i = 0; i &lt; 200000000; ++i) { } long end = System.currentTimeMillis(); System.out.println(end - beg); } } </code></pre> <p>outputs 334</p> <pre><code>#include &lt;cstdio&gt; #include &lt;ctime&gt; int main() { double beg = clock(); for (int i = 0; i &lt; 200000000; ++i) { } double end = clock(); printf("%f\n", (end - beg) / double(CLOCKS_PER_SEC) / 1000.0); return 0; } </code></pre> <p>outputs 0.000810</p> <p>I am a little confused. Is Java really that slow or I'm doing something wrong?</p>
java c++
[1, 6]
144,943
144,944
JQuery Toggle True or False on data-filter
<p>I have an image link which I want to use as a toggle button.</p> <pre><code>&lt;img id="myToggleButton" src="myToggle.jpg" /&gt; And what I want it to toggle is this: &lt;ul id="listview" data-filter="true"&gt; So, basically I need to change from data-filter="true" or data-filter="false" and so on. </code></pre> <p>How can I get this working using JQuery?</p>
javascript jquery
[3, 5]
1,312,825
1,312,826
javasript in another file with php in it
<p>i want to tidy up my index.php. i have some scripts which i want to move to another files.</p> <p>atm i come to this, i hava javascript which has php in it to echo values from database. i came to solution, copy that to another php file, like script.php, and just include it with php.</p> <pre><code>&lt;!-- AUTO complete --&gt; &lt;script src="/pages/JQuery/js/jquery-1.8.3.js"&gt;&lt;/script&gt; &lt;script src="/pages/JQuery/js/jquery-ui-1.9.2.custom.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" type="text/css" href="/pages/JQuery/css/no-theme/jquery-ui-1.10.3.custom.css" /&gt; &lt;?php include './pages/skripti/autocomplete.php'; //pats skripts ?&gt; </code></pre> <p>and</p> <pre><code>&lt;script&gt; jQuery(function($) { var availableTags = [ &lt;?php $names = $db-&gt;query("SELECT * FROM names"); while ($name = $names-&gt;fetch_object()) { echo '"' . $name-&gt;rs_name . '",'; } ?&gt; ]; $( "#autocomplete" ).autocomplete({ source: availableTags }); }); &lt;/script&gt; </code></pre> <p>The question is: How good solution it is?</p>
php javascript
[2, 3]
1,981,168
1,981,169
Dismissing an Android popupwindow
<p>I use a popupwindow in my activity that i would like to dimiss, but i see the following documentation about the dimiss() method for popup windows:</p> <p>public void dismiss () Since: API Level 1</p> <p>Dispose of the popup window. This method can be invoked only after showAsDropDown(android.view.View) has been executed. Failing that, calling this method will have no effect. See Also</p> <pre><code>* showAsDropDown(android.view.View) </code></pre> <p>If I don't want to show the popup with showAsDropDown how else can u remove it from the main view?</p>
java android
[1, 4]
3,773,078
3,773,079
How can I pass an object in addition to json from my ajax function?
<p>I have the following code:</p> <pre><code>function submitHandler(dialog) { dialog.$submits.disableBt(); dialog.$message.addMessage("loading", "&lt;li&gt;Contacting Server, please wait ...&lt;/li&gt;"); $.ajax({ url: href, dataType: 'json', type: 'POST', data: dialog.$form.serializeArray() }) .done(onSubmitDone()) .fail(onSubmitFail()); } </code></pre> <p>This function has a parameter of dialog which is an object looking like this:</p> <pre><code>{ $modal: $modal, $form: $modal.find('.form'), $message: $modal.find('.message'), $submits: $modal.find('.submit-button'), href: $form.attr('data-href') }; </code></pre> <p>I need to send the dialog object to the onSubmitDone and onSubmitFail functions. Previously I was not using an object to hold $modal, $form etc and the variables were all available to all functions that were enclosed within an outer function</p> <p>Two questions:</p> <p><strong>Is it sensible to pass things around as parts of an object or should I just declare these variables at the top of an outer function.</strong> </p> <p>If I do pass around the object how can I pass it to the following:</p> <pre><code>function onSubmitDone(json) { json = json || {}; if (json.Success) { switch (action) { </code></pre> <p>I understand that my json object is passed but how can I pass the dialog object also?</p>
javascript jquery
[3, 5]
3,291,765
3,291,766
Is there an equivalent for var_dump (PHP) in Javascript?
<p>We need to see what methods/fields an object has in Javascript.</p>
php javascript
[2, 3]
126,305
126,306
Using jQuery to select multiple values of attributes across a collection of objects
<p>In this example I am selecting a bunch of 'A's within 'LI's (it doesn't really matter what I am selecting, just know I am returning a group of 'A' tags that all have the same "attribute structure").</p> <p>I was wondering how I would go about returning a comma delimited list (or object/collection) of "attribute values". I was wondering if it can be done without a loop.</p> <pre><code>alert($(".bzsUserSelector-selected A")); // this returns "[object]", which is expected alert($(".bzsUserSelector-selected A").length); // this returns "4", which is expected for my example alert($(".bzsUserSelector-selected A").attr("myAttribute")) // this returns "aaa", which is the value of the FIRST "myAttribute" only, I don't want that. // I want something like this "aaa, bbb, ccc, ddd" </code></pre> <p>I would like that to return an object of 4 items and just the 4 values of the "myAttribute" attribute.</p> <p>I hope this is clear enough. Thanks in advance. - Mark</p>
javascript jquery
[3, 5]
3,855,132
3,855,133
Javascript/Asp.net - Changing values based on selection/enter data in other fields
<p>We got an old app DotNet 2.0 - asp.net, developers left and I'm new to DotNet/Javascript - so need help</p> <p>Query:</p> <p>Got 3 drop downs of Date Calender Field</p> <p>On selection/enter date in first Date field - second and third date field should get populated</p> <p>So lets we enter 1st Date field : 01-Jan-12 and then second should add 30 days to it which will be then 01-Feb-12 and third date field should be 01-March-12</p> <p>So on entering date in first field, will automatically populate the second and day field.</p> <p>I know I need to write onclick and javascript function - can any one please help.</p> <p>Regards</p>
javascript asp.net
[3, 9]
2,129,056
2,129,057
Make SoundManager 2 play next song
<p>I read in the documentation that this is the line of code I would need in order to do this. </p> <pre><code>soundManager.play('aDrumSound',{ multiShotEvents: true, // allow onfinish() to fire for each "shot" (default: only fire onfinish() for last shot.) onfinish:function() { soundManager.play('aCymbalSound'); } }); </code></pre> <p>Problem is my soundmanager is playing search results that are uniquely generated for each search results. For example I'll have a list of 20 songs. So what parameters would I have to put instead of 'aDrumSound' and 'aCymbolSound'. Furthermore do I add that line of code in my script within the header?</p>
php javascript
[2, 3]
2,442,653
2,442,654
jQuery - How is this timeline made?
<p>I can't figure out how to make an interactive timeline with javascript. Does anybody know how the timeline on top of this website is made? <a href="http://www.ivillage.com/getting-ready-try/6-t-124335" rel="nofollow">http://www.ivillage.com/getting-ready-try/6-t-124335</a></p> <p>For a screencap: <a href="http://gyazo.com/9aa8295ac65a8b54796a34df7ea35b6c.png" rel="nofollow">http://gyazo.com/9aa8295ac65a8b54796a34df7ea35b6c.png</a></p> <p>Thanks a million!</p>
javascript jquery
[3, 5]
2,938,869
2,938,870
jQuery: how to return the appended element
<p>I use jQuery API <code>append()</code> to add a new element:</p> <p><code>$(selector).append('&lt;div class="test"&gt;&lt;/div&gt;')</code></p> <p>I want the expression return the just appended element for my further use, however it returns <code>$(selector)</code>. So, how can I let jQuery to return the just appended element to avoid re-selecting it?</p>
javascript jquery
[3, 5]
962,367
962,368
Pure Javascript application with ASP.NET
<p>In your opinion, what's the best way to create the server side to a pure Javascript application with ASP.NET?</p> <p>WCF rendering JSON? IHttpHandler?</p> <p><strong>Update</strong></p> <p>Like GMail, that runs in the browser (with a lot of Javascript) and submit and receive data with Ajax, for example.</p>
javascript asp.net
[3, 9]
1,446,188
1,446,189
Function to match a field
<p>I am trying to return a value (ID), matching another field (Type) in the array.</p> <p>Object array:</p> <pre><code>a: Array[3] 0: Object 1: Object Desc: "Desc" ID: "V000002" Type: "SK" __proto__: Object 2: Object length: 3 </code></pre> <p>find method:</p> <pre><code>ns.find = function (a) { $.each( a, function (k, v) { if (v.Type == 'SK') { return v.ID } } ); return ""; } ; </code></pre> <p>It doesn't work even though there is a match. what's wrong!</p>
javascript jquery
[3, 5]
4,248,649
4,248,650
Shorten JQuery Snippet
<p>I have the following JQuery snippet:</p> <pre><code>(someVar.next().length == 0)?someVar.fadeOut().end().find("ul").first().fadeIn():someVar.fadeOut().next().fadeIn(); </code></pre> <p>There is a fair amount of code duplication between the two results of the conditional - i.e. someVar.fadeOut() and .fadeIn() on both.</p> <p>I would ideally like something like this:</p> <pre><code>someVar.fadeOut().((someVar.next().length == 0)?end().find("ul").first():next()).fadeIn(); </code></pre> <p>But that doesn't work :) Safari developer tools reports a syntax error but I'm not skilled enough to work out how to do it properly.</p> <p>If it can't be shortened, then just saying that is fine :)</p>
javascript jquery
[3, 5]
4,168,963
4,168,964
Foolproof way to get Android User's Personal Phone Number?
<p>I currently use this:</p> <pre><code>TelephonyManager telephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); String phoneNumber = telephonyManager.getLine1Number(); </code></pre> <p>Which works like 85% of the time. But on some phones it returns nothing. I believe this is due to differences in Sim cards.</p> <p>Is there somewhere else on the Android platform to gain this information reliably?</p> <p>Thanks</p>
java android
[1, 4]
5,367,992
5,367,993
pause until event/function is completed with jquery or javascript
<p>Is there a way to check if a function has completed its operation using either javascript or jquery?</p> <p>I'm trying to make a counter that slows down as the number gets bigger(decelerating the output, if you will), using setTimeout. As you know, the larger the number the longer the delay (in setTimeout). </p> <p>What I'm trying to do is click a button, then current loop iteration is printed on the screen. This loop number is used as the setTimeout delay, so while the number is low it will quickly rush through, as it gets bigger the delay is larger thus making it print the number more slowly (since this number is the delay and the larger the delay the less often it prints it). </p> <pre><code>Here is the logic I'm trying to accomplish 1. Click button 2. Initiate loop 3. trigger function to set timeout 4. set timeout triggers a function to print the loop iteration # 5. Repeat step 3 until the number of set iterations is completed </code></pre> <p>Well, as you can see when the timeout is set the loop will continue, but there will be a timeout delay. Is there any way that I can put a pause-type function that waits until the timeout function is completed, and then continue onto the next iteration?</p> <p>Here is my code</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form&gt; &lt;input type="button" value="Display alert box" onclick="setMessage()" /&gt; &lt;script&gt; function setMessage(){ for(i=0;i&lt;5000;i++){ var b = i; timeMsg(); //some sort of puase here checking until timeMsg &amp; docWrite are completed, then continue to the next iteration } } function timeMsg(){ var t=setTimeout("docWrite()",b); } function docWrite(){ document.write(i); } &lt;/script&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript jquery
[3, 5]
4,975,066
4,975,067
Object reference not set to an instance of an object error message
<p>What is wrong with my code? I recently posted a question about <a href="http://stackoverflow.com/questions/11754489/calculation-in-code-behind">Calculation in code behind</a> and I tried Vinoth's answer but it gives me an error at this line:</p> <pre><code>bool isChaffeurUsed = (bool)Session["IsChaffeurUsed"]; </code></pre> <p>error message is: <strong>Object reference not set to an instance of an object.</strong></p> <p>Please tell me what should i do. Many thanks and have a nice day.</p>
c# asp.net
[0, 9]
3,708,109
3,708,110
How to remove the duplicate rows by summing up the required columns in a datatable
<p>Hi all I am having my data table which is from my database is as follows</p> <pre><code>Name Total XYZ 20 XYZ 20 ABC 20 </code></pre> <p>Now I would like to have my data table as follows</p> <pre><code>Name Total XYZ 40 ABC 20 </code></pre> <p>I tried this <code>linq</code> from here <a href="http://stackoverflow.com/questions/13062875/find-duplicate-and-merge-record-into-single-datatable-c-sharp">Find duplicate and merge record into single datatable c#</a> which works fine but as I am having my values from database I don't know the type of the variable so can some one help me and give me the solution in non-linq way</p>
c# asp.net
[0, 9]
4,810,288
4,810,289
... (three dots) in jQuery?
<p>I was looking at the documentation page for jScroll plugin for jQuery (<a href="http://demos.flesler.com/jquery/scrollTo" rel="nofollow">http://demos.flesler.com/jquery/scrollTo</a>) and I noticed this :</p> <pre><code>$(...).scrollTo( $('ul').get(2).childNodes[20], 800 ); </code></pre> <p>So, what does the three dots in jQuery mean ? I have never seen this selector before</p> <p>EDIT :</p> <p>DOM Element</p> <p>This is from the source HTML. Viewing the source for the following links :</p> <pre><code>Relative selectorjQuery objectDOM ElementAbsolute numberAbsolute </code></pre> <p>all give the same implementation.</p> <p>EDIT : I didnt look at the attribute clearly, its for the title attribute. I assumed its the href attribute. Feel silly asking this question now :) Thanks for the answers</p>
javascript jquery
[3, 5]
5,636,272
5,636,273
type @, show a name list like facebook status box
<p>in facebook status box, if you type '@', then a list of friends' names appear. I am trying to implement such a status box.</p> <p>But the problems are:</p> <p>On typing '@', where should the 'div's location be and how to show the list? I just can't make anything out of it.</p> <p>I went through <a href="http://stackoverflow.com/questions/7497824/how-to-highlight-friends-name-in-facebook-status-update-box-textarea">this</a> question of SOF, but that actually does not discuss that.</p> <p>Anybody there to shed light on it as much as possible?</p> <p>My choice is jquery.</p>
javascript jquery
[3, 5]
961,730
961,731
if x = 3 and z is unassigned, why does z = x-- - --x evaluates to 2?
<p>if <code>x = 3</code> and z is unassigned,<br> why does <code>z = x-- - --x</code> evaluates to 2?</p> <p>my professor is lecturing about this at the moment, and I'm currently stuck with this dilemma. Unfortunately, no one can explain why it happens.</p>
c# javascript
[0, 3]
5,983,806
5,983,807
jQuery Functions Syntax Difference
<p>How does:</p> <pre><code>(function($) { /// code })(jQuery) </code></pre> <p>differ from <code>$(document).ready(function()</code> in jquery?</p> <p>I know what the <code>ready</code> function does. It awaits until the HTML is loaded before it starts. However, does <code>(function($)</code> do the same?</p>
javascript jquery
[3, 5]
3,755,626
3,755,627
How does the StackOverflow CMD-K key binding work?
<p>How does StackOverflow take highlighted text and toggle between code formatted and not code formatted? Any ideas how they approach this problem? Thanks</p>
javascript jquery
[3, 5]
4,683,973
4,683,974
Android: Create List<Map<String, List<ObjectType>>
<p>Can someone help me solve my problem, how to create <code>List&lt;Map&lt;Integer, List&lt;MyType&gt;&gt;</code> in while cycle. I'm slecting data from database and I'd like to add objects, that accomplish select's where condition into List and then put it into <code>Map&lt;Integer, List&lt;MyType&gt;</code> where map key is in my case integer from database column order_num. Finally I wuold like to add all created maps into List. Method's return value is <code>List&lt;Map&lt;Integer, List&lt;MyType&gt;&gt;&gt;</code>.</p> <p>Here's my part of source:</p> <pre><code>while (cursor.moveToNext) { int id = cursor.getInt(cursor.getColumnIndex("item_id")); int orderNum = cursor.getInt(cursor.getColumnIndex("order_num")); String name = cursor.getString(cursor.getColumnIndex("item_name")); list.add(new Item(id, orderNum, name); } </code></pre> <p>now I'd like to add this list into Map where key is <code>orderNum</code> and value is <code>List&lt;Item&gt;</code>.</p>
java android
[1, 4]
102,102
102,103
Getting the value of a DropDownList after client side javascript modification
<p>I have a cascading DropDownList in an application. The contents of the cascading drop down list is small enough that there isn't a need to use AJAX/JSON to go to a database to get the content, I am just doing it in client side javascript like this (this is a subset of the data):</p> <pre> <code> var val = typeList.value; var applyTimeList = document.getElementById('clientid'); for (var q=applyTimeList.options.length; q>=0; q--) applyTimeList.options[q]=null; if (val == 'AutoRoute') { myEle = document.createElement('option') ; myEle.value = 'SOP Processed'; myEle.text = 'SOP Processed'; applyTimeList.add(myEle) ; } else if (val == 'Tier1Retention') { myEle = document.createElement('option') ; myEle.value = 'Study Processed'; myEle.text = 'Study Processed'; applyTimeList.add(myEle); myEle = document.createElement('option') ; myEle.value = 'Study Restored'; myEle.text = 'Study Restored'; applyTimeList.add(myEle); myEle = document.createElement('option') ; myEle.value = 'Study Archived'; myEle.text = 'Study Archived'; applyTimeList.add(myEle) ; } </code> </pre> <p>When I attempt to access the DropDownList on the client side I can't get the value selected, it always returns 0 as the index:</p> <pre> <code> int index = RuleApplyTimeDropDownList.SelectedIndex; </code> </pre> <p>How can I get the value selected on the Server side after modification?</p> <p>Note: I already know the answer to this, I just want the question/answer posted on SO.</p>
asp.net javascript
[9, 3]
1,043,299
1,043,300
Intercept when new rows are added to a table
<p>Within a legacy application I have a table to which initially only a subset of available rows is displayed in order to fit the current page size. When the user scroll down the div containing the table, automatically new rows are added via javascript.</p> <p><strong>What I need to do is to be able to intercept <em>when</em> these rows are added to the table.</strong> <br/>At the beginngin I polled through the setInterval method in order to execute my logic, but unfortunately this interfers with the business logic of the legacy application.</p> <p>I tried the following code (applied once at the div container and once to the table) without any results:</p> <pre><code>$(document).ready(function() { $('#myWebGrid1').change(function() { alert('changed!'); }); }); </code></pre> <p>I tried also the resize() method, but it does not work either since by scrolling the div size does not change.</p>
javascript jquery
[3, 5]
3,999,329
3,999,330
Javascript: Setting variable to work in attr line
<p>Kinda of a noob question, can't seem to solve it, but I may just be tired.</p> <p>What I'm trying to do is insert a PHP variable in to Javascript (Jquery), and then that variable in to an attr line.</p> <p>The script I'm using to create the variable:</p> <pre><code>$.extend({ getUrlVars: function(){ var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&amp;'); for(var i = 0; i &lt; hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; }, getUrlVar: function(name){ return $.getUrlVars()[name]; } }); </code></pre> <p>Setting the variable:</p> <pre><code>var searchresult = $.getUrlVar('s'); </code></pre> <p>And then, where I'm stuck, inserting the variable within the line so that'll come out correctly when I send it off to my iframe.</p> <pre><code> $(function() { $("#searchbutton").click(function() { $("#theiframe").attr("src","http://whateverdomain.com/index.php?s=VARIABLE HERE WITHIN JAVASCRIPT"); }) }) </code></pre> <p>I know, kinda beginners question going here, but I admit it, I'm stuck.</p>
php javascript jquery
[2, 3, 5]
4,592,507
4,592,508
Javascript Adding Two Fields Together for Tiggzi App
<p>I need some help putting together a line of javascript. I Am looking to add the values of two different fields and display them in a text area. The fields are "AP" and "MP" and the text are is "TotalCost".</p> <p>I am not sure of how to make his happen at all. Please help!</p>
javascript jquery
[3, 5]
2,240,120
2,240,121
circle PNG image making it interactive on android
<p>Well i have a circle image that i am using imageview to show in the app </p> <p>I need someway to make parts of this image interactive like event should fire depend on which part of the image the user is clicking , i.e. if user is clicking on the center of the image or on one of the pie slices of the circle image </p> <p>how this could be achived ?!</p>
java android
[1, 4]
669,300
669,301
Detect specific devices within android application
<p>Is there a way of telling, within the application the spcific device model that the app is being run from. For example for it to be able to tell the difference if the app is running on a Nexus S or a HTC Desire or the Samsung Galaxy Tab?</p>
java android
[1, 4]
2,103,767
2,103,768
jquery on method not working with window or document
<p>Pretty simple code:</p> <p>html:</p> <pre><code>&lt;div id="wrap" style="background-color:gray; height:2000px;"&gt; &lt;/div&gt; </code></pre> <p>js:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ $(document).on('mouseup', function(e) { console.log(" mouse up \n"); }) }); &lt;/script&gt; </code></pre> <p>I replaced <code>$(document)</code> with <code>$(window)</code> but with no effect.</p> <p>Browser: FF 13.0</p> <p>How to make it work ?</p> <p><strong>EDIT:</strong></p> <p><strong>OMG</strong>, I used scroll instead of clicking the mouse to get the 'mouseup' event. What a silly mistake !!!</p>
javascript jquery
[3, 5]
4,476,880
4,476,881
jquery modal / dialog
<p>I want to use some jquery plugin to show modal. I have been using fancybox but it has problem that second fancybox can not be shown on one. I have used jquery UI but it has images and I want some plugin which is not dependent on images. Here are my requirements:</p> <ol> <li>to show on page load</li> <li>to show on ajax success</li> <li>customizable with custom css</li> <li>second modal/dialog can be shown on first one.</li> </ol> <p>Please suggest.</p>
javascript jquery
[3, 5]
1,331,161
1,331,162
javascript working of closure
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/14645471/javascript-closure-not-working-as-it-should">javascript closure not working as it should</a> </p> </blockquote> <p>see the first code:</p> <pre><code>var count = 0; (function addLinks() { var count = 0; //this count var is increasing for (var i = 0, link; i &lt; 5; i++) { link = document.createElement("a"); link.innerHTML = "Link " + i; link.onclick = function () { count++; alert(count);//here all the paragraph updates the same variable }; document.body.appendChild(link); } })(); </code></pre> <p>when the link gets clicked the counter variable keeps on increasing for each link element .This is an aspected reult</p> <p>Second:</p> <pre><code>var count = 0; $("p").each(function () { var $thisParagraph = $(this); var count = 0; //this count var is increasing too.so what is different between them .They both are declared within the scope in which closure was declared $thisParagraph.click(function () { count++; $thisParagraph.find("span").text('clicks: ' + count); $thisParagraph.toggleClass("highlight", count % 3 == 0); }); }); </code></pre> <p>Here the closure function is not working as aspected.On each click on the paragraph element ,the counter var is increased but that increment is not displayed on click on second paragraph element?What is the reason behing this?Why is this happening?the count variable is not increasing for each paragraph element.At my previous question i didn't got the satisfied answer so i requestioned</p>
javascript jquery
[3, 5]
3,549,931
3,549,932
how to bulk print using asp.net, c#
<p>when i enter roll no it displays name, marks obtained in all subjects and pass/fail of the student and i can print clicking on print button. But the problem is i want to print all students record continuously by clicking only one time on [Print] button. I used loop like this</p> <pre><code>for(int i=1;i&lt;studentno.count;i++) { bindgrid(i); // i is the roll no of the student Session["ctrl"] = Panel1; ClientScript.RegisterStartupScript(this.GetType(), "onclick", "&lt;script language=javascript&gt;window.open('Print.aspx','PrintMe','height=300px,width=300px,scrollbars=1');&lt;/script&gt;"); } </code></pre> <p>but it prints only the last one.</p>
c# asp.net
[0, 9]
4,867,554
4,867,555
Running check on empty input type of text
<p>How would I run a check after a keypress function to see if an inputs value was empty so I can do another action.</p> <p>For example.</p> <pre><code> $("input[name=amount]").keypress(function() { $("table[name=apply]").show(); }); </code></pre> <p>I want to hide the table if the user deletes all the keystrokes.</p>
javascript jquery
[3, 5]
5,826,956
5,826,957
How to get rid of diacriticial marks (~ from ñ, ' from á and é)?
<p>I want to convert diacritical characters (ñ, á, é, ...) to plain characters . I would prefer a simple regexp solution (as in: an oneliner) in JavaScript or jQuery.</p>
javascript jquery
[3, 5]
2,995,991
2,995,992
Website in pure C#
<p>I want to learn how to make a website with C#. I know PHP, but I like the C# language better. I have tried learning how to make a website in ASP.NET which so far has really frustrated me because I really don't like ASP at all (even less than I like PHP). Something about it drives me completely insane to the point where I am having a hard time forcing myself to learn it. Is there a way to just immediately transfer control away from ASP to C# and then do everything from C#, including outputting HTML and other stuff when necessary like you would in PHP? In other words I like the PHP way of website programming but prefer the C# language. Any help will be appreciated.</p>
c# php asp.net
[0, 2, 9]
39,267
39,268
Update information as needed
<p>On the page I have a list of HTML-elements, each element has its status: </p> <pre><code>&lt;ul&gt; &lt;li&gt; &lt;span class='status'&gt;ok&lt;/span&gt; &lt;span class='content'&gt;content1&lt;/span&gt; &lt;/li&gt; &lt;li&gt; &lt;span class='status'&gt;not ok&lt;/span&gt; &lt;span class='content'&gt;content2&lt;/span&gt; &lt;/li&gt; &lt;li&gt; &lt;span class='status'&gt;ok&lt;/span&gt; &lt;span class='content'&gt;content3&lt;/span&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>This list is very big.</p> <p>I need to update the status (without reloading the page).</p> <p>What are the ways to do this?</p> <p>I wanted to use AJAX. And periodically poll the database and get out status, etc. What could be more options?</p> <p><strong>Update1:</strong></p> <p>I think that the use of Ajax in this way is not very good: the status change very rarely, and a list of objects is large.</p>
php javascript
[2, 3]
3,981,615
3,981,616
Put LinkButton on GridView's cell and run javascript function when user click on it
<p>I add a GridView on page in UpdatePanel and put a Panel in one of cells and add LinkButton from code behind to this panel like below</p> <pre><code>Panel pnl = (Panel)GridView1.Rows[i].Cells[4].FindControl("pnlSteps");//pnlSteps is Panel's Id LinkButton lnk = new LinkButton(); //... pnl.Controls.Add(lnk); </code></pre> <p>when user click on each LinkButton I want to run a javascript's function,how can i do it?</p>
javascript asp.net
[3, 9]
5,104,466
5,104,467
Error text on edittext box appears to be white
<p>I have the following code:</p> <pre><code>EditText edit = (EditText) findViewById(R.id.bluetractor); if (edit.getText().toString().equals("Blue Tractor")) { Toast.makeText(getApplicationContext(), "Correct", Toast.LENGTH_LONG).show(); } else { edit.setError("Incorrect"); } </code></pre> <p>But when I click the button that executes the code, it all works well apart from the fact the writing (the "Incorrect") appears to be white and therefore it is not visible on the white background of the error popup. Can anyone help? Thanks</p>
java android
[1, 4]
713,194
713,195
What's the difference between $.add and $.append JQuery
<p>I was wondering and couldn't get any best documentation that what's the difference between $.add and $.append when we have single element to add or append to a container.</p> <p>Thanks in Advance</p>
javascript jquery
[3, 5]
1,783,079
1,783,080
How can i make disable Notification in preference in android
<p>How can i make disable Notification in preference in android?(if the user do not like the see the notification but the notification still in the app) i already doing check Box in xml</p> <pre><code> &lt;CheckBoxPreference android:title="Disable Notification" android:defaultValue="true" android:key="checkbox" android:summary="Check the Box"/&gt; </code></pre> <p>but i do not know what is the code to disable Notification, Thank you in advance !</p>
java android
[1, 4]
4,691,082
4,691,083
calling jquery from a javascript function
<pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; function display(id) { // open jquery modal window using jquery UI } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I want to open jquery modal window using jquery UI whenever the function display is called using normal javascript function call . </p> <p>I can use .diolog function of jquery UI , but how to call it from within javascript function ?</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,471,123
3,471,124
I heve to get an entire path of an image by clicking a button
<p>I want the entire image path when I click the image</p> <p>I tried </p> <pre><code>$_SERVER['HTTP_HOST']; $_SERVER['PHP_SELF']; $_server['PHP_PATH]; </code></pre> <p>etc</p> <p>I am getting the page path only, not the image path</p>
php javascript
[2, 3]
1,173,777
1,173,778
Control of forward and backward button of browser
<p>I have a login page and once a person is logged in , he should not be allowed to move back to login page.<br> So , can someone tell me how to disable backward/forward button of browser ?</p>
c# asp.net
[0, 9]
3,374,002
3,374,003
How to work with multiple CSS properties?
<p>Is it possible to work with CSS properties?</p> <p>For instance:</p> <pre><code>-webkit-transform: scaleX(-1) scaleY(-1) </code></pre> <p>Can I easily remove <em>scaleX(-1)</em> or add something new, without rewriting the whole <em>-webkit-transform</em> or changing classes?</p>
javascript jquery
[3, 5]
3,055,545
3,055,546
how to split a query with 'AND' and/or 'OR' arguments in it in jquery?
<p>how to split a query with 'AND' and/or 'OR' arguments in it in jquery? Suppose iam having </p> <pre><code>A=( 1=1,FirstName='aaa' or FirstName='bbb' and FirstName='ccc' or FirstName='ddd' and FirstName='eee') </code></pre> <p>Now i want to split 'A' with 'and' &amp; 'or' and get the result as below</p> <pre><code>A=(FirstName='aaa' , FirstName='dddd' , FirstName='bbb' , FirstName='dddd' , FirstName='cccc') </code></pre> <p>but the thing is i may or may not have 'or' in the query, still it should produce a o/p with all the values after split. Please help. Different types of queries could be as below:</p> <pre><code>A=( 1=1,FirstName='aaa' or FirstName='bbb' and FirstName='ccc' or FirstName='eee' and FirstName='fff') A=( 1=1,FirstName='aaa' and FirstName='bbb' and FirstName='ccc' and FirstName='ddd' and FirstName='fff') A=( 1=1,FirstName='aaa' or FirstName='bbb' or FirstName='ccc' or FirstName='ddd' or FirstName='fff') </code></pre> <p>Query is not static i just gave an example, it could be any string.</p>
javascript jquery
[3, 5]
3,149,306
3,149,307
How come .parent() is not working?
<pre><code>&lt;div class="apple"&gt; &lt;div class="abc"&gt; &lt;input id="go"&gt; &lt;/div&gt; &lt;/div&gt; $("#go").click(function(){ $(this).parent('.apple').hide(); // this doesn't work. $(this).parent().parent().hide(); //this works }); </code></pre> <p>I want the <code>.parent('.apple')</code> to work.</p>
javascript jquery
[3, 5]
2,289,430
2,289,431
Is there a way to get domain level user groups the logged in user belongs to in asp.net/c#?
<p>in asp.net/c#</p> <p>is there a way to find all of the AD level user groups from a given domain in which the logged in user belongs to?</p> <p>e.g. i have a domain level user and few groups. i want to pass in the domain name and the logged in user's user name and get a list of AD groups of that particular domain.</p>
c# asp.net
[0, 9]
4,152,055
4,152,056
Prevent CTRL V in HTML Editor Ajax Control MS
<p>Hello I am using in C# HTML EDITOR Control MS Ajax.</p> <p>I would like to know if is possible FORCE the control HTML EDITOR to DO NOT ACCEPT text from PASTE (short cut ctrl+v or menu command).</p> <p>My aim is to prevent css inline code to be added to the text.</p> <p>I would allow user to add text if pasted just with HTML EDITOR Button PASTE PLAIN TEXT.</p> <p>Any ideas? Do you think it is a good solution or any others= thansk</p>
c# asp.net
[0, 9]
3,608,589
3,608,590
.live disable double click
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6201242/is-there-a-way-to-force-event-to-fire-only-once-on-given-element-per-element-n">is there a way to force event to fire only once on given element (per element, not whole document) when using live()?</a> </p> </blockquote> <p>This is my code:</p> <pre><code>$('.answerx').live('click', function(){ comprobar($(this).attr('name') , "\'" + $(this).attr('id') + "\'"); }) </code></pre> <p>I want to make it so that once the click has been made, the user is unable to click and run the function again as the function running more than once is making my program go crazy.</p> <p>So is there a way to make it so that after clicking once it disables further clicks on specific element whose id is <code>$(this).attr('id')</code></p>
javascript jquery
[3, 5]
4,330,657
4,330,658
ASP.Net search subdirectory
<p>How do I search a sub directory in my ASP.Net web site?</p> <p>I know if this was a regular Winform project, I could easily get it by the following:</p> <pre><code>Environment.CurrentDirectory </code></pre> <p>or</p> <pre><code>System.IO.Directory.GetCurrentDirectory() </code></pre> <p>then</p> <pre><code>string[] directories = System.IO.Path.Combine(Environment.CurrentDirectory, "Portfolio") </code></pre> <p>How do I build the path to a subfolder called Portfolio in ASP.Net? </p> <p>I'm having a problem building everything from the <a href="http://??????????/Portfolio" rel="nofollow">http://??????????/Portfolio</a>. How do I find the ?????? part?</p> <p>I tried the code above but got a completely different directory...</p> <p>I don't want to hard code everything before that last subfolder because it will be different on another server.</p>
c# asp.net
[0, 9]
5,200,789
5,200,790
asp.net textbox adding BehaviorID
<p>can I add BehaviorID attribute for asp.net textbox and use it to be recognize by java script??</p> <p>On other word, I want to to apply some java script function on asp.net text box and I want to let the java script find the asp.net text box by the BehaviorID.</p>
asp.net javascript
[9, 3]
375,455
375,456
How To Pass a PHP Variable To Javascript
<pre><code>&lt;html&gt; &lt;head&gt; &lt;?php $your_name=$_POST['name']; ?&gt; &lt;script language="javascript"&gt; function fash(at1,at2) { alert(at1+at2); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;?php echo $your_name; echo '&lt;script language="javascript"&gt;fash("the key is: "+'&lt;?php echo $your_name; ?&gt;');&lt;/script&gt;'; ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The output is:</p> <blockquote> <p>the key is : undefined</p> </blockquote> <p>How can I fix this?</p>
php javascript
[2, 3]
2,552,268
2,552,269
Automatically send an email from an app
<p>My app is really progressing now, much of it due to you guys and your willingness to help out so thanks alot. As to my problem, I want my app to email a user each day as a kind of reminder additional to notifications. However I can't find a way to do this without user intervention, I am aware I can use a send intent but I want it to be automated without the user needing to do anything other then select the option in the settings to enable email reminders. I don't actually know if this is even possible but I'm hoping that is. If it isn't maybe there's a way i can hack it together to achieve the desired outcome?</p>
java android
[1, 4]
63,051
63,052
Asp.Net : How to provide email preview for the different email providers
<p><p>In my asp.net application I need to show the email preview of created email, like with gmail the email will display some different formatting &amp; with hotmail it will some different formatting...</P></p> <p> So, How to provide email preview for the different email providers like gmail, hotmail rediffmail etc...</p> <p><br/> Is their any tool with which I can render in my application?</p>
c# asp.net
[0, 9]
3,216,933
3,216,934
Clearing all fields in an asp.net form
<p>I have an <code>asp.net</code> <code>form</code>. In this <code>form</code>I want to clear all the data what I entered in <code>textbox</code>,<code>dropdownlist</code> etc. So how can I do without going to each textbox and set the value.</p> <p>like <code>TextBox1.Text="";</code> etc. How can i clear all values of a form ?</p>
c# asp.net
[0, 9]
3,115,589
3,115,590
append data in existing file in android and read it
<p>i want to append a text in an existing file but i can not read it(i can read the first inserted data) i do not know what is the mistake . this is the write code(save in file):</p> <pre><code> FileOutputStream fos = openFileOutput("test",MODE_APPEND); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(text); oos.flush(); oos.close(); </code></pre> <p>and this is how to read(read the data from the file):</p> <pre><code> FileInputStream fis = openFileInput("test"); ObjectInputStream ois = new ObjectInputStream(fis); String s=(String) ois.readObject(); while(s != null){ Toast.makeText(getApplicationContext(),s, Toast.LENGTH_SHORT).show(); s=(String) ois.readObject(); Toast.makeText(getApplicationContext(),s, Toast.LENGTH_SHORT).show(); } </code></pre> <p>pleas help me !! are there a wrong in writing or in the reading code </p>
java android
[1, 4]
5,440,191
5,440,192
TouchPaint Android API
<p>All I am trying to do is use this API to write on the screen.</p> <p>I am very new to programming, I can run this code, and play with it, but which class would I need to edit if I wanted to add a save button to it.</p> <p>Once you draw something you would save it to your phone, how would I do this? Can you point me to some code please?</p> <p><a href="http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.html" rel="nofollow">http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.html</a></p>
java android
[1, 4]
2,074,145
2,074,146
is using the $() shortcut in jQuery bad practice?
<p>I was recently listening to a podcast which made a comment on using <code>$()</code> vs using <code>jQuery()</code>. It was stated that every time <code>$()</code> was used a new object would be created and when <code>jQuery()</code> was used this was not the case. I google'd around but couldn't find anything on this specific topic.</p> <p>I realize this is not a typical example, but the following is the reason I am interested in the answer to this question.</p> <p>I have a page that the user will keep loaded in a browser for a whole day (24 hours, or possibly longer) and updates are done to the DOM every ~5 seconds as the result of an AJAX call via jQuery (the AJAX call portion is irrelevant to updating the DOM - the update to the DOM is done using a string of HTML and a call on a jQuery object to <code>.empty()</code> and then <code>.html()</code>).</p> <p>Since hearing this, I subsequently switched all of the <code>$()</code> calls to <code>jQuery()</code> calls, but I would like to know:<br> Is using <code>$()</code> vs using <code>jQuery()</code> a bad practice? Is there a negligible difference between the two? Or is it actually noticeable on larger projects?</p>
javascript jquery
[3, 5]
3,604,743
3,604,744
How to convert timespan to pm or am time?
<p>I'm storing user time in UTC time and when I show it I need to convert it to am pm time.</p> <p>Here is example in database I have 17:00:00 convert to 5:00 pm</p> <p>Here is the code what I came up so far but it's not working</p> <pre><code>var time = DateTime.ParseExact(object.Time.ToString(), "HHmm", CultureInfo.CurrentCulture).ToString("hh:mm tt"); </code></pre>
c# asp.net
[0, 9]
1,160,598
1,160,599
Selecting a value from drop down changes the next drop down list
<p>Hi Guys I am ruby on rails developer and have no idea about javascript or Jquery.</p> <p>I have a select tag like this :</p> <pre><code>&lt;select name="form[city]" id="form_city"&gt; &lt;option value=""&gt;Select Office&lt;/option&gt; &lt;option value="WA - Washington PD"&gt;WA - Washington PD&lt;/option&gt; &lt;option value="CA - California PD"&gt;CA - California PD&lt;/option&gt; &lt;option value="NY - NewYork PD"&gt;NY - NewYork PD&lt;/option&gt; &lt;/select&gt; </code></pre> <p>When a user selects for example <strong><em>CA - California PD</em></strong> from the above select tag, the next select tag which will be below it should have a drop down list like this :</p> <pre><code> &lt;select name="form[cityselected]" id="form_cityselected"&gt; &lt;option value="CAF"&gt;CAF&lt;/option&gt; &lt;option value="CAL"&gt;CAL&lt;/option&gt; &lt;option value="CAU"&gt;CAU&lt;/option&gt; &lt;option value="CAS"&gt;CAS&lt;/option&gt; &lt;/select&gt; </code></pre> <p>Thus a Javascript or JQuery function has to be used to collect the option selected in "form[city]" and to append F,L,U,S characters to the first two characters from "form[city]" select tag to the second select tag -> form[cityselected].</p> <p>Thanks a lot in advance</p>
javascript jquery
[3, 5]
319,975
319,976
How do you dynamically update your Android application?
<p>I am new to android development, but I am wondering how an android application like ESPN Scorecenter or maybe a news application dynamically updates without the user having to do this manually. Will changing/updating the apk file automatically change the user's android app or will they have to update the version?</p>
java android
[1, 4]
2,427,109
2,427,110
Dynamically changing css style in c#?
<p>I have some link buttons in which I am dynamically adding a style to it. I am doing the following in a method:</p> <pre><code>LinkButton lb = new LinkButton(); lb.Style["font-weight"] = "bold"; </code></pre> <p>When the another link is clicked, it should unbold the link button that is bold and bold the currently clicked one, so in the method that is doing this, I have tried:</p> <pre><code>lb.Style["font-weight"] = "none"; </code></pre> <p>The above does not work though, the previously selected link stays bold.</p> <p>I just realized the possible problem. I am creating multiple links and what it looks like is that since all the links are named lb, it never removes the bold. I am trying to think of a way for it to remember the previously selected link and to only unbold that one.</p>
c# asp.net
[0, 9]
3,880,608
3,880,609
fetching only new rows from mysql with jquery ajax
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2788975/jquery-ajax-load-new-content-when-available">jquery/ajax load new content when available</a> </p> </blockquote> <p>i have a table named news with 3 fields i.e (id, news, time) and i have a setInterval after every 3mints to fetch news from google or any news site ....</p> <p>now i want to fetch only new rows inserted after every 5 minutes...with jquery $.ajax()...how can i do that...</p> <p>do i reload the whole table or there is a way to fetch only the new ones...</p>
php jquery
[2, 5]
32,344
32,345
C# String.Format() Equivalent in PHP?
<p>I'm building a rather large Lucene.NET search expression. Is there a best practices way to do the string replacement in PHP? It doesn't have to be this way, but I'm hoping for something similar to the C# String.Format method. </p> <p>Here's what the logic would look like in C#.</p> <pre><code>var filter = "content:{0} title:{0}^4.0 path.title:{0}^4.0 description:{0} ..."; filter = String.Format(filter, "Cheese"); </code></pre> <p>Is there a PHP5 equivalent?</p>
c# php
[0, 2]
980,375
980,376
On JavaScript + asp.net
<p>In my asp.net page i have java script calendar,on which i want the selected date &amp; then that date has to passed to the code behind's method. How should it be done???</p>
asp.net javascript
[9, 3]
2,704,130
2,704,131
Which is the best lightweight jquery plugin to make cross browser round corner without using image?
<p>Round corner should be compatible with all <strong>IE versions</strong> also.</p> <p>From one plugin i want to make round corner button, text input field, round corner tab, round corner div, round corner table etc.</p> <p>Although i use <a href="http://www.dillerdesign.com/experiment/DD%5Froundies/" rel="nofollow">http://www.dillerdesign.com/experiment/DD%5Froundies/</a></p> <p>but it has slow rendering in IE8 and i thought if I'm already using jquery library then to use any jquery plugin would be better and lighter.</p>
javascript jquery
[3, 5]
4,718,725
4,718,726
extract line from javascript
<p>I need to extract this line of code from a script i am retrieving via ajax..</p> <p>this line <code>new Date(2010, 10 - 1, 31, 23, 59, 59)</code> from </p> <pre><code>jQuery(function () { jQuery('#dealCountdown').countdown({ until: new Date(2010, 10 - 1, 31, 23, 59, 59), serverSync: serverTime, timezone: +11, compact: true, format: 'HMS', expiryUrl: BASE, layout: ' </code></pre> <p>Is it possible to do this with jquery. The jquery selector won't let me manipulate script tags.</p> <p>Any help would be greatly appreciated.</p>
javascript jquery
[3, 5]
1,157,318
1,157,319
jquery adding decimal numbers
<p>I'm trying to add together decimal numbers but when i alert the variable <code>finalnumber</code> i get zero. The variable <code>number</code> is a decimal number. How do i solve this so that variable <code>finalnumber</code> is the sum of all <code>number</code>?</p> <pre><code>var finalnumber = 0; $('#chosen-keyword-container').find('.keyword-row').each(function() { var number = $(this).find('td:last').find('input[name=bid-price[]]').val(); var finalnumber = parseInt(number) + parseInt(finalnumber); });​ </code></pre>
javascript jquery
[3, 5]
1,924,031
1,924,032
MS DRM License Acquisition
<p>I need to acquire ms drm license to play a video. It requires custom data, laurl and header to send to acquire the license.</p> <p>Is there any client library in java or javascript or any method to acquire it?</p>
java javascript
[1, 3]
1,074,799
1,074,800
C#: Base64 encoding
<p>Can anyone please let me know where I made a mistake in this code? This code is written in C#.NET. I need to write an algorithm for encoding a string using base64 format using C#.NET, and then decoded with base64_decode() using PHP. Please see the snippit below:</p> <pre><code>System.Security.Cryptography.RijndaelManaged rijndaelCipher = new System.Security.Cryptography.RijndaelManaged(); rijndaelCipher.Mode = System.Security.Cryptography.CipherMode.CBC; rijndaelCipher.Padding = System.Security.Cryptography.PaddingMode.Zeros; rijndaelCipher.KeySize = 256; rijndaelCipher.BlockSize = 128; byte[] pwdBytes = System.Text.Encoding.UTF8.GetBytes(_key); byte[] keyBytes = new byte[16]; int len = pwdBytes.Length; if (len &gt; keyBytes.Length) len = keyBytes.Length; System.Array.Copy(pwdBytes, keyBytes, len); rijndaelCipher.Key = keyBytes; rijndaelCipher.IV = keyBytes; System.Security.Cryptography.ICryptoTransform transform = rijndaelCipher.CreateEncryptor(); byte[] plainText = Encoding.UTF8.GetBytes(unencryptedString); byte[] cipherBytes = transform.TransformFinalBlock(plainText, 0, plainText.Length); return Convert.ToBase64String(cipherBytes); </code></pre>
c# php
[0, 2]
5,479,373
5,479,374
How can I view jquery success message after the form submit in php?
<p>I want to view a jquery success message after the form submit in php. I tried following code. But its not appearing. But when I code it in html it is working.But it is not after submiting. How can I achieve it?</p> <p>here is my javascript code in php</p> <pre><code> &lt;?php if(isset($_POST['aaa']) and $_POST['aaa']=="Submit"){ echo '&lt;html&gt; &lt;style type="text/css" media="screen"&gt; &lt;!-- .container {width: 670px; margin: 10px auto;} .messagebox {background-color: #F5F5F5;padding:5px;margin:10px 0px;border: 1px solid #DBDBDB;} .errorbox {color:#000;background-color:#ffeded;padding:5px;margin:10px 0px;border:1px solid #f27c7c;} .confirmbox {background-color:#F2FFDB;color:#151515;border:1px solid #9C6;margin:10px 0px;padding:5px;} --&gt; &lt;/style&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script &gt; &lt;!-- $(document).ready(function() { $("#messageBox").addClass("messagebox");setTimeout(function(){ $("#messageBox").fadeOut("slow")}, 4000); }); function messagebox(){ $("#messageBox").removeClass().addClass("confirmbox").html("Item has been saved").fadeIn(2000).fadeOut(4000); } function alertbox(){ $("#messageBox").removeClass().addClass("errorbox").html("Oops, there was an error!").fadeIn(2000).fadeOut(4000); } --&gt; messagebox(); &lt;/script&gt; &lt;body&gt; &lt;div class="messagebox" id="messageBox" style="display:none;"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt;'; } ?&gt; </code></pre>
php javascript jquery
[2, 3, 5]
2,190,007
2,190,008
Can I check whether Java is enabled from PHP
<p>I would like to detect whether java is enabled in the user's browser when they use my website(php).</p> <p>If java is enabled a certain div loads on the website if not another div loads. </p> <p>I do the following:</p> <p>in the PHP header file: (so whatever loads it checks whether java is enabled)</p> <pre><code>&lt;?php $no_java=0;?&gt; &lt;noscript&gt;&lt;input type="image" src="whatever.jpg" id="java_checker" value="1"&gt;&lt;/noscript&gt; </code></pre> <p>This a 1px by 1px transparent image which can't be seen but it's better than a text box which can be seen. </p> <pre><code>if(java_checker==1){ $no_java=1; }else{ $no_java=1 } </code></pre> <p>I've been programming in PHP for a few months now. I know that the <code>if(java_checker==1)</code> is not right but I don't know how to check the value without submitting a form etc... </p> <p>Anyone could tell me how to do it? the <code>value="&lt;?php $no_java=1;?&gt;"</code> is not good because the php part seems to load regardless to the <code>&lt;noscript&gt;</code> tags :( </p> <p>Any idea? Or any other idea how I could "tell" php that there is no java so do whatever... </p>
php javascript
[2, 3]
1,818,830
1,818,831
How can I update a breadcrumb string after a link is clicked?
<p>I have a navigation menu for my CMS and underneath it is a breadcrumb trail. How can I update this breadcrumb trail with a new string when a link is clicked?</p> <p>Here is my code:</p> <p><a href="http://jsfiddle.net/ZMpkv/1" rel="nofollow">jsfiddle.net/ZMpkv/1</a> </p> <p>For some reason the dropdowns aren't showing but when you click on a link in the dropdown I'm trying to find out how I can have it update the breadcrumb with a specific string. </p> <p>I know that with the jQuery I'd have to have it make a AJAX request but not sure what else I'm missing.</p>
php jquery
[2, 5]
5,468,725
5,468,726
What is causing a nullreference exception in this code?
<p>I try to add a new "Order" to my Session. I begin create a session in my Global.aspx file under Session_Start:</p> <pre><code>Session.Add("Cart", new WebShopData.Order()); </code></pre> <p>At my login page i make a new Session:</p> <pre><code> Session["userID"] = "User"; ((Order)Session["Cart"]).UserID = userID; </code></pre> <p>Then at my shop page i want to add stuff to the session:</p> <pre><code> if ((Order)Session["Cart"] != null) ((Order)Session["Cart"]).OrderRow.Add(new OrderRows({ArticleID = 2, Quantity = 1) }); </code></pre> <p>At this last line i get att nullreference exception. Why could that be?</p> <hr> <p>Here are my two classes:</p> <pre><code> public class Order { public List&lt;OrderRows&gt; OrderRow { get; set; } public string Address { get; set; } public string City { get; set; } public string Zip { get; set; } public int UserID { get; set; } } public class OrderRows { public int ArticleID { get; set; } public int Quantity { get; set; } public override string ToString() { return string.Format("Artikel: {0}, Antal: {1}.\n", ArticleID, Quantity); } } </code></pre>
c# asp.net
[0, 9]
5,326,575
5,326,576
Finding and Looping Through span Elements Inside (this) JQuery?
<p>im trying to find every <code>&lt;span class ="anime_yellow"&gt;..</code> inside another <code>&lt;span class="toggle"&gt;</code>, this is the code:</p> <p>HTML:</p> <pre><code> &lt;span class="title_white"&gt;Menu 1&lt;/span&gt; &lt;span class="toggle"&gt; this is menu 1 i want to animate &lt;span id="position" class="anime_yellow"&gt;Position&lt;/span&gt; and &lt;span id ="market" class="anime_yellow"&gt;market&lt;/span&gt;. &lt;/span&gt; &lt;br&gt;&lt;br&gt; &lt;span class="title_white"&gt;Menu 2&lt;/span&gt; &lt;span class="toggle"&gt; this is menu 2 i want to animate &lt;span id="simple" class="anime_yellow"&gt;Simple&lt;/span&gt; and &lt;span id ="kool" class="anime_yellow"&gt;Kool&lt;/span&gt;. &lt;/span&gt; </code></pre> <p>The Javascript:</p> <pre><code>$(".toggle").hide(); $(".title_white").click(function() { $(".toggle").hide(); $(this).next(".toggle").toggle("slow"); // i want to find every span.anime_yellow inside the // THIS TOGGLE class and get its element ID // and then run function on the ID // animate(position) or animate(simple). }); </code></pre> <p>im trying to use the jquery function .find(), but don't know where to start, this is the jsfiddle for it here: <a href="http://jsfiddle.net/wJJBa/2/" rel="nofollow">http://jsfiddle.net/wJJBa/2/</a></p>
javascript jquery
[3, 5]
1,910,847
1,910,848
How do I handle this document ready situation?
<p>Hopefully a very simple question. I have some various js functions written as such:</p> <pre><code>var app={ start:function(){ //do some stuff and call calculate }, //end start calculate:function(){ //do some more stuff } //end calculate }; //end var app var neato={ go:function(){ //do some stuff and call creation }, //end go creation:function(){ //do some more stuff } //end creation }; //end var neato </code></pre> <p>Which I could then start as follows:</p> <pre><code>$(document).ready(app.start); $(document).ready(neato.go); </code></pre> <p>Is there any way I can combine starting both functions in one document ready request?? I just can't seem to figure it out despite trying a few different possibilities.</p>
javascript jquery
[3, 5]
2,349,095
2,349,096
Horizontal type accordion
<p>I have built 2 tabs which each slide down when the expand button is clicked. However what I would like to happen is that if one is already expanded and the other is clicked if for it to automatically close/hide the other. At the moment I have two functions</p> <pre><code>$(function() { $("#content1 h3.expand").toggler(); $("#content1 div.demo").expandAll({trigger: "h3.expand", ref: "h3.expand"}); $("#content1 div.post").expandAll({ expTxt : "click to expand +", cllpsTxt : "collapse -", ref : "div.collapse", localLinks: "p.top a" }); }); $(function() { $("#content2 h3.expand").toggler(); $("#content2 div.demo").expandAll({trigger: "h3.expand", ref: "h3.expand"}); $("#content2 div.post").expandAll({ expTxt : "click to expand +", cllpsTxt : "collapse -", ref : "div.collapse", localLinks: "p.top a" }); }); </code></pre> <p>Also if you need access to my full code, let me know and I will put it on a bit of webspace.</p> <p>Thanks</p>
javascript jquery
[3, 5]