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
767,906
767,907
How to clear the text when clicked on any other controls
<p>the below js script works fine but there is small problem and the problem is that:</p> <p>i have a textbox with multiline and when the user clicks on it and it does clear the textbox but the problem is; when the user click on Save button (asp.net control button) to save the textbox value and i want that to ignore on code behind and also client side. </p> <p>one thing i can do is to compare the value and clear if it is matached but what if; if i have many controls and dont want to spread the string every where in the code...</p> <p>looking for a optimized solution.</p> <pre><code>&lt;asp:TextBox runat="server" ID="txtNew" onclick="if (this.value == 'Enter here...') this.value = ''" TextMode="MultiLine" Rows="7" Width="100%"&gt;Enter here...&lt;/asp:TextBox&gt; </code></pre>
javascript asp.net
[3, 9]
1,847,307
1,847,308
How to collect data from table cells
<p>How to collect data from inputs (inputs are in table which has id=tbl_bbmd and unknown number of rows , like on picture) <img src="http://i.stack.imgur.com/SxI9O.jpg" alt="enter image description here"></p> <p>I need to collect data from inputs cells and concaneta them. How to iterate through this table and collect ?</p>
javascript jquery
[3, 5]
4,544,474
4,544,475
Check value fields that if the same empty value in last field?
<p>I have several field that just get number, I want if user typed be identical value in two or more field empty value the last field that is identical by jQuery.keyup?</p> <p>For Example:</p> <pre><code>&lt;input name="num[]" value="11111"&gt; &lt;input name="num[]" value="33333"&gt; &lt;input name="num[]" value="11111"&gt; // in this input should empty value it. </code></pre> <p>How can fix it?</p>
javascript jquery
[3, 5]
345,399
345,400
How can I use javascript to capture a click and send the page to a link?
<p>I have the following code:</p> <pre><code>&lt;li&gt;&lt;a id="logout" class="access button red" href="/MyAccount/Access/Logout" data-href="/MyAccount/Access/Logout" title="Logout"&gt;&lt;span class="smaller"&gt;LOGOUT&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; </code></pre> <p>When the user goes to this link it shows "/MyAccount/Access/Logout" in the bottom of the browser screen. </p> <p>Can I make it so the link uses javascript to go to the new location? Something like:</p> <pre><code> $('#logout').click(function (e) { ??? ??? e.preventDefault(); }); </code></pre>
javascript jquery
[3, 5]
5,142,002
5,142,003
Assign JavaScript values to C# Variable
<p>I have a Javascript function that pulls down variables, like so:</p> <pre><code> function OnClientCloseSecure(oWnd, args) { var arg = args.get_argument(); if (arg) { var ResultCode = arg.ResultCode; var PONumber = arg.PONumber; } } </code></pre> <p>I need to assign ResultCode and PONumber to a variable in C# or if that isn't possible a label in c#.</p> <p>Are any of these options possible? If so, how would I go about doing that? I've tried several things with no luck. Thanks! </p>
c# asp.net
[0, 9]
3,212,121
3,212,122
Android 4.0 WebView.loadURL oddity
<p>I have an Android app which includes an activity called <a href="https://github.com/ldo/ti5x_android/blob/master/src/Help.java" rel="nofollow">Help</a> This uses a WebView to display the help content in HTML format. Thie activity can be invoked two ways: either passing a URL, or direct text content. The only URL that I ever pass to this is “file:///android_asset/help/index.html” (which is an HTML page included in my assets in the APK).</p> <p>Passing the URL works fine on my HTC Desire running Android 2.2. It also seems to work in an emulator running Android 3.0. However, when I try it in an emulator with Android 4.0, it seems to try to launch the Web browser instead, to display a blank page; when I close this, I am back in my Help activity, also showing a blank page.</p> <p>Passing direct text content works fine on all the versions I’ve tried. The <a href="http://developer.android.com/reference/android/webkit/WebView.html" rel="nofollow">WebView</a> documentation says “Note that, in order for your Activity to access the Internet and load web pages in a WebView, you must add the INTERNET permissions to your Android Manifest file:” But I have no need to access the Internet as such, I just want to display my app-internal help page. And this has worked on Android versions prior to 4.0.</p> <p>Is this a bug in Android 4? Or is it just something I’ve misunderstood? Thanks for any help.</p>
java android
[1, 4]
143,307
143,308
What BroadcastReceiver should I use when the device is shutting down?
<p>I have been developing some Android application and I need to catch some events: when the device is rebooting and when device is shutting down. I know which BroadcastReceiver I should use for the first task but I don't know anything the second one. Please, tell me about it. Thank you.</p>
java android
[1, 4]
3,438,850
3,438,851
How to trigger a button as clicked using jquery or jscript?
<p>Is there a way to trigger a hidden button on an html markup page using jquery or jscript?</p> <p>How would I do that if possible?</p> <p>Thank you,</p> <p>James</p>
asp.net javascript jquery
[9, 3, 5]
3,036,856
3,036,857
javascript/jQuery: Clicking anywhere to trigger a function but on a particular button
<p>I want to trigger a function by clicking anywhere except an asp.net button.</p> <pre><code>&lt;script&gt; $(document).ready(function () { $(document).click(function () { Test(); }); }); </code></pre> <p>and</p> <pre><code>&lt;asp:Button ID="btnSave" runat="server" Text="SaveChanges" OnClick="btnSave_Click" /&gt; </code></pre> <p>How to modify my javascript code?</p> <p>Thanks. </p>
javascript jquery asp.net
[3, 5, 9]
5,052,706
5,052,707
jQuery find li with class until
<p>This might be tricky.</p> <p>Php will generate:</p> <pre><code>&lt;li&gt;element&lt;/li&gt; &lt;li&gt;element&lt;/li&gt; &lt;li class="alt"&gt;element&lt;/li&gt; &lt;li class="alt"&gt;element&lt;/li&gt; &lt;li class="alt"&gt;element&lt;/li&gt; &lt;li&gt;element&lt;/li&gt; &lt;li&gt;element&lt;/li&gt; &lt;li class="alt"&gt;element&lt;/li&gt; &lt;li class="alt"&gt;element&lt;/li&gt; &lt;li class="alt"&gt;element&lt;/li&gt; &lt;li&gt;element&lt;/li&gt; </code></pre> <p>What I need is a way to find the li elements with the .alt class until the li elements start. So...</p> <pre><code>&lt;li&gt;element&lt;/li&gt; &lt;li&gt;element&lt;/li&gt; // if I click on this one, it will select &lt;li class="alt"&gt;element&lt;/li&gt; // this one &lt;li class="alt"&gt;element&lt;/li&gt; // and this one &lt;li class="alt"&gt;element&lt;/li&gt; // and this one &lt;li&gt;element&lt;/li&gt; // stops selecting here &lt;li&gt;element&lt;/li&gt; &lt;li class="alt"&gt;element&lt;/li&gt; // doe not this one &lt;li class="alt"&gt;element&lt;/li&gt; // or this one &lt;li class="alt"&gt;element&lt;/li&gt; // or any other .alt &lt;li&gt;element&lt;/li&gt; </code></pre> <p>I tried doing this with .find(), but I can't find a way to divide the .alt elements into groups and isolate the first one.</p> <p>Any braniacs there with a good idea?</p>
php jquery
[2, 5]
302,815
302,816
Use title in fancybox to open up another link in a separate window
<p>All, I've got the following code to display a group of instagram photos and then I open them on my site with fancybox:</p> <pre><code>$output .= '&lt;script type="text/javascript"&gt; jQuery(document).ready(function($) { $(".fancybox").fancybox(); }); &lt;/script&gt;'; $output .= '&lt;div id="bd-instagram"&gt;'; for($i=0; $i&lt;$count; $i++){ $output .= '&lt;div class="bd-instagram-item"&gt; &lt;a rel="instagram-widget" class="fancybox" title="This is a title" href="'.$images[$i]['image_large'].'"&gt; &lt;img src="'.$images[$i]['image_small'].'" alt=""&gt;&lt;/a&gt; &lt;/div&gt;'; } </code></pre> <p>The fancybox opens up and displays the title "This is a title" underneath the image. However I'd actually like to make this a link so that when someone clicks on the title it opens up a link. I was trying to do something like this:</p> <pre><code>&lt;a rel="instagram-widget" class="fancybox" title="&lt;a href="http://www.instagram.com"&gt;Testing&lt;/a&gt;" href="'.$images[$i]['image_large'].'"&gt; </code></pre> <p>That doesn't work though and produces some odd HTML on my page. Does anyone have any idea on how to do something like that this?</p>
php jquery
[2, 5]
2,222,291
2,222,292
jquery jrating plugin extra url parameter
<p>Hey I'm using a jquery plugin called jRating, it's pretty cool you can check it out here: </p> <p><a href="http://www.myjqueryplugins.com/jRating" rel="nofollow">http://www.myjqueryplugins.com/jRating</a></p> <p>The issue I'm having is... I have multiple ratings on 1 page and thought it would be super convenient to be able to send in an extra "rating_type" parameter along with the request. Something like mypage.php?rating_type=personality. If I add it to the 'php' option, when calling </p> <pre><code>$(".rating").jRating({ ... phpPath: phpPath: $(this).attr("data-remote") + "?rating_type=" + $(this).attr("data-rating-type"); ... }); </code></pre> <p>I notice the rating_type parameter is not being sent in the request.</p> <p>Is there an easy way to add extra url parameters? or is this something I should just hack together myself? thanks!</p>
javascript jquery
[3, 5]
434,973
434,974
How do I check when nested $.getJSON requests have finished running?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3709597/wait-until-all-jquery-ajax-request-are-done">Wait until all jquery ajax request are done?</a><br> <a href="http://stackoverflow.com/questions/8726046/multiple-ajax-calls-inside-a-each-function-then-do-something-once-all-of-the">Multiple ajax calls inside a each() function.. then do something once ALL of them are finished?</a> </p> </blockquote> <p>The function below runs all this code at document ready but I am trying to run other functions when all the data from these completes.</p> <pre><code>function loadZonesDistrictsStoresData(){ $.getJSON('/CampaignMgmt/GetZonesByClient', { 'clientid': clientid }, function (zones){ $.each(zones, function(index, zoneid){ var li_tag = '&lt;li id="'+ zoneid +'"&gt; &lt;label&gt;&lt;input id="'+zoneid+'" data-id="'+zoneid+'" onchange="zones.selectZone(this.value)" type="checkbox" name="zone_'+zoneid+'" value="'+ zoneid +'"&gt;&lt;span&gt;' + zoneid +'&lt;/span&gt; &lt;/label&gt;&lt;/li&gt;'; $("ul.zones").append(li_tag); $.getJSON('/CampaignMgmt/GetDistrictsByZone', {'clientid': clientid, 'zone': zoneid }, function(data){ zone_object[zoneid] = data; $.each(data, function(index, districtid){ $.getJSON('/CampaignMgmt/GetStoresByDistrict', {'clientid': clientid, 'district': districtid }, function(stores){ districts_object[districtid] = stores; }); }); }); }); }); } </code></pre>
javascript jquery
[3, 5]
4,628,800
4,628,801
disable paste (control V) in IE for an input text box
<p>Is there a way to disable the paste (control V) into a text box using javascript/jquery for IE? </p> <p>I do not have access to the markup unfortunately or I would use onPaste="return false". Can it be attached with Jquery? </p> <p>If it cannot be disabled at least is there a way to detect it so that when the paste event occurs just remove the text from the input text box.</p> <pre><code>&lt;input type="text" maxlength="" size="25" value="Enter letters here" name="TEXTBOX___97___470GCPC___31" autocomplete="off"&gt; </code></pre>
javascript jquery
[3, 5]
4,426,594
4,426,595
can I call a PHP method to run asynchronously?
<p>When a user views a certain profile page I need to send the end user an email but would like to do this asynchronously if at all possible. Can this be done with PHP? I really don't want to wait for the PHP function to complete before rendering the rest of the page. It should be seamless to the user.</p> <p>Or is this a better solution from the client side:</p> <pre><code>$.post("msg.php?user=xxx", function(data) { .... }, "json"); </code></pre> <p>Is there a preferred method? </p>
php jquery
[2, 5]
1,064,521
1,064,522
Data in string format sorting as per duration using javascript
<p>I have certain data in the form of number of lines containing string. Each line contains date. I want to sort the data for certain duration. e.g. from 12th DEC 2012 to 23rd March 2013. This is supposed to done using javascript and jquery. I have done following code.</p> <pre><code>for (TempDate = strFrom; TempDate &lt;= strTo; TempDate.setDate(TempDate.getDate() + 1)) { var FromDate = $.datepicker.formatDate('yy-mm-dd', strFrom); alert("FromDate : " + FromDate); if (temp1[i].indexOf(FromDate) &gt; 0) { $('#BasicDetailsPlaceHolderPanel div:eq(' + i + ')').css({ 'display': 'block'}); } else { $('#BasicDetailsPlaceHolderPanel div:eq(' + i + ')').css({ 'display': 'none'}); } } </code></pre> <p>But it is showing the records of last date only. Please tell me solution.</p>
javascript jquery
[3, 5]
3,215,210
3,215,211
stop a jquery animation loop (function and nested)
<p>How would i stop a jquery animation from loading upon user interaction?</p> <pre><code> $('#jqNav li a').click(function(){ if($(this).parent().is(".nav1")){ $('.landing .main .nav ul').css({ "background-position" : "0 -50px" });} else if($(this).parent().is(".nav2")) { $('.landing .main .nav ul').css({ "background-position" : "0 -100px" });} else if($(this).parent().is(".nav3")) { $('.landing .main .nav ul').css({ "background-position" : "0 -150px" });} else if($(this).parent().is(".nav4")) { $('.landing .main .nav ul').css({ "background-position" : "0 -200px" });}; $page = $(this).attr('href'); var $hashTag = $(this).attr('name'); window.location = "#" + $hashTag; loadData(); return false; }); </code></pre> <p>this is the user click function;</p> <pre><code> function doReplay(){ $('body') .fadeTo(0,1,function(){ $page = $welcome; loadData(); }) .delay(1000) .fadeTo(0,1,function(){ $page = $startup; loadData(); }) .delay(1000) .fadeTo(0,1,function(){ $page = $to2m; loadData(); }) .delay(1000) .fadeTo(0,1, function(){ $page = $to25m; loadData(); setTimeout(function(){doReplay();},5000); }); } </code></pre> <p>and the above is the animation function</p> <p>I have tried clearTimeout but it doesn't seem to work.</p>
javascript jquery
[3, 5]
4,056,411
4,056,412
I want to change background color after clicking using javascript
<p>Following is my code:</p> <pre><code>&lt;table border="0" align="center" cellpadding="0" cellspacing="0" class="grid_table"&gt; &lt;tr class="grid_caption"&gt;&lt;td class="grid_caption"&gt;Customer Name&lt;/td&gt;&lt;/tr&gt; &lt;? if(count($arrResult) &gt; 0) { ?&gt; &lt;? foreach($arrResult as $row) { ?&gt; &lt;tr class="grid_row" &gt;&lt;td class="grid_row" onClick="javascript:return selectCustomer(this,&lt;?=$row['customer_id']?&gt;);"&gt;&lt;?=HTMLVarConv($row['Name'])?&gt;&lt;/td&gt;&lt;/tr&gt; &lt;? } ?&gt; &lt;? } ?&gt; &lt;/table&gt; </code></pre> <p>here i got the list of customer but when i click on this customer name then its background color should be change.. here is my javascript function </p> <pre><code>function selectCustomer(row, id) { alert(row); var mark_color = '#fdf5d2' //'#c1c1ff' var current_row = '#aad4f0' //'#e8e8e8' if (row.style.backgroundColor == current_row) { row.style.backgroundColor = mark_color; } else if (row.style.backgroundColor == mark_color) { row.style.backgroundColor = current_row; } $("#editCustomer").attr("src","editcustomer.php?customer_id="+id+"&amp;showmenu=0"); $("#ajaxList").show(); return; } </code></pre> <p>but not changing what the problem ???? please help me</p>
php javascript jquery
[2, 3, 5]
1,534,573
1,534,574
Legal use of creating a new object on a global namespace
<p>Would this be a legal use of creating an object on a global namespace? My goal is to create 1 global namespace for this application. Also how would I alias MYNYTE.app? Could I do something like this with out polluting the Global namespace: <strong>var b = MYNYTE.app;</strong></p> <pre><code>if( ! MYNYTE ) MYNYTE = {}; if( ! MYNYTE.app ) MYNYTE.app = {}; MYNYTE.app.Playbook = function(){ this.change = ''; this.boo = function(){alert('boo');} this.setChange = function( v ) { this.change = v; } this.getChange = function( v ) { return this.change; } } var test = new MYNYTE.app.Playbook(); var test2 = new MYNYTE.app.Playbook(); test.boo(); test.setChange( 'Change is bad' ); test2.boo(); test2.setChange( 'Change is great' ); console.log( test2.getChange() ); console.log( test.getChange() ); </code></pre>
javascript jquery
[3, 5]
2,090,881
2,090,882
save js files as php
<p>Let's say I've to include the following line with my website header:</p> <pre><code>&lt;script type="text/javascript" language="javascript" src="file.js"&gt;&lt;/script&gt; </code></pre> <p>Now anyone easily can visit <code>my--web--site/file.js</code> and view its source. So, I wonder if there any idea I can rename <code>file.js</code> to <code>file.php</code> and still able to call it and works fine, so that no one can view it by visiting <code>my--web--site/file.php</code>.</p> <p>Any idea?</p>
php javascript
[2, 3]
1,331,275
1,331,276
applying a var to an if statement jquery
<p>Need to apply a var to a statement if its conditions are met, this syntax isn't throwing errors but its not working.</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ var action_is_post = false; //stuff here $(this).ready(function () { if ($("#stepDesc0").is(".current")) { action_is_post = true; } }); //stuff here &lt;/script&gt; </code></pre> <p>should I use something other than <code>.ready</code>? Do I even need the <code>$(this).ready(function ()...</code> part? I need it to apply the <code>var</code> when <code>#stepDesc0</code> has the class <code>current</code>.</p> $(document).ready(function(){ var action_is_post = false; $("form").submit(function () { action_is_post = true; }); if ($("#stepDesc0").is(".current")) { var action_is_post = true; } window.onbeforeunload = confirmExit; function confirmExit() { if (!action_is_post) return 'Using the browsers back, refresh or close button will cause you to lose all form data. Please use the Next and Back buttons on the form.'; } });
javascript jquery
[3, 5]
5,407,108
5,407,109
Click events on overlapping items
<p>I have </p> <ul> <li>table row with click event</li> <li>button with click event, that button is on table row</li> </ul> <p>and I have problem. When I hit button, row click event execute too, but I don't want this behavior. I want only button click execute, without row click.</p>
javascript jquery
[3, 5]
410,860
410,861
Multiple jQuery .ready() - appending to existing event handler instead of creating another one
<p>Say that I have a HTML that links to two scripts:</p> <pre><code>... &lt;script type="text/javascript" src="general.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="[pagename]_specific.js"&gt;&lt;/script&gt; ... </code></pre> <p>Each of the two scripts has it's own jQuery's <code>.ready()</code> defined.</p> <p><strong>general.js:</strong></p> <pre><code>jQuery(function() { var foo; $('#btn').click(function() {alert(foo())}); } </code></pre> <p><strong>home_specific.js:</strong> an example of "[pagename]_specific.js"</p> <pre><code>jQuery(function() { foo = function() {alert("hello")}; } </code></pre> <p>where <code>#btn</code> is a button element.</p> <p>"general.js" is a script that is shared by multiple pages, while each page has its dedicated "[pagename]_specific.js" for defining how the function assigned to <code>foo</code> behaves. </p> <p>When I clicked on <code>#btn</code> I was expecting to see "hello" dialog, but instead, I got <code>Uncaught TypeError: undefined is not a function</code> in chrome developer tools. From <a href="http://stackoverflow.com/questions/12631817/working-with-the-same-variable-across-the-jquery-ready-defined-in-multiple-sc/12631833#comment17033977_12631833">this SO question</a>, I understand that's because the two <code>.ready()</code> have two separate event handlers. </p> <p><strong>Question:</strong> Is there any way that the <code>.ready()</code> in "[pagename]_specific.js" appends to the event handler of the <code>.ready()</code> in "general.js", instead of defining another anonymous function?</p>
javascript jquery
[3, 5]
5,555,153
5,555,154
Can't find the bug in this jQuery code
<p>I have the following code, which, upon the press of a certain button, should validate for an email address (this functionality works already), and then should try to post my form, and if it gets back "Error", it should show an error. I think I'm mixing up PHP and JS somewhere.</p> <pre><code>$('#recoverSub').live('click',function() { $("#recoverPost").validate({ rules: { recoverField: { email: true } }, messages:{ recoverField: { email: "Not a valid email." } } }); if($("#recoverPost").valid()) { $.post('php/recoverPost.php', $('#recoverPost').serialize(), function(){ function(data) { if(data != "Error") { $('#recoverPost').hide(); $('#success').show(); } else { echo "This email is not in our records."; } } }); } }); </code></pre>
php jquery
[2, 5]
4,962,296
4,962,297
How is the "jQuery" var a function and an object?
<p>For example, when you use <code>jQuery('someDiv');</code>, it's a function, but you can also use <code>jQuery.ajax(...);</code>.</p> <p>How is it possible?</p>
javascript jquery
[3, 5]
3,783,583
3,783,584
Highlight selected list item only on long click?
<p>I'm using this to make a list item visible selected:</p> <pre><code>&lt;item android:state_activated="true" android:drawable="@android:color/holo_blue_light" /&gt; </code></pre> <p>But I want the item only to be highlighted if a longclick is performed (so to say: only during the context menu bar is displayed above). And on a single click I do not want it to be highlighted, even though performing an action on single click.</p> <p>How can I disable the activated state only on longclick?</p>
java android
[1, 4]
524,918
524,919
how to insert text on image dynamically using java script or jquery
<p>using jquery or javascript , how to insert textbox data display on image,</p> <p>Thank you</p>
javascript jquery
[3, 5]
2,846,537
2,846,538
jQuery .trigger('click')
<p>I am having trouble getting this to work. I would like to trigger the second link. If anyone can help that would be much appreciated.</p> <pre><code> $(".links").click(function () { alert($(this)); }) function someFunction(){ $(".links").trigger('click'); } someFunction(); ... &lt;a href="1.html" class="links"&gt;One&lt;/a&gt; &lt;a href="2.html" class="links"&gt;Two&lt;/a&gt; &lt;a href="3.html" class="links"&gt;Three&lt;/a&gt; </code></pre>
javascript jquery
[3, 5]
1,148,943
1,148,944
iPhone coords and onclick with JavaScript
<p>I have a couple of js queries.</p> <p>Onclick isn't working on iPhones although its fine elsewhere.</p> <p>JavaScript:</p> <pre><code>document.onclick = function(){newTarg(speedS)}; </code></pre> <p>Any ideas on way round this, thinking maybe onchange but not sure how best to implement?</p> <p>Also I am trying to get coordinates of the touch please help, so far code below.</p> <p>JavaScript :</p> <pre><code>event = window.event; xTarg = event.clientX; yTarg = event.clientY; </code></pre>
javascript iphone
[3, 8]
3,083,508
3,083,509
How to avoid Logged User change after refreshing page?
<p>I am using FormsAuthentication.SetAuthCookie Method in my application.after Client login i am setting <strong>FormsAuthentication.SetAuthCookie(txtUserNo.Text.Trim(), false);</strong></p> <p>and in web.config file i set </p> <pre><code> &lt;authentication mode="Forms"&gt; &lt;forms loginUrl="PasswordEntry.aspx" path="/" timeout="1"&gt;&lt;/forms&gt; &lt;/authentication&gt; </code></pre> <p>after 1 minute (Page refreshing) i am getting Administrator data.its not right.Please tell me where the problem is ? and the solution also.</p> <p>Thanks in advance. Rakesh.</p>
c# asp.net
[0, 9]
3,701,763
3,701,764
How to download jQuery js plugin?
<p>I am confused about js file of jQuery which one i have downloaded just now.</p> <p>downloaded a zipped folder contains a lot of folder and files inside it. How can i know which one js file exactly is for particular plugin?</p> <p>Lets say, i have to downloaded for <strong><em>Dialog</em></strong> and i <a href="http://jqueryui.com/download" rel="nofollow">download from this page by selecting</a> Model under Widget section. It downloads a zip folder and has many folder and files inside it.</p>
javascript jquery
[3, 5]
1,936,925
1,936,926
Easy way to bind dynamic elements without having to recall functions jquery
<p>I currently have a page in which users can drag content around, resize it, etc. </p> <p>The basic structure looks like the following:</p> <pre><code>$('.element').on().resizable().draggable(); </code></pre> <p>When called at the beginning of the document load it adds bind events, resizable and draggable. Now the problem I have is that a user can add in new elements dynamically. These new elements are no longer covered by the above code. What I ended up doing is the following:</p> <pre><code>function bindEvents(){ $('.element').on().resizable().draggable(); } </code></pre> <p>bindEvents();</p> <p>And then when elements are added I turn off the current implementation and then turn it on again so that it will include the new elements:</p> <pre><code>$('.element').off().resizable("destroy").draggable("destroy"); bindEvents(); </code></pre> <p>No I know this is incredibly inefficient and most likely uses way more memory than needed. My question is, is there a better way to do this? Is there a way to add the one particular element to the already established group of bound elements?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
3,000,304
3,000,305
jquery/javascript - parsing url to see if you're on a certain page
<p>So say you have some navigation, and you don't/can't use server side code to choose which link is "current". How can you use the first part of the url (as in after the first slash but before any next slash) i.e. (example.com/dashboard/view/16) would return dashboard. Of course there's not always a second slash, it could be (example.com/dashboard). Also before a hash mark i.e. (example.com/dashboard#users) would return dashboard.</p> <p>Is the best choice to just use location.href and try to write some functions to parse it? Or is there something already made/simpler?</p>
javascript jquery
[3, 5]
79,400
79,401
How to get the object of Iframe at clientside(javascript) which placed inside Table in asp.net
<p>I have iframe inside the column of <code>&lt;asp:table&gt;</code>. I want to get the object of an iframe in javascript. I tried like this in <code>&lt;body&gt;</code> section:</p> <pre><code>&lt;script type="text/javascript"&gt; function resizeIframe() { var height = document.documentElement.clientHeight; height -= document.getElementById('frame').offsetTop; height -= 20; document.getElementById('frame').style.height = height + "px"; }; document.getElementById('frame').onload = resizeIframe; window.onresize = resizeIframe; &lt;/script&gt; </code></pre> <p>But I'm getting error like <em>"object expected or null"</em>.</p>
javascript asp.net
[3, 9]
4,436,703
4,436,704
How can i get accelerometer values from onSensorChanged to class ThreatForLoopA?
<p>For example. I´m working with accelerometer and i want values x,y,z in another class ThreatForLoopA.</p> <pre><code>@Override public void onSensorChanged(int sensor, float[] values) { // TODO Auto-generated method stub x = values[0]; y = values[1]; z = values[2]; ThreadForLoopA threadA = new ThreadForLoopA(); if (sensor == SensorManager.SENSOR_ACCELEROMETER) { long curTime = System.currentTimeMillis(); threadA.start(); </code></pre> <p>This is example of class ThreatForLoopA:</p> <pre><code>public class ThreadForLoopA extends Thread{ TextView xacc = null; TextView yacc = null; TextView zacc = null; float[][] p= new float[5][3]; private long lastUpdate = -1; public float x,y,z; int row = 0; @Override public void run() { // TODO Auto-generated method stub long curTime = System.currentTimeMillis(); if (lastUpdate == -1 || (curTime - lastUpdate) &gt; 2000) { lastUpdate = curTime; for (int column = 0; column &lt; 3; column++) { if (column == 0) { p[row][column] = x; //xacc.setText("Os X: " + p[row][column]); } if (column == 1) { p[row][column] = y; //yacc.setText("Os X: " + p[row][column]); } if (column == 2) { p[row][column] = z; //zacc.setText("Os X: " + p[row][column]); }} if (row == 0) { xacc.setText("Os X: " + p[row][0] + " " + p[row][1] +" " + p[row][2]); } </code></pre> <p>How can i get accelerometer values from onSensorChanged to class ThreatForLoopA?</p>
java android
[1, 4]
4,734,100
4,734,101
Why click event is not propagating?
<p>Attached a Header with a (kinda) close button (in red) moc-up. When I click on the close button (the area that overlaps with a header) - nothing happens. Can you please advice on the correct solution regarding the subject?</p> <p><strong>HTML:</strong></p> <pre><code>&lt;div id="my_body" style="background:rgba(0, 0, 0, 0.6);padding:10px;"&gt; &lt;div id="cls_btn" style="position:absolute;left:0px;top:0px;height:50px;width:50px;background-color:red;"&gt; &lt;/div&gt; &lt;div id="my_header" style="position:relative;padding:14px 26px 26px"&gt; &lt;/div&gt; &lt;div id="pic_area" style="border:2px solid #b3b3b3;margin-top:10px"&gt; &lt;img id="pic" src="http://never.mind.which.pic.com" &gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>JS:</strong></p> <pre><code>$("#cls_btn").bind("click", function() { alert("clicked!"); return true; }); </code></pre> <p>JSFiddle: <a href="http://jsfiddle.net/JuGx9/" rel="nofollow">http://jsfiddle.net/JuGx9/</a></p> <p>Thanks!</p>
javascript jquery
[3, 5]
5,713,935
5,713,936
Convert date format in javascript
<p>I have an input field that on page load looks like this:</p> <pre><code>&lt;input type="input" id="start_date" name="start_date" value="May 12, 2012"/&gt; </code></pre> <p>I want the following to happen:</p> <ul> <li>When a user clicks on the field to enter a date, the format changes to YYYY-MM-DD. (2012-05-12)</li> <li>After a user leaves the field, the format changes back to MMM DD, YYYY (May 12, 2012).</li> <li>When the data is submitted via post, it is in the format YYYY-MM-DD (2012-05-12).</li> </ul> <p>How would I accomplish this with jQuery?</p>
javascript jquery
[3, 5]
2,702,537
2,702,538
Can't field be assigned memory?
<p>I am new to Java. I have runtime error at the line containing <code>myImageViews[0].v1 = new ImageView(context)</code>. Is something wrong there?</p> <pre><code>class MyImageViews { ImageView v1; ImageView v2; } MyImageViews[] myImageViews; protected class MyLayout extends RelativeLayout { public MyLayout(Context context) { super(context); myImageViews = new MyImageViews[10]; myImageViews[0].v1 = new ImageView(context); //runtime error at this line } } </code></pre>
java android
[1, 4]
1,486,650
1,486,651
Accessing html controls within an #include html file, from server side c#
<p>Following code is an example, I just want to know if this can be done.</p> <p>I have an test.aspx file with this server side include tag;</p> <pre><code>&lt;!--#include file="listOfCountries.htm" --&gt; </code></pre> <p>Within listOfCountries.htm, I have:</p> <pre><code>&lt;html&gt; &lt;div&gt; &lt;select id="countryList" runat="server"&gt; &lt;option&gt;&lt;/option&gt; ... &lt;/select&gt; &lt;/div&gt; &lt;/html&gt; </code></pre> <p>Now, Is there a way to access "countryList" in test.aspx.cs file ?</p> <p>On another note, say I didn't have the #include "Countries.htm" in test.aspx, is it possible to access the controls within Countries.htm from test.aspx.cs ? (i.e. accessing an external html file controls in cs)</p>
c# asp.net
[0, 9]
2,976,939
2,976,940
Images will not upload on web server but ok on local
<p>I have some images on server i want to upload it on another server i make code to upload all images on server but it is OK to upload on local but i didn't know what is wrong in that it can't be upload on server </p> <pre><code> try { byte[] content; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); WebResponse response = request.GetResponse(); Stream stream = response.GetResponseStream(); using (BinaryReader br = new BinaryReader(stream)) { content = br.ReadBytes(500000); br.Close(); } response.Close(); string CompleteDPath = "ftp path"; string UName = "abc"; string PWD = "123"; WebRequest reqObj = WebRequest.Create(CompleteDPath + file_name); reqObj.Method = WebRequestMethods.Ftp.UploadFile; reqObj.Credentials = new NetworkCredential(UName, PWD); reqObj.GetRequestStream().Write(content, 0, content.Length); reqObj = null; //FileStream fs = new FileStream(file_name, FileMode.Create); //BinaryWriter bw = new BinaryWriter(fs); //bw.Write(content); //fs.Close(); //bw.Close(); } catch (Exception ex) { Response.Write(ex.Message); } </code></pre>
c# asp.net
[0, 9]
5,588,690
5,588,691
get the value from one master to another
<p>iam using a dropdownlist in one master page. i want to get the dropdownlist value in session and i want to use it in another master page.</p> <p>how to do this.</p>
c# asp.net
[0, 9]
1,970,690
1,970,691
randomly replace a substring in a block of text in javascript or jquery
<p>how would i randomly replace a string in a text using javascript or jquery?</p> <p>given: <code>&lt;p&gt;foo bar foo baz foo&lt;/p&gt;</code></p> <p>I want to just randomly replace 1 occurrence of 'foo' with 'buz', so possible results would be:</p> <pre><code>&lt;p&gt;buz bar foo baz foo&lt;/p&gt; &lt;p&gt;foo bar buz baz foo&lt;/p&gt; &lt;p&gt;foo bar foo baz buz&lt;/p&gt; </code></pre>
javascript jquery
[3, 5]
3,761,503
3,761,504
NullRefrenceException was unhandled by user code
<p>Code below is placed in page_Load. How I should handle this to bypass UrlReferrer when you enter page directly first time and there is no referrer? What I am missing here?</p> <pre><code> if (HttpContext.Current.Request.UrlReferrer.AbsoluteUri != null) { urlReferer = HttpContext.Current.Request.UrlReferrer.AbsoluteUri.ToString(); } else { urlReferer = ""; } </code></pre>
c# asp.net
[0, 9]
1,737,678
1,737,679
Advice on jquery resize plugins
<p>I am using jquery sliding tabs. The tab container will ajust to the height of the inactive content but the only problem is that the autoHeight jquery function does not adjust to active expanding content. I tried <a href="http://benalman.com/projects/jquery-resize-plugin/" rel="nofollow">THIS</a> plugin but no luck. Any suggestion of other plugins? here is my <a href="http://jsfiddle.net/HZj7k/14/" rel="nofollow">JSFIDDLE</a>.</p> <p>Thank you.</p> <p>My method of resizing is not working:</p> <pre><code>&lt;script&gt; $(document).ready(function() { $('div#st_horizontal').slideTabs({ // Options contentAnim: 'slideH', autoHeight: true, contentAnimTime: 600, contentEasing: 'easeInOutExpo', tabsAnimTime: 300 }); var height = 50 // Set to the height you want $('.st_view').css('height', height+'px') });​ &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
2,894,580
2,894,581
Performing click event on a disabled element? Javascript jQuery
<p>I would like to perform the click event of a element:</p> <pre><code>jQuery('input#submit').click(function() { if ( jQuery('input#submit').attr("disabled") ) { alert('SUP'); } }); </code></pre> <p>However this will not work as the element is required to be enabled for the click even to be executed.</p> <p>Any help would be appreciated,</p> <p>Thanks</p>
javascript jquery
[3, 5]
928,732
928,733
Filling Up DropDown in Page Load
<p>I'm trying to fill up my dropdown menu by a series of queries that I make, automatically whenever the page loads. Whenever I choose a value in the dropdown and I press a button, it goes back to the first index, so I'd like to know if there is anyway to prevent this problem:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { Functions.username = "1"; // This is just to get rid of my login screen for testing puposes DropDownList1.Items.Clear(); Functions.moduledatelister(); for (int i = 0; i &lt;= Functions.moduledatelist.Count-1; i++) { DropDownList1.Items.Add(Functions.moduledatelist.ElementAt(i)); } } protected void Button2_Click(object sender, EventArgs e) { Label1.Text = Functions.DATES.ElementAt(DropDownList1.SelectedIndex).ToString(); } </code></pre> <p>after the button is pressed the index goes back to 0 and the label shows the value for the first item.</p>
c# asp.net
[0, 9]
5,572,635
5,572,636
Refresh page when directory content changes
<p>I am working on an online jQuery slideshow for showing the latest scores for a local sport community. The slides are images, made from a Powerpoint presentation, which are automatically synced with a directory on my Centos6 server using the Windows program Autover.</p> <p>For a good user experience it would be great when the page is refreshed when the images are updated (or show some text that the scores are updated and let the user refresh). I could set a meta refresh, for refreshing the page every 10 minutes but thats not an ideal solution.</p> <p>Browsing other topics I found out that it is not possible to monitor a server directory using only Javascript.</p> <p>My idea is now to make a php script to which returns true (changed) or false (not changed), and call this script from the slideshow webpage every 5 minutes using javascript. </p> <p>For the php script I read some topics using these solutions:</p> <ul> <li>Inotify-tools (which is not installed by default on Centos)</li> <li>FAM (could be outdated?)</li> <li>Making a md5 hash of the directory, and compare this with a previous hash.</li> </ul> <p>Which of the solutions above is the best way to go? Could someone provide me with an php example? Unfortunately my php skills are not so good.</p>
php javascript
[2, 3]
4,448,137
4,448,138
Do I need to learn Javascript before learning JQuery?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/668642/is-it-a-good-idea-to-learn-javascript-before-learning-jquery">Is it a good idea to learn JavaScript before learning jQuery?</a> </p> </blockquote> <p>I want to learn html5 in order to write some games. I realized people include some JQuery code inside the game. So I head over and check JQuery and found that JQuery have some relationship with Javascript. </p> <p>Should I learn Javascript before learning JQuery?</p>
javascript jquery
[3, 5]
5,997,552
5,997,553
Best way to block on a socket for data
<p>What is the efficient way of blocking on the socket for data after opening it.The method i used is to call read on input stream (this is a blocking call that waits till some data written to this socket).</p> <pre><code>//Socket creation SocketForCommunication = new Socket(); InetSocketAddress sAddr = new InetSocketAddress("hostName", 8800); SocketForCommunication.connect(sAddr,10000); is = new DataInputStream(SocketForCommunication.getInputStream()); os = new DataOutputStream(SocketForCommunication.getOutputStream()); //Waiting on socket using read method for data while(true) { int data = is.read(); if(data == HEADER_START) { processPackage(is); } } </code></pre> <p>Here problem is read can timeout.Is there a way to register a callback that gets called when data available to read on socket.?</p>
java android
[1, 4]
4,100,838
4,100,839
Help me convert this 2d array code from PHP to C#
<p>Please help me re-write this code sample in PHP to C#:</p> <pre><code>$stringArray = array(); $stringArray['field1'] = 'value1'; $stringArray['field2'] = 'value2'; $stringArray['field3'] = 'value3'; foreach ($stringArray as $key =&gt; $value) { echo $key . ': ' . $value; echo "\r\n"; } </code></pre>
c# php
[0, 2]
4,554,644
4,554,645
ASP.Net global error handler for all... but a few
<p>i want to implement a global error handler for my asp.net website.</p> <p>I usually implement this in the global.asax by logging the error and redirecting to an error page.</p> <p>So far so good, but in this case we have calls to asmx webservices from Jquery, and, sorry to say, Errors thrown in the asmx webservice are used in the calling Jquery. So when errors are thrown from an asmx file, i want to log them and rethrow them</p> <p>The only thing i could come up with is to check for the .asmx extension in the stacktrace, but was hoping for some other way (don't know why, but string checking just feels awkward)</p>
c# asp.net
[0, 9]
2,505,951
2,505,952
Impossible to hide a DIV in ASP.NET MVC
<p>I have some trouble to hide some div in my application, this code is used in jQuery UI tabs.</p> <p>In the controller :</p> <pre><code>public ActionResult MyAction() { return View("MyView", model); } </code></pre> <p>In the view "MyView", I have this :</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $('#divToHide1').hide(); $('#divToHide2').hide(); }); &lt;/script&gt; &lt;div id="divToHide1"&gt; &lt;/div&gt; &lt;div id="divToHide2"&gt; &lt;/div&gt; </code></pre> <p>The problem the div are never hidded, any idea ?</p> <p>Thanks,</p> <p>Update1 : when I switch to second tab, I do the prcedure below. The switch to thez tab is ok, I receive an "alert1", and I receive "1" correspondinf to the length, but the div is still visible.</p> <pre><code> function e2() { var jqxhr = $.post("/Controller/MyAction", function (data) { $('#tabs-2').html(data); }) .success(function () { alert('alert1'); }) .error(function () { }) .complete(function () { alert($('#divToHide1').length); $('#divToHide1').hide(); }); } </code></pre> <p>Update2 : I tried with class instead of id ... and look ok</p>
jquery asp.net
[5, 9]
4,832,391
4,832,392
Re-running JQuery's selectors and actions after a programmatic insertion of new content
<p>Fellow JQuery hackers, hello :-)</p> <p>Suppose you have the following code:</p> <pre><code>$('.links').click(function(){ //Do something } </code></pre> <p>And I then insert dynamic content into a DIV's HTML content (Say, for example, after clicking a button, the new content gets inserted). This content has the "links" class. The problem is that the "click" button doesn't get registered with the newly inserted content.</p> <p><strong>How do I tell JQuery to re-select all the elements with a "links" class and apply the above function on them? Can this be automated?</strong></p> <p>Thanks.</p>
javascript jquery
[3, 5]
4,938,467
4,938,468
check the horizontal scroll bar reached at end of webview
<p>i am working with a webview that is inside 2d scroll view so whenever i tried to get computescrollrange() ,computescrolloffset() etc so these methods are not returning any value so i want to use the javascript to detect that horizontal scroll bar reached at the end of webview so please suggest me the way how to create the function that will return the Boolean value to tell whether it is at end or not using any way either in android or javascript/jquery</p> <pre><code>thanks in advance </code></pre>
javascript jquery
[3, 5]
4,756,427
4,756,428
How to get a server-side variable into JavaScript
<p>I want to pass a value to this JavaScript from the database (using datareader in asp.net(C#)).</p> <p>The script is from <a href="http://www.dynamicdrive.com/dynamicindex14/leftrightslide.htm" rel="nofollow">http://www.dynamicdrive.com/dynamicindex14/leftrightslide.htm</a></p> <p>I need to set a pass value in the below line:</p> <pre><code>leftrightslide[cnt] = '&lt;a href="MYWEBPAGE"&gt;&lt;img src="MYIMAGE FRM DATABASE.gif" border=1&gt;&lt;/a&gt;'; cnt++; </code></pre> <p>So the value of the datareader would be passed into the JavaScript array.</p>
asp.net javascript
[9, 3]
1,396,265
1,396,266
.load() is not pulling in content from html file
<p>I have been using the jQuery Docs and I am trying to set up a situation where the content of a modal is filled from a separate html file. All files are on the same domain, same folder. So far, the modal will launch on click, but no content is being pulled in from the html file. I'm using Zurb reveal for modal.</p> <p>jQuery:</p> <pre><code>$('.video-btn').click(function (e) { e.preventDefault(); var modalUrl = $(this).attr('href'); $('#myModal').load('modalUrl #vidModal').reveal({ animationspeed: 500, animation: 'fadeAndPop', dismissmodalclass: 'close-reveal-modal' }); //$('.video-wrapper').children().show(); }); </code></pre> <p>The Link</p> <pre><code>&lt;a href="modal1.html" class="info-btn video-btn"&gt; &lt;h2&gt;Video&lt;/h2&gt; &lt;p&gt;Cambridge at a glance&lt;/p&gt; &lt;/a&gt; /*Outer modal hidden on page*/ &lt;div id="myModal" class="reveal-modal"&gt;&lt;/div&gt;/*Content that is in a file named modal1.html*/ &lt;div id="vidModal" class="reveal-modal"&gt; &lt;div class="inner-modal"&gt; &lt;div class="modal-head"&gt; &lt;h2&gt;Video&lt;/h2&gt; &lt;p&gt;Cambridge at a glance&lt;/p&gt; &lt;a class="close-reveal-modal"&gt;&lt;/a&gt; &lt;/div&gt; &lt;div class="modal-share-btns"&gt;&lt;/div&gt; &lt;div class="video-wrapper"&gt; &lt;iframe id="vid" src="http://player.vimeo.com/video/20800836?api=1" width="700" height="400" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""&gt;&lt;/iframe&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- /inner-modal --&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
2,349,014
2,349,015
Internal page refresh with JavaScript
<p>I have a form and everytime some performs a onchange()-event, the page should run my javascript code again (but a refresh of the page using a new url request is not an option).</p> <p>Any idea? I know this must be very simple.</p> <p>my javascript-code:</p> <pre><code> $(document).ready(function(){ formObject = document.forms['newBom']; var vendor = formObject.elements['inptHardware'].value; console.log('selected vendor: ' + vendor); var product = formObject.elements['inptProduct'].value; console.log('selected product: ' + product); }); </code></pre>
javascript jquery
[3, 5]
3,754,596
3,754,597
Which C# practices should be avoided in C++?
<p>I'm currently teaching myself C++. I'm very proficient at C#, and was wondering which common practices in C# can lead to difficulties in C++, and what a C++ programmer should do instead.</p>
c# c++
[0, 6]
5,715,262
5,715,263
Getting value of p tag with jquery
<p>Im using jquery to try to take the value text in a p tag. </p> <p>I set up an alert for testing to give me the value and it says "current stack is [object Object]" </p> <p>My html for this is</p> <pre><code>&lt;div id="player9"&gt; &lt;div class="player_stats"&gt; &lt;p class="player_name"&gt;&lt;/p&gt; &lt;p class="player_action"&gt;&lt;/p&gt; &lt;p class="player_money"&gt;&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>My alert code is:</p> <pre><code>alert("current stack is " + $("#player9").children(".player_stats").children("p.player_money")); </code></pre> <p>if I add .val() it comes back as undefined. These values were set upon page load by:</p> <pre><code>$(whichseat[seat]).children(".hand").children("p.bet").text(bet); </code></pre> <p>"whichseat[seat] and bet are based into the function. They are setting correctly.</p> <p>If I use firebug and checkout that specific p tag it says:</p> <pre><code>&lt;p class="player_money"&gt;60000&lt;/p&gt; </code></pre> <p>How do I correctly grab that value?</p> <p>Any help would be greatly appreciated!</p>
javascript jquery
[3, 5]
1,969,340
1,969,341
How to prevent HREF (which calls JS function) from being triggered when "Enter" key is pressed?
<p>I am facing a problem.</p> <p>I have a href which calls a javascript function "delete_element_on_page" when i click on it.</p> <p>So when i click the HREF with my mouse, everything is fine and the function gets called.</p> <p>However, because the HREF has focus, if keep hitting my enter key, the function gets called again and again and again leading to undesired outcomes.</p> <p>How can i prevent this from happening?</p> <p>I was thinking of 1. Blurring the focus on the href when my function is called --> I could do this, but this will mean I have to manually do this for every single HREF because jquery.blur can only be triggered at an individual element level. --> Alternatively, is there a javascript equivalent of where I can do a universal Blurring, regardless of which element is in focus? </p> <p>OR</p> <ol> <li>Deactivate enter key from triggering clicking of a HREF --> Is this even possible? And if so, worth my while in terms of code complexity / compatibility etc..</li> </ol> <p>Thanks so much :)</p>
javascript jquery
[3, 5]
1,863,087
1,863,088
Errors attempting to publish a project from Visual Studio Express 2008
<p>I am attempting to publish an application to a local intranet site, and am getting the following errors:-</p> <pre><code>Unable to add 'ControlPanel.aspx' to the Web site. 550 ControlPanel.aspx: Access is denied. Unable to add 'Default.aspx' to the Web site. 550 Default.aspx: Access is denied. . . . Unable to add folder 'bin' to the Web site. Cannot create folder "bin". </code></pre> <p>but I can connect to the location using ftp and do anything I like, using the same username and password. Does anyone know why this might be?</p> <p>(Although I have copied the files and the new application runs I suspect doing this has wrecked the licensing of one of the components, so I'd like to be able to try the 'official' way.)</p>
c# asp.net
[0, 9]
1,644,294
1,644,295
Can't seem to get RequiredFieldValidator in nested user control to fire
<p>I have a user control (form) inside a user control (grid) with a Validator in the form. A snippet from the code is below</p> <pre><code>&lt;asp:tablerow&gt; &lt;asp:tablecell HorizontalAlign="center" columnspan="2" &gt; &lt;asp:ValidationSummary runat="server" id="ValidationSummary1" /&gt; &lt;/asp:tablecell&gt; &lt;/asp:tablerow&gt; &lt;asp:tablerow&gt; &lt;asp:tablecell HorizontalAlign="left" style="padding-left:250px;" &gt; &lt;asp:label ID="Label1" runat="server" Text="Foo:" AssociatedControlId="txtFoo" /&gt; &lt;/asp:tablecell&gt; &lt;asp:tablecell HorizontalAlign="left" style="padding-right:200px;" &gt; &lt;asp:textbox runat="server" id="txtFoo" Text="" /&gt; &amp;nbsp &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Foo is a Required Field" Text="*" ControlToValidate="txtFoo" /&gt; &lt;/asp:tablecell&gt; &lt;/asp:tablerow&gt; </code></pre> <p>This code is identical to code in another user control where the parent is not a user control and that page works fine, but on this page the <code>Validator</code> doesn't fire and the <code>Foo_ItemCommand</code> method fires instead. I tried searching Google and StackOverFlow but haven't been able to find anything that helps.</p> <p>Thanks for any assistance you might have.<br> Dan</p>
c# asp.net
[0, 9]
1,109,186
1,109,187
JQuery: Append/After difficulties
<p>I have a simple input line and want to append whatever has been entered each time somebody pushes the OK button. Sounds simple so far, still I am unable to get it working HTML:</p> <pre><code>&lt;p&gt; &lt;input name="todo" id="todo" type="text" value="Set Me To Value" size="32" maxlength="30" /&gt; &lt;p id="status"&gt;Ok&lt;/p&gt; &lt;br&gt; </code></pre> <p>JQuery:</p> <pre><code>$(document).ready(function(){ $('#status').on('click', function(){ var input = $('input[name=todo]').val(); $('&lt;br&gt;&lt;b id="taskz"&gt;'+input+'&lt;/b&gt; - &lt;b id="statusz"&gt;Ok&lt;/b&gt;').after('#status'); }); }); </code></pre> <p>I also tried my luck with append or appendTo, but both times unsuccessfully. Just in case here is the JSFiddle: <a href="http://jsfiddle.net/NRWzE/" rel="nofollow">http://jsfiddle.net/NRWzE/</a></p>
javascript jquery
[3, 5]
3,400,918
3,400,919
Python and executing php files?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2931061/start-local-php-script-w-local-python-script">Start local PHP script w/ local Python script</a> </p> </blockquote> <p>How do you execute a php file and then view the output of it?</p> <pre><code>os.system("php ./index.php") </code></pre> <p>Does not work only returns <code>0</code></p>
php python
[2, 7]
1,035,183
1,035,184
Using variable to add and remove a form input field with jQuery
<p>I am trying to add a hidden input field to a form when a span with class="checkbox" is clicked, and remove that same field when span with checkmark is clicked.</p> <p>I am able to add the input, but <strong>I cannot remove it</strong>. </p> <p>My HTML:</p> <pre><code>&lt;span title="Here's My Title" class="wishlistcheck checkbox"&gt;1&lt;/span&gt; &lt;form id="wishlistform"&gt;&lt;/form&gt; </code></pre> <p>My Javascript:</p> <pre><code>$(document).ready(function() { var appNum = 0; $("span.wishlistcheck").click(function() { var el = $(this); var appName = el.attr("title"); var isChecked = el.hasClass('checkmark'); if(!isChecked) { el.removeClass('checkbox'); el.addClass('checkmark'); appNum++ $("#wishlistform").append("&lt;input id=\"" + appName + "\" type=\"hidden\" name=\"product_" + appNum + "\" value=\"" + appName + "\"&gt;"); } else { el.removeClass('checkmark'); el.addClass('checkbox'); appNum-- $("input#" + appName).remove(); } }); }); </code></pre>
javascript jquery
[3, 5]
194,471
194,472
Execute jquery animate only one time
<p>I've the following function:</p> <pre><code>$('.link1').click(function(){ $("#div2").slideUp(function(){$("#div1").slideToggle();}); $('html, body').animate({scrollTop: '600px'}, 800); }); </code></pre> <p>It toggles a div and scroll the page down. The problem is that everytime the user toggles the page scroll down again...how could I run this animate function only at first click?</p>
javascript jquery
[3, 5]
5,340,234
5,340,235
Add .live or .on to jquery function
<p>I have some JavaScript that pulls how many items I have in my cart and places it in span.cartTotal for better styling. I need the code to work so it pulls the information instantly and I don't have to refresh my page to see the update. I assume the code would require either jquery .live or .on to be added. Any help is much appreciated. Thank you</p> <pre><code>$(function(){ if ($('#catCartSummary .cartSummaryItem').html() != 'Shopping cart is empty.') { var summary = $('#catCartSummary .cartSummaryItem').text().split(" "); var total = summary[0]; $('span.cartTotal').html(total); }else{ $('span.cartTotal').html("0"); } }); </code></pre> <p>More info: My add to cart class is .productSubmitInput </p> <p>I pull the info from this code below which is dynamically created. This cart total updates automatically in cartSummaryItem. I just need my new styled total to update from it when someone adds to cart. I tried the below suggestions but they didn't seem to work. I could be just adding something wrong.</p> <pre><code>&lt;td class="cartSummaryItem"&gt; 1 item(s), Total: $10.95 &lt;/td&gt; </code></pre>
javascript jquery
[3, 5]
3,102,328
3,102,329
Android java code to change displayed spinner
<p>Is there a way in android java to change the displayed spinner item to another item in the spinner list?</p> <p>If I have a spinner that has three items in its arrary can I change the value displayed to the second or third item in the arrary? I want to create a button that will change all my spinner displayed values to another selection in each of their arrarys?</p>
java android
[1, 4]
4,890,819
4,890,820
load an event on a finished redirected page after an AJAX call
<p>How do I load an event after a redirected page has finished loading, following an ajax call?</p> <p>For the sake of simplicity, here is some sample code:</p> <pre><code>$.ajax({ type: "POST", url: "some_page.php", success: function() { window.location.href="new_page.php"; // redirect to this page $(window).load(function() { alert("test"); }); // load after redirect } }); </code></pre> <p>the "alert" box does not load for me, but the redirect works.</p>
php javascript jquery
[2, 3, 5]
33,499
33,500
Why can't JQuery load my resource?
<p>I have the following script in an page called ajax.aspx page:</p> <pre><code> &lt;script type="text/javascript"&gt; $(document).ready(function () { var nameFoundMessage = $('#nameFoundMessage'); var nameInput = $('#name'); nameFoundMessage.hide(); nameInput.blur(function () { if ($(this).val()) { $.getJSON('Services/ArtistFound.aspx?' + escape($(this).val()), function (results) { if (results.available) { if (nameFoundMessage.is(':visible')) { nameFoundMessage.html('The name was found'); } } else { nameFoundMessage.show(); nameFoundMessage.html('The name was not found'); } }); } }); }); &lt;/script&gt; </code></pre> <p>The page has an input field with an id of "name" and when I blur off of that it goes into a service folder which has another aspx page ArtistFound.aspx and in that Page load, I have the following:</p> <pre><code> Response.ContentType = "application/json"; string name = Request.QueryString.ToString(); string output = string.Empty; name = db.Names.Single(x =&gt; x.Name== name).Name; if(name == null) { output = "{available:false}"; } else { output = "{available:true}"; } Response.Write(output); } </code></pre> <p>When I run the page and blur off the input, it says the following:</p> <p>Failed to load resource: the server responded with a status of 500 (Internal Server Error)</p> <p>I have tried ../Services/ArtistFound.aspx... and /Services/ArtistFound.aspx..., but it still gives me the same error.</p>
c# jquery asp.net
[0, 5, 9]
4,509,370
4,509,371
Error when trying to connect to webservice using kSOAP
<p>i encounter this error sentence in the DDMS:</p> <p><strong>10-18 06:25:46.181: ERROR/Error(password)(246): expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG @2:7 in java.io.InputStreamReader@43d370e0)</strong></p> <p>i am trying to access a function in the webservice that is written by python language. Can anyone have a solution or how to resolve this error.</p> <p>I don't encounter such error when i trying in my house network but such error is encountered when i was trying the program in school.</p>
android python
[4, 7]
4,308,556
4,308,557
WebView and Cookies on Android
<p>I have an application on appspot that works fine through regular browser, however when used through Android WebView, it cannot set and read cookies. I am not trying to get cookies "outside" this web application BTW, once the URL is visited by WebView, all processing, ids, etc. can stay there, all I need is session management inside that application. First screen also loads fine, so I know WebView + server interactivity is not broken. </p> <p>I looked at WebSettings class, there was no call like setEnableCookies. </p> <p>I load url like this:</p> <pre><code>public class MyActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); WebView webview = new WebView(this); setContentView(webview); webview.loadUrl([MY URL]); } .. } </code></pre> <p>Any ideas? </p>
java android
[1, 4]
4,245,890
4,245,891
Best free book/tutorial for learning ASP.net
<p>I am an experienced C++ programmer and also have experience with C#. I am interested in web-designing/development. I want a book which teaches ASP.net without teaching C# first. In other words, it dives directly into ASP.net using C# (not VB.net). What is the best free book of that sort? </p>
c# asp.net
[0, 9]
848,648
848,649
Server side reload vs. Client Side reload? ( Very similar - Server Side does not send content )
<p>Progam control is at the server and I need to do a relaod. I can use a php command:</p> <pre><code>echo '&lt;meta http-equiv="refresh" content="0"&gt;' </code></pre> <p>or I can pass control back to the client with a reload flag set and use a javascript command</p> <pre><code>window.location.reload(); </code></pre> <p>Which is best practice or better to use, in terms of speed?</p> <p>My guess it that the PHP version would be a bit faster because there is no logic on the client side, the browser receives the header and reloads.</p> <p>I'm not concerned with disabled javascript.</p>
php javascript
[2, 3]
4,560,670
4,560,671
Scriptlet is not working in head tag
<p>I want to add version number to CSS files for production environment not to force user every time press Ctrl+F5 to download new CSS files after new version is deployed in prod server as the old version is cached in browser.</p> <p>I'm adding build number as querystring param like this.</p> <pre><code>link href="Styles/jquery.Autocomplete.css?&lt;%= Globals.BuildNumber %&gt;" rel="stylesheet" type="text/css" </code></pre> <p>but the output is this</p> <pre><code>link href="../../Styles/jquery.Autocomplete.css?&amp;lt;%= Globals.BuildNumber %&gt;" </code></pre> <p>Looks that scriptlet is not working in head tag, as this is fine in body tag.</p>
c# asp.net
[0, 9]
5,313,649
5,313,650
a small corrrection needed in jquery code snippet. . along with a small query
<p>there is this fiddle which is giving me not the desired output</p> <p><a href="http://jsfiddle.net/8FXFE/1/" rel="nofollow">http://jsfiddle.net/8FXFE/1/</a></p> <p>The jquery code</p> <pre><code>$(document).ready(function () { console.log("parsed"); $("input[name='txtNumber']").change(function () { console.log("changed"); if ($("input[name='txtNumber']:checked").val() == '100') $("#output").text("Changed to 100"); else if ($("input[name='txtNumber']:checked").val() == '200') $("#output").text("Changed to 200"); else if ($("input[name='txtNumber']:checked").val() == '500') $("#output").text("Changed to 500"); else if ($("input[name='txtNumber']:checked").val() == '1000') $("#output").text("Changed to 1000"); else if ($("input[name='txtNumber']:checked").val() == '10000') $("#output").text("Changed to 10000"); else($("input[name='txtNumber']:checked").val() == 'other') $("#output").text("Changed to Other"); }); }); </code></pre> <p>the desired output is that it shall show which radio button is clicked</p> <p>Also I have a question?</p> <ol> <li><p>What is the meaning of this line??</p> <pre><code>console.log("parsed"); </code></pre></li> </ol> <p>Thanks in advance for your answers :)</p>
javascript jquery
[3, 5]
1,858,595
1,858,596
Submit value of dynamically created checkboxes, with ajax
<p>I've got about twenty checkboxes that are dynamically created with the following pattern:</p> <pre><code>&lt;input type="checkbox" id="cb01" name="vehicle" /&gt; </code></pre> <p>I give it an ID of cb + index and a name attribute that corresponds to a database entry.</p> <p>So over to my question: </p> <p>Whats the best way to loop through the checkboxes performance wise? I need to send both the name and the value of the checkbox.</p> <p>I would prefer the data as a jsonstring..</p>
javascript jquery
[3, 5]
5,668,367
5,668,368
Popup form using asp.net and javascript
<p>Hi I am new for web development. I have an application which consists of a button. On clicking the button a popup window should appear which consists of 2 fields and a button. On clicking button in Popup window 2 fields in popup has to be saved in to database. How to implement this using <strong>ASP.NET and javascript</strong> ?</p>
javascript asp.net
[3, 9]
4,488,077
4,488,078
contains is object has no method?
<p>Im trying to find weather there is some character in my string in JS </p> <p>like that :</p> <pre><code>$('.upld_btn').bind("click", function () { changeApiFormat($('#embbed').val()); }); if ($('#embbed.contains("?vid=")')) { .... .... } </code></pre> <p>I've got an error in my google chrome console :</p> <pre><code>Object XXXX has no method 'contains' </code></pre> <p>how come?!</p>
javascript jquery
[3, 5]
4,689,746
4,689,747
Event binding issue in jquery
<pre><code> &lt;div id="parent"&gt; &lt;div id="children"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>And if we bind both parent and children with same events like :</p> <pre><code> $("#parent").live({ mouseenter : Infocus , mouseleave : Outfocus }); $("#children").live({ mouseenter : Infocus , mouseleave : Outfocus }); </code></pre> <p>Now my problem is when i get my mouse over to the children the parent is also highlighted, Can anybody tell me whats going on here?</p>
javascript jquery
[3, 5]
2,189,646
2,189,647
how to dynamically assign numbers to several ids?
<p>This seem like long way of doing things, is it possible to dynamically assign numbers to ids?</p> <pre><code> $(function () { $('#Button1').click(function(){ $('#RegularExpressionValidator1, #RegularExpressionValidator2, #RequiredFieldValidator1, #RequiredFieldValidator2, #RequiredFieldValidator3, #RequiredFieldValidator4, #RequiredFieldValidator5, #RequiredFieldValidator6, #RequiredFieldValidator7, #RequiredFieldValidator8, #RequiredFieldValidator9').css("display", "block"); }); }); </code></pre> <p>These are .NET generated ids which I don't have access to.</p>
javascript jquery
[3, 5]
4,351,850
4,351,851
Mouse in-out events for Javascript
<p>question from a beginner..</p> <p>I want to show/hide an inner div when the mouse enter/out from the parent div. I tried first with <code>onmouseover</code>, <code>onmouseout</code> events, but the problem is that <code>onmouseover</code> keep firing while the mouse over the div, and I want it to fire one time only.</p> <p>I found <a href="http://api.jquery.com/mouseenter/" rel="nofollow">JQuery</a> events that might help me, but I don't know where can I put this code because my divs exist in a template for a control, and there is no <code>onload</code> event for the div.</p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; // Where should I call this !!! function Init(sender) { $(sender).bind("mouseenter", function () { $(sender.childNodes[1], this).show(500); }).bind("mouseleave", function () { $(sender.childNodes[1], this).hide(500); }); } &lt;/script&gt; </code></pre> <p>Any help!</p>
javascript jquery asp.net
[3, 5, 9]
2,394,678
2,394,679
It keeps displaying undefined for file name
<p>I trying to display the name of the file after the user has uploaded it. The file uploads successfully but in the javascript it keeps displaying the message below:</p> <blockquote> <p>The file (undefined) was uploaded successfully!</p> </blockquote> <p>It keeps displaying undefined when it should display the filename. Why is this? At the moment what is happening is that wen the user uploads the file, the files is uploaded into the "ImageFiles" folder, when uploading is finsihed the javascript function below displays the message to state the name of the file which has been successfully uploaded.</p> <p>Below is the code which displays the file name and message after uploading:</p> <pre><code>function stopImageUpload(success){ function handleFileSelect(evt) { var files = evt.target.files; localStorage["fname"] = files[0].name; //save the name for future use } $('.fileImage').bind('change', handleFileSelect, false); var result = ''; if (success == 1){ result = '&lt;span class="msg"&gt;The file ('+localStorage["fname"]+') was uploaded successfully!&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;'; localStorage["fname"] = undefined; //remove the temporary variable } else { result = '&lt;span class="emsg"&gt;There was an error during file upload!&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;'; } return true; } </code></pre> <p>Below is form:</p> <pre><code> &lt;form action='imageupload.php' method='post' enctype='multipart/form-data' target='upload_target' onsubmit='stopImageUpload(this);' class='imageuploadform' &gt; &lt;p&gt;Image File: &lt;input name='fileImage' type='file' class='fileImage' /&gt; &lt;input type='submit' name='submitImageBtn' class='sbtnimage' value='Upload' /&gt; &lt;/p&gt; &lt;/form&gt; </code></pre>
javascript jquery
[3, 5]
2,169,326
2,169,327
Toggling of radio button only works once (refresh)?
<p>I am trying to toggle a radio box selection included in cells table.</p> <p>The toggling works only once per radio button. </p> <p>After, all radio buttons are disabled but my HTML code seems to be correct; the attribute <code>checked="checked"</code> is present.</p> <p>Why is this not working?</p> <p>Here is the jQuery I am using:</p> <pre><code>$('td').click(function(){ var $elem = $(this).children('input'); var name = $elem.attr('name'); $('input[name='+name+']').each(function(){ $(this).removeAttr('checked'); }).promise().done(function(){ $elem.attr('checked','checked'); }); }); </code></pre> <p>And the image:</p> <p><img src="http://i.stack.imgur.com/4fCel.png" alt="enter image description here"></p>
javascript jquery
[3, 5]
4,100,930
4,100,931
Identify the a tag
<p>Need to identify each of these 'a' tag in div and bind an onclick event.I have binded the same.I need to append some text below the clicked 'a' tag.But when i tried with my code it binds to all the 'a' tag in the div.How can i specify the 'a' tag which i have clicked.I can make changes to the content in div using jquery.can't modify the content in 'a' tag.</p> <pre><code> &lt;div class="people_rt_link2"&gt; &lt;a href="#" title="2011"&gt;2011&lt;/a&gt;&lt;br&gt;&lt;br&gt; &lt;a href="#" title="2008"&gt;2008&lt;/a&gt;&lt;br&gt;&lt;br&gt; &lt;/div&gt; $(document).ready(function() { var timesClicked = 0; $('.people_rt_link2 a').bind('click', function() { jQuery.post("&lt;?php bloginfo('template_directory'); ?&gt;/test.php", data, function(response) { alert('Got this from the server: ' + response); //this response should to binded to the clicked a tag //$(this).after('&lt;div&gt;'+response+'&lt;/div&gt;'); }); timesClicked++; if (timesClicked &gt;= 1) { $(this).unbind(); } }); }); </code></pre>
javascript jquery
[3, 5]
5,303,411
5,303,412
Is this possible to convert a million digit number to 1000 digit number by a certain mathematical operation in C++ or C#?
<p>I am working on project and ran into an issue. Now I want to know is there anyway to reduce digits of a big number? For example convert a million digit number to 1000 digit number.</p>
c# c++
[0, 6]
5,912,500
5,912,501
treeview with more than one parent
<p>im using treeview in asp.net</p> <p>treeview like</p> <pre><code>*parent @child1 .child2 *parent .child </code></pre> <p>if i click child2 after postback the alignment which is in above should not change</p> <p>but parent1 should be collapsed</p> <p>if i click child then parent node should be collapsed</p> <p>im using thi following code</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { if (Session["tvExpandNode1"] != null) { TreeView1.FindNode(Session["tvExpandNode1"].ToString()).Expand(); } } protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e) { if (TreeView1.SelectedNode.Expanded == true) { Session["tvExpandNode1"] = TreeView1.SelectedNode.Parent.Parent.Value; if (strOpenpage == "Report.aspx") { OpenNewWindow(strOpenpage); } else { Response.Redirect(strOpenpage, false); } } } </code></pre> <p>its just not working properly...pls provide ur valuable infromation........</p>
c# asp.net
[0, 9]
4,287,221
4,287,222
C# Hashtable vs c++ hash_map
<p>I'm comparing the following code in C++ and C# and C# (Mono 2.4) seems to be faster. Is there anything wrong with the C++ code?</p> <pre><code> #include &lt;map&gt; #include &lt;string&gt; #include &lt;iostream&gt; #include &lt;ext/hash_map&gt; #include &lt;boost/any.hpp&gt; int main() { //std::map&lt;long, long&gt; m; // hash_map is a little bit faster __gnu_cxx::hash_map&lt;long, long&gt; m; for( long i = 0; i &lt; 1000000; ++i ) { m[i] = i; } } </code></pre> <p>And C#</p> <pre><code> using System; using System.Collections; public int Main() { Hashtable m = new Hashtable(); for( long i = 0; i &lt; 1000000; ++i ) { m[i] = i; } } </code></pre> <p>C# code is actually twice as fast on the same machine.</p> <pre><code>$ time ./a.out real 0m1.028s user 0m0.986s sys 0m0.041s $ time mono test.exe real 0m0.603s user 0m0.732s sys 0m0.090s </code></pre>
c# c++
[0, 6]
4,057,661
4,057,662
Why isn't jQuery handling id and selector passed?
<p>I have an id <code>"#post0"</code></p> <p>and a class <code>"reply"</code></p> <p>When I do:</p> <pre><code> var rep = ".reply"; $(rep).toggle(400); </code></pre> <p>All components with class "reply" toggle. </p> <p>However when I do:</p> <pre><code>var rep = "#post0.reply"; $(rep).toggle(400); </code></pre> <p>Nothing happens to the elements with class reply and post0 ...instead of toggling them</p> <p>Help is appreciated!</p>
javascript jquery
[3, 5]
1,656,717
1,656,718
automatic link creation using php without breaking the html tags
<p>i want to convert text links in my content page into active links using php. i tried every possible script out there, they all fine but the problem that they convert links in img src tag. they convert links everywhere and break the html code.</p> <p>i find a good script that do what i want exactly but it is in javascript. it is called jquery-linkify. you can find the script here <a href="http://github.com/maranomynet/linkify/" rel="nofollow">http://github.com/maranomynet/linkify/</a></p> <p>the trick in the script that it convert text links without breaking the html code. i tried to convert the script into php but failed.</p> <p>i cant use the script on my website because there is other scripts that has conflict with jquery.</p> <p>anyone could rewrite this script for php? or at least guide me how?</p> <p>thanks.</p>
php javascript
[2, 3]
5,363,008
5,363,009
Video View does not show video in Android 4.0
<p>I tried to show a .3gp format video using Video View. It works well in Android 2.3, however, when I tested it in Android 4.0, i can only hear the audio, but the video does not appear. </p> <p>This is my java code:</p> <pre><code>@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_video_backandhips); showVideo(); } private void showVideo() { vd = (VideoView)findViewById(R.id.video_view); Uri uri = Uri.parse("android.resource://"+ getApplication().getPackageName() +"/"+R.raw.vd_backnhips); //Uri uri = Uri.parse("android.resource://"+ getApplication().getPackageName() +"/"+R.raw.video); MediaController mc = new MediaController(this); vd.setMediaController(mc); vd.setVideoURI(uri); vd.requestFocus(); } </code></pre> <p>And this is the .xml code:</p> <pre><code>&lt;VideoView android:id="@+id/video_view" android:layout_width="320px" android:layout_height="240px" android:layout_gravity="center_horizontal" android:layout_margin="10dp" /&gt; </code></pre> <p>Please help me. </p> <p>Thank you.</p>
java android
[1, 4]
5,768,195
5,768,196
Java include snippet in different class files?
<p>I wrote a listener that does some actions onKeyDown basically I need to include it in all my activities but I'm new to Java and don't know the best way to do it, I can of course just copy paste the code on every class but it would be a pain to keep every one updated.</p> <pre><code>@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(sharedPrefs.getBoolean("pref_disable_keydowns", true)) { System.out.println("Prevent keydown"); return true; } return super.onKeyDown(keyCode, event); } </code></pre> <p>How can I include this in different .java files so I only have to modify it once to affect all classes it's included?</p>
java android
[1, 4]
84,655
84,656
How to get IP Address of User using .net?
<p>In my web application i have registration form, when user register i want to get his ip address of his system, how can i get using asp.net. help me please.</p>
c# asp.net
[0, 9]
2,333,816
2,333,817
Converting/formatting date object
<p>I am working on a jquery calendar script. In the script, selecting a row gives a date object as callback.</p> <pre><code>select: function(start, end, allDay) { $("#datepicker_add").val(start); $("#datepicker_add_end").val(end); calendar.fullCalendar('renderEvent', { title: title, start: start, end: end, allDay: allDay }, true // make the event "stick" ); calendar.fullCalendar('unselect'); }, </code></pre> <p>Here that <code>start</code> and <code>end</code> objects are like that <code>Wed Aug 22 2012 00:00:00 GMT+0300 (EEST)</code> What i want is to format this as <code>Y-m-d</code> </p> <p>How can i do that ?</p>
javascript jquery
[3, 5]
5,326,940
5,326,941
button can not be resolved
<p>This is my starting activity. I'm trying to get this button to work but it's been giving me this error.</p> <p>Line 15 button can not be resolved.</p> <pre><code> package com.synamegames.giveaway; import android.view.View.OnClickListener; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class GiveawayActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Button register = (Button) findViewById(R.id.register); button.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Perform action on clicks } }); setContentView(R.layout.main); } } </code></pre>
java android
[1, 4]
820,694
820,695
How can I rewrite this JavaScript to PHP?
<p>Following are some individual JavaScript statements from a block of java-script code. I want to convert this JavaScript code in PHP so that I can execute it server-side. In the following snippet, there are some operators used, such as <code>&gt;&gt;</code>, <code>&gt;&gt;&gt;</code>, <code>~</code>, <code>^</code>, <code>&lt;&lt;</code>, <code>&lt;&lt;&lt;</code>, etc.</p> <p>How can I translate these JavaScript functions to PHP?</p> <pre><code>function core_enc(K, F) { K[F &gt;&gt; 5] |= 128 &lt;&lt; ((F) %32); K[(((F + 64) &gt;&gt;&gt; 9) &lt;&lt; 4) + 14] = F; } function enc_ff(C, B, G, F, A, E, D) { return enc_cmn((B &amp; G) | ((~B) &amp; F), C, B, A, E, D); } function enc_hh(C, B, G, F, A, E, D) { return enc_cmn(B ^ G ^ F, C, B, A, E, D); } function safe_add(A, D) { var C = (A &amp; 65535) + (D &amp; 65535); var B = (A &gt;&gt; 16) + (D &gt;&gt; 16) + (C &gt;&gt; 16); return (B &lt;&lt; 16) | (C &amp; 65535); } function bit_rol(A, B) { return (A &lt;&lt; B) | (A &gt;&gt;&gt; (32 - B)); } </code></pre>
php javascript
[2, 3]
5,272,372
5,272,373
How to print div inner html
<p>I have aspx page and some html in div control. I am trying to print the html, after print the page i got url in the page bottom and title of the page on the uppaer side. but I want to print only div inner html. please help.</p>
javascript asp.net
[3, 9]
2,184,537
2,184,538
Default parameters from Python in a C++ defined function?
<p>I've embedded Python in my C++ application, and I've created several C functions which can be called from Python.</p> <p>To get the arguments, I'm currently doing:</p> <pre><code>if (!PyArg_ParseTuple(args, "zk", &amp;param1, &amp;param2)) return NULL; </code></pre> <p>However, I want <code>param2</code> to be optional. How can I check for the two of them separately?</p>
c++ python
[6, 7]
691,859
691,860
Sorting Arrays alphabeticly
<p>How can I sort an array in Java/Android alphabetically? After that I want to provide the ordered array to a <code>ListView</code>.</p>
java android
[1, 4]
84,327
84,328
How to better store arrays of data for use in a JavaScript app
<p>I have an interactive JavaScript app that runs through arrays of data. I don't want users to be able to easily view the array content, so I have stored the arrays in PHP and pass them to the JavaScript app with AJAX and JSON. I had thought about using a database, but since these files only have to read (not written) I thought it would be unnecessary. </p> <p>Am I missing an obvious and easier way to do this? Perhaps some sort of server-side cache?</p> <p>Cheers,</p>
php javascript
[2, 3]