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,745,302
1,745,303
Redirecting Application-Level Error Handler
<pre><code>protected void Application_BeginRequest(object sender, EventArgs e) { const int maxFileSizeKBytes = 10240; //10 MB const int maxRequestSizeKBytes = 305200; //~298 MB if (Request.ContentLength &gt; (maxRequestSizeKBytes * 1024)) { Response.Redirect(".aspx?requestSize=" + Request.ContentLength.ToString()); } for (int i = 0; i &lt; Request.Files.Count; i++) { if (Request.Files[i].ContentLength &gt; (maxFileSizeKBytes * 1024)) { Response.Redirect(".aspx?fileSize=" + Request.Files[i].ContentLength.ToString()); } } } </code></pre> <p>This code is in Global.asax.cs page. I need to redirect to the page that triggered this check. And I need to know the ticketId or projectId parameter. For example I create new ticket at the View Project page <code>/Project/ViewProject.aspx?projectId=1</code> I need to redirect to this page with a meaningful message to the user, because I think that redirecting to another page to display the error message is not a good idea.</p>
c# asp.net
[0, 9]
1,790,287
1,790,288
Resizable div doesn't stay within containment parameter
<p>When resizing the middle div, it will not stay within the <code>containment</code> parameter on the right boundary of the grid, and it will not resize to the left.</p> <p><a href="http://jsfiddle.net/dKuER/8/" rel="nofollow">http://jsfiddle.net/dKuER/8/</a> (clear example, updated)</p> <p><strong>HTML</strong></p> <pre><code>&lt;div id='grid'&gt; &lt;div class='outline first top'&gt; &lt;div class='container'&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class='outline top'&gt; &lt;div class='container resizable'&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class='outline last top'&gt; &lt;div class='container'&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class='outline first bottom'&gt; &lt;div class='container'&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class='outline bottom'&gt; &lt;div class='container'&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class='outline last bottom'&gt; &lt;div class='container'&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>JS</strong></p> <pre><code>$(document).ready(function() { $('.resizable').resizable({ containment: "#grid", // Updated to reflect answer, but wasn't the issue. handles: "ne,se,nw,sw" }); });​ </code></pre>
javascript jquery
[3, 5]
1,923,868
1,923,869
tag cloud filter
<p>I have a div that contains many spans and each of those spans contains a single href.</p> <p>Basically it's a tag cloud. What I'd like to do is have a textbox that filters the tag cloud on KeyUp event.</p> <p>Any ideas or is this possible?</p> <p>Updated question: What would be the best way to reset the list to start the search over again?</p>
javascript jquery
[3, 5]
3,677,342
3,677,343
Block characters from input text field, mirror input into span or div
<p>I have some html</p> <pre><code>&lt;input type="text" name="name" value="" id="name"&gt; &lt;div id="preview"&gt;&lt;/div&gt; </code></pre> <p>The rules for entry into the field:</p> <ul> <li>Letters A-Z a-z 0-9 space and dash, no other characters allowed<br /></li> <li>Entry of forbidden characters should do nothing<br /></li> </ul> <p>The rules for the div:</p> <ul> <li>Show each characters as it is entered into the input field<br /></li> <li>Do not show characters that are forbidden<br /></li> <li>When a space is encountered, show it as a dash<br /></li> </ul> <p>I have had various potions working, not working, or misbehaving. This version seems to work in all cases I can test other than backspace/delete is non functional. Only tested in Safari so far.</p> <p>There are other "gotcha" areas, like entering in text in-between already entered text, select all, using the arrow keys, all these play a role in this problem. </p> <pre><code> $(document).ready(function(){ $('#name').keypress(function(e) { // get key pressed var c = String.fromCharCode(e.which); // var d = e.keyCode? e.keyCode : e.charCode; // this seems to catch arrow and delete better than jQuery's way (e.which) // match against allowed set and fail if no match var allowed = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890- '; if (e.which != 8 &amp;&amp; allowed.indexOf(c) &lt; 0) return false; // d !== 37 &amp;&amp; d != 39 &amp;&amp; d != 46 &amp;&amp; // just replace spaces in the preview window.setTimeout(function() {$('#preview').text($('#name').val().replace(/ /g, '-'));}, 1); }); }); </code></pre> <p>If there is a way to put a monetary bounty on this post, let me know. Yes, that is where I am at with this one :)</p>
javascript jquery
[3, 5]
1,861,804
1,861,805
Jquery - Click Coordinate on Page
<p>Probably such a simple question, but after reading a few tutorials and other posts on stackoverflow, I couldn't get what I was looking for. Essentially what I want is easy, using the .click() function in jQuery, I want to click a specific X, Y, location on the page. All I found were tutorials on how to find coordinates, but not specifically click them! Any help is appreciated, thank you!</p>
javascript jquery
[3, 5]
4,124,914
4,124,915
jQuery access to 'this' object with events and triggers
<p>I have two classes orchestrated by a main class and I would like to know how to gain access to the correct 'this' object when events are fired among these classes. Here's what I have:</p> <pre><code>// My main class that orchestrates the two worker classes function MainClass() { this.workerOne = new ChildWorkerOne(); this.workerOne.bindBehaviors.apply(this.workerOne); this.workerTwo = new ChildWorkerTwo(); this.workerTwo.bindBehaviors.apply(this.workerTwo); // a custom event I'm creating and will be triggered by // a separate event that occurs in workerTwo $(document).bind("customEvent", this.onCustomAction); } MainClass.prototype.onCustomAction = function(event, data) { // I want to call a method that belongs to 'workerOne'. this.workerOne.makeItHappen(); // However, the 'this' object refers to the 'Document' and // not the 'MainClass' object. // How would I invoke 'makeItHappen' here? }; ChildWorkerOne.prototype.makeItHappen = function() { // Do a bunch of work here }; ChildWorkerTwo.prototype.bindBehaviors = function() { $(div).click(function(e){ $.post(url, params, function(data) { // do a bunch of work with this class and then // trigger event to update data with ChildWorkerOne $(document).trigger("customEvent", [data]); } }); }; </code></pre> <p>I don't want to merge ChildWorkerOne and ChildWorkerTwo because they are two separate entities that don't belong together and MainClass conceptually should orchestrate the ChildWorkerOne and ChildWorkerTwo. However, I do want to invoke the behavior of one in the other. </p> <p>What's the best way to go about doing this?</p>
javascript jquery
[3, 5]
3,670,320
3,670,321
Controlling C++ Output from Python Script
<p>I have a bit of an issue here. I have a Python script which calls binaries compiled from C++. The Python script has its own set of outputs (to standard out and error), which are easily disable-able. The C++ binaries have their own set of outputs (to standard out and error, among others) as well; the source can be altered, but I am not the original author. This is an issue because I do not want the C++ output in my final program, and I also don't want future users to need to edit the C++ source. </p> <p>What I'd like to be able to do is have some Python method which will catch the C++ code's output that is sent to standard out or error. Is this possible? If so, could someone point me in the right direction?</p> <p>Thank you!!</p>
c++ python
[6, 7]
1,628,116
1,628,117
jQuery remove appended element
<p>I'm trying to have a form fade away then show a message "connecting your call" then after 3 seconds the "connecting your call" message fades away and after 30 seconds the form comes back. The form is hiding and coming back just find I just can't figure out how to make the dynamic appended tag fade. Any suggestions would be great </p> <pre><code>$("#form").hide().delay(30000).fadeIn('slow'); $("#formarea").append("&lt;h3&gt;Connecting your call...&lt;/h3&gt;").delay(3000).$('h3').fadeOut('slow'); </code></pre>
javascript jquery
[3, 5]
5,679,694
5,679,695
Using jQuery.get() to measure client bandwidth
<p>I am using the following script do determine the downlink bandwidth of a user to serve content accordingly:</p> <pre><code> var bandwidthCheckStart = new Date().getTime(); var bandwidthCheckEnd; $.ajax({ url: xBandwidthCheckFile, async: false, cache: false, success: function(clipXmlRequest){ bandwidthCheckEnd = new Date().getTime(); }, error: function() { xSendDebugMessage("Could not get \""+xBandwidthCheckFile+"\" from server.", "warning"); } }); var bandwidthCheckDuration = bandwidthCheckEnd - bandwidthCheckStart; </code></pre> <p>However, I feel like this method is not reliable, since it doesnt consider the time needed to initiate the file transfer. (We could probably minimize the effects by using a larger file to check the bandwidth but I want it to be 10kb max.)</p> <p>Is there any way to determine the time the request starts to be answered or do you have another more reliable way in mind?</p>
javascript jquery
[3, 5]
1,497,284
1,497,285
Why my code doesn't work on Internet Explorer?
<p>Why my code doesn't work on Internet Explorer:</p> <p><img src="http://i.stack.imgur.com/p0aYq.png" alt="enter image description here"></p> <p>64 line start here:</p> <pre><code>$(function () { $('#id_laufzeit_bis').datepicker().on('changeDate', recalculate_deadline); $('#id_kuendigungsfrist').change(recalculate_deadline); $('#id_kuendigungsfrist_type').change(recalculate_deadline); $('#id_kuendigung_moeglichbis').change(check_reminder_date); $('#id_erinnerung_am').datepicker().on('hide', check_reminder_date); //$('#id_vertrag_verlaengerung').change(recalculate_deadline); //$('#id_vertrag_verlaengerung_type').change(recalculate_deadline); }); </code></pre> <p>Full code here: <a href="http://wklej.org/hash/a8884a307f3/" rel="nofollow">http://wklej.org/hash/a8884a307f3/</a></p>
javascript jquery
[3, 5]
2,126,224
2,126,225
How to find and remove attirbutes in cloned item using jquery?
<p>I trying to clone a div content with below code.</p> <pre><code>var clonedItem = $("#cloneableSchoolTab").clone(); clonedItem.find(".clonableSchool").addClass("clonedSchoolTab" + schoolTabCount ); $("#clonedSchoolTabsContainer").append(clonedItem); </code></pre> <p>First line gets the whole target item. But, the excecution of second line, the value of <code>clonedItem</code> changed as empty array. I dont know. If i merge the first 2 line, the reasult was same as the above code.</p> <p><strong>HTML Code:</strong></p> <pre><code>&lt;div id="cloneableSchoolTab" class="schoolInput"&gt; &lt;input type="text" id="schName"/&gt; &lt;input type="text" id="schDes"/&gt; &lt;/div&gt; </code></pre> <p>Any help would be appreciative.</p> <p>Thanks in advance</p>
javascript jquery
[3, 5]
5,128,960
5,128,961
jQuery - Selecting element after current position
<p>What I want to do is select the next element below where I am on the page. I want to do this to create a "View next post" function. So, if I am past the beginning of post 2, then I want the function to take me to post 3. Conventional jQuery will ask me which child to use of the parents and by default use the first instance, but I want to select the next post below the top of the screen.</p> <p>So far I am able to grab the current position of the page using:</p> <pre><code>var curPos = $('html').offset(); var Posi = String(curPos.top).replace(/-/g, ""); </code></pre> <p>But I'm not sure how to filter a function to only select elements below that position.</p> <p>Help?</p>
javascript jquery
[3, 5]
668,992
668,993
How to write code below as jquery?
<p>How can I write the code below as a jquery:</p> <pre><code>var imagefile = document.getElementsByClassName("fileImage"); var filename = imagefile.files[0]; </code></pre> <p>I attempted this below but it says it is not defined even though I have already stated file input's class is 'fileImage'.</p> <pre><code>var filename = $('.fileImage').files[0]; </code></pre>
javascript jquery
[3, 5]
2,779,823
2,779,824
Overwriting paddingLeft in a LinearLayout on Android
<p>i am currently making one android application, i moded title bar, so all content for title bar is holded in window_title.xml where i have LinearLayout set: paddingLeft="5dip" . And now i need to load one imageView on the right side of this titleBar how i am able to some kind of overwrite this paddingLeft i cant delete it as it required for text and image on the left but i need it on right too...</p> <p>Here is current xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="50dip" android:gravity="center_vertical" android:paddingLeft="5dip" android:background="#222222"&gt; &lt;ImageView android:id="@+id/header" android:src="@drawable/header" android:layout_width="wrap_content" android:layout_height="wrap_content"/&gt; &lt;TextView android:text="TextTexast" android:textSize="10pt" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:paddingLeft="5dip" android:textColor="#F7F7F7" /&gt; &lt;/LinearLayout&gt; </code></pre>
java android
[1, 4]
4,838,045
4,838,046
How to pass data from Java applet to client side python script?
<p>I have a python script which does various number-crunching jobs and now need to put a graphical front-end on it (a molecular editor in which a user draws a compound to pass to the script) to allow others in the lab to use it more easily. The available editors are Java applets, standalone Java or written in JavaScript. </p> <p>I would greatly appreciate any advice on the best strategy to put the editor and script together. I really don't want to get into client/server arrangement and envisage a self-contained install on each machine i.e. "client only". Is it better to start off in javascript and pass the output in some way to python and then run the python script from within js. Or (preferably) is there some way to run applets (or standalone java) within python e.g. in Tkinter or some other GUI and "on-click" take the output from the editor into the python script for the crunching bit. </p> <p>Thanks for any pointers - book chapters, useful projects/libraries and links to examples would be great. </p>
java javascript python
[1, 3, 7]
4,475,456
4,475,457
Simple jQuery assignment
<p>I have a on change method defined for my drop-down as follows - </p> <pre><code>$("[name=engine]").change( function() { var selectedIndex = $(this).val() ; var selectedValue = $("#engine option[value=333]").text() alert("Change..." + selectedIndex + " - "+ selectedValue); }); </code></pre> <p>Here instead of <code>333</code>, i want to substitute the value of <code>selectedIndex</code>, how can I assign it to the <code>option[Value= ??]</code> element?</p>
javascript jquery
[3, 5]
160,571
160,572
jQuery: too much recursion on .focus()
<p>I am using the jQuery <code>.focus()</code> method to focus on an element through a remote script in asp.net. I am getting an error about too much recursion.</p> <p>What am I doing wrong?</p> <p>asp.net code : </p> <pre><code>Response.Write("&lt;script&gt;$('#ledger_name').focus();&lt;/script&gt;"); </code></pre> <p>html </p> <pre><code>&lt;input type="text" id="account_name" name="account_name" /&gt; </code></pre> <p>js for auto complete </p> <pre><code>$("#account_name").autocomplete({ source: account_master, minLength: 1, minChars: 0, width: 350, mustMatch: 0, selectFirst: true, matchContains: false, autoFocus: true, autoFill: false, change: function (event, ui) { if (!ui.item) { $(this).val(''); } }, select: function (event, ui) { $("#account_name").val(ui.item.label); $("#account_name_code").val(ui.item.id); $("#account_name_parent").val(ui.item.parent); //$('#ledger_name').focus(); return true; } }); </code></pre> <p>jquery ui</p> <pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>it's giving an error in jquery-ui.min.js file on calling <code>$('#ledger_name').focus();</code> in autocomplete</p>
javascript jquery asp.net
[3, 5, 9]
5,868,657
5,868,658
Adding floats with javascript
<p>I'm using jQuery, and I want to sum up the values in my table column, everything seems to work fine, but my value is returned a string with all the values added like: <code>123.5013.0012.35</code></p> <p>How can I sum these properly?</p> <pre><code>var totals $(".add").each(function(i) { totals += parseFloat($(this).text()).toFixed(2); }); console.log(totals); </code></pre>
javascript jquery
[3, 5]
3,665,300
3,665,301
Why my Dialog box isn't working
<p>This is the code I am trying and not working, nothing comes up at all</p> <pre><code>&lt;script type="text/javascript" src="jquery/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery/jquery-ui.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function HandleIt() { var objA = $get('&lt;%= chkBox.ClientID %&gt;'); if(objA.checked == false) $("#dialog").dialog(); //alert("it works"); } &lt;/script&gt; &lt;div style="width: 800px;"&gt; &lt;asp:ScriptManager ID="ScriptMan1" runat="server" /&gt; &lt;div class="dialog"&gt; &lt;div class="a"&gt; &lt;asp:Label ID="lbla" runat="server" CssClass="text" /&gt; &lt;/div&gt; &lt;div class="b"&gt; &lt;asp:Label ID="lblb" runat="server" CssClass="text" /&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Code I given down works when dialog when it is like this, </p> <pre><code>&lt;div class="dialog"&gt; Hahahahaha &lt;/div&gt; </code></pre> <p>I want to use it as message box but its not working out.</p>
c# javascript jquery asp.net
[0, 3, 5, 9]
5,823,979
5,823,980
JQuery - DIV-Content-Change should be another URL
<p>after the user logged in, the project-url is root/inside/. The site has 4 different main-sections, which will be displayed in a div via Ajax. The url does not change, after clicking on the links. How can i do it, that the url changes like this after clicking on the links for the main sections:</p> <pre><code>root/inside/my_account root/inside/part_one root/inside/part_two root/inside/part_three </code></pre> <p>I would like to use that, because when the user is at one section and uses the back-button in the browser he is at the root. That's not user likely...</p> <p>Thanks-</p>
javascript jquery
[3, 5]
4,287,032
4,287,033
strange behaviour of static method
<p>I load a js variable like this:</p> <pre><code>var message = '&lt;%= CAnunturi.CPLATA_RAMBURS_INFO %&gt;'; </code></pre> <p>where the static string CPLATA_RAMBURS_INFO i put like:</p> <pre><code>public static string CPLATA_RAMBURS_INFO = "test"; </code></pre> <p>I use it very well in this method.</p> <pre><code> &lt;script type="text/javascript"&gt; var categoryParam = '&lt;%= CQueryStringParameters.CATEGORY %&gt;'; var subcategoryParam = '&lt;%= CQueryStringParameters.SUBCATEGORY1_ID %&gt;'; var message = '&lt;%= CAnunturi.CPLATA_RAMBURS_INFO %&gt;'; function timedInfo(header) { $.jGrowl(message, { header: header }); }; &lt;/script&gt; </code></pre> <p>so the message appears.</p> <p>I do not undersand, why, iso of "test", if i take the value from a static method, ths use of message js var is no longer succesfull (the message no longer appears).</p> <pre><code>public static string CPLATA_RAMBURS_INFO = getRambursInfo(); public static string getRambursInfo() { return System.IO.File.ReadAllText(PathsUtil.getRambursPlataFilePath()); } </code></pre> <p>EDIT: Source Code:</p> <pre><code>&lt;script type="text/javascript"&gt; var categoryParam = 'category'; var subcategoryParam = 'subcategory1Id'; var message = 'Lorem ipsum dolor sit amet, eu curabitur venenatis </code></pre> <p>viverra pellentesque tortor tempor, nam est suspendisse, aenean vestibulum, suspendisse eget metus aenean at dictum nulla. In luctus, neque porttitor suscipit nibh, aenean ut, commodo velit leo volutpat ullamcorper. ';</p> <pre><code> function timedInfo(header) { $.jGrowl(message, { header: header }); }; &lt;/script&gt; </code></pre>
c# asp.net javascript
[0, 9, 3]
5,648,015
5,648,016
jQuery - Lose labels text on Postback
<p>I'm filling some labels using jQuery AJAX and it's working properly (i'm getting the values through webservices). But after that, i'm firing and Button click to get that values but in debugging the labels are empty.</p> <p>I think it's because the values are losing in PostBack.</p> <p>Is there anyway to keep those labels values on Postback?</p>
c# jquery
[0, 5]
5,365,310
5,365,311
Create new cookie to edit its value
<p>I know that you can't edit incoming cookies. I have a cookie that I just need to read..nothing more but I have a need to remove some characters from its value so that I can parse it. How can I do this? I don't need to send the modified new cookie back in the response, it's just for my server-side consumption and then that's it.</p> <p>Updated:</p> <p>figured it out:</p> <pre><code> HttpCookie facebookAuthCookie = HttpContext.Current.Request.Cookies[facebookCookieName]; string cleanValue = facebookAuthCookie.Value.Replace("\"", string.Empty); HttpCookie cleanedFacebookAuthCookie = new HttpCookie("cleanedFacebookCookie", cleanValue); </code></pre> <p>gayness</p>
c# asp.net
[0, 9]
5,483,101
5,483,102
Async Task Can it partially run?
<p>It is definitely working as postData sends to my site and forwards an email which it is doing. But loadingDialog does not execute ( it may be but it is a very quick process). The last process sentdialog is not executing as it brings up a new dialog saying sent and is not happening. I have this script for the async</p> <pre><code> protected class sendReport extends AsyncTask&lt;Void, Void, Void&gt; { protected void onProgressUpdate() { progressdialog(); } protected void onPostExecute() { sentdialog(); loadingDialog.dismiss(); } @Override protected Void doInBackground(Void... arg0) { postData(); publishProgress(); return null; } } </code></pre> <p>Below is the sent dialog script.</p> <pre><code>public void sentdialog(){ //set up dialog final Dialog sentdialog = new Dialog(context); sentdialog.setContentView(R.layout.sentdialog); sentdialog.setTitle("Sent"); sentdialog.setCancelable(true); final Button button = (Button) sentdialog.findViewById(R.id.Button01); button.setOnClickListener(new OnClickListener() { public void onClick(View v) { sentdialog.dismiss(); } }); sentdialog.show(); } </code></pre>
java android
[1, 4]
322,128
322,129
Why it skips the if block
<p>Apology for another newbie question. I have this block of code in my MainActivity should check the users and returns an appropriate activity based on the if else statement. Problem is that it skips the if block and I can't figure out why. All I know is that the getID function works fine on other classes. Thank you for reading this.</p> <pre><code>public class MainActivity extends Activity { UserFunctions userFunctions; @Override public void onCreate(Bundle savedInstanceState) { userFunctions = new UserFunctions(); super.onCreate(savedInstanceState); setContentView(R.layout.main); UserFunctions fn = new UserFunctions(); String id = fn.getID(getApplicationContext()); if("100".equals(id)){ Intent in = new Intent(getApplicationContext(), AdminActivity.class); startActivity(in); finish(); }else{ Intent in = new Intent(getApplicationContext(), UserActivity.class); startActivity(in); finish(); } } } </code></pre> <p>UserFunction Class</p> <pre><code>/* Get user ID from DatabaseHandler */ public String getID(Context context) { String id = ""; DatabaseHandler db = new DatabaseHandler(context); Cursor cursor = db.getUserID(); if(cursor != null) { while(cursor.moveToNext()) { id = cursor.getString(0); } } else { id = ""; } cursor.close(); db.close(); return id; } </code></pre> <p>DatabaseHandler Class</p> <pre><code>/* Get user ID from the database */ public Cursor getUserID() { String qry = "SELECT id FROM " + TABLE_LOGIN; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(qry, null); return cursor; } </code></pre>
java android
[1, 4]
5,268,474
5,268,475
Find all asp:textboxes that are textmode=password and change display to none
<p>Is there a way to find all asp:textboxes where textmode=password and change their display to none or do I need to give them all a class?</p> <p>Thanks</p>
javascript jquery
[3, 5]
1,171,408
1,171,409
Disable gridview refresh after SQL insert?
<p>I'm using a gridview and SQL data source .</p> <p>After I'm inserting information in data table if I refresh the page the query is executed again and if I refresh it again it will execute again.</p> <p>Is there any way to disable refresh or make the events unique to be executed only once when the event is raised without execution on refresh</p> <p>Thanks</p>
c# asp.net
[0, 9]
1,142,097
1,142,098
Append Trakt.tv API
<p>I'm trying to query trakt.tv for my latest activity, but I only get a blank screen on proceeding with this script using jquery-1.4.4.js:</p> <pre><code> $(document).ready(function(){ // on document load show_trakt(); }); function show_trakt() { var user = 'INSERT_USERNAME'; var akey = 'INSERT_API_KEY'; var data; var turl = 'http://api.trakt.tv/activity/user.json/'+akey+'/'+user+'/all/?callback=?'; if($('.traktrecent ul').length &lt;= 0) { $('.traktrecent').append('&lt;ul /&gt;'); } $('.traktrecent').hide(); $.getJSON(turl, function(data){ var i=0; $.each(data.activity, function(index, item){ if (i &lt; 11) { var ts = tc(item.timestamp); $('.traktrecent ul').append('&lt;li&gt;&lt;small&gt;'+ts+'&lt;/small&gt;: &lt;a class="lP" href="'+item.episode.url+'" target="_blank"&gt;'+item.show.title+'&lt;/a&gt; - &lt;cite&gt;'+item.episode.title+'&lt;/cite&gt;&lt;/li&gt;'); } i++; }); $('.traktrecent').fadeIn(); }); } function tc(uts){ var a = new Date(uts*1000); var mon = pad(a.getMonth()+1); var d = pad(a.getDate()); var h = pad(a.getHours()); var min = pad(a.getMinutes()); var time = d+'/'+mon+' '+h+':'+min; return time; } function pad(number) { return (number &lt; 10 ? '0' : '') + number } </code></pre> <p>Any help is much appreciated :-)</p>
javascript jquery
[3, 5]
4,154,103
4,154,104
Jquery - Validating Email
<p>I do NOT want to use the Jquery attachment to the field. <strong>I just want a function I can call and pass in a value and get back a result on if it is a valid email.</strong> JQuery documentation seems to indicate this is possible but the documentation falls short on examples outside of attaching it to the field.</p> <p>I realize I can use third-party functions, but it would be nice to know how to do this with Jquery since I do this alot in projects.</p>
javascript jquery
[3, 5]
3,856,380
3,856,381
Embed open source libraries or plugins in a jQuery plugin
<p>When building a jQuery plugin, do you think it's bad practice to embed the source of another plugin or library that it depends on?</p> <p>It seems to me that it's a better way to go than requiring users to do multiple <code>&lt;script src="..."&gt;</code> calls or compressing the multiple source files themselves.</p>
javascript jquery
[3, 5]
225,860
225,861
Calling ASP.NET Code Behind function from JavaScript
<p>Is it possible to call ASP.NET codebehind function from JavaScript.</p>
javascript jquery asp.net
[3, 5, 9]
197,747
197,748
onclick depending on where the view is
<p>I want to make something appear depending on where the view is on a tablet for example : so i know i need to use ontouch listener like this :</p> <pre><code>.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub Toast.makeText(getContext(), "X :"+event.getX(), Toast.LENGTH_LONG).show(); return true; } }); </code></pre> <p>For example there is 2 images from left to right, if i click on the left one, something appear on the right, and if i click on the right one, something will appear.. And i want to extend this to a horizontal scrollview full of images.</p>
java android
[1, 4]
2,370,015
2,370,016
Orientation change and Notification
<p>I want to implement the following scenario:</p> <p>When a user presses the Home key a Notification is displayed in the Status bar and the App is normally hidden. When user taps the Notification App is normally restored.</p> <p>Here is my code for this:</p> <pre><code>private int NOTIFICATION = R.string.local_service_started; private NotificationManager mNM; private void showNotification() { CharSequence text = getText(R.string.local_service_started); Notification notification = new Notification(R.drawable.icon, text, System.currentTimeMillis()); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, JingleCartoucheActivity.class), 0); notification.setLatestEventInfo(this, getText(R.string.local_service_label), text, contentIntent); mNM.notify(NOTIFICATION, notification); } @Override public void onPause() { super.onPause(); if (!isFinishing()) { showNotification(); } } @Override public void onResume() { super.onResume(); mNM.cancel(NOTIFICATION); } </code></pre> <p>All of this is working well except for one thing: </p> <p>When the App is run and the user rotates the phone, the notification is created and immediately destroyed. Is there a way to detect the phone orientation change in onPause() and not show this Notification? </p>
java android
[1, 4]
675,387
675,388
get value of an attribute of the clicked element
<pre><code>&lt;ul id='langs'&gt; &lt;li data-val='en'&gt;english&lt;/li&gt; &lt;li data-val='fr'&gt;francais&lt;/li&gt; &lt;li data-val='it'&gt;italiano&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>when the user clicks on any of these <code>&lt;li&gt;</code> I want to <code>alert()</code> it's data-val attribute value</p> <p>anybody knows how?</p>
javascript jquery
[3, 5]
6,033,082
6,033,083
Accessing a inner div value in javascript, with no ids to help
<p>I have following structure</p> <pre><code>&lt;div onClick="javascript:Myfunction('value');"&gt; &lt;div title="Mytitle"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Can I access in the javascript Myfunction, the title of the inner div. There are no ids here.</p>
javascript jquery
[3, 5]
390,912
390,913
How to Add a Div and text in side the div in aspx using C#
<p>How to Add a Div and text inside a div in .aspx file using C#. I want to add a textbox for typing comment or query and a button to post that text/query. to the server. After redirect that page should get data from DB and Show on that page. same as(all Forms) like stackoverflow, we type Question, and submit it, can show it </p>
c# asp.net
[0, 9]
3,355,510
3,355,511
calling same function after timeout malfunctioning
<pre><code>$(document).ready(function () { tabSlideOut() } function tabSlideOut() { $('.slide-out-div').tabSlideOut({ //---- }); </code></pre> <p>Want call tabslideout hide after 3 second showing the success or error message so i call it after timeout , </p> <pre><code>setTimeout(function () { tabSlideOut(); }, 3000) </code></pre> <p>but it malfunctioning it repeat hiding and showing again and again please any one can guide me to to do this </p>
javascript jquery asp.net
[3, 5, 9]
360,908
360,909
Variable's value not retained in the method of a class
<p>In ASP>Net using C#, I declared a variable as member of the class as follows:</p> <pre><code>public class sales: System.Web.UI.Page { string type=null; } </code></pre> <p>And i have an Image Button in my UI for which I've defined the event called</p> <pre><code>protected void ImageButton2_Click(object sender, ImageClickEventArgs e) </code></pre> <p>in this method, any value assigned to variable 'type'(by any other method of the class) is not retained and only value null is being retrieved though I've assigned some value to 'type' somewhere inside the class...</p> <p>What could be the problem that I cant access the assigned value????</p>
c# asp.net
[0, 9]
4,799,050
4,799,051
Using a dynamic variable within a for statement
<p>I would like to dynamically create and reference some variables on the fly, but i'm not understanding how to.</p> <p>Here is what I would think 'should' work, but I know doesn't.</p> <pre><code>var weeks = 4; for(i=0; i&lt;weeks.length;i++){ var 'week_'+i = valueFromXML; } function wtFn (){ 'week_'+i.splice(-1, 1); if('week_'+i.length &lt;=0){ $(this).parent().parent().slideUp(); } } </code></pre> <p>I'm open to suggestions. Thanks in advance.</p>
javascript jquery
[3, 5]
2,796,850
2,796,851
Change margin value on table with value from a variable with jQuery?
<p>I select some tables using this:</p> <pre><code>$('.StatusDateTable').each(function() { var statusLight = $(this).find(".StatusLight").attr("src"); statusLight = statusLight.substring(33).slice(0,-9); if (statusLight == "Blue") { var columns = Math.abs((start - end)-1); var columnWidth = 40; var marginRight = Math.abs(columnWidth * columns); </code></pre> <p>Now I want to set margin-right="theValueOfmarginRightHere" on the current table, is this possible?</p> <p>I tried something like:</p> <pre><code>$(this).attr('margin-right=" + marginRight + "'); </code></pre> <p>but obviously it doesn't work.</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
957,044
957,045
Avoid data redundancy in ASP.NET page
<p>I have an asp.net page which uses a listview to show 2 columns of data. The first column has just labels and the second one has dropdowns.</p> <p>My concern is, the dropdowns in second column has same items 100% of the time, they never change and since it is databound, and datasource to these dropdown is also same. As these dropdowns are in a list view this repetition happens on each row added to my list view!</p> <p>So, I was thinking of removing this data redundancy being transported over the wire. Any ideas?</p>
c# asp.net
[0, 9]
5,804,537
5,804,538
Example of use GetRolesForUser();
<p>I need to check in conditional logic if a user has more that one role associated. Script should work like: If a user has 1 role CODE OK If a user has more that 1 role CODE ERROR</p> <p>The method is GetRolesForUser();</p> <p>But I do not know how to use it, could you please give me a sample of code? how to implement it, arrays?</p> <p>Thanks guys</p>
c# asp.net
[0, 9]
2,485,120
2,485,121
while using maskededitextender all links in master page will disabled in asp.net
<p>I have a text box in my content page of asp.net webapplication. I masked the text box with maskededitextender with date format dd/MM/yyyy. I use custom validator to validate the text box. While entering wrong date format in text box like MM/dd/yyyy(12/23/2011) it will throw validation message "Incorrect date format". During this time it disables all other links in Master page. </p> <p>How to overcome this problem. Can anyone help me with this? </p> <p>Thanks.,</p>
c# asp.net
[0, 9]
3,659,054
3,659,055
In a browser extension, how do I click a specific button of an alert?
<p>So...</p> <p>I need to click <code>[Stay on this page]</code> automatically in such a prompt:</p> <blockquote> <p>Confirm navigation: [Leave this page] [Stay on this page]</p> </blockquote> <p>The code that invokes this is </p> <pre><code>$(window).bind('beforeunload', function() { return 'Leave page?'; //Click prompt code goes here. $(window).unbind(); }); </code></pre> <p>If I take away <code>return 'Leave page?';</code> then the iframed page overrides the top frame and the user is struck with an unknown site, maybe there's another way to do this?</p>
javascript jquery
[3, 5]
1,677,092
1,677,093
passing variable javascript into php
<p>I want to pass a variable javascript into variable php. I can't use $_GET or $_POST because is all loaded by the method load in jquery and I don't have any form or possbility to implement it. This is my code:</p> <pre><code>&lt;script type="text/javascript"&gt; var id= "test"; &lt;/script&gt; &lt;?php $_SESSION['my_page'] =?&gt; + id; </code></pre> <p>How can I resolve It?</p>
php javascript
[2, 3]
946,159
946,160
Style formatting
<pre><code>&lt;marquee style = "color: Red; font-size: 24px;"&gt; &lt;?php for($i = 0; $i &lt; 50; $i++) { echo $symbol[$i]; echo "\t"; echo $chng[$i]; echo "\t\t\t"; }?&gt; &lt;/marquee&gt; </code></pre> <p>I need to change the color of text based on the value of <em>$chng[$i]</em>. i.e. if $chng[$i] > </p> <p>0.. green, else red.</p>
php javascript
[2, 3]
3,511,884
3,511,885
How to change the button with a spinner in actionbar to loading?
<p>I have a webview and want to listen its loading event and I have a refresh button on my actionbar. </p> <p>How to change the button to a spinner programmatically?</p>
java android
[1, 4]
2,178,496
2,178,497
Intent problem, return value (Android)
<p>I have an application that open an other class using intent : </p> <pre> private void createRepository(){ Intent j = new Intent(this, Repository.class); startActivityForResult(j, ACTIVITY_CREATE); } </pre> <p>In Repository.class we have the <strong>onActivityResult</strong> method :</p> <pre> public void onActivityResult(int reqCode, int resultCode, Intent data) { super.onActivityResult(reqCode, resultCode, data); switch (reqCode) { case (PICK_CONTACT) : if (resultCode == Activity.RESULT_OK) { Uri contactData = data.getData(); c = managedQuery(contactData, null, null, null, null); if (c.moveToFirst()) { //String name = c.getString(c.getColumnIndexOrThrow(People.NAME)); num = c.getString(c.getColumnIndexOrThrow(People.NUMBER)); } } break; } finish(); } </pre> <p>I don't know how I can return the value of <strong>num</strong> to the first class (that create Repository.class). Thank you for your help. Michaël</p>
java android
[1, 4]
364,586
364,587
jQuery select first child three levels deep
<p>I have the following HTML structure:</p> <pre><code>&lt;div class="s1&gt; &lt;div class="s2"&gt; &lt;span class="span1"&gt; &lt;span&gt;text&lt;/span&gt; &lt;/span&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Currently I am selecting the most nested span with the following selectors:</p> <pre><code>$(".s1").find("&gt;:first-child").find("&gt;first:child").find("&gt;:first-child") </code></pre> <p>Is there a more efficient way to select that inner span?</p> <p>Edit: Div with class s1 is already cached, so I cant use $("selector").</p>
javascript jquery
[3, 5]
2,878,777
2,878,778
How to make those dynamic anchor links with jQuery?
<p>I've recently discovered a website which does something really cool! Example:</p> <ul> <li>There are two links "Cat" and "Dog". </li> <li>There are two DIV containers, id="catImage" and id="dogImage"</li> <li>The initial URL looks like <a href="http://mysite.com/#cat" rel="nofollow">http://mysite.com/#cat</a></li> <li>Initially, the cat image is visible</li> <li>Clicking on the Dog link will fade out the <code>catImage</code> div and fade in the <code>dogImage</code> div</li> <li>Additionally, it will change the anchor in the browser URL to: <a href="http://mysite.com/#dog" rel="nofollow">http://mysite.com/#dog</a></li> <li>Opening the website with httü://mysite.com/#dog will show the dog image initially</li> </ul> <p>Is this possible using jQuery? How would I scan for that anchor, and how would I call a function when the link is clicked without causing the link to follow some URL? I'm an objective-c dude and don't know anything about JS... hope my question isn't too dumb for you.</p>
javascript jquery
[3, 5]
775,976
775,977
Issue converting a string value to an int
<p>Below is a snippet of my code.</p> <pre><code> private String makeDayCode(String unlockCode, String code) { // TODO Auto-generated method stub int intUnlockCode = 0; int[] newDateArray = new int[8]; Log.v (LOG_TAG, "tick "); SimpleDateFormat s = new SimpleDateFormat("yyyyMMdd"); String dateTime = s.format(new Date()); Log.v (LOG_TAG, "tick 2:"+ dateTime + "."); Log.v (LOG_TAG, "tick 3:"+Integer.valueOf(dateTime)+"."); int intDate = Integer.valueOf(dateTime); Log.v (LOG_TAG, "tick 3.1" + Integer.parseInt(unlockCode) + "."); </code></pre> <p>The following is from my logcat, showing the values of dateTime in the Log msgs.</p> <pre><code>02-23 21:03:57.415: V/dbtest(15552): tick 2:20130223. 02-23 21:03:57.415: V/dbtest(15552): tick 3:20130223. </code></pre> <p>The problem i am having is that i am having the following error message:</p> <pre><code>java.lang.NumberFormatException: Invalid int: "" </code></pre> <p>which causes my code to fail before the Log with tick 3.1 - narrowing my issue to the line:</p> <pre><code>int intDate = Integer.valueOf(dateTime); </code></pre> <p>From researching it would appear that for some reason dateTime is not being converted from a String to an int. I think because it isnt a string, or has no value. however the log cat on tick 2 and tick 3 show that dateTime has a value of 20130223.</p> <p>Can anyone shed some light on why i am getting this exception?</p> <p>Mucho thanks in advance</p>
java android
[1, 4]
1,700,452
1,700,453
Which technique is better?
<p>Which technique is better:</p> <pre><code>&lt;span onclick="dothis();"&gt;check&lt;/span&gt; </code></pre> <p>or:</p> <pre><code>&lt;span class="bla"&gt;check&lt;/span&gt; &lt;script type="text/javascript"&gt; $('.bla').click(function(e) {} ); &lt;/script&gt; </code></pre> <p>Are there any differences according to usability, performance etc.?</p> <p>Thank you!</p>
javascript jquery
[3, 5]
2,042,326
2,042,327
Make delete button procedurally
<p>I have HTML:</p> <pre><code>&lt;button id='pusher'&gt;pusher&lt;/button&gt; &lt;ul id="sortable"&gt; &lt;li&gt;things here&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>And JavaScript:</p> <pre><code>$(".del").click(function(e) { $(this).parent().remove(); }); $("#pusher").click(function(e) { var text = "test"; var lix = $("&lt;li class='uix' /&gt;").text(text); lix.append($('&lt;button class="del"&gt;xx&lt;/button&gt;')); lix.appendTo($("#sortable")); }); </code></pre> <p>I'm trying to make the pusher button make new <code>&lt;li&gt;</code> elements with a delete button inside, then when delete button is pressed it deletes its <code>&lt;li&gt;</code> element...</p> <p>But it is not deleting.</p> <p>Any ideas?</p>
javascript jquery
[3, 5]
1,062,999
1,063,000
Explain Java Notation 'new' with bracketed code
<p>I see this notation, a new operator with a class name and then bracketed code, occasionally in Android examples. Can someone explain this? In the example below, <em>PanChangeListener</em> is a class (or maybe an interface) and 'new' creates an instance, but what role does the bracketed code play with respect to the <em>PanChangeListener</em>?</p> <pre><code>fType pcListener = new PanChangeListener() { @Override public void onPan(GeoPoint old, GeoPoint current) { //TODO } }); </code></pre> <p>Even a name for this syntax would be useful, as I could Google it.</p>
java android
[1, 4]
2,021,418
2,021,419
Registering a script multiple times
<p>In the code behind, I register a startup script as below:</p> <pre><code> string strFunctionName = "ShouldAdd"; sb.Append(strFunctionName + @"((blnShouldAdd ? "true" : "false") + ", true);"); ScriptManager.RegisterStartupScript(this, this.GetType(), "shouldAdd", sb.ToString(), true); </code></pre> <p>This piece of code is called twice, once in Page Load when <code>blnShouldAdd</code> evaluates to <code>false</code> and in the event handler of a button when <code>blnShouldAdd</code> evaluates to <code>true</code>.</p> <p>Strangely, when I debug the code and step into the ShouldAdd JS function, the value is always false. I would assume it to be true as the second call in the event handler overrides the first one.</p> <p>Any ideas?</p>
c# asp.net
[0, 9]
2,645,433
2,645,434
Javascript calendar not working
<p>My JavaScript calender is working in IE but it is not working in Mozilla.</p> <p>My code:</p> <pre><code> &lt;table&gt; &lt;tr style="height: 5px;"&gt; &lt;td&gt; &lt;asp:TextBox ID="txtBorderedDate" runat="server" CssClass="TextBoxMandatory" Enabled="false"&gt;&lt;/asp:TextBox&gt; &lt;/td&gt; &lt;td class="FieldButton_bg" style="height: 5px;"&gt; &lt;a onclick="javascript:showCalendarControl(ctl00_SaralConetentPlaceHolder_txtBorderedDate);" href="#"&gt; &lt;img src="../Images/iconCalendar.png" style="width: 20px; height: 20px; vertical-align: bottom;" border="0" /&gt; &lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>
asp.net javascript
[9, 3]
5,020,096
5,020,097
Dalvik VM vs Sun JVM
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/230193/what-can-you-not-do-on-the-dalvik-vm-androids-vm-that-you-can-in-sun-vm">What can you not do on the Dalvik VM (Android&rsquo;s VM) that you can in Sun VM?</a> </p> </blockquote> <p>What ever interviews i have faced.In every interview when interviewers come on android topic they ask this question. "what is the difference between Dalvik VM vs Sun JVM?". i have given some answers like. <a href="http://stackoverflow.com/questions/230193/what-can-you-not-do-on-the-dalvik-vm-androids-vm-that-you-can-in-sun-vm">http://stackoverflow.com/questions/230193/what-can-you-not-do-on-the-dalvik-vm-androids-vm-that-you-can-in-sun-vm</a></p> <p>but i think they wanted more.</p>
java android
[1, 4]
4,264,219
4,264,220
Why Dead Code Warning?
<p>i have: </p> <pre><code> if (Constants.IS_LIVE_MOD == false) account = Constants.OM_ACCOUNT; else account = "abc"; </code></pre> <p>i am getting a dead code warning on 'else'. Why is it so and wat is the solution for it. Please help.</p>
java android
[1, 4]
971,532
971,533
Jquery dynamic TextBoxes with Request.form Iteration
<p>i am Adding multiple TextBoxes with Jquery in my Application, then in code behind file i want can access the values by Request.form[name]. I want o iterate these textboxes and read values of whatever Text is entered by the user, so i can store it in database. any idea how can i save the value of these textboxes in Database, i am working in asp.net 2.0</p> <pre><code>$(document).ready(function () { var counter = 2; $("#addButton").click(function () { if (counter &gt; 10) { alert("Only 10 textboxes allow"); return false; } var newTextBoxDiv = $(document.createElement('div')).attr("id", 'TextBoxDiv' + counter); newTextBoxDiv.html('&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;input type="text" name="textbox' + counter + '" id="textbox' + counter + '" value="" &gt;&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="textbox' + counter + '" id="textbox' + counter + '" value="" &gt;&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="textbox' + counter + '" id="textbox' + counter + '" value="" &gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;'); newTextBoxDiv.appendTo("#TextBoxesGroup"); return false; counter++; }); }); </code></pre>
c# jquery asp.net
[0, 5, 9]
851,435
851,436
How to invoke browser without losing browsing state?
<p>I have written an activity that has 2 image buttons (1 for messaging and another for browser). On click on each will start messaging and browser android activities respectively.</p> <p>My question is: whenever I start my app and click on any of the buttons say browser button for example, and after it starts the android browser app, and it allows me whatever to browse in this time if I press the home button on android emulator and again if I start my app and select the browser button in my activity as usual the browser get started from the beginning rather than starting form where I left previously.</p> <p>Should I start a service to call browser activity or should I set some flags while calling android browser activity?</p>
java android
[1, 4]
1,546,587
1,546,588
Jquery: How to window.open() with no valid href?
<p>I have web page on which I display a lot of summary information. I would like to be able to, by clicking a right button or link, to open up a new window and display the underlying data.</p> <p>For many reasons I cannot request the underlying data again from the server once the summary information page is generated</p> <p>What I would like to achieve is:</p> <ul> <li>Embed the underlying data in a hidden table in the summary page </li> <li>On thesummary page I also provide a 'drill down' button </li> <li>Open a new window upon a click of this button </li> <li>Inject the content of the hidden<br> table into the new windows.</li> </ul> <p>What I want to learn are:</p> <ol> <li>What to pass to the href parameter of the window.open(href) function? How to get a reference to the new window and inject the content?</li> </ol> <p>I am using jquery 1.5.2</p>
javascript jquery
[3, 5]
365,208
365,209
selectbox value calculation
<p>I want to do a calculation between selectbox values. The problem with my code is that the first part of the calculation only gives me <code>0</code>, which Motherboard value*quantity. the second part works fine which Chassis*quantity. My formulas is <code>motherbord*Quanity+chassis*quantity</code>. </p> <p>Here is my code: </p> <pre><code>function calculate() { var parsedMotherboard = parseFloat(document.calcform.Motherboard.value || 0); var parsedQuantity = parseFloat(document.calcform.Quantity.value || 0); var parsedChassis = parseFloat(document.calcform.Chassis.value || 0); var parsedQuantity1 = parseFloat(document.calcform.Quantity1.value || 0); document.calcform.total.value = (parsedMotherboard * parsedQuantity + parsedChassis * parsedQuantity1); } </code></pre> <p><img src="http://i.stack.imgur.com/LnHKt.jpg" alt="interface"></p>
php javascript
[2, 3]
5,155,323
5,155,324
thread problem in suspend() and resume()
<p>hi all i doing a stop watch. for pause i use Thread.suspend() and resume i use Thread.resume(). but the resume is not resume the work. code:</p> <pre><code>pause(){ shouldRun = false; currentThread.suspend(); } resume(){ shouldRun = true; currentThread.resume(); } </code></pre> <p>while(shouldRun){ ....... }</p>
java android
[1, 4]
4,368,554
4,368,555
Take href of an anchor in a container and apply it to image
<p>I have a list of DIV's that all contain a piece of text, an image, and an anchor.</p> <p>With Javascript/jQuery, is it possible to take the href of the anchor, and wrap the image in anchor tags with that link? </p> <p>I know this is a strange requet, Ive made a fiddle...</p> <p><a href="http://jsfiddle.net/fFgwb/" rel="nofollow">http://jsfiddle.net/fFgwb/</a></p> <hr> <p>There will be multiple divs so I cant have the same id </p>
javascript jquery
[3, 5]
754,173
754,174
Is it possible to iterate through JSONArray?
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="http://stackoverflow.com/questions/3408985/json-array-iteration-in-android-java">JSON Array iteration in Android/Java</a><br> <a href="http://stackoverflow.com/questions/1568762/jsonarray-with-java">JSONArray with Java</a> </p> </blockquote> <p>Is it possible to iterate through JSONArray object using Iterator?</p>
java android
[1, 4]
6,026,972
6,026,973
Using SqlDBType.Decimal in Prepared Statement C#
<p>am using a Prepared Statement in C#. </p> <pre><code> SqlCommand inscommand = new SqlCommand(supInsert, connection); inscommand.Parameters.Add("@ordQty", SqlDbType.Decimal,18); inscommand.Prepare(); u = inscommand.ExecuteNonQuery(); </code></pre> <p>The above code throws below Exception:</p> <p><em>SqlCommand.Prepare method requires parameters of type 'Decimal' have an explicitly set Precision and Scale.</em></p> <p>EDIT: How to avoid this Exception</p>
c# asp.net
[0, 9]
2,140,430
2,140,431
How do I create an ASP.NET website to search MLS or IDX listings?
<p>How do I create an ASP.NET website to search <a href="http://en.wikipedia.org/wiki/Multiple_Listing_Service" rel="nofollow">MLS</a> or <a href="http://en.wikipedia.org/wiki/Internet_Data_Exchange" rel="nofollow">IDX</a> listings for a real estate website? I'm assuming there is a C# library to do this? I'm curious about any pitfalls or unexpected expenses people have ran into in using these services?</p>
c# asp.net
[0, 9]
1,169,628
1,169,629
Writing to a file
<p>I am extracting content from a web page using JS/JQuery and want to write the data to a comma separated file. I know javascript doesn't really support file io and I'm trying to avoid setting up a local apache server just to process the content to a file. Is there an easier way to do this?</p>
javascript jquery
[3, 5]
3,944,320
3,944,321
jQuery map splitting the value of input
<p>jQuery map is returning : <code>data:["1", "8", "5", ".", "9", "0"]</code> when the input <code>val</code> is <code>185.90</code> - <strong>why the value is being splited?</strong> </p> <p>The code:</p> <pre><code>var $cel = $.map( $('td:nth-child(' + (i + 2) + ') input').each(function() { $(this).val(); }).val(), function(value) { return value; ); return { data: $cel }; </code></pre>
javascript jquery
[3, 5]
1,178,699
1,178,700
String is undefined
<p>I've got the following property in the code-behind of my .aspx:</p> <pre><code> protected string CurrentProductView { get { string viewName = string.Empty; viewName = Enum.GetName(typeof(ProductView), currentProdView); return viewName; } } </code></pre> <p>In my .aspx I've got some Javascript that tries to reference this string:</p> <pre><code>$(document).ready(function () { var action = &lt;%=CurrentProductView %&gt; $("#recommendations").load("recommendationsHandler.ashx?action=" + action + "item&amp;csid=" + csid + "&amp;productID=" + productID, function() { $("#recommendationsView").show(); }); }); </code></pre> <p>but for some reason I get "Item is not defined".</p> <p>When I debug this, I'm definitely seeing a string come back for viewName. So why would it complain if a string is coming back?!?!</p>
c# javascript jquery
[0, 3, 5]
4,371,847
4,371,848
JQuery .append not appending to textarea after text edited
<p>Take the following page:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"/&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="hashtag"&gt;#one&lt;/div&gt; &lt;div class="hashtag"&gt;#two&lt;/div&gt; &lt;form accept-charset="UTF-8" action="/home/index" method="post"&gt; &lt;textarea id="text-box"/&gt; &lt;input type="submit" value ="ok" id="go" /&gt; &lt;/form&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $(".hashtag").click(function(){ var txt = $.trim($(this).text()); $("#text-box").append(txt); }); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The behavior I would expect, and that I want to achieve is that when I click on one of the divs with class <code>hashtag</code> their content ("#one" and "#two" respectively) would be appended at the end of the text in textarea <code>text-box</code>.</p> <p>This does happen when I click on the hash tags just after the page loads. However when I then also start editing the text in <code>text-box</code> manually and then go back to clicking on any of the hashtags they don't get appended on Firefox. On Chrome the most bizarre thing is happening - all the text I type manually gets replaced with the new hashtag and disappears.</p> <p>I probably am doing something very wrong here, so I would appreciate if someone can point out my mistake here, and how to fix that. Thanks.</p>
javascript jquery
[3, 5]
1,729,572
1,729,573
How to check if there exists at least one li element with attr = something?
<p>So I want to check if there is any li element that has a attribute of "data-foo" and its value is "bar".</p> <p>Would this work? :</p> <pre><code>if ($('li[data-foo=bar]')) { //exists } else { //does not exist } </code></pre> <p>Thanks</p>
javascript jquery
[3, 5]
5,553,421
5,553,422
tableDnD - enabling drag / drop for only one <td> in a <tr>
<p>I'm using Denis' outstanding tableDnD jquery plugin. I would like to allow users to drag/drop rows but only when their mouse is within a particular td within the row.</p> <p>So far I've tried two methods:(note that the var "tr" contains the jquery row element I'm operating on. the td id="queue_position" is the one I'm trying to enable dragging for).</p> <p>I think that tableDnD only checks for the nodrag class when it starts up. adding or deleting the nodrop class dynamically doesn't change anything. So I tried two ways to do what I need to do.</p> <p>Attempt one was to dive into tableDnD internals and try to call it's makeDraggable function. Attempt two was to re-initialize tableDnD after adding/removing the nodrop class.</p> <p>Either of these methods seems to work to <strong>enable</strong> dragging when in the allowed td. Neither of them properly <strong>disables</strong> dragging when leaving the td. Once a row is enabled in the mouseenter event it stays enabled forever. </p> <p>I'd prefer to find a way to do what I need without modifying tableDnD.</p> <p>Any suggestions on how to make this work?</p> <pre><code>$(tr) .addClass("nodrag") .find("td[id='queue_position']") //.on("mouseenter",function() { // $(tr).removeClass("nodrag"); // $.tableDnD.makeDraggable(document.getElementById("tableLeft")); //}) //.on("mouseleave",function() { // $(tr).addClass("nodrag"); // $.tableDnD.makeDraggable(document.getElementById("tableLeft")); //}); .on("mouseenter",function() { $(tr).removeClass("nodrag"); $("#tableLeft").tableDnD({onDrop: handleDragDrop}); }) .on("mouseleave",function() { $(tr).addClass("nodrag"); $("#tableLeft").tableDnD({onDrop: handleDragDrop}); }); </code></pre>
javascript jquery
[3, 5]
2,262,033
2,262,034
Convert File object to byte array
<p>I am developing an application which I capture videos in it. I am saving the recorded videos to the phone. What I want to do is to convert the saved files to byte arrays.</p>
java android
[1, 4]
2,186,094
2,186,095
Populating ArrayAdapter - type String[]
<p>I'm new to Java and Android development and i'm stucked while trying to populate an ArrayAdapter to creating a ListView. The code below works perfectly:</p> <pre><code> String name[] = {"a","b","c", "d","e"}; this.setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.row, R.id.label, name)); </code></pre> <p>But I simply can't figure out how I should populate <code>name</code> with a <code>for</code> loop. All suggestions are welcome.</p>
java android
[1, 4]
1,691,653
1,691,654
How to create a tracking script with js and php?
<p>I want to create a simple tracking script to give to my clients. Something similar with GA but very basic.</p> <p>The requirements are <li> give the clients a single and simple js script like google Analytics does <li> make most of the logic inside the js file loaded by 3th party sites from the main site <li> collect in PHP the information and store it</p> <p>What I can't figure yet is what are the ways to do this? Google from what I see is loading a gif file, stores the information and parses the logs. If I do something similar sending the data to a php file Ajax cross site policy will stop me, from what I remember.</p> <p>So what is a clean way to do this ? ( I don't need code just the logic behind it )</p>
php javascript
[2, 3]
3,267,176
3,267,177
How to limit users from entering english characters in a textbox
<p>Do I need to use regex to ensure that the user has typed in English? All characters are valid except non English characters.</p> <p>How do I validate this textbox?</p>
c# asp.net javascript
[0, 9, 3]
2,123,221
2,123,222
How to prevent simultaneous login with same user on different pcs
<p>We have a build a intranet application where users have to login to do certain tasks... We have to make sure that no "application user" is logged in more than once at the same time.</p> <p>So what I do at the moment is that I store the current asp .net session id in the database and then i compare at every page load wheter they are same or not. The session id is stored in the database when the user logs in.</p> <p>But by using this kind check, there is always a database select needed. So I don't like this way very much. There must be a more elegant way to solve this, or?</p> <p>We use ASP .Net2, C#..</p> <p>Thanks in advance for any input</p> <p><strong>[Info Update]</strong></p> <p>I have already created a custom Membershipprovider and a custom Membershippuser. The Membershipuser has a method called "StartSession(string sessionId)" which is used, when the user logs in.</p> <p>The other method CheckSession(string sessionId) is used at every postback, and it compares the current session id with the session id stored in the database.</p> <p><strong>[Update]</strong> Thanks everybody for your input. I will now use the cache to prevent permanent database access. I first thought that there is already a Class or something that is already handling this problem.</p>
c# asp.net
[0, 9]
3,843,864
3,843,865
How to run separate application from Android button click
<p>I tried to add two buttons in my Android application to select an application from separate two applications Order system and Inventory system.As shown in the image.</p> <p><img src="http://i.stack.imgur.com/PslmY.jpg" alt="enter image description here"></p> <p>I have implemented these two applications as separate two Android projects. When I try to run this application it comes until to the the selecting window correctly, but when one button is pressed emulator shows "Force Close" message. I have added Order system and Inventory system projects to first application's build path and then import their packages(com.oms.ws and com.inv.ws). This may be incorrect, but don't know how to do this. Please help me! I'm new to Android. I want to test this application using the emulator! </p> <p>Here is the code I have used to select applications.</p> <pre><code>import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import com.oms.ws.*; public class ThirdScreen extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.thirdscreen); Button oms; oms = (Button)findViewById(R.id.orderSystem); oms.setOnClickListener(ordrMnagemntSys); Button inventory; inventory = (Button)findViewById(R.id.inventorySystem); inventory.setOnClickListener(inventorySys); } private OnClickListener ordrMnagemntSys = new OnClickListener(){ public void onClick(View v) { Intent oMs = new Intent(getApplicationContext(), com.oms.ws.TestOms.class); startActivity(oMs); } }; private OnClickListener inventorySys = new OnClickListener(){ public void onClick(View v) { Intent inven = new Intent(getApplicationContext(), com.inv.ws.TestInventory.class); startActivity(inven); } }; } </code></pre> <p>Thanks!</p>
java android
[1, 4]
5,511,078
5,511,079
Android: assets alternative
<p>I'm using <strong>assets</strong> as standard <strong>icons storage</strong> but now I have request that these icons should be <strong>updated</strong> for some cases. I know that I can't touch assets, so do you have any suggestions where to store them?? These files should be <strong>pre-installed</strong> and <strong>updated</strong> for some cases. From start I've been thinking about <strong>Internal Storage</strong> but now I have some doubts. What do you think???</p>
java android
[1, 4]
5,252,518
5,252,519
How to select all values in drop down list by clicking a button using jQuery?
<p>How to select all values in drop down list by clicking a button using jQuery in JavaScript?</p> <p>Thanks in advance</p>
javascript jquery
[3, 5]
4,582,149
4,582,150
checking if location.hash exists
<p>I have a carousel that I can change the location of with an integer value. <br>What I'd like to do is take the hash, remove the <code>#</code> symbol and store that value in a variable which I can later use in a function.</p> <p>I've pasted the code below, which for some reason just won't work.</p> <pre><code>var $hash = window.location.hash; if($hash != ''){ var $grave_nr = $hash.substring(1); return $grave_nr; } else{ var $grave_nr = 1; return $grave_nr; } // carousel $('#the_graves_carousel').tinycarousel({ intervaltime: 7000, pager: true, duration: 1600, start: $grave_nr }); </code></pre> <p>Anyone have an idea why it's not working?</p> <p><br><strong>EDIT:</strong> fixed it by removing the <code>return $grave_nr;</code> in the if statements :)</p>
javascript jquery
[3, 5]
71,773
71,774
Which Language I Should Learn After Python?
<p>I'm 14. I'm currently learning Python Language. Now What Should I Learn After Python ? Here are the options:</p> <ol> <li>C++0x</li> <li>C# or .Net</li> <li>Java or any other like Scala, Groovy, etc.</li> <li>D</li> </ol> <p>Sorry For First Post. Plz Help me this time.</p>
java c++ python
[1, 6, 7]
1,449,633
1,449,634
Why does my function get called twice in jQuery?
<p>I have the following jQuery</p> <pre><code>$('img[title*=\"Show\"]').click(function() { //$e.preventDefault(); var position = $('img[title*=\"Show\"]').parent().position(); $('#popover').css('top', position.top + $('img[title*=\"Show\"]').parent().height() + 150); console.log(position); $('#popover').fadeToggle('fast'); if ($('img[title*=\"Show\"]').hasClass('active')) { $(this).removeClass('active'); } else { $('img[title*=\"Show\"]').addClass('active'); } }); </code></pre> <p>I have two images with the title "Show Options." For some reason whenever I click on any of these images, it gets printed TWICE. When I only have 1 image, it only gets printed once. Why is this?</p>
javascript jquery
[3, 5]
258,465
258,466
How to change the value of two hidden fields with the same id and name jquery?
<p>I have this fields</p> <pre><code>&lt;input type="hidden" id="uidhcdm" name="uidhcdm" value="0"&gt; &lt;input type="hidden" id="uidhcdm" name="uidhcdm" value="0"&gt; </code></pre> <p>and i am using a function called change val </p> <pre><code>function changeval(x,val) { $('#'+x).val(val); } </code></pre> <p>but when i run the function it only affects the first hidden fields value but not the seconds!</p> <p>Please help me !!</p>
php jquery
[2, 5]
2,784,806
2,784,807
Internet Speed measurement(3G) with geolocation in a single thread
<p>I have to find out internet speed (upload/download) with geo-location and put it into a database. What is the method to find out the upload/download speed and location?</p>
java android
[1, 4]
5,064,566
5,064,567
Android --- Connecting activities and services
<p>I have this basic design in mind:</p> <ul> <li>A main activity will offer a choice of sub activities and also create a Bluetooth service.</li> <li><p>The Bluetooth service will reads and buffer live data from a Bluetooth connected device. Enough data , at a fast enough rate (100 to 1000 sps ) so that I don't think it is realistic to use Intents or broadcasting</p></li> <li><p>The sub activities will simply be displaying the same received data but in different way. Each sub activities will also the user to interact with the data in a different way.</p></li> <li>I really prefer that the Bluetooth service is agnostic of the Activity/View onto which the data gets presented.</li> </ul> <p>I'd be willing to 'register' a bunch a 'destination' (which would really be activities) to which 'cooked' data would be sent to. I didn't quite get how to 'register' anything from starting an activity.</p> <p>How do I pass, for example, a reference to my service to each of those activities? Or it might be the other way around; how do I register each activity to the running service.</p> <p>Having a C/C++ background, I realize this might not be a good approach in Java. Thank you.</p>
java android
[1, 4]
5,676,689
5,676,690
Loading effect using jQuery
<p>Can anyone help me with any method, jQuery functions/plugins or so on which can give a loading effect similar to this site <a href="http://www.big.dk/" rel="nofollow">http://www.big.dk/</a>??</p> <p>I'll be loading lots of images and I want to load it the way the site above is doing.</p>
javascript jquery
[3, 5]
1,043,961
1,043,962
How I access HttpContext.GetGlobalResourceObject() in javascript(.js) file which is used in my application?
<p>I am using javascript file for validtion. Now I have to localize that javascript file. I want to HttpContext.GetGlobalResourceObject() in .js file. Can I use HttpContext.GetGlobalResourceObject() in my .js file? Is there any other option to locaize javascript file.</p>
c# javascript asp.net
[0, 3, 9]
5,882,640
5,882,641
Flipping around a div using Javascript
<p><a href="http://lab.smashup.it/flip/" rel="nofollow">Flip</a> is a great JQuery plugin for flipping blocks, but it doesn't preserve the background while it animates the flip.</p> <p>For example, <a href="http://i.stack.imgur.com/3j46N.png" rel="nofollow">I have this pretty background here</a>, before I flip. <a href="http://i.stack.imgur.com/JoGYs.png" rel="nofollow">While flipping, it gets ugly</a>. </p> <p>Is there a way I can flip this <code>div</code> nicely, keeping the pretty background I have, and maybe even achieve a smoother animation than I can get with Flip?</p> <p>If I need to dive into this headfirst and code my own function for flipping a <code>div</code>, that's also doable, and I'd really appreciate some pointer there, if that's what I must do. </p> <p>Thanks so much!</p>
javascript jquery
[3, 5]
5,331,848
5,331,849
Iterating thru an array using javascript for
<p>How do I iterate thru an array like this using 'for' in jquery. This one has me totally lost. I cant figure how to get those values out from an array like this and I cant change the way the array is done.</p> <pre><code>//Php $errors['success'] = false; $errors['#errOne'] = "Enter a valid username"; $errors['#errTwo'] = "Enter a valid email"; $errors['#errThree'] = "Enter a valid password"; echo json_encode($errors);// dataType:"json", cache:false, success: function(data){ for (i=1; i&lt;?; i++){//Start at 1 //I'm totally lost here. //Output: "#errOne" "Enter a valid username" -&gt;Loop thru remaining messages } }, </code></pre>
javascript jquery
[3, 5]
2,939,453
2,939,454
Trying to toggle a panel whilst changing the icon to 'view more' and 'view less'
<p>I've just started learning jQuery/javascript, so this might seem like a really basic question, but it's annoying me nevertheless.</p> <p>I have a panel of 6 <code>&lt;li&gt;</code>s, 3 of which are hidden until clicking on the 'view more' link at which point the panel toggles to reveal the other 3. The icon is changing from 'more' to 'less', but then not changing back to 'more'. Can anyone see the problem in the code?</p> <p>Any help would be greatly appreciated :)</p> <p>Thanks, David</p> <pre><code>$(document).ready(function() { $('.allApps').hide(); $('.moreAppsIcon').click(function() { $('.moreAppsIcon').removeClass("moreAppsIcon").addClass("lessAppsIcon"); $(this).toggleClass("active"); $('.allApps').slideToggle("slow"); return false; }); $('.lessAppsIcon').click(function() { $('.appsMore').slideToggle("slow", function () { $('.appsMore').removeClass("appsMore").addClass("moreAppsIcon"); $(this).toggleClass("active"); return false; }); }); }); </code></pre>
javascript jquery
[3, 5]
5,191,237
5,191,238
allow only .25, .50 and .75 in a text box
<p>I am working on a web application and using javascript to restrict or round off a value. Whenever I enter any decimal value in a textbox, it should be rounded off to .25, .50, .75, or .00. any idea how to do that? Even if am able to enter only .25, .50, .75 and .00 is also fine... but how to restrict for only these specific values?</p>
javascript jquery
[3, 5]
3,658,091
3,658,092
Add reset to defaults button to asp form but avoid postback
<p>I have a couple of fields on a form that will be populated with default values. I would like to put a button that will allow me to reset those fields to their default values if they have been modified. However I would like to avoid the postback so that I don't have data being sent to the database.</p> <p>Is it possible to add a javascript hook such that when that button is pressed I can pull the default values and populate those fields in javascript?</p>
javascript asp.net
[3, 9]
1,954,936
1,954,937
Javascript code not being called in asp.net code behind
<p>I have a block of code (posted below) where if the first IF clause is satisfied, the app does not call the javascript('MyPortfolioItemExists()') function. Instead, it exits the function and goes on to process other code lines. </p> <pre><code>If drPortfolio.HasRows Then Dim p As Page = CType(System.Web.HttpContext.Current.Handler, Page) p.ClientScript.RegisterStartupScript(Me.GetType(), "Script", "javascript:'MyPortfolioItemExists()';", True) Return "" Exit Function ElseIf drFav.HasRows = False And drPortfolio.HasRows = False Then Utils.ExecNonQuery("insert into UserPortfolio values ('" &amp; PortfoName &amp; "','" &amp; PortfoPage &amp; "','" &amp; Username &amp; "')") Return GeneratePortfolioContent() End If </code></pre> <p>How can I force the javascript function to be executed?</p>
javascript asp.net
[3, 9]
2,840,761
2,840,762
Jquery: shake effect not working
<p>Sorry to be a pain, but im really frustrated this isn't working for me at all</p> <pre><code>$(document).ready(function(){ $('.wrap').effect("shake", { times:3 }, 300); }); </code></pre>
javascript jquery
[3, 5]
1,120,190
1,120,191
Find value from one UserControl to anoter Usercontrol
<p>I have a page in that Page I have <strong>2 usercontrols uc1 and uc2</strong> I have one property <strong>PageID</strong> on the <strong>Usercontrol uc1</strong>, now I have a button on uc1 on that button's click event I am doing some database process and that will return the PageID, now I want to access this PageID on another Usercontrol uc2.</p> <p>any one please help me to find out the PageID on another usercontrol</p>
c# asp.net
[0, 9]
994,734
994,735
Jquery onclick event
<p>I have a link</p> <pre><code>&lt;a id="special_link" href="" onclick="" &gt;Link&lt;/a&gt; </code></pre> <p>Is it possible to use Jquery in the onclick part and apply something to the current element?</p> <p>Something similar with : </p> <pre><code>$("#special_link").html('test'); </code></pre> <p>Update : </p> <ul> <li>I want to change the content after click</li> <li>I would prefer using <code>$this</code> so I don't depend on the id</li> </ul>
javascript jquery
[3, 5]
5,191,072
5,191,073
Error free JQuery/Javascript is not working in Firefox 4 or Chrome
<p>Code: <a href="http://dpaste.org/Oerz/" rel="nofollow">http://dpaste.org/Oerz/</a></p> <p>The page looks as it should, with the title, 5 paragraphs and buttons all appearing. Each button is supposed to make a small alteration to a specific elements styling. </p> <p>Currently no action occurs when any of the buttons are clicked.</p> <p>I'm only claiming the above code is error free based on finding no errors in chrome's javascript console or firebug. Then again, I'm new to all this so I don't know if I'm using them correctly.</p> <p>Any help would be appreciated.</p>
javascript jquery
[3, 5]
2,676,529
2,676,530
Error parsing attribute 'enableEventValidation': Type 'System.Web.UI.Page' does not have a public property named 'enableEventValidation'
<p>Not seen this error discussed previously here (see subject line), maybe someone has run into the same problem. I have <code>enableEventValidation = "False"</code> set for the <code>&lt;page&gt;</code> tag in my web.config file. As I try to build my web app project on VS2010, I receive this error , rendering me unable to continue with my debugging of the app. The page in question does not have enableEvenValidation set in its Page directive.</p> <p>Any ideas out there on this one ?</p> <p>Appreciate the feedback</p> <p>Thanks</p>
c# asp.net
[0, 9]