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
1,555,689
1,555,690
Issue with draggable cloned elements
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/10672180/jquery-draggable-and-resizable-is-not-working-on-cloned-div">jquery draggable and resizable is not working on cloned div</a> </p> </blockquote> <p>I have a <code>div</code> with draggable and resizable functionality of <code>jQuery UI</code>. I clone the <code>div</code> and append it to the same parent:</p> <pre><code>$("div").clone(true).appendTo($("div").parent()); </code></pre> <p>The clone is created successfully, but when I am trying to drag it, the orignal one drags. Resizing is also not working. Can anybody explain me what is happening here?</p>
javascript jquery
[3, 5]
4,256,587
4,256,588
In javascript/jquery what is the best way to convert a number with a comma into an integer?
<p>I want to convert the string "15,678" into a value 15678. parseInt and parseFloat are both returning 15 for "15,678." Is there an easy way to do this?</p>
javascript jquery
[3, 5]
5,247,671
5,247,672
how to do this style slide navigation?
<p>eg: the main navigation is "one","two","three","four". the child navigation is "welcome to our site" this navigation under the main nav "one". the "two1","two2","two3","two4" belongs two, the "three1","three2 belogs to main nav "three"</p> <p>now, i want to get when the mouse hover on one, the "welcome to our site" shows in a blcok.the block only shows the "one" child nav. when hover on the two, the "two1","two2","two3","two4" shows in the same block.the block only shows the "two" child nav then hover on the "three". the same as the above. </p> <p>could i use the jquery or javascript to get this?</p>
javascript jquery
[3, 5]
1,150,060
1,150,061
Changing action bar menu color
<pre><code>ActionBar bar = getActionBar(); bar.setBackgroundDrawable(new ColorDrawable("COLOR")); </code></pre> <p>How to change the action-bar menu color. </p> <pre><code>&lt;item android:id="@+id/about" android:title="@string/about" android:showAsAction="never" /&gt; &lt;item android:id="@+id/help" android:title="@string/help" android:showAsAction="never" /&gt; &lt;item android:id="@+id/signout" android:title="@string/signout" android:showAsAction="never" /&gt; </code></pre>
java android
[1, 4]
2,918,550
2,918,551
Commenting parts of a blog post or document with jquery
<p>I am interested in making an addon to an existing site where there is a system where users can post information, sort of like a blog post, and then regular comments like you see on any page are shown below the content of the post.</p> <p>However I have been considering using something like this <a href="http://www.electrictoolbox.com/jquery-modify-right-click-menu/" rel="nofollow">http://www.electrictoolbox.com/jquery-modify-right-click-menu/</a></p> <p>In order to make a custom dropdown menu where users can right click and comment that section of the page. What would be even better is if I could make it so that a user can highlight a section of text and then add a comment for that section. When another user then views the page he/she will see a highlighted block for the part of the content which the comment references to.</p> <p>What i need help with is the highlighting part to activate a comment and how I would know what part the user is commenting. Or a way of knowing where the right click is done and then showing the comment box.</p> <p>Some alternatives I have thought of is sending the highlighted part via post to a php file that then parses the content and updates the right area with the highlight, however this could cause conflicts for content which is the same. Another is of course to make each line of the content its own span or something where the id could be used to match the right row and highlight it, however the highlight and comment is a much better approach for me. </p> <p>Anyone know if there are any existing examples of how to go about doing this?</p>
javascript jquery
[3, 5]
3,557,253
3,557,254
function not seeing newly added classes
<p>I have a navigation that fades in and out the text color on a mouseover. It does this based on inactive class.</p> <p>It works perfectly except for the page that is initially active.</p> <p>When I change pages (via ajax) I add the 'inactive' class to the element that was previously 'active' but my function doesn't notice it as such. I can see in web inspector that the active class is being removed and inactive class added properly. Any suggestions?</p> <pre><code>('header#primary nav a.inactive').hover( function(){ $(this).stop().animate({'color': '#ffffff'}, 'slow'); }, function() { $(this).stop().animate({'color': '#a2a2a2'}, 'slow'); }); </code></pre>
javascript jquery
[3, 5]
636,919
636,920
php, jquery only first id working normal
<p>I have the following code in .php (code is edited for easier understanding).</p> <pre><code>while($row = mysql_fetch_array($biznis)){ &lt;div id='listItem'&gt; &lt;div id='listPic'&gt; &lt;img src='../../social/images/avatar/empty_avatar_full.jpg'&gt;&lt;/img&gt; &lt;/div&gt; &lt;div id='listCont'&gt; &lt;span&gt;abcde&lt;i&gt;(request pending)&lt;/i&gt;&lt;/span&gt; &lt;/div&gt; &lt;div id="listInfo"&gt; &lt;span id='info'&gt;More info&lt;/span&gt; &lt;/div&gt; &lt;div style='clear:both;'&gt;&lt;/div&gt; &lt;div id='moreInfo'&gt; &lt;span&gt;Invitation sent: xx-yy-zzzz&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div style='clear:both;'&gt;&lt;/div&gt; } </code></pre> <p>So the code is nothing special, I just get all records from the table lined up. So now, here is the problem, as you can see, I use the same ids for the same elements.</p> <p>Jquery code</p> <pre><code>$(document).ready(function () { $("#moreInfo").hide(); $("#info").click(function(){ $("#moreInfo").slideToggle(); }); }); </code></pre> <p>OK so here are now the problems. Only first div (#moreinfo) is hidden, all the others are shown. And only first span (#info) is toggling the slider.</p> <p>I tried with putting the counter for ids, and jquery each function, but nothing realy worked as i imagined.</p> <p>Ty, Sebastian</p>
php jquery
[2, 5]
42,509
42,510
why cookies are always null after postback
<p>i am trying to maintain some data into cookies but after postback if i check the value of the cookies in pageload the value is always null</p> <p>this is how i set and get the cookies</p> <pre><code>private static string GetCookie(string name) { return HttpContext.Current.Response != null ? HttpContext.Current.Response.Cookies[name].Value : string.Empty; } private static void SetCookie(string name, string value) { HttpContext.Current.Response.Cookies[name].Value = value; HttpContext.Current.Response.Cookies[name].Expires = DateTime.Now.AddDays(ExpireTimeInDays); } </code></pre>
c# asp.net
[0, 9]
3,888,736
3,888,737
Ignore a property while using jquery $.extend()?
<p>Is there an efficient way to clone an object yet leave out specified properties? Ideally without rewriting the $.extend function?</p> <pre><code>var object = { "foo": "bar" , "bim": Array [1000] }; // extend the object except for the bim property var clone = $.extend({}, object, "bim"); // = { "foo":"bar" } </code></pre> <p>My goal is to save resources by not copying something I'm not going to use.</p>
javascript jquery
[3, 5]
4,059,583
4,059,584
validation, multiple radio button in each row
<p>I am displaying three radio buttons in each row for each employee, how to validate for empty check. </p> <pre><code>&lt;td&gt;&lt;input type="radio" name="stf_att_&lt;?php echo $stf_id ;?&gt;" value="p" /&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="stf_att_&lt;?php echo $stf_id ;?&gt;" value="a" /&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="stf_att_&lt;?php echo $stf_id ;?&gt;" value="l" /&gt;&lt;/td&gt; </code></pre> <p>am using another table to display values using id for each employee. have to use name="" for validation but in name am using id from database, how i do with js or php</p>
php javascript
[2, 3]
2,450,511
2,450,512
Why will the following line crash my Android app?
<p>The following line, no mather where placed where will crash my Android program.</p> <pre><code>EditText editText1; double pro = Double.parseDouble(editText1.getText().toString()); </code></pre> <p>Additional code:</p> <pre><code> &lt;EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/btsub" android:layout_marginTop="58dp" android:ems="10" android:inputType="number" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt; </code></pre> <p>What am I doing wrong? I am not experieced with debugging.</p> <p>EDIT--</p> <p>The following will show a toast containing: "Something is real wrong"</p> <pre><code>try { if(editText1 != null) { pro = Double.parseDouble(editText1.getText().toString()); } else { Context context = getApplicationContext(); CharSequence text = "Something real wrong"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } } catch(NumberFormatException e) { Context context = getApplicationContext(); CharSequence text = "Empty"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } </code></pre>
java android
[1, 4]
5,462,623
5,462,624
adding a class in the navigation menu
<p>Considering the case, that I have the following menu:</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href="index.php"&gt;Index&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="about.php"&gt;About&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="test.php"&gt;Test&lt;/a&gt;&lt;li&gt; &lt;/ul </code></pre> <p>And the menu is located in header.php . For each page (Index, About, Test), I have index.php, about.php and test.php, and all these files include the header.php ! </p> <p>What I need is adding a class to the li when we are on different pages. So if we are on the about.php, the class should be added on the second li.</p> <p>Is there any way to do with jQuery, or what are the ways to handle this problem?</p>
php javascript jquery
[2, 3, 5]
639,576
639,577
Comparing comma separated strings
<p>I have 2 string's </p> <pre><code>string1="fruit,animal,vehicle"; string2="plane,fruit,culture,animal"; </code></pre> <p>So if i compare string1 and string2 it should say true since fruit,animal is present in the string in both the strings else false if nothing is present. </p>
javascript jquery
[3, 5]
427,782
427,783
min and max jQuery character counter
<p>There are many max character counters in jQuery.</p> <p>Has anyone found any useful <em>min</em> character counters?</p> <p>I'm looking for something like what StackOverflow uses when creating a comment: </p> <p><img src="http://i.stack.imgur.com/PHSzl.png" alt="n chars to go"></p>
javascript jquery
[3, 5]
997,319
997,320
How to handle enter event of multiple text boxes which invoke input button clicks event?
<p>I have 3 asp.net text box and an html input botton, when enter is pressed in any of the above text boxes input button click event must be fired.My code is</p> <pre><code> &lt;li class="right2"&gt; &lt;asp:TextBox ID="txtPassportNumber" ClientIDMode="Static" MaxLength="20" CssClass="textEntry" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;/li&gt; &lt;li class="left"&gt;&lt;label&gt;First Name&lt;/label&gt;&lt;/li&gt; &lt;li class="right2"&gt; &lt;asp:TextBox ID="txtFName" ClientIDMode="Static" MaxLength="20" CssClass="textEntry" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;/li&gt; &lt;li class="left"&gt;&lt;label&gt;Last Name&lt;/label&gt;&lt;/li&gt; &lt;li class="right2"&gt; &lt;asp:TextBox ID="txtLName" ClientIDMode="Static" MaxLength="20" CssClass="textEntry" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;/li&gt; &lt;input type="button" id="btnSearch" clientidmode="Static" class="search button formbutton" value="Search" validationgroup="SearchPanelSubmit" runat="server" /&gt; </code></pre> <p>I have write the following jquery code</p> <pre><code>$(document).ready(function () { if ($('#txtPassportNumber').keypress(function (e) { if (e.keyCode == 13) $('#btnBasicSearch').click(); })); } </code></pre> <p>I have used multiple if 's in jquery code but the button is not working when more then 1 text box has some text in it.How to handle enter event for multiple text boxes ?</p>
javascript jquery asp.net
[3, 5, 9]
3,110,851
3,110,852
Dynamically created divs get hidden after postback
<p>I have several divs in a nested gridview which are bound to att runtime with the command div id="div&lt;%# Eval("id") %>". I then set the visibilty of the div via javascript. The problem is that the visibilty setting isnt retained between postbacks. (Im using a filter feature that filters the rows in the nested gridview). </p> <p>How can I retain the visibilty settings for all the divs created dynamically? (Could be up to fifty divs.)</p>
c# asp.net
[0, 9]
1,446,485
1,446,486
How to select parent div of a form in JQuery?
<p>here is what i got</p> <pre><code>&lt;div id="right"&gt; &lt;from id="test"&gt; &lt;input type="submit"&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>and a lil jquery</p> <pre><code> $(document).ready(function(){ $('form').submit(function() { $(this).parent().html('&lt;h1&gt;1&lt;/h1&gt;'); }); }); </code></pre> <p>you can play with <a href="http://jsfiddle.net/W9S4F/" rel="nofollow">that here</a>,</p> <p>and by clicking on submit button it should put <code>&lt;h1&gt;1&lt;/h1&gt;</code> in <code>div#right</code> but it don't ! </p> <p>Cause <code>this</code> is a form in this case but it works with button label or any thing else and I think that is because form is not a DOM node.</p> <p>So how can I select the parent of a form, or in other words how can i select the <code>Div</code> that contents the <code>form</code> ?</p> <p>Update: as it was a part of an ajax call i wanted to break it down and find the problem but i had made a typo which cost me an hour or so, but the problem with ajax was that you <code>$(this)</code> inside <code>success:</code> is not the form any more so i did like this</p> <pre><code> `$('form').submit(function(){ form = $(this);// I set the form to a varible !! $.ajax({ type: "POST", url: "ajax.php", data: $(this).serialize(), success: function(data){ $(form).parent().html(data); // I used the varible i set to form before! }});` </code></pre> <p>anyways, how can i mark this question as solved ?!</p>
javascript jquery
[3, 5]
5,840,600
5,840,601
Develop android and iphone app
<p>I'm gonna develop a small app both for android and Iphone. The app will contain a simple little online magazine. I have not done any app before. I work with developing Web pages in asp.net c# and I'm familiar with java. So I'm a beginner in terms of mobile apps, and now I'm wondering how to begin and where to find good information about basic app-development.</p>
android iphone
[4, 8]
719,705
719,706
Downloading files in an Android 3.0 browser from my ASP.NET site
<p>I'm having an issue downloading a PDF file from my custom asp.net site in the out of the box browser on an Android tablet (a Motorola Xoom).</p> <p>I'm using Response.OutputStream.Write to send the file because it's having to read the file from a UNC path. This method works on IE, Firefox, Safari, and on iPad, but doesn't work on the browser on the Xoom. However, when I downloaded Firefox on the Xoom I was able to download the file just fine. </p> <p>I've found a couple of spots suggesting I use the following headers: Content-Type: application/octet-stream Content-Disposition: attachment; filename="MyFileName.PDF"</p> <p>I've tried this with no luck. I also tried using Content-Types of application/pdf and application/force-download and every combination of filename capitalized, extension capitalized, extension lowercase, double quotes, single quotes, no quotes, etc... for Content-Disposition and have yet to find anything that works.</p> <p>I have also found that if I execute the code to download the file on Page_Load it is able to download, but if I do a postback and then execute the code (clicking on a link button to download the file) it doesn't work</p> <p>Has anyone been able to download a file using custom C# code on the OOTB Android 3.0 browser?</p>
c# android
[0, 4]
1,876,059
1,876,060
How to trigger sound whenever a user clicks an element
<p>How can I play an mp3 or wav sound using the jquery click event?</p> <p>i want to add click sound not any track or song</p>
javascript jquery
[3, 5]
5,576,061
5,576,062
Get anchor href attribute using JQuery
<p>I have a button with the following javascript function:</p> <pre><code>function getHyperLink(){ window.getSelection().anchorNode.parentNode.attributes["0"].nodeValue; } </code></pre> <p>What i do is i highlight a text which contains a hyperlink, i then press the button and want go get the link from selected text.</p> <p>The following above works but i want my code to be in jQuery if possible.</p>
javascript jquery
[3, 5]
5,683,112
5,683,113
simple jquery on asp.net does not work on firefox
<p>I have been struggling with getting this work on Firefox. Hope there is somebody help me!</p> <p>Basically; Firefox ignores the button click function and it's sub functions and the button posts the page instead of running the jquery code.</p> <p>It works on IE and Chrome but not on Firefox.</p> <p>Thank you for your help in advance.</p> <p>Here is the output code:</p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; $(document).ready(function() { $(".CatList li").click(function() { if ($(this).is(".selected")) { $(this).attr("class", ""); $('#ctl00_ContentPlaceHolderRight_CatChanged').val(1); return false; } else { $(this).attr("class", "selected"); $('#ctl00_ContentPlaceHolderRight_CatChanged').val(1); return false; } }); $("#ctl00_ContentPlaceHolderRight_btnSave").click(function() { var elements = $("li.selected"); if (elements.val() == null) { alert("You must select at least one category"); return false; } else { elements.each(function() { $('#ctl00_ContentPlaceHolderRight_CatChecked').val($('#ctl00_ContentPlaceHolderRight_CatChecked').val() + "," + $(this).attr("id")); return true; }); } }); }); &lt;/script&gt; </code></pre> <p></p> <p> </p>
javascript jquery
[3, 5]
405,932
405,933
Looping through list items with jquery
<p>I have this block of code</p> <pre><code>listItems = $("#productList").find("li"); for (var li in listItems) { var product = $(li); var productid = product.children(".productId").val(); var productPrice = product.find(".productPrice").val(); var productMSRP = product.find(".productMSRP").val(); totalItemsHidden.val(parseInt(totalItemsHidden.val(), 10) + 1); subtotalHidden.val(parseFloat(subtotalHidden.val()) + parseFloat(productMSRP)); savingsHidden.val(parseFloat(savingsHidden.val()) + parseFloat(productMSRP - productPrice)); totalHidden.val(parseFloat(totalHidden.val()) + parseFloat(productPrice)); } </code></pre> <p>and I'm not getting the desired results - totalItems is coming out as 180+ and the rest all NaN. I suspect its where i use <code>var product = $(li);</code> or perhaps with the expression on the loop itself. Either way - I need to loop through the <code>&lt;li&gt;</code> items in the <code>&lt;ul&gt;</code> labelled <code>#productList</code></p>
javascript jquery
[3, 5]
5,701,871
5,701,872
How can I use a JavaScript file in my ASP.NET project?
<p>I want to use a JavaScript file, lying in the root folder. How can I include that JS file?</p>
asp.net javascript
[9, 3]
3,847,249
3,847,250
Intercepting HTTP event using JQuery
<p>I have this JQuery code working however I need to know whether how to actually get the URL executed from the tags selected. </p> <pre><code>$("link, script, style, a, img").each(function(){ $(this).load(function(){ // get the URL and log it console.log("Intercepted HTTP Event"); }); }); </code></pre> <p>First thing I need to do it to get the actual URL during the load. </p> <p>Next thing I may need to do is to actually catch before the load event happens, I mean before an image or link is loaded for example. Also, I need to modify the URL of the event that will be executed, for example, <code>img</code> tag has <code>src="/somewhere/image.png"</code> I mean, this will cause a <code>GET /somewhere/image.png</code> I may need to change it to <code>GET/otherplace/image.png</code> </p> <p>Any ideas how to achive any of these?</p>
javascript jquery
[3, 5]
5,579,178
5,579,179
Find out if X509Certificate2 is revoked?
<p>How can I figure out if an <code>X509Certificate2</code> has been revoked? I assume the <code>Verify()</code> method checks it, but it doesn't explicitly state it in the help. Does anybody know?</p> <p>Also: does the Verify() check if the certificate is expired?</p>
c# asp.net
[0, 9]
4,304,987
4,304,988
How to implement web camera for video conferencing in asp?
<p>I want to create a asp web application for video conferencing, how i can implement this? Thanks...</p>
c# asp.net
[0, 9]
5,357,763
5,357,764
Add UserControl to page From another class
<p>I have page and call method inside my page. I want to add some control to my page Control (not page itself) inside that method.</p> <p>My Default.aspx : </p> <pre><code>&lt;%@ Page Title="Home Page" MasterPageFile="~/Site.master" ... %&gt; &lt;asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"&gt; &lt;asp:PlaceHolder ID="PlaceHolder1" runat="server"&gt;&lt;/asp:PlaceHolder&gt; &lt;/asp:Content&gt; </code></pre> <p>and Code Behind : </p> <pre><code>namespace Program { public partail class Default : Page { protected void Page_Load(object sender, Eventargs e) { MyClass.Calling(this); } } } </code></pre> <p>my another class</p> <pre><code>namespace Program { public class MyClass { public static void Calling(Page page) { Textbox txt = new Textbox() // I want somthing like this: // page.PlaceHolder1.Controls.Add(txt); } } } </code></pre> <p>Is this possible?</p> <p>Update: Thanks to @The King.</p>
c# asp.net
[0, 9]
569,955
569,956
Save Gridview data as Template
<p>I have a report generated in Gridview and I want to save the report as a template for later retrieval. I do not want to export to excel. The template should available for user to retrieve and see whenever he logs in. I am using VS 2008 and C#/ASP.NET</p> <p>I do format the gridview data source according to some business logic and presentation purposes before binding it to the gridview so I can not just keep the retrieval SQL in the database.</p> <p>Any idea?</p>
c# asp.net
[0, 9]
5,235,057
5,235,058
How do you make jQuery's .offset() work?
<p>I'm working on a web app that I need to know the coordinates of an element relative to the web page. This seems like it should be simple with jQuery's offset(), however it is not working for me.</p> <p>Here is the code I am using to find the offset:</p> <pre><code> var offset=$('#container').offset(); alert(offset.right); </code></pre> <p>Here is the code that I'm using for the whose position I want:</p> <pre><code>&lt;div id='container' style='position:absolute; height:30px; width:300px; background-color:orange;'&gt;&lt;/div&gt; </code></pre> <p>But when I load the page and the alert() fires, it alerts as undefined. Does anyone have any ideas on how I could fix this?</p>
javascript jquery
[3, 5]
5,036,474
5,036,475
How to find website refer using Javascript?
<p>How would I find which website referred to the my website using Javascript? For exmaple, if A.com had a link to B.com (my website), how could I tell who referred to my website?</p> <p>Thanks</p>
javascript jquery
[3, 5]
2,988,826
2,988,827
Pass string parameters to master page
<p>Hi folks<br /> I'm using C# language Asp.net version 3.5 I have a masterpage and pages which they use master. I think there are three ways to implement my application with ability passing parameters between controller to pages.<br /> <br /><b>First Way :</b> I need to pass a string parameter from page to master how I can do that ?<br /> I'm going to pass a string parameter between page to master when controller request page and then page pass parameter to it's master.<br /><br /> <b>Second way :</b> Passing some string parameters from a controller class to master page at first (not to page and then page to it's master).<br /><br /> <b>Third Way :</b> Passing to another class or field that must be static and then master load it's value.<br /></p> <blockquote> <p>Which is the best or possible way I mean with high performance and security.</p> </blockquote>
c# asp.net
[0, 9]
1,513,648
1,513,649
jQuery 1.4 change(), checkbox and IE
<p>I have a page with a checkbox that is set to checked when the page is loaded. If/when the checkbox is unchecked I need to run a function. The following code works fine in all browsers with the exception of IE. In versions 7 and 8(haven't even tested 6) it works but you are required to uncheck it, check it, then on the second uncheck it executes the function. The jQuery documentation states: "As of jQuery 1.4 the change event now bubbles, and works identically to all other browsers, in Internet Explorer"... but it doesn't seem to work. Any ideas? </p> <p>The code:</p> <pre><code>$('#checkbox').change(function() { // do something }); </code></pre>
javascript jquery
[3, 5]
1,591,154
1,591,155
How to get the Win32_battery class information of the battery connected to computer through RS 232 Interface?
<p>I need to get the battery information (Win32_battery class) (using WMI) of the battery connected to the PC through RS 232 Interface(C#.NET app). Can any one help me to get this information?</p>
c# c++
[0, 6]
1,840,560
1,840,561
Run the button event handler before page_load
<p>I have a table with all the objects I have in my db. I load them in my Page_Load function. I have a text field and a button that when clicking the button, I want the handler of that click to put a new object with the name written in the text field in the db.</p> <p>Now, I want that what happens after the click is that the page loads again with the new item in the table. The problem is that the button event handler is run after the Page_Load function.</p> <p>A solution to this would be to use IsPostBack in the Page_Load or use the pre load function. A problem is that if I would have 3 different buttons, I would have to differ between them there instead of having 3 different convenient functions.</p> <p>Any solutions that don't have this problem?</p> <p>Code:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (Session["userId"] == null) Response.Redirect("Login.aspx"); // LOAD DATA FROM DB } protected void CreateObject(object sender, EventArgs e) { // SAVE THE NEW OBJECT } </code></pre>
c# asp.net
[0, 9]
1,737,044
1,737,045
ASP.net download page
<p>I have a Reports.aspx ASP.NET page that allows users to download excel report files by clicking on several hyperlinks. When a report hyperlink is clicked, I open a new window using the javascript window.open method and navigate off to the download.aspx page. The code-behind for the download page creates a excel file on the fly using openxml(in memory) and send it back to the browser. Here is some code from the download.aspx page:</p> <pre><code> byte[] outputFileBytes = CreateExcelReport().ToArray(); Response.Clear(); Response.BufferOutput = true; Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", "tempReport.xlsx")); Response.BinaryWrite(outputFileBytes); Response.Flush(); Response.Close(); Response.End(); </code></pre> <p>My problem : Some of these reports take some time to generate. I would like to display a loading.gif file on my Reports.aspx page, while the download.aspx page is requested. Once the page request is completed, the loading.gif file should be made invisible.</p> <p>Is there a way to achieve this. Perhaps some kind of event. I have mootools to my disposal.</p> <p>Thanks</p> <p>PS. I know that generating reports like this is not ideal, but thats a different story all together...</p>
asp.net javascript
[9, 3]
156,994
156,995
Refresh page data when button is clicked inside a usercontrol
<p>I have a page which displays data from a web service. It first checks if the data exists in session, and then gets it from the WS if not.</p> <p>My control calls the web service and adds another row to the data (an SP list in this case). If the new item was added successfully, I want to refresh the list in session. If not, no refresh is needed.</p> <p>I want the page to get the new data from the web service, even if the data exists in session. My problem is that the event handler for the button fires after the page load event of the page containing the control, where the data is retrieved and bound to a repeater.</p> <p>I was thinking of using some client side tricks, like checking the event target or checking for a button name in the post params list, but my button is a server side control, and I would like it to remain that way.</p> <p>Is there some best practice solution for this type of situation? </p>
c# asp.net
[0, 9]
4,427,455
4,427,456
Select folder intent & Work out when intent complete?
<p>So I'm making a wallpaper and I want the user to select a folder. So I have a button in the preferences that launches an intent to open an image, but what I want is actually just a directory (I guess in the worst case i can strip the filename from the end). So that's my first problem: what's the best way to select a folder only?</p> <p>The second problem is how do I get notified of when the intent is complete?</p> <pre><code>public class FilePreference extends DialogPreference implements View.OnClickListener { public void onClick(View v) { // open up a gallery/file browser Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); getContext().startActivity(Intent.createChooser(intent, "Select Folder")); } </code></pre>
java android
[1, 4]
1,730,400
1,730,401
Adobe Flash at IOS
<p>Does IOS support Flash? I am thinking to make some games in Flash For IOS and Android, Any help</p>
iphone android
[8, 4]
2,923,597
2,923,598
dynamically added images not getting added on page when toggel function in Jquery is used
<p>Below is code to add images in Javascript.</p> <pre><code>function AddFirstRow() { //Create an input type dynamically. var element ; var seatArr = document.getElementById("seatArr"); //Assign different attributes to the element. var rowCounter ; for( rowCounter = 1 ; rowCounter &lt; 8 ; rowCounter++ ){ element = document.createElement("input"); element.setAttribute("type", "image"); element.setAttribute("src","../Images/available_seat_img.png") ; element.setAttribute("class", "seatRightMostRow1"); element.setAttribute("id", "1V"); seatArr.appendChild(element); } } </code></pre> <p>Body elements where images are added.</p> <pre><code>&lt;div class="seatArr"&gt; &lt;span id="seatArr" &gt;&amp;nbsp;&lt;/span&gt; &lt;input type="image" class="seatRightMostRow1" id="1A" alt="sfdsf" src="../Images/available_seat_img.png" /&gt; &lt;input type="image" class="seatRightMostRow2" id="1B" alt="sfdsf" src="../Images/available_seat_img.png" /&gt; &lt;/div&gt; </code></pre> <p>JQuery for toggel feature on image.</p> <pre><code>$("input[id]").toggle(function(){ $(this).attr("src","../Images/selected_seat_img.png"); },function(){ $(this).attr("src","../Images/available_seat_img.png"); }); </code></pre>
javascript jquery
[3, 5]
1,502,246
1,502,247
width() not returning a value
<p>I have an image in a page that I am trying to get the width of. </p> <pre><code>&lt;img class="zoomerIcon" src="zoomer.png" /&gt; </code></pre> <p>So I'm trying to get the width like this.</p> <pre><code>var imageWidth = $('.zoomerIcon').width(); </code></pre> <p>However the value is 0 unless I set the width property in the tag.</p> <p>Does width() only return a width greater than 0 if it's manually set in the property? You can see the whole script here.</p> <p><a href="http://www.wantedcreative.com/development/zoomer/index.html" rel="nofollow">http://www.wantedcreative.com/development/zoomer/index.html</a></p> <p>Thanks</p>
javascript jquery
[3, 5]
3,785,936
3,785,937
Dynamic table with multiple datepickers
<p>I have a web form which has dynamic table using repeating rows. New rows are added by calling the addRow function below:</p> <pre><code>function addRow(tableID) { var table = document.getElementById(tableID); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var colCount = table.rows[0].cells.length; for(var i=0; i&lt;colCount; i++) { var newcell = row.insertCell(i); newcell.innerHTML = table.rows[0].cells[i].innerHTML; //alert(newcell.childNodes); switch(newcell.childNodes[0].type) { case "text": newcell.childNodes[0].value = ""; break; case "checkbox": newcell.childNodes[0].checked = false; break; case "select-one": newcell.childNodes[0].selectedIndex = 0; break; } </code></pre> <p>I would like one datepicker (or more) in each row. Datepicker from here: <a href="http://www.frequency-decoder.com/2011/10/11/unobtrusive-accessible-datepicker-widgit-v6" rel="nofollow">http://www.frequency-decoder.com/2011/10/11/unobtrusive-accessible-datepicker-widgit-v6</a></p> <p>I need the following script for each datepicker:</p> <pre><code>&lt;script&gt; datePickerController.createDatePicker({ // Associate the text input to a DD/MM/YYYY date format formElements:{"formInputName":"%Y-%m-%d"} }); &lt;/script&gt; </code></pre> <p>How can I easily execute this script for each table row that is added? I'm aware that using in innerHTML does not work. Please see the attached image for the desired result.</p> <p><img src="http://i.stack.imgur.com/sDq1p.jpg" alt="http://i.stack.imgur.com/HHn2w.jpg"></p> <p>Thanks for your help!</p>
php javascript jquery
[2, 3, 5]
3,061,408
3,061,409
Combining retrieved values with javascript and jquery
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1133770/how-do-i-convert-a-string-into-an-integer-in-javascript">How do I Convert a String into an Integer in JavaScript?</a> </p> </blockquote> <p>I have a select element that contains options for products. What I want to achieve is when they pick an option the price on the page automatically adjusts. I have figured out how to retrieve those values but when I combine them it just puts two numbers together instead of actually adding them.</p> <p>For example instead of outputting 60 when I have 50 + 10 it outputs 5010.</p> <p>My code:</p> <pre><code>$('.product_options').change(function(){ var base_price = $('#base_price').html(); var add_price = $(this).find("option:selected").data('price'); var new_price = base_price+add_price; console.log(new_price); $('.current_price').html(base_price+add_price); </code></pre> <p>});</p> <p>Is there a way I can convert them both to integers so the operation actually goes through?</p> <p>Thanks in advance!</p>
javascript jquery
[3, 5]
3,826,042
3,826,043
jQuery, same function for multiple ids
<p>i want to clear specified input if the value is not number. function works for one ID, but i want it to work for multiple. of course i can write function multiple times but i dont want to do that.</p> <p>the following code gets effect only for input with id "d". i dont know how to identify other ids. can anyone help?</p> <pre><code>&lt;input id="d" /&gt; &lt;input id="d2" /&gt; &lt;input id="d3" /&gt; &lt;script type="text/javascript"&gt; $('#d,d2,d3').keyup(function(){ if($('#d,d2,d3').val() != "") { var value = $('#d,d2,d3').val().replace(/^\s\s*/, '').replace(/\s\s*$/, ''); var intRegex = /^\d+$/; if(intRegex.test(value)) {} else { $(this).val(''); } } }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
4,257,049
4,257,050
How can I get Date in MM/DD/YY format from Timestamp
<p>I want to get the Date in MM/DD/YY format from the timestamp. </p> <p>I search many but I dont get any Idea...</p> <p>I use below method but It not gives proper output</p> <pre><code>final Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(Long.parseLong(1306249409)); Log.d("Date--",""+cal.DAY_OF_MONTH); Log.d("Month--",""+cal.MONTH); Log.d("Year--",""+cal.YEAR); </code></pre> <p>But its gives the output like below</p> <p>Date--5 Month--2 Year--1</p> <p>The correct date is 24 May 2010 for Timestamp - 1306249409</p> <p>Note - Timestamp is get bye the webservice which is used in my application</p>
java android
[1, 4]
2,959,124
2,959,125
Dynamically get drawables by ID
<p>I want to take a <code>byte</code> and append it to a resource ID to be able to get the image that corresponds to that numbered deck in the game. It was easy to with paths on other devices, but with the Resource ID's I am unsure how I could go about do this.</p> <p>Here's what I have now:</p> <pre><code>switch(GameSettings.gameDeck) { case 1: deckImage.setBackgroundResource(R.drawable.deck1); break; case 2: deckImage.setBackgroundResource(R.drawable.deck2); break; case 3: deckImage.setBackgroundResource(R.drawable.deck3); break; case 4: deckImage.setBackgroundResource(R.drawable.deck4); break; } </code></pre> <p>In my Blackberry version of this, I simply had:</p> <pre><code>deckImage.setBitmap(Bitmap.getBitmapResource("/path/deck" + GameSettings.gameDeck + ".png")); </code></pre> <p>Is there a way to accomplish something similar using Resource IDs on Android?</p>
java android
[1, 4]
1,221,572
1,221,573
how to catch the table data td value?
<p>How to catch the td value in jquery on mouse click event? I have done these things in pure js but it is lengthy. Can jquery have easy solution? I want to add those catch value in the form text field.</p>
javascript jquery
[3, 5]
3,279,132
3,279,133
Creating buttons and separating there functionality android
<p>my app have action bar on top of windows. Where are some buttons. Buttons count and there functions is changing depending on activity user are.</p> <p>I want to write a class with methods <strong>addFirstButton</strong>, <strong>removeFirstButton</strong> and so on. So i other classes i want to do this:</p> <pre><code>MyButtons myButtons = new MyButtons(); myButtons.addFirstButton(); </code></pre> <p>So there is everything alright, but how to create a listener button if i want to do this ?</p> <p>Normally i would do this:</p> <pre><code> Button backButton = (Button) customNav.findViewById(R.id.back); backButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Toast.makeText(Action_Bar_TestingActivity.this, "BACK", Toast.LENGTH_SHORT).show(); } }); </code></pre> <p>But i want that this would be in <strong>MyButtons</strong> class and method somehow would return a listener to that action.</p> <p>So any ideas if this possible ?</p> <p>Thanks.</p>
java android
[1, 4]
2,934,774
2,934,775
dynamic image source?
<p>I'm entirely new to jQuery and am trying to use a plugin carousel, however it is a bit confusing. I have it installed now, and I am trying to get rid of it's bottom scroll bar and automate it. The code to make enable auto according to the manual is: </p> <pre><code>&lt;script type="text/javascript"&gt; jQuery(function($) { $("#carousel").rcarousel({ auto: { enabled: true, interval: 3000, direction: "next" } }); }); &lt;/script&gt; </code></pre> <p>but it appears that is not going to work.<br> If there is any other info you need please let me know, so the goals here are:</p> <ol> <li>remove scroll bar</li> <li>automate the scrolling.</li> </ol>
javascript jquery
[3, 5]
2,401,968
2,401,969
AES Encryption done on both Iphone and Android
<p>We are creating same project in android and iphone. Now problem is that we need to send user information to aspx server using webservice in encrypted form. We both have implemented it but results are diiferent so is there a common AES encryption method which will produce same result and can be parsed at server.</p> <p>Please reply as soon as possible, my work get affected because of it.</p> <p>Thanks in advance</p>
android iphone
[4, 8]
295,845
295,846
How to avoid @SuppressWarnings with anonymous inner classes in Java?
<p>I'm struggling with smarter coding style in usage of anonymous classes.</p> <p>How can I use anonymous inner class WITHOUT @SuppressWarnings in the case below?</p> <p>When using anonymous classes like this way:</p> <pre><code>someMethod( new Y(){ // non-overriding public method public void echo1(){ // do some stuff } } ); ... public abstract class Y { // use me as an anonymous class, // and define any methods when defining me } </code></pre> <p>This code makes warning.</p> <p>public method "echo1" needs to be annotated @SuppressWarnings("unused") .</p> <p>If I code additionally echo2, echo3, echo4,... all methods needs to be annotated one by one.</p> <p>In order to avoid writing annotations frequently, I tried to code this way for propagating annotation effects over all child classes:</p> <pre><code>@Inherited // &lt;- This is what I want this annotation to be! @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface SuppressWarningsPropagate extends SuppressWarnings { } </code></pre> <p>then I tried to annotate class Y with this annotation. This would be useful and simple enough to annotate only one base class.</p> <p>...and I found myself stupid. </p> <p>Annotations like SuppressWarnings can't be "extended" nor "implemented".</p> <p>Instead, this code works and has no warnings, because SuppressWarnings goes well for this only one concrete class:</p> <pre><code>@SuppressWarnings("unused") public class X { private int i; private int j; } </code></pre> <p>In summary, how can I...</p> <ul> <li>use anonymous inner class (for good readability of code)</li> <li>and also defining public methods on new (must be public, for the matter of addJavascriptInterface() of Android SDK)</li> <li>and also avoid writing @SuppressWarnings("unused") for all the methods one by one (for good writability)</li> </ul> <p>...possible? or am I just daydreaming?</p> <p>Thanks a lot in advance.</p>
java android
[1, 4]
5,596,259
5,596,260
Redirection not happening when clicking on button
<p>I am trying to redirect the user to a different page upon clicking on a button and stop any asp related events if it meets the validation in the if() statement in javascript, the reason why i am doing it like this is because on a specific page.. it is not grabinhg the On_Click event for some reason. While debugging it.. before it goes into the On_Click event in the .cs file it call multiple classes and functions .. by the time it is done.. it is redirecting somewhere else and never goes through the On_Click event.. now these are a dozen of classes it is going through so I decided to use javascript to do it right after the button is clicked without letting it evaluate in .cs BUT i still want to allow that for other pages because it is working there.. this page seems to be special..</p> <p>When i click on the image button it is supposed to check the function first and then if its true redirect and stop any other processing on Page_Load or anywhere but its not working see my code here in my user control</p> <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="FindPage.ascx.cs" Inherits="Data_Manager_FindPage" %&gt; &lt;script type="text/javascript"&gt; function ForwardSearch() { if (window.location.href.indexOf('FindPage.aspx') &gt; -1) { var value = document.getElementById('&lt;%= txtFind.ClientID %&gt;').value; window.location.href = '~/ResultSet.aspx?findvalue=' + encodeURIComponent(value); } } &lt;/script&gt; </code></pre>
c# asp.net
[0, 9]
1,727,872
1,727,873
Get error exception when using the sleep function
<p>I want to delay my application for a while while a melody is playing, and when it's finished change the image on an imageview.</p> <pre><code>public void addListenerOnButtons() { harmonicaTecknad= (ImageView)this.findViewById(R.id.harmonicatecknadspelautblas); harmonicaTecknad.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { harmonicaTecknad.setImageResource(R.drawable.harmonicatecknadtryckrood); RunAnimations(); utblas=MediaPlayer.create(SpelaTonerActivity.this, R.raw.utblas4); utblas.start(); Thread timer = new Thread(){ public void run() { try { // The delay should occur here sleep(utblas.getDuration()); } catch(InterruptedException e) { e.printStackTrace(); } finally { harmonicaTecknad.setImageResource(R.drawable.harmonicatecknad1); } } }; timer.start(); } } </code></pre> <p>I get an exception error, obviously I cannot set the image inside the thread, so where should I set it?</p>
java android
[1, 4]
231,882
231,883
Remember the selected value once refreshed the page
<p>In a page containing a form with select fields, I need to remember the previuos choice (if any) of, for example, the selected state. I want to do it via PHP embedded in JS, where I'm wrong?</p> <pre><code>&lt;script&gt; &lt;?php if(isset( $_GET["state"] )){ $selected_state = $_GET["state"]; ?&gt; $("#state option[&lt;?php echo $selected_state ?&gt;]").attr("selected", "selected"); &lt;?php } ?&gt; &lt;/script&gt; </code></pre> <p>Thank you in advance!</p>
php javascript jquery
[2, 3, 5]
2,925,592
2,925,593
change css classes of element added to DOM at runtime
<p>I've included some JavaScript from a third party in my page. This adds the following element to the page some time after the page is loaded:</p> <pre><code>&lt;a class="foo"&gt;some link&lt;/a&gt; </code></pre> <p>I need to ensure that this is changed to:</p> <pre><code>&lt;a class="bar"&gt;some link&lt;/a&gt; </code></pre> <p>ASAP after the element is added to the page. I tried adding the following to a JQuery ready handler</p> <pre><code>$('a.gullSearchBtn').removeClass('gullSearchBtn').addClass('roundButton'); </code></pre> <p>But this executes before the element is added and therefore doesn't work. I've searched the web and it seems like the jQuery feature known as "livequery" might be the solution to my problem, but I can't seem to get it to work.</p>
javascript jquery
[3, 5]
5,973,294
5,973,295
Why can't I remove an attribute of all children?
<p>I have a cloned div containing input elements, all of which are disabled. I am trying to use the following JQuery code to remove the disabled attribute of each of the div's children.</p> <pre><code>clonedElement.children().removeAttr('disabled'); </code></pre> <p>I do not have a ton of JQuery experience, so I am probably misunderstanding the way this is supposed to work. How should I be going about removing the "disabled" attribute from all children of the cloned node?</p> <p>If it helps, clonedElement was created with the JQuery .clone() method.</p> <p>HTML I AM USING TO TEST---</p> <pre><code> &lt;div id="original_item" class="hidden"&gt; &lt;div class="row_submit"&gt; &lt;div class="med_field"&gt; &lt;p&gt;Product:&lt;/p&gt; &lt;select name="product[]"&gt; &lt;option&gt;&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;div class="small_field"&gt; &lt;p&gt;Type:&lt;/p&gt; &lt;select name="type[]"&gt; &lt;option&gt;&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;div class="small_field"&gt; &lt;p&gt;Price:&lt;/p&gt; &lt;input type="text" name="price[]" value="test" disabled="disabled" /&gt; &lt;/div&gt; &lt;div class="small_field"&gt; &lt;p&gt;Quantity:&lt;/p&gt; &lt;input type="text" name="quantity[]" /&gt; &lt;/div&gt; &lt;img onclick="removeItem(this);" title="Remove Item" style="margin: 18px 0 0 12px;" src="icons/cancel.gif" /&gt; &lt;/div&gt; &lt;input type="hidden" name="warehouse_data[]" /&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
1,669,008
1,669,009
jQuery function for checking a check box checked and do an action for it
<p>I want to write one function in <strong>jQuery</strong> that it can recognize when user checked a check box on my page then it know and in real time (it means when user checked check box then label of this <code>td</code> that <code>check-box</code> and one <code>label</code> are there <strong>change color to red</strong>.<br/> <br/>I need it because I have one <code>calendar</code> that user can checked <code>check box</code> of each day for selecting holiday days of one year and then i save all 365 days of year in my db . I create a data-list and Crete table and i have 365 <code>&lt;td&gt;</code> that it contains <code>&lt; label &gt;</code> and <code>&lt; check box &gt;</code> <code>&lt;/td&gt;</code> for each days of one year </p> <p>I hope help me very soon thanks.</p>
jquery asp.net
[5, 9]
281,974
281,975
Is it possible to pass '$(this)' on to a delegated user function in jQuery?
<pre><code>function myfunc() { alert($(this)); } $("#SELECTOR").delegate("SELECTOR","click",myfunc); </code></pre> <p>This is about clicking on different images, therefore, I'd really love to use the $(this) variable in my user function.</p> <p>Is that possible? Is there any workaround?</p>
javascript jquery
[3, 5]
5,569,541
5,569,542
Detecting collisions and and walking around obects
<p>I am writing a program for an Android phone (Which uses Java as the programming language)</p> <p>I am writing a game that needs objects to - move around - other objects. For example: if an object was to move from point A to point B and there was another game object in the way, it would move around it.</p> <p>I also need to detect collisions with object, for example if an object hits another object.</p> <p>Any good resources for this stuff?</p>
java android
[1, 4]
1,734,796
1,734,797
jQuery: Selecting the text when p contains a listpoint
<p>I've got some comments in a guestbook. p containins '(In [ 'sometimes. The '(In [' sometimes contains a list.</p> <pre><code> &lt;div class=&quot;comment searchable&quot;&gt; &lt;p&gt; (In &lt;a class=&quot;changeset&quot; href=&quot;/../&quot; sets mynumber&quot;&gt;[Phonebook]&lt;/a&gt;) &lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;tt&gt;Name&lt;/tt&gt;, &lt;tt&gt;Number&lt;/tt&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;is &lt;a class=&quot;is new entry&quot; href=&quot;/../mynumber&quot;&gt;new entry&lt;/a&gt; &lt;/p&gt; &lt;/div&gt; </code></pre> <p>This is how I get all '(In' 's and some text in the same line. I insert them in a 'box' after a div.</p> <pre><code> $(&quot;&lt;div id='createDiv' style='border:1px outset #999966;padding:1em;margin-top:1em'&gt;&lt;/div&gt;&quot;).insertAfter(&quot;#changelog&quot;); $(&quot;#createDiv&quot;).append($(&quot;p:contains('In [')&quot;).clone()); </code></pre> <p>But how do I select and insert the whole text when the comments also contains a listpoint?</p> <p>I'm using jQapi as a reference which is very useful. I was looking for sth like: p:contains('li'). </p> <p>Thank you in advance for any hint.</p> <p><strong>Edit:</strong> What should come out:</p> <p>(In [Phonebook]) Name, Number is new entry.</p> <p>Now it is: (In [Phonebook])</p>
javascript jquery
[3, 5]
5,396,850
5,396,851
How do I update content in the parent window of the Iframe I am in with jQuery
<p>If I am inside the contents of iframe_2 how do I change the text of header_2?</p> <pre><code>&lt;h3 id="header_1"&gt;&lt;/h3&gt; &lt;iframe id="iframe_1"&gt;&lt;/iframe&gt; &lt;h3 id="header_2"&gt;&lt;/h3&gt; &lt;iframe id="iframe_2"&gt;&lt;/iframe&gt; &lt;h3 id="header_3"&gt;&lt;/h3&gt; &lt;iframe id="iframe_3"&gt;&lt;/iframe&gt; </code></pre>
javascript jquery
[3, 5]
3,209,144
3,209,145
jquery image replace?
<p>when click on More Button the picture of More button and Featured will be changed and when you click agin on the More button the image should be the same as what it was the first, but it isn't.</p> <pre><code>$(document).ready(function(){ $('#buy_now').hide(); $('#more').click(function() { $("#more-btn").attr("src", "http://kilrush.mobi/kil/GetAssetFile?fileId=77470"); $("#featur-btn").attr("src", "http://kilrush.mobi/kil/GetAssetFile?fileId=77472"); $('#buy_now').toggle(); }); }); </code></pre>
javascript jquery
[3, 5]
5,119,271
5,119,272
Swap + (plus) with space in string
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3803716/how-can-i-decode-a-url-with-jquery">How can I decode a URL with jQuery?</a> </p> </blockquote> <p>Could somebody please help me to take a string (i.e. URL parameter) and remove the +(plus) or %20 to a regular space (" ")?</p> <p>For example, to change this:</p> <pre><code>"my+string+to+change" or "my%20string%20to%20change" </code></pre> <p>to this:</p> <pre><code>"my string to change" </code></pre> <p>I use a lot of jQuery already, so that would be fine. Or pure javascript if that's easier.</p>
javascript jquery
[3, 5]
3,790,659
3,790,660
How to create a runat server DIV in the behind code ? ASP.NET & C#
<p>I'm creating multiple DIVs according to database records at my C# behind code. How could I make them runat server ? </p> <p>Thanks in advance .. </p>
c# asp.net
[0, 9]
1,164,660
1,164,661
What is the fastest way to assign a variable in a class that implements Runnable?
<p>I have a class A that has a class B object. Class B has a boolean variable bool that the A instance keeps updating (off events). The B object b implements Runnable.</p> <pre><code>class A{ private B b; } class B implements Runnable{ private boolean bool; run(){ while(true){ if(bool){//do something} } } } </code></pre> <p>I assume that the boolean bool is actually on a’s thread because it is initialized when a calls B’s constructor, and the b thread does not begin until start is called on the b instance, and start is not called until after bool has been initialized. </p> <p>If this is the case then the b thread must keep its own copy of bool. If this is the case, what is the fastest way of altering bool from a such that the b thread will see it; making bool volatile, or is there some way to assign directly to b’s copy?</p> <p>Please forget about the loop, it is for GLES20. What I need to know is whether b has its copy of bool, and what is the fastest way for an event thread to continuously update a boolean on the GL thread.</p>
java android
[1, 4]
3,538,068
3,538,069
How to create delay before ajax call?
<p>I am using jQuery 1.8. </p> <p>I have a series of checkboxes that a user can check to get information on particular product. When the box is check, a function is called and loads the product info into a div. CURRENTLY, the function fires immediately after each click. So, if the visitor checks all five boxes, the ajax call will be made five times. </p> <p>What I want is for the function to fire after a certain period of time once the visitor stops clicking. The function should fire only once. The purpose of the delay is to limit the number of calls and create a smoother user experience.</p> <p>Here is my HTML:</p> <pre><code>&lt;input type='checkbox' class='SomeClass' data=prodid='1'&gt; 1 &lt;input type='checkbox' class='SomeClass' data=prodid='2'&gt; 2 &lt;input type='checkbox' class='SomeClass' data=prodid='3'&gt; 3 &lt;input type='checkbox' class='SomeClass' data=prodid='4'&gt; 4 &lt;input type='checkbox' class='SomeClass' data=prodid='5'&gt; 5 &lt;div id='ProductInfoDiv'&gt;&lt;/div&gt; </code></pre> <p>Here is my pseudo JavaScript:</p> <pre><code>// set vars $Checkbox = $('input.SomeClass'); $ProductInfoDiv = $('div#ProductInfoDiv'); // listen for click $Checkbox.click(getProductInfo); // check which boxes are checked and load product info div getProductInfo = function() { // create list of product id from boxes that are checked var QString = $Checkbox.filter(":checked"); // LOAD THE PRODUCT DIV $ProductInfoDiv.load('SomePage.cfm?'+QString); } </code></pre> <p>So, where do I put the delay? How do ensure that the function only fires ONCE?</p>
javascript jquery
[3, 5]
1,953,080
1,953,081
How to implement a background socket listener for Android?
<p>I have an android app that listens for json commands over a socket. I am wondering how I can implement this as a background service. The service would receive the commands and depending on which commands they are, notify the user, or update data within the main program. Some code examples would be great if anyone has them. I've got an example of how to build a background service however it uses timers. I'd like for socket to always be listening.</p>
java android
[1, 4]
2,373,805
2,373,806
javascript not updating a variable
<p>I have a asp.net application which i am trying to create a progress bar which run with the system, I am using Java Script to do the update progress and would like an idea on how i would be update <code>var update = 0;</code> and this <code>$("#progressbar").progressbar('value', update);</code> in the code below without using a for loop, as i all ready have used a for loop and booleans, the system throws an error of a long running progra. the rest of the java script code is blow, I would like to update it up to the value of 60; </p> <p><strong>JavaScript which is being called</strong></p> <pre><code> $.updateProgressbar = function () { //Calling PageMethod for current progress PageMethods.OperationProgress(function (result) { //Updating progress $("#progressbar").progressbar('value', result.progress) //If operation is complete if (result.progress == 100) { //Enable button $("#Confirm_btn").attr('disabled', ''); } //If not else { //Reset timer setTimeout($.updateProgressbar, 10); } }); }; $(document).ready(function () { //Progressbar initialization $("#progressbar").progressbar({ value: 0 }); //Button click event $("#Confirm_btn").click(function (e) { e.preventDefault(); //Disabling button $('#error').text(""); $("#Confirm_btn").attr('disabled', 'disabled'); var update = 0; //Making sure that progress indicate 0 $("#progressbar").progressbar('value', update); //Call PageMethod which triggers long running operation PageMethods.Operation(function (result) { if (result) { //Updating progress $("#progressbar").progressbar('value', result.progress) //Setting the timer setTimeout($.updateProgressbar, 5); } }); }); }); </code></pre>
c# javascript asp.net
[0, 3, 9]
609,276
609,277
ASP.Net: Using UpdatePanels in a GridView
<p>I'm trying to build a sort of Accordion effect using a GridView and UpdatePanels. And I have problems with tieing everything together:</p> <pre><code>&lt;asp:GridView ID="gridMain" runat="server" ... &gt; &lt;Columns&gt; ... &lt;asp:TemplateField ShowHeader="False"&gt; &lt;ItemTemplate&gt; &lt;span&gt;Id:&lt;%# Eval("Id") %&gt;&lt;/span&gt; &lt;a href="/* javascript code to open the updatepanel??*/" title="Open"&gt;&lt;img ..../&gt;&lt;/a&gt; &lt;asp:UpdatePanel runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:PlaceHolder runat="server" Visible="false"&gt; &lt;asp:Label Text="??"/&gt; &lt;/asp:PlaceHolder&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; </code></pre> <p>How do I open the update panel using javascript? </p>
c# asp.net
[0, 9]
684,865
684,866
How to round an answer to a mathematical equation
<p>All- I have an app in which the users inputs data such as the cost of a dinner bill and the tip percentage and the number of people. The app than takes the numbers and outputs the total bill cost and the amount each person has to pay. I am almost there but when the user inputs numbers that don't work well I get outputs like $23.576 or $34.999999999. My question is how do I make the app round the two output answers to two decimal places ($55.349 goes to $55.35)? Thanks in advance! </p>
java android
[1, 4]
4,939,453
4,939,454
Validation method error
<p>I have the following method to ensure that an entered username does not already exist.</p> <pre><code>protected void checkUsername(object source, ServerValidateEventArgs args) { string connString = "Data Source=server;Initial Catalog=database;User Id=username;Password=password;"; string cmdText = "SELECT COUNT(*) FROM igs_users WHERE username = @username"; using(SqlConnection conn = new SqlConnection(connString)) { conn.Open(); using(SqlCommand cmd = new SqlCommand(cmdText, conn)) { cmd.Parameters.AddWithValue("@username", username); Int32 count = (Int32)cmd.ExecuteScalar(); args.IsValid = true; } } } </code></pre> <p>When I run it, I get the following error.</p> <p>System.ArgumentException was unhandled by user code HResult=-2147024809 Message=No mapping exists from object type System.Web.UI.WebControls.TextBox to a known managed provider native type. Source=System.Data</p> <p>The debugger gives me this error for the below line.</p> <pre><code>Int32 count = (Int32)cmd.ExecuteScalar(); </code></pre> <p>Any idea what's wrong with this code?</p>
c# asp.net
[0, 9]
4,588,139
4,588,140
Android Files folder will be deleted while upgrading an app in Market?
<p>I had developed Android Application which has <strong>Login Authentication Page.</strong> When the user logs in with valid data, the details are stored in <strong>Shared Preferences</strong> (shared_prefs folder in <code>data/data/&lt;App_PackageName&gt;/&lt;shared_prefs&gt; folder</code> as <code>SharedPreferences.xml</code> file). So when the user minimizes and maximizes the App, the Shared Preferences is working fine. I recently upgraded the App in the market with updated version Name and Version Code. The users gets the notification and upgrading the App from the market. While launching upgraded version, the app is displaying the Login Auth Page again. I thought that shared Preferences are deleted while upgrading the app, so i changed the storing the details from <code>Prferences.xml to .txt file.</code> The text file is storing in <code>data/data/&lt;App_PackageName&gt;/&lt;files&gt;</code> folder. Here my questions are:</p> <pre><code>1.The `files` folder and `shared_prefs` folder are stored in cache memory? 2. Whether cache will be cleared while upgrading the app from the market? </code></pre>
java android
[1, 4]
2,114,671
2,114,672
javascript search() working problem
<p>I have an jquery autosuggest plugin in which when i type ex. <code>Korea</code> then it show 2 results i.e. <code>Korea (North)</code> &amp; <code>Korea (South)</code> but when i type <code>Korea (</code>, its not displaying any result where it had to show both <code>Korea (North)</code> &amp; <code>Korea (South)</code>.</p> <p>After searching in the code for the error then i found a <code>search()</code> function which search for the type string in the results..</p> <p>means: <code>Korea (</code> in <code>Korea (North)</code> &amp; <code>Korea (South)</code></p> <p>and i think this search function stops at bracket <code>(</code> and i don't know why???</p> <p>Please, suggest a search() function to remove this error..</p> <p>code:::</p> <pre><code>str.search(query) != -1 </code></pre> <p>where: str = one result at a time i.e. <code>Korea (North)</code> query = entered string i.e. <code>Korea (</code> </p>
php javascript jquery
[2, 3, 5]
2,154,279
2,154,280
failed to call event from gridview linkbutton
<p>basically i wish to set a session folo by button click, but i failed to do so</p> <p><strong>i failed to call abcde function(), don't know what to set,i did try onRowCommand,onDataBound,OnDataBinding</strong></p> <pre><code>&lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"&gt; </code></pre> <p><strong>my link button on gridview</strong> </p> <pre><code>&lt;asp:LinkButton ID="lnkname" runat="server" Text='&lt;%#Eval("movieTitle") %&gt;' Width=500 CommandName="cmdLink"&gt; </code></pre> <p><strong>in order to find link button control i did try DataGridItemEventArgs, but it didnt work as well</strong></p> <pre><code> protected void abcde(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "cmdLink") { string path = //some path; Session["path"] = path; ((LinkButton)e.Item.FindControl("lnkname")).PostBackUrl = "~/somewhere/ + Session["path"].ToString()"; } } </code></pre> <p><strong>y i do so is because my next page function is depend on the session</strong></p>
c# asp.net
[0, 9]
4,282,549
4,282,550
How to get my div to fade out with jQuery on page load?
<p>I'm brand new to jQuery (and javascript in general). I've been meaning to use it/learn it for some time, and nows the time.</p> <p>So I'm going to use jQuery <a href="http://joelglovier.com" rel="nofollow">on this page</a> to fade out the "under construction" warning at the top of the page on load. But I'm unfamiliar with any of the functions or selectors to use.</p> <p>I found <a href="http://api.jquery.com/fadeOut/" rel="nofollow">this basic article</a> at jQuery which has a demo that seems to work perfect for what I'm doing, only it's set up to fade out on click.</p> <p>What do I need to change to get it to fade out after a few seconds once the page has loaded, and can you point me where to look to find out more about those type of functions (specifically on jQuery's site, if you're familiar). And please don't say, "In the documentation." I'm a noob but not a dummy, thanks. I'm just trying to learn more about that particular area of the syntax responsible for functions for now (if that's what they're called).</p>
javascript jquery
[3, 5]
4,838,098
4,838,099
find next element with conditions
<p>Hierarchical tree: </p> <pre><code> mouse (depth:0, sequence:0) * organ system (depth:1, sequence:1) o visceral organ (depth:2, sequence:2) urinary system (depth:3, sequence:3) mesentery (depth:4, sequence:4) * rest of mesentery (depth:5, sequence:5) * urogenital mesentery (depth:5, sequence:6) metanephros (depth:4, sequence:7) * renal capsule (depth:5, sequence:8) * nephrogenic zone (depth:5, sequence:9) </code></pre> <p>I have the following code which should retrieve the name of the the FIRST next node after the selected node, which has the same depth as the selected node and the sequence values should be greater than selected_node_sequence :</p> <pre><code>/** node id has the same value as node_depth **/ var selected_node_depth = parseInt($j(element).attr('APO_DEPTH')); var selected_node_sequence = parseInt($j(element).attr('APO_SEQUENCE')); var first_next_node_with_same_depth = $j("#"+selected_node_depth).next().attr("name"); [where first_next_node_with_same_depth sequence value &gt; selected_node_sequence] </code></pre> <p>For example, if 'selected_node' = mesentery, the 'first_next_node_with_same_depth' should be metanephros</p> <p>Any suggestion on how to do that is most appreciated</p>
javascript jquery
[3, 5]
801,656
801,657
Android Application Just After Boot
<p>I did a android application which launch just after boot finishes. It works in android 2.3.3 and Android 3.1 but when i force closed application which runs in android 3.1 and i reboot again the application doesn't come after boot ? </p>
java android
[1, 4]
2,277,230
2,277,231
A unique ID for a poll response
<p>In my system a manager create a poll and publish it to the world so users which have the link to the poll can answer it.</p> <p>There is some question which designed to receive multiple answers, so user can choose multiple distract in one response.</p> <p><strong>The response table structure in the DB</strong></p> <ul> <li>ID</li> <li>ActivityID - the poll ID</li> <li>Value - the district value</li> <li>TimeResponse</li> </ul> <p>In the database i am currently saving each response separately.</p> <p>I will give you an example Lets say there is 4 district in a poll (a,b,c,d) User choose the following district (a,b,c)</p> <p>The response table will look like this:</p> <pre><code> ID ActivityID Value TimeResponse 1 234 a 01/01/2012 2 234 b 01/01/2012 3 234 c 01/01/2012 </code></pre> <p>So if i try to count the ID i will get the number 3 which represent the number of district were answered is a given poll.</p> <p>BUT i need the number of responses per user in a given poll, so i need somehow to combine those two...</p> <p>Until now i thought about the following solutions but neither of them is good.</p> <ul> <li>the first solution was to add a column of the user's IP, but sometimes i cant get the user's IP.</li> <li>the second solution was to add a column of the user's sessionID using the sessionIDManager, but if the user answer twice (2 response) it will store the same session ID.</li> </ul> <p>FYI, the user which answer the poll is anonymous. </p> <p>And also one of the system requirement is to allow a user to answer a poll several times </p>
c# asp.net
[0, 9]
1,224,485
1,224,486
Call a method when class name not known at compile time
<p>I have a number of sub-games, SubGame1, SubGame2 etc. Each is derived from a SubGame class and implements a static String getDescription() function.</p> <p>I want to access these descriptions, e.g. SubGame1.getDescription(), SubGame2.getDescription() etc.</p> <p>However I want to use a code loop and not all the subgames will exist.</p> <p>How can I call getDescription() for a sub game when I only know the game number. Something like:</p> <pre><code>String description = Class.forName(this.getPackageName()+".SubGame"+subGameNo.getDescription(); </code></pre> <p>but that returns: The method getDescription() is undefined for the type Class&lt; capture#5-of ?></p> <p>Any ideas?</p>
java android
[1, 4]
32,097
32,098
How to call a popup window in C#
<p>I have webform1,webform2. I have a submit button in webform1.When the submit is clicked, it has to perform some function then based on the result i have to show different data (let say accept/decline images) in the webform2(POPUP). When this popup is displayed user should not be allowed to make any changes to webform1.</p> <p>Let me know how to achieve this. </p> <p>Thanks in advance</p>
c# javascript asp.net
[0, 3, 9]
4,431,506
4,431,507
Android, opening PDF
<p>I have a problem with my code in android.</p> <p>I have a Textview that receives a spanned text (html text) from the method <code>Html.fromHtml("www.mylink.com/something.html");</code>. </p> <p>I make this link clickable with this code</p> <pre><code>public static void setView(TextView text, String append) { if(append!=null) { Spanned htmlSpanned=Html.fromHtml(append); text.append((htmlSpanned)); text.setMovementMethod(LinkMovementMethod.getInstance()); } else { System.exit(1); } } </code></pre> <p>this code is correct when my links are web pages. If I have a link like <code>www.mylink.com/a.pdf</code>, the application crashes. </p> <p>I always resolved this problem using an intent, but this app does not receive every time the same link, it can be either a pdf or a web link.</p> <p>How can I resolve this error?</p>
java android
[1, 4]
5,783,911
5,783,912
Accessing and binding events to an ASP.NET Grid view using Jquery
<p>I have an ASP page which displays a text box when it loads. It takes an input number, send it to the server through post back, and then displays some record in a grid view. After a number is input into the box, the server fetches some data from a database and add records to the grid view. It also contains a link column, whose URL is set to "#", so that the page isn't redirected when it is clicked.</p> <p>Now I want to bind a jquery "click" event to that link. How can I do that ? I have tried that to do myself but failed, because it is not available when the DOM is loaded (since it only contains rows when a number is input through the box), and is being modified through ASP.NET Ajax post back.</p>
asp.net jquery
[9, 5]
3,367,198
3,367,199
javascript function that run php file who delete table row in database,mysql
<p>As title says, I was wondering is there any way to create function in javascript that will delete row in table? To call some php to delete row in table? I need help quickly! Thanks in advanced!</p>
php javascript
[2, 3]
2,269,306
2,269,307
jquerycropping,codiegniter,php
<p>I want to crop the image using jquery,codigniter</p> <p>in jquery i get four coordinate of image x1=249 x2=326 y1=194 y2=271 w=77 h=77</p> <p>in codiegniter done the query</p> <p>function do_crop() {</p> <pre><code> $x=249; $y=194; $w=77; $h=77; $path= 'system/application/'; $config = array( 'image_library' =&gt; 'gd2', 'source_image' =&gt; $path.'/jag1/flowers.jpg' , 'new_image' =&gt; $path.'/jag2/flowers.jpg', 'maintain_ration' =&gt; false, 'width' =&gt; $w, 'height' =&gt; $h, 'x_axis' =&gt; $x, 'y_axis' =&gt; $y ); $this-&gt;load-&gt;library('image_lib'); $this-&gt;image_lib-&gt;initialize($config); if ( ! $this-&gt;image_lib-&gt;crop()) { echo $this-&gt;image_lib-&gt;display_errors(); } $this-&gt;image_lib-&gt;clear(); } </code></pre> <p>i get cropped image. But problem is don't get exact cropped image x,y coordinate problem</p> <p>Please correct the coordinate</p>
php jquery
[2, 5]
5,249,485
5,249,486
How to find element with class on any depth using JQuery?
<p>I know that I have somewhere inside div on any depth ( maybe one or two or three, it changes over time ) with class="nested". How to find that element on any depth using JQuery ?</p> <p>I tried like </p> <p><code>var nest=$('#container_div').find('.nested');</code> but it doesn't work.</p>
javascript jquery
[3, 5]
5,255,476
5,255,477
How to use Ajax Loader in jQuery pop up
<p>Please tell me how to use Ajax Loader in jQuery pop up.</p> <p>On my aspx page there is jquery pop up, and on the pop up there is list of checkboxes, and when a check box is checked another list of checkboxes load. For this I want use Ajax Loader.</p>
jquery asp.net
[5, 9]
2,650,668
2,650,669
What's wrong with this Java code? Android?
<p>the purpose of this activity/program is to simply switch from this activity to another one using a button. From IzzynActivity to notes. Here is the android manifest:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="izzy.n" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="10" /&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" &gt; &lt;activity android:name="izzy.n.IzzynActivity" android:label="@string/app_name" &gt; &lt;activity android:name="izzy.n.notes" android:label="@string/notes"&gt;&lt;/activity&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>And here is the IzzynActivity.java code:</p> <pre><code>package izzy.n; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class IzzynActivity extends Activity{ /** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button wg = (Button) findViewById(R.id.button1); wg.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Intent myIntent = new Intent(IzzynActivity.this, notes.class); IzzynActivity.this.startActivity(myIntent); } }); } } </code></pre>
java android
[1, 4]
5,995,909
5,995,910
GridView - set selected index by searching through data keys
<p>I have a GridView which has DataKey[0] as productId. If i have for instance productId = 54, is there any way to search through all GridView item and set as selected the one who has DataKEy[0] = 54?</p> <p>For a drop down list i have :</p> <pre><code>ddlProducts.Items.FindByValue(lblProduct.Text.ToString())).Selected = true </code></pre> <p>Is anything similar for GridView?</p> <p>Thanks in advance.</p>
c# asp.net
[0, 9]
5,874,757
5,874,758
Modify a Binary file(an after effect project file) in c# or c++
<p>I need to change some text values inside an after effect project file that I assume it's a binary file. You cannot edit this file with a text editor, if you do next time you open it you will encounter the error message about corrupted project file.</p> <p>So i need to for example change "TextArea1" to "Some new text" so as you see the length of the new text is not the same as the original one. should i use BinaryReader or something? how can i find the original String in Byte[] Array i get from this command...</p> <p>As I'm a newbie in this field please tell me what should I do in this matter.</p>
c# c++
[0, 6]
5,988,051
5,988,052
how to handle the error message: Session state is not available in this context
<p>I am trying to create an error message page to display exception when exception occurs, and there is a return button on error message page to return the previous page where the exception caused.</p> <p>here is the code used to redirect the error page. </p> <pre><code>protected void btnAssign_Click(object sender, EventArgs e) { try { SqlDataSource3.Insert(); } catch (Exception ex) { Session["Exception"] = ex; Response.Redirect("~/ErrorMessage.aspx", false); } } </code></pre> <p>here is the code for my global.asax file</p> <pre><code>void Application_Error(object sender, EventArgs e) { // Code that runs when an unhandled error occurs Exception ex = Server.GetLastError().InnerException; Session["Exception"] = ex; Response.Redirect("~/ErrorMessage.aspx"); } </code></pre> <p>here is the code for errorMessage page.</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Exception ex = (Exception)Session["Exception"]; Session.Remove("Exception"); Literal1.Text = "&lt;p style='color:blue'&gt;&lt;b&gt;An unrecoverable error has occurred:&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style='color:red'&gt;" + ex.Message + "&lt;/p&gt;"; } } protected void btnReturn_Click(object sender, EventArgs e) { Response.Redirect("~/IncidentAssignment.aspx"); } </code></pre> <p>When I click the assign button, it opens the errorMessage page and display the exception, but when I click return button, the program crashed and pointed to global.asax file and says Session state is not available in this context, as shown in blew. <img src="http://i.stack.imgur.com/J0j9b.jpg" alt="enter image description here"></p> <p>I don't get it why is the session["exception"] Null. it will be much appreciated if anyone answered my question. Thanks.</p>
c# asp.net
[0, 9]
5,063,974
5,063,975
Android activity/task order issue
<p>I have an app with 2 main activities and a service. The app starts with activity 1, and the service launches activity 2 via an intent upon detection of an app launch A. Activity 2 then does some stuff and calls finish(), returning to app A.</p> <p>However, if I launch app A when I'm in activity 1, activity 2 appears and returns to activity 1 once it's done instead of returning to app A. If I then tap on the back button, I return to app A.</p> <p>On the other hand, if I go back to the home screen when I'm on activity 1 and start app A, activity 2 appears, and now returns to app A once it's done. This is the behavior I'm looking for, but it only happens when I'm not starting out from activity 1.</p> <p>Why does this happen? I'm launching activity 2 via an intent in the service with the FLAG_ACTIVITY_NEW_TASK flag.</p> <p>Thanks.</p>
java android
[1, 4]
5,393,373
5,393,374
Trying to get a "snapshot" of a form but am losing the values
<p>I have a highly dynamic form where interacting with a top-level element will completely transform the elements in the lower level part of the form. I wanted an easy way to maintain state so that if the user partially entered in form data for one of the top level categories, they could switch to something else (temporarily lose all the data they typed as well as the actual input elements) and then click back to that previous top-level category and restore everything as it was.</p> <p>I was planning something simple like, on clicking the top-level element, to do something like:</p> <pre><code>form_state[category] = $('form').html(); category = this.val(); if (form_state[category]) { $('form').html(form_state[category]) } </code></pre> <p>However, I quickly found that the html of the form was not including the values of the form elements that the user had interacted with (it was all the original default values). So I then realized that I need to collect all of the values of the elements within the form, and then reset them manually after resetting the form's inner html... So I am thinking something like:</p> <pre><code>$('input, select, textarea').each(function(el) { values.push($(el).val()); } </code></pre> <p>and then re-iterate over those and update the elements with something like:</p> <pre><code>if (form_state[category]) { $('form').html(form_state[category]) $('input, select, textarea').each(function(el, i) { $(el).val(values[i]); } } </code></pre> <p>But I was just wondering if anyone has come across something like this before and knows of a better solution than manually iterating over these? I was wondering if there is any sort of way to do a reverse form.serialize()? That way I could just store a serialized form snapshot also and update the entire form with the serialized data. Since .serlize() returns an escaped string, it seems like it might be more work than it's work and manually iterating over the form element types is a better way to go... ?</p>
javascript jquery
[3, 5]
3,896,202
3,896,203
handling views by ID
<pre><code>for(id=1;id&lt;=33;id++) { i = new TextView(this); i.setClickable(true); i.setOnClickListener(this); i.setId(id); i.setBackgroundResource(R.drawable.yes); AbsoluteLayout.LayoutParams lp2= new AbsoluteLayout.LayoutParams(abc, abc,abc ,abc); al.addView(i, lp2); } i = (TextView) findViewById(4); i.setBackgroundResource(R.drawable.no); </code></pre> <p>This peice of code never works for me. The <code>i= (TextView) findViewById(4);</code> part works. But then when I try to change the image, the app doesnt run. Help please</p>
java android
[1, 4]
816,368
816,369
javascript jquery function that expects a specific type of function as parameter?
<p>In jquery when I run:</p> <pre><code>$('li').each(some-function(i){}); </code></pre> <p>The IDE seems to know that some-function is expecting an index.</p> <p>It leads me to believe I can make a function in javascript/jquery that expects a function as one of it's parameters that expects certain paramters. (I am new to javascript)</p> <p>I know how to do it in c language.</p> <p>I am looking for something like this:</p> <pre><code>void somefuncA ( void (*funcB)(int) ){ //do stuff with funcB (*funcB)(5); } </code></pre> <p>So the function 'somefuncA' expects to get a function funcB that gets one integer as a parameter and then does something.</p> <p>Hope that makes sense.. thanks p.s. I know JavaScript is weakly type but I also noticed that <code>.each()</code> expects a function as parameter and not just any function but one with an int as parameter.</p>
javascript jquery
[3, 5]
3,488,428
3,488,429
Adding a function to one jQuery/DOM element
<p>I am authoring a plugin which instantiates a map. The map would then provide a function to move to another place on the earth.</p> <p>The script makes the map just fine. However I can't "tack" the function on the element, to be used by another plugin in a callback.</p> <p>Here's the approach I tried; in plugin:</p> <pre><code>(function($){ $.fn.mapDo(options){ map = new BlahMap(this.get(0)); this.moveTheMap = function(place){ map.moveItToThat(place); }; // nope. } })(jQuery); </code></pre> <p>Then, in view:</p> <pre><code>$(map).mapDo(); $(otherElement).otherControl({ callback: function(place){ $(map).moveTheMap(place); // moveTheMap is not there on $(map)! } }; </code></pre> <h3>The Question</h3> <p>How do I add a function to the map jQuery or DOM element, if possible? If not, how can I provide that kind of functionality?</p> <p>More importantly, am I going the right way here by separating the things that way? I'm a bit of a neophyte to Javascript, how are these tasks usually done while still keeping the components apart?</p> <p>While that's the stab I took at it, more generally, I struggled with the concept of outputting things from a jQuery plugin while maintaining chainability. In this case, what I am trying to do is to <strong>output</strong> a callback from the plugin that will work on the called element later in the execution.</p>
javascript jquery
[3, 5]
3,040,317
3,040,318
Jquery get hit from tempary image
<p>Ok so what I am doing is creating an upload form for images that gets displayed as a thumbnail, sort of like a preview. I have a set width that it is displayed and then in php on server side it is cropped to the size I want. However, for client side preview I want to show it at the width I have specified but get the height of the image after being resized to the specified width and adjust it with javascript. I hope that makes sense, anyway here is my code. Im not very Jquery / javascript savy so I am probably missing something.</p> <pre><code>&lt;script&gt; function readURL(input) { if (input.files &amp;&amp; input.files[0]) { var reader = new FileReader(); var imgHeight = $(".previewlogo").height(); reader.onload = function (e) { $('.previewlogo') .attr('src', e.target.result) $('.droparea') .attr('style', 'height:', imgHeight, 'px;') }; reader.readAsDataURL(input.files[0]); } } &lt;/script&gt; </code></pre> <p>and then the html</p> <pre><code>&lt;img class="previewlogo" src="#" alt="Click or Drag image here to add login logo"/&gt; &lt;input type="file" class="droparea spot logoupload" name="logo" onchange="readURL(this);"/&gt; </code></pre> <p>at the moment it is giving the size of the broken image size 39px; and also I am seeming to have an issue mixing the code with html on the .attr() tage, I am sure I am overlooking something</p>
javascript jquery
[3, 5]
4,231,784
4,231,785
Display images in Mosaic "without holes"
<p>I try to put pictures in a photo album or a div row so it would be "optimized" the vignatures images,</p> <p>In fact I try to recreate the management of sites Google Images +,</p> <p>Is there any resource for that?</p> <p>The algorithm seems to me to be a real headlock to arrive at this result as:</p> <p><a href="http://www.hostingpics.net/viewer.php?id=15859466a1.png" rel="nofollow">http://www.hostingpics.net/viewer.php?id=15859466a1.png</a></p> <p>Any idea to begin with ?</p>
php javascript jquery
[2, 3, 5]
1,324,519
1,324,520
Removing images that a user has clicked on
<p>I am working on a memory matching game. I have some code that checks if two images that the user clicked on have the same source and removes the images if they do have the same source.</p> <pre><code>(function compareClicked() { var lastclicked = ""; $("img").click(function() { var path = $(this).attr("src"); if( lastclicked == path) { $('img').hide(1000, function () { $(this).remove(); }); } else { if( lastclicked != "") alert("Not a match"); } lastclicked = path; }); })(); </code></pre> <p>However, as you can see, when they have the same source, it removes all of the images on the page - even if the user did not click any them. How can I change it so it only removes the two images that the user clicked on?</p>
javascript jquery
[3, 5]
121,775
121,776
how to know the the objects x and y position in web page
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1101292/how-to-get-the-top-position-of-an-element">How to get the top position of an element?</a> </p> </blockquote> <p>i am just wondering how to know the correct position of an object in the webpage. I try to solve this doubt myself. But i am not able to solve. In other language like AS3, there is x and y properties are there to know the position. but using java script or j query, i do not know how to do this.</p> <p>here is little bit of code to start : i want to know the container object's x and y position.</p> <pre><code>$(function(){ var myObject = $('#container'); var objectXpos; var objectYpos; }); </code></pre> <p>thanks, naresh kumar.</p>
javascript jquery
[3, 5]
2,682,739
2,682,740
Android Save Image and read
<p>Hı a have a bitmap(from byte array). I want to save that as PNG file in internal storage. </p> <p>Then I want load this image to webview ?</p> <p>How can ı do this ?</p>
java android
[1, 4]