Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
2,502,648
2,502,649
How to implement a generic click event for anchors
<p>Currently i have a php script that throws out a bunch of buttons(Format in case needed is</p> <pre><code>&lt;a class="ClassInfo" id="id"&gt;Name&lt;/a&gt; </code></pre> <p>The file is retrieved dynamically and there can be as many buttons as possible, maybe none and maybe a million(Unlikely though). Anyways this is about javascript. I need to use javascript for this and cant just redirect the user to another website(Mostly because the operation is repeated heavily and gets EXTREMELY tedious..).</p> <p>Is it possible for me to use some combination of javascript + jquery to essentially detect which button was pressed and do an operation appropriately?</p> <p>Example of what i am hoping for is this: User clicks one of the buttons(Which has its unique id number). Javascript detects which button was clicked(I cant just use fixed code as the number of buttons and the ids can change whenever they feel like it). Javascript send out an Ajax request and does some fancy operations(I got this part covered).</p> <p>Now is it possible for me to detect which button was clicked? I am really struggling with this. </p>
javascript jquery
[3, 5]
5,636,294
5,636,295
Increasing a number by 1 using jquery?
<pre><code>$('.fav').live('click', function(e){ $(this).toggleClass('highlight'); //increase the number by 1 </code></pre> <p>html:</p> <pre><code>&lt;li class="fav light_gray_serif"&gt;5&lt;/li&gt; </code></pre> <p>how can i use jquery to increase the number between the li everytime its clicked? thanks</p>
javascript jquery
[3, 5]
4,561,023
4,561,024
JS error in IE7 / IE8 : 'var' has value Null or is not an object
<p>This snippet just makes IE7/IE8 crashes the page throwing error. I don't know why cause on chrome / FF, everything is fine.</p> <p><a href="http://jsfiddle.net/Zrz9t/15/" rel="nofollow">http://jsfiddle.net/Zrz9t/15/</a></p> <p>The problem seems to be here :</p> <pre><code> return event.Date.valueOf() === date.valueOf(); </code></pre> <p>The error is :</p> <p>Message: <strong>'Date' has value Null or is not an object</strong></p> <p>What's causing this ? Thanks</p> <p><strong>EDIT</strong> I updated my code here <a href="http://jsfiddle.net/Zrz9t/15/" rel="nofollow">http://jsfiddle.net/Zrz9t/15/</a></p>
javascript jquery
[3, 5]
5,709,853
5,709,854
How to get JQuery and ASP.Net work together?
<p>Is there any reason why JQuery would not work when used in an ASPX page? We have been trying to get working a simple call like this:</p> <pre><code>$(document).ready(function() { alert("This is SPARTA!!!!!!!!!"); }); </code></pre> <p>An the alert box is never shown. I've had some experience with JS and ASP.Net before with buttons and I know that I have to return false after the JS like:</p> <pre><code>&lt;input type=button value="Button 1" onclick='button_1_onclick();return false;'&gt; </code></pre> <p>Is there a similar thing to be done?</p> <p>Edited: I have ran Firebug in the debugger mode and the JS is never ran, all the libs are present in the page. The only thing I can think of is that the ready event is not triggered or something similar.</p>
asp.net javascript jquery
[9, 3, 5]
1,195,865
1,195,866
jquery - checking for inline javascript on attribute
<p>Is there a way to test if a custom attribute is a function? I've tried using jquery's isFunction method, but it doesn't seem to work with this scenario. </p> <p>For example:</p> <pre><code>&lt;input id="test" class='date' oncomplete="function() { alert('i am a function'); }" type="text" /&gt; &lt;script&gt; $(".date").livequery(function () { var onComplete = $(this).attr("oncomplete"); if ($.isFunction(onComplete)) { $(this).mask("99/99/9999", { completed: onComplete }); } else { $(this).mask("99/99/9999"); } }); &lt;/script&gt; </code></pre> <p>I have several date fields. I'm trying to give a couple of them special behavior. I know I can just have a separate jquery selector to set them up with the behavior they need. But wanted to see if there was an inline way of doing this.</p>
javascript jquery
[3, 5]
5,521,408
5,521,409
File.GetAttributes(unc) generating "Network path not found" error
<p>I'm passing a UNC path to File.GetAttributes(). This works fine when running off my local, but when I move the site to the test server, I get a "Network path not found" error. I am able to navigate to the path from the test server, so I don't know why I would be getting this error. The code is very simple. This is where it errors out:</p> <pre><code>try { if (FileAttributes.Directory != (FileAttributes.Directory &amp; File.GetAttributes(directory))) directory = GetPath(directory); } catch... </code></pre>
c# asp.net
[0, 9]
1,160,626
1,160,627
Checkbox in listview
<p>I would like to set a checkbox in a listview's click-event. How can I set the right checkbox?</p> <p>This is my code:</p> <pre><code> listView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView&lt;?&gt; adapter, View view, int position, long id) { Checkbox checkbox = ?? checkbox.setChecked(true); return true; } }); </code></pre>
java android
[1, 4]
1,478,055
1,478,056
ASP.Net: Programatic runat="server" and onclick
<p>I am trying to edit a control which doesn't have an .ascx page, it was done completely in code. I am trying to add an optional delegate to be called from an ImageButton which was previously completely handled at the client. So I would like to set runat="server". However, I don't see this property exposed programatically on the object!</p>
c# asp.net
[0, 9]
38,664
38,665
Adding # before a div id without creating an HTMLDivElement
<p>I have an array of div names (with no hash), and i'm using the following jQuery code do do something with them:</p> <pre><code>for(dayList in dayLists) { dayListID = "#" + dayList; $(dayListID).append("test"); } </code></pre> <p>Unfortunately, it does not work. I can see in the console that <code>dayListID</code> is an "HTMLDivElement", rather than the string that JQ is expecting. How can I join a hash and the div name while keeping the result as a string? Thanks!</p>
javascript jquery
[3, 5]
2,135,770
2,135,771
Fire an ASP.NET TextBox event on enter press
<p>How do i fire a ASP.NET click event when the user press enter.</p> <p>This is what i do now but it does not work:</p> <pre><code>function KeyDownHandler(event) { if (event.keyCode == 13) { __doPostBack('&lt;% ButtonGetListforUser.ClientID %&gt;', 'OnClick'); isClicked = true; } } </code></pre>
c# javascript asp.net
[0, 3, 9]
5,794
5,795
jQuery 'document', 'body' and 'html' selectors not working on iPhone
<p>I need to run a function when you click anywhere on the page. Initially I used this: </p> <pre><code>$('html').click(function() { // stuff to happen }); </code></pre> <p>This works perfectly in my android phone and in firefox, but doesnt work on iPhones. Ive tried changing 'html' to 'body' and 'document' but still no luck. </p> <p>Is there a proper iPhone way to use anything as a selector? I guess I could use '*' but I dont want the overhead as this is a mobile optimised site. Thanks </p>
jquery iphone
[5, 8]
5,589,546
5,589,547
Request.Form.Get from a select option tag error
<p>Im trying to get a value or a text from the "select option" tag through C#, but I run on some issues :</p> <p>this is my code :</p> <pre><code>&lt;select id="country" &gt; &lt;option value="" &gt;Select One...&lt;/option&gt; &lt;%for (int i = 0; i &lt; dt.Rows.Count; i++) {%&gt; &lt;option value="&lt;%=dt.Rows[i][0].ToString() %&gt;" &gt;&lt;%=dt.Rows[i][1].ToString() %&gt;&lt;/option&gt; &lt;%} %&gt; &lt;/select&gt; </code></pre> <p>and this is my code behind :</p> <pre><code>string value = Request.Form.Get("country"); </code></pre> <p>its keep getting <code>null</code> in my value. and if Im trying to set my <code>&lt;select&gt;</code> tag with <code>runat="server"</code>, its getting an error : </p> <blockquote> <p>Code blocks are not supported in this context</p> </blockquote> <p>any help?</p> <p>Thanks!</p>
c# asp.net
[0, 9]
1,513,897
1,513,898
Detect if input has focus
<p>One of my web app's page consists of a grid and a search box. I capture the keypress event to select through each of the grid's rows using the space bar. However, this creates a problem for when someone wants to look up a phrase in the search box.</p> <p>I know that jQuery has a <code>.focus</code> method to bind an event handler to an input or give focus to an element. But how do I get a boolean value to determine if the search input has focus or not?</p>
javascript jquery
[3, 5]
4,151,094
4,151,095
jquery class selector with css() does not seem to work?
<p>When I click the link(Anasayfa), function doesn't work. There is no change. What am I doing wrong?</p> <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"&gt; &lt;/script&gt; &lt;script type="text/javascript" language="javascript"&gt; function anasayfa() { $( '.gributon1' ) . css({ "background-color": "red" }); } &lt;/script&gt; .... &lt;div class="gributon1"&gt;&lt;/div&gt; .... &lt;a href="" onclick="anasayfa()"&gt; Anasayfa &lt;/a&gt; </code></pre>
javascript jquery
[3, 5]
1,801,896
1,801,897
jquery fetch php data is slow. How to make it fast?
<p>As the title describe, the speed of jquery display data is 1 to 2 seconds slower than pure php. Demo at <a href="http://plekz.com/test-slow3.php" rel="nofollow">http://plekz.com/test-slow3.php</a> . How to make jquery display data as fast as pure php?</p> <p>Codes :</p> <pre><code>&lt;div id="jqryd"&gt; &lt;/div&gt; &lt;script src="javascripts/jquery-1.5.js" type="text/javascript" language="javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var jqryd = $('#jqryd'); jQuery.get("sale-show-month2.php", function(data) { jqryd.html(data); }); &lt;/script&gt; &lt;?php $sql = "SELECT payment_date, SUM(price) FROM sale WHERE seller_id=? &amp;&amp; Year(payment_date)=? GROUP BY Month(payment_date) DESC"; //this is loged-in user. $q = $conn-&gt;prepare($sql); $result = $q-&gt;execute(array($user_id, $selected_year)); if(!$result){ die("Error Select user table query : ". implode(" : ", $q-&gt;errorInfo())); //if don't use implode, output of errorInfo() will be "Array". } while($r = $q-&gt;fetch(PDO::FETCH_ASSOC)){ $price_db2 = $r['SUM(price)']; $payment_date_db = $r['payment_date']; $payment_month_db = date("F", strtotime($payment_date_db)); $payment_month_db2 = date("m", strtotime($payment_date_db)); echo "This is pure php : " . $payment_month_db . " - " . $money_currency . $price_db2 ."&lt;br&gt;"; } ?&gt; </code></pre>
php jquery
[2, 5]
1,501,015
1,501,016
Jquery not working
<pre><code>(function($) { $(document).ready(function(){ /*$('body').css('position','relative'); $('body').animate({'left':'-9999px'},3000);*/ alert('hello'); }); }(jQuery)); </code></pre> <p>Tried also</p> <pre><code>$(document).ready(function(){ /*$('body').css('position','relative'); $('body').animate({'left':'-9999px'},3000);*/ alert('hello'); }); </code></pre> <p>And firebug jumps:</p> <pre><code>jQuery is not defined [Detener en este error] }(jQuery)); </code></pre>
jquery javascript
[5, 3]
2,379,211
2,379,212
request parameter using jquery/javascript
<p>is it possible to stop the submission of a form,after submit button has been clicked and get the action attribute and the request parameters of the submission using javascript(preferably jQuery) ? I want to get the action and the parameter so that the it can be submitted to an alternate location ,what i am tryin to do is try writing a proxy website.</p>
javascript jquery
[3, 5]
4,051,995
4,051,996
Code works in Chrome but infinite loop in IE
<p>I am using this code to dynamically change the text of a span element. It works in chrome, only changing the content of the span once, but does an infinite loop in IE (the count keeps updating and the html text keeps changing). Anyone know how I can fix it or why its happening?</p> <pre><code>bindFlagUpdate(); function bindFlagUpdate(){ $(document).bind('flagGlobalAfterLinkUpdate', function(event, data) { var string = $('#like-' + data.contentId).html(); var getNum = string.match(/[0-9]+/g); var count = getNum[0]; if(data.flagStatus == 'flagged') { count++; } else { count--; } $('#like-' + data.contentId).html("1 user likes this"); $(document).unbind(); bindFlagUpdate(); return false; }); } </code></pre> <p>Description of the event:</p> <blockquote> <p>The flagGlobalAfterLinkUpdate event This event is triggered immediately after a flag link has been updated. (Flag links appear in two flavors: "Bookmark this!" and "Unbookmark this!", and when we speak of "update" we mean this change in appearance).</p> </blockquote> <p>The even is attached to a "flag" button</p>
javascript jquery
[3, 5]
176,662
176,663
Function doesn't work as it should in IE7 & IE8 when invoked from a setTimeout
<p>I've got this crazy javascript issue with IE7 and IE8. The function expression below loads some images. That's it. quite simple. When the function is invoked directly ie <code>testmypatience()</code> it works as it should but if I call it from inside a timeout it won't load the images. The function is invoked but the images won't load. It also fails to work when invoked by the jQuery animate callback. </p> <p>I've tried everything and i can't get it to work so you help would be most appreciated.</p> <pre><code>var testmypatience = function($active){ var arr = ['images/site/products-medium/m_cordial_pomegranateelderflower.png', 'images/site/products-medium/m_cordial_spicedberry.png', 'images/site/products-medium/m_cordial_strawberryelderflower.png', 'images/site/products-medium/m_750presse_coxsapple.png', 'images/site/products-medium/m_party_appleandelderflower.png', 'images/site/products-medium/m_squeezy_blackcurrentandapple.png', 'images/site/products-medium/m_270presse_cranberryandorange.png', 'images/site/products-medium/m_270presse_elderflower.png', 'images/site/products-medium/m_270presse_gingerlemongrass.png']; for (i = 0; i &lt; arr.length; i++) { var img, len; img = new Image(); img.src = arr[i]; img.onload = function(){ console.log('done ' + this.src); } } } //this works testmypatience() //None of these work setTimeout(function(){ testmypatience() }, 400) setTimeout(testmypatience, 400) jQuery('elm').animate({left:'1000px'}, { duration:200, complete: testmypatience }); </code></pre>
javascript jquery
[3, 5]
2,815,390
2,815,391
GridView DataFormatString problems. convert Doudle to TimeStamp
<p>Need some help with DataFormatString in GridView. I have a Double value that needs to be shown as TimeSpan. I have tried DataFormatString="{0:HH:mm:ss}". This did not work. </p> <p>Tested it a bit in C# and there I would do:</p> <pre><code>TimeSpan.FromHours(16.7358217592592).ToString() </code></pre> <p>This gives me.</p> <pre><code>"16:44:08.9580000" </code></pre> <p>Which is what i am after. But how to get it in ASP.Net is the big question. Any Suggestions?</p> <p>I have a simple GridView that looks like this.</p> <pre><code>&lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"&gt; &lt;Columns&gt; &lt;asp:BoundField DataField="sOprTime" HeaderText="Sum OprTime" ReadOnly="True" SortExpression="sOprTime" /&gt; &lt;asp:BoundField DataField="sWorkTime" HeaderText="Sum WorkTime" ReadOnly="True" SortExpression="sWorkTime" /&gt; &lt;asp:BoundField DataField="sFaultTime" HeaderText="Sum FaultTime" ReadOnly="True" SortExpression="sFaultTime" /&gt; &lt;/Columns&gt; &lt;EmptyDataTemplate&gt; No data is present. &lt;/EmptyDataTemplate&gt; </code></pre> <p></p> <p>The SQL query looks like this:</p> <pre><code>sqlString1 = string.Format(@"SELECT SUM(CONVERT (Float, OprTime)) AS sOprTime, SUM(CONVERT (Float, WorkTime)) AS sWorkTime, SUM(CONVERT (Float, OprTime)) - SUM(CONVERT (Float, WorkTime)) AS sFaultTime FROM tblNovikLogg WHERE (Date_Time &gt; '{0:yyyy/MM/dd H:mm:ss}' And Date_Time &lt; '{1:yyyy/MM/dd H:mm:ss}')", selectedDate, selectedDate.AddDays(1)); </code></pre>
c# asp.net
[0, 9]
3,804,859
3,804,860
How do I show an enlarged version of a thumbnail properly even when I'm close to the edges of a container div or the browser?
<p>I have a div full of 60x60 images arranged in rows of 5. I want to show an enlarged version (at 300x300 max) of each thumbnail when you hover each image. I have a surrounding div that hides overflow, so if you hover over an image at one of the corners, the enlarged image will get cut off, so I need to flip the image to the other side. The code I have currently fails at addressing this clipping problem. Any ideas how to properly implement this, or are there any packaged solutions out there (preferably using jQuery)?</p> <pre><code> $('a.thumb img').live('mouseover', showThumbnail); $('a.thumb img').live('mouseout', function() { $('#image-thumbnail').hide(); }); $('#images a.thumb').live('click', function() { return false; }); /* disable clicks */ function showThumbnail() { var pos = { left: this.offsetLeft, top: this.offsetTop } var css = { } css['left'] = pos.left + 60 + 5; if (css['left'] + 300 &gt; this.offsetParent.offsetWidth) { css['right'] = pos.left - 5 + 'px'; delete css['left']; } else { css['left'] += 'px'; } css['top'] = pos.top + 60 + 5; if (css['top'] + 300 &gt; this.offsetParent.offsetHeight+50) { css['bottom'] = pos.top - 5 + 'px'; delete css['top']; } else { css['top'] += 'px'; } $('#image-thumbnail').css(css); $('#image-thumbnail').html("&lt;img style='max-width: 300px; max-height: 300px;' src='" + $(this).parent()[0].href + "' /&gt;").show(); } </code></pre>
javascript jquery
[3, 5]
966,623
966,624
I need help with Android and Java
<p>I am struggling to figure out how to handle a situation in Android where code continues to execute when I really don't want it to. In the onCreate() of an activity I have some stuff that I need to do in order and I can't have the code continue to execute until certain things happen first. I understand that this is how Android and Java behave and I am struggling to figure out another way to accomplish what I need. </p> <p>ShowEula is a class that I created to show a simple dialog with my EULA. I really need to wait until the user agrees or disagrees with the EULA before calling DBGetOnlineVersionNumber(). Maybe I'm just not going this the correct way. Anyway here's a snippet of my code:</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); String version; ShowEula(); version = DBGetOnlineVersionNumber(); .... </code></pre>
java android
[1, 4]
4,386,800
4,386,801
Jquery to populate input or textarea
<pre><code>&lt;div id="example"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; jah = "&lt;p&gt;Browser CodeName: " + navigator.appCodeName + "&lt;/p&gt;"; jah+= "&lt;p&gt;Browser Name: " + navigator.appName + "&lt;/p&gt;"; jah+= "&lt;p&gt;Browser Version: " + navigator.appVersion + "&lt;/p&gt;"; jah+= "&lt;p&gt;Cookies Enabled: " + navigator.cookieEnabled + "&lt;/p&gt;"; jah+= "&lt;p&gt;Platform: " + navigator.platform + "&lt;/p&gt;"; jah+= "&lt;p&gt;User-agent header: " + navigator.userAgent + "&lt;/p&gt;"; document.getElementById("example").innerHTML=jah; &lt;/script&gt; </code></pre> <p>I'm using the above code to compile some browser info I need to collect from a form. How can I get that info passed to a Input or Textarea? </p> <p>Thanks in advance!</p>
javascript jquery
[3, 5]
4,701,313
4,701,314
Member '<method>' cannot be accessed with an instance reference
<p>I am getting into C# and I am having this issue:</p> <pre><code>namespace MyDataLayer { namespace Section1 { public class MyClass { public class MyItem { public static string Property1{ get; set; } } public static MyItem GetItem() { MyItem theItem = new MyItem(); theItem.Property1 = "MyValue"; return theItem; } } } } </code></pre> <p>I have this code on a UserControl:</p> <pre><code>using MyDataLayer.Section1; public class MyClass { protected void MyMethod { MyClass.MyItem oItem = new MyClass.MyItem(); oItem = MyClass.GetItem(); someLiteral.Text = oItem.Property1; } } </code></pre> <p>Everything works fine, except when I go to access <code>Property1</code>. The intellisense only gives me "<em>Equals</em>, <em>GetHashCode</em>, <em>GetType</em>, and <em>ToString</em>" as options. When I mouse over the <code>oItem.Property1</code>, Visual Studio gives me this explaination:</p> <blockquote> <p><code>Member 'MyDataLayer.Section1.MyClass.MyItem.Property1.get' cannot be accessed with an instance reference, qualify it with a type name instead</code></p> </blockquote> <p>I am unsure of what this means, I did some googling but wasn't able to figure it out. Can anyone help this newbie out? </p> <p>thanks, anders</p>
c# asp.net
[0, 9]
1,215,581
1,215,582
Inherit parent frame's jQuery object including plugins
<p>I have a frame B which is a child of A:</p> <pre><code>A |_B </code></pre> <p>The page loaded by B can (will) change, and I used multiple jQuery plugins in my app. Is there a way I can include jQuery and all those plugins in A and just inherit the whole jQuery (which will have the plugins) object in every page in B so that everything works just like if I had included everything in B again? This code doesn't work as expected (being included in B):</p> <pre><code>window.$ = function(){ var args = Array.prototype.slice.call(arguments); args.push( window.document ); return top.window.jQuery.apply( top.window.$, args ); }; </code></pre> <p>Basically, the idea is to include jQuery and plugins in A, then work in B using normal jQuery syntax, in the context of B's <code>document</code>.</p> <p>Edit: Just for clarification, I <em>have</em> access to the pages loaded by B, and can execute any code I want.</p>
javascript jquery
[3, 5]
1,328,409
1,328,410
HTML-Javascript - Filechooser showing only server-side files
<p>I hope the following isn't too tricky. </p> <p>I have a simple html button. Now I want to open a filechooser as soon as a user clicks on this button.</p> <p>I do this like the following:</p> <pre><code>$('.button').click(function() { $('&lt;input type="file"/&gt;').attr('value'); }); </code></pre> <p>This opens a filechooser, but I want this file-chooser to only show files on the server, not on the client. I've searched the net but couldn't find an adequate solution so far.</p> <p>Any proposals are welcome :)</p>
javascript jquery
[3, 5]
5,661,742
5,661,743
Canvas draw once flashing
<p>I have a game loop that's drawing to the canvas, when I open the menu within the game I want to be able to display the game in the background and overlay a transparent layer on top. The problem is when I draw this layer once it keeps flashing all over the place instead of being persistent. Here's the code I'm using to draw the layer.</p> <pre><code>public void Render(Canvas canvas) { if(isVisable) { if(mDrawOnce) { canvas.drawPaint(mBGPaint); mDrawOnce = false; } } } </code></pre>
java android
[1, 4]
4,416,367
4,416,368
Prevent an element from losing focus
<p>We have a lot of <code>input</code>s in a document.<br> We want to open a dialog that generates text and puts that in the currently focused input.</p> <p>The problem is that, when I click a button or anything else to open the dialog that input loses focus. I can't determine which input has to get the generated text.</p> <pre><code>$("#button").click(function(){ // something should goes here to prevent stealing inputs focus }); </code></pre> <p>Is there any solution to prevent stealing focus by that special button?</p>
javascript jquery
[3, 5]
5,549,239
5,549,240
How to use HTML Table as gridview
<p>How to fetch data from database in HTML TABLE rather than Gridview?</p>
c# asp.net
[0, 9]
5,524,102
5,524,103
The method getPreferenceManager() is undefined for the type BatteryService in android app
<p>I am making a service so I have service class which is extended from Service. I am getting a checkbox from PreferenceScreen and based on whether it is checked or not I perform an action. To get CheckBoxPreference I use getPreferenceManager() method. But it has red underline. When I hover over it shows me this error <code>The method getPreferenceManager() is undefined for the type BatteryService</code>. When I use the same code in my main class then it works. Here is my code</p> <pre><code>public int onStartCommand(Intent intent, int flags, int startId) { initNotification(); final CheckBoxPreference checkboxPref = (CheckBoxPreference) getPreferenceManager().findPreference("cbAlarm"); checkboxPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { if (newValue.toString().equals("true")) { Toast.makeText(getApplicationContext(), "Service Started", Toast.LENGTH_LONG).show(); registerReceiver(batteryInfoReceiver, new IntentFilter( Intent.ACTION_BATTERY_CHANGED)); } else if (newValue.toString().equals("false")) { stopService(new Intent(getBaseContext(), BatteryService.class)); Toast.makeText(getApplicationContext(), "Unchecked", Toast.LENGTH_SHORT).show(); } return true; } }); return START_STICKY; } </code></pre> <p>How can I solve this problem? Help Please</p>
java android
[1, 4]
951,402
951,403
Best method to repeat JS function
<p>Sometimes this function can be called too quickly and multiple elements are created but since it uses an ID that's not unique to each instance it the part to fade out and remove the div only applies to the top level element, not all of them. So I end up with a static div tag that isn't fading/removing.</p> <p>The best thing I can think to do is to simply repeat the process again. How do I do that, or is there a better method?</p> <pre><code>document.triggerNotification = function (type, message) { jQuery(document.body).append("&lt;div class='push-notification push-"+type+"' id='notification'&gt;"+message+"&lt;/div&gt;"); jQuery('#notification').delay(1500).fadeOut(1200, function () { jQuery('#notification').remove(); }); } </code></pre>
javascript jquery
[3, 5]
1,886,393
1,886,394
Page jumps when fadeIn() and fadeOut() of two overlapping elements occurs
<p>I've created something in jQuery, I have a problem when clicking the images though. If you scroll down entirely to the bottom of the page and then click, you'll see it jumps. I've tried multiple methods to prevent jumping but its not working.</p> <p>Here is my code:</p> <pre><code>$('.author').click(function(e) { var name = $(this).attr('id') + '-info';    $('.author-info article').hide();    $('#' + name).fadeIn(); $('.author').removeClass('active'); $(this).addClass('active'); e.preventDefault(); }); </code></pre> <p>here is the live link - <a href="http://sites.lukespoor.com/author/" rel="nofollow">http://sites.lukespoor.com/author/</a></p> <p>any help is appreciated </p>
javascript jquery
[3, 5]
3,094,242
3,094,243
Problem tracking what javascript is causing jQuery UI error in firebug
<p>So I am getting the following error in firebug regarding jQuery UI. It would be as simple if it was a matter of a process-of-elimination on the JS on the page, but there is allot of JS as well as some on the page and some on the site.master.</p> <p><strong>ERROR</strong></p> <pre><code>(this.uiDialogTitlebarCloseText = c("&lt;span/&gt;")) .addClass("ui-icon ui-icon-closethick").text(m.closeText).appendTo is not a function </code></pre> <p>Is there a way in Firebug to see what javascript is the initial caller?</p>
javascript jquery asp.net
[3, 5, 9]
2,922,951
2,922,952
Jquery changing the value of a drop-down using its value, not the text
<p>I'm having difficulty changing the calue of a dropdown menu using jquery.</p> <pre><code>&lt;div class="input-box"&gt; &lt;select name="options[4]" id="select_4"&gt; &lt;option value=""&gt;-- Please Select --&lt;/option&gt; &lt;option value="24"&gt;Not Sure - Send Me Some Samples First &lt;/option&gt; &lt;option value="13"&gt;1 Jet Black &lt;/option&gt; &lt;option value="14"&gt;Blondette 4/27 &lt;/option&gt; &lt;option value="15"&gt;Boho Blonde 613/12 &lt;/option&gt; &lt;option value="16"&gt;Caramel 6 &lt;/option&gt; &lt;option value="17"&gt;Cherry 530 &lt;/option&gt; &lt;option value="18"&gt;Dirty Blonde 612/12 &lt;/option&gt; &lt;option value="19"&gt;Ebony Black 1b &lt;/option&gt; &lt;option value="20"&gt;Hot Toffee 4 &lt;/option&gt; &lt;option value="21"&gt;LA Blond 24/613 &lt;/option&gt; &lt;option value="22"&gt;Malibu Blonde 60/613 &lt;/option&gt; &lt;option value="23"&gt;Raven 2 &lt;/option&gt;&lt;/select&gt; &lt;/div&gt; </code></pre> <p>I can't understand why this won't work</p> <pre><code>function changeIt(theId) { $j('.input-box:eq(0)').val(theId); } changeIt(22); </code></pre>
javascript jquery
[3, 5]
3,048,869
3,048,870
How can I get current location on Android?
<p>I use this code for getting current location:</p> <pre><code>LocationManager lm = (LocationManager) this .getSystemService(Context.LOCATION_SERVICE); List&lt;String&gt; providers = lm.getProviders(true); /* * Loop over the array backwards, and if you get an accurate location, * then break out the loop */ Location l = null; for (int i = providers.size() - 1; i &gt;= 0; i--) { l = lm.getLastKnownLocation(providers.get(i)); if (l != null) break; } if (l==null) { return; } Toast.makeText(this, String.valueOf(l.getLatitude()), Toast.LENGTH_LONG).show(); </code></pre> <p>But I never see a latitude, because l is null always. My Manifest file contains ACCESS_FINE_LOCATION and INTERNET permissions. Where have I made mistake? </p>
java android
[1, 4]
2,015,120
2,015,121
Single click triggered on a double click
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1067464/need-to-cancel-click-mouseup-events-when-double-click-event-detected">Need to cancel click/mouseup events when double-click event detected</a> </p> </blockquote> <p>I am trying to get a HTML object to behave differently when a <code>single</code> or <code>double</code> click event happens.</p> <p>Currently with my working example <a href="http://jsfiddle.net/9vvEG/" rel="nofollow">http://jsfiddle.net/9vvEG/</a> the single click is triggered on the double click, I wish for my code to listen exclusively for the event pre-configured. <strong><em>i.e. if double clicked ignore single click and vice versa.</em></strong></p> <p>No success as of yet, but if you click my example link above you can see the error in progress.</p>
javascript jquery
[3, 5]
425,155
425,156
Is it considered bad practice if you use an <input> for a textbox compared to <asp:Textbox>?
<p>I have an ASP.NET page that contains a form and a button. In order to use the <code>OnKeyPress</code> and a javascript function (to stop the user from using the enter key and without adding a <code>FilteredTextBoxExtender</code>) attribute I had to change the <code>&lt;asp:Textbox&gt;</code> to an <code>&lt;input&gt;</code> with <code>type="text"</code>.</p> <p>Is this considered bad practice? Or are there valid situtations where should be used? </p> <p>To ensure this question isn't subjective - are there any other ways to prevent the user using the enter key when typing in an ASP.NET textbox? (without putting code in the code behind)</p>
c# javascript asp.net
[0, 3, 9]
6,032,147
6,032,148
Copying file to .jar file results in an error
<p>I am attempting to copy a zip file to a jar file in a C# method like this:</p> <pre class="lang-cs prettyprint-override"><code>ProcessStartInfo start = new ProcessStartInfo(); start.FileName = "java.exe"; start.WorkingDirectory = @"C:\mydir\"; start.Arguments = @" -jar example.jar example.zip"; Process java = new Process(); java.StartInfo = start; java.Start(); var stdOut = java.StandardOutput.ReadToEnd(); java.WaitForExit(); Console.WriteLine(java.ExitCode.ToString()); </code></pre> <p>The problem is that I am receiving this error:</p> <p><strong>Error: Unable to access jarfile example.jar</strong></p> <p>I've confirmed that both example.jar and example.zip exist in the Working Directory and have also written a batch file that I can run and create a .jar file that is almost identical:</p> <pre><code>jar -cf example.jar test.zip </code></pre> <p>I was able to run this without issue with this code:</p> <pre><code>const string batchFile = @"C:\mydir\batJar.bat"; System.Diagnostics.Process.Start(batchFile); </code></pre> <p>My environment variables (Windows 7) are also set up properly.</p>
c# java
[0, 1]
3,537,929
3,537,930
How to use Web parts in asp.net C#?
<p>How can i use web parts for performing drag and drops ?</p>
c# asp.net
[0, 9]
3,816,441
3,816,442
Folder Browser Dialog Box in ASP.Net
<p>I've created a word document generator in C sharp and I want that generated word document to be save in a specific place in the client. I'm looking for a similar functionality like FolderBrowserDialog in Windows Form. I'm using ASP.Net and I tried may solutions but still no luck. Anyone can help me.</p>
c# jquery asp.net
[0, 5, 9]
540,460
540,461
How can I get the Android SDK, version 1.5, to run on my G1 phone?
<p>Well, put it this way. I have already tested an Android application in emulator. Now I want to try that in a real G1 phone. But I am not able to run 1.5 SDK on my G1. Could anyone help me with this, please.</p>
java android
[1, 4]
883,347
883,348
Adding characters to string (input field)
<p>I have a text box where the value is the result of a calculation carried out in jQuery. What I would like to do, using jQuery, is to display brackets around the number in the text box if the number is negative. </p> <p>The number may be used again later so I would then have to remove the brackets so further calculations could be carried out.</p> <p>Any ideas as to how I could implement this? </p> <p>Thanks</p> <p>Zaps</p>
javascript jquery
[3, 5]
1,817,434
1,817,435
how to insert value in input, with javascript
<p>So I tried to do something like this -</p> <pre><code>$('#price').val(price); </code></pre> <p>price is 300, and it shows good on browser, in input field, but when I want to take it out and mail it with PHP, in $_POST['price'] it doesn't show up, How can I insert something in inputs value with JavaScript, so I can mail it? It seems this is not an insertion in value, but just a feature to display something, correct?</p>
javascript jquery
[3, 5]
4,015,961
4,015,962
Android make scroll view auto scroll to bottom
<p>How can i make it once the scroll view is out of the screen it will auto scroll to the bottom?</p>
java android
[1, 4]
1,260,894
1,260,895
Change background of Div from select
<p>I have made the following, which works, fine. It changes the background of a Div onSelectChange from a dropdown. I’m sure there is abetter way. Could anybody recommend?</p> <p>Thank you for looking.</p> <pre><code>$(document).ready(function() { $("#QuoteRequiredFor").change(onSelectChange); }); function onSelectChange() { var selected = $("#QuoteRequiredFor option:selected"); var output = ""; if (selected.val() == '') { output = "You Selected " + selected.text(); $('#FinanceQuoteForm').css('background', 'url(/Finance-Quote/FinanceQuoteForm/images/FFheaderQuoteFactoring.jpg)'); }; if (selected.val() == 'Factoring') { output = "You Selected " + selected.text(); $('#FinanceQuoteForm').css('background', 'url(/Finance-Quote/FinanceQuoteForm/Images/factoring.jpg)'); }; if (selected.val() == 'Mortgage') { output = "You Selected " + selected.text(); $('#FinanceQuoteForm').css('background', 'url(/Finance-Quote/FinanceQuoteForm/Images/Mortgage.jpg)'); }; if (selected.val() == 'Stock') { output = "You Selected " + selected.text(); $('#FinanceQuoteForm').css('background', 'url(/Finance-Quote/FinanceQuoteForm/Images/stock.jpg)'); }; if (selected.val() == 'Asset') { output = "You Selected " + selected.text(); $('#FinanceQuoteForm').css('background', 'url(/Finance-Quote/FinanceQuoteForm/Images/asset.jpg)'); }; if (selected.val() == 'Invoice discounting') { output = "You Selected " + selected.text(); $('#FinanceQuoteForm').css('background', 'url(/Finance-Quote/FinanceQuoteForm/Images/factoring.jpg)'); }; $("#output").html(output); } </code></pre>
javascript jquery
[3, 5]
4,148,246
4,148,247
Prevent click event in jQuery triggering multiple times
<p>I have created a <a href="http://pmck.net/jq-switcher/">jQuery content switcher</a>. Generally, it works fine, but there is one problem with it. If you click the links on the side multiple times, multiple pieces of content sometimes become visible.</p> <p>The problem most likely lies somewhere within the click event. Here is the code:</p> <pre><code>$('#tab-list li a').click( function() { var targetTab = $(this).attr('href'); if ($(targetTab).is(':hidden')) { $('#tab-list li').removeClass('selected'); var targetTabLink = $(this).parents('li').eq(0); $(targetTabLink).addClass('selected'); $('.tab:visible').fadeOut('slow', function() { $(targetTab).fadeIn('slow'); } ); } return false; } ); </code></pre> <p>I have tried adding a lock to the transition so that further clicks are ignored as the transition is happening, but to no avail. I have also tried to prevent the transition from being triggered if something is already animating, using the following:</p> <pre><code>if ($(':animated')) { // Don't do anything } else { // Do transition } </code></pre> <p>But it seems to always think things are being animated. Any ideas how I can prevent the animation being triggered multiple times?</p>
javascript jquery
[3, 5]
1,825,816
1,825,817
jquery toggling a div - how to do this with multiple ids?
<p>I am new to Jquery. My setup is as follows:</p> <p>I have a series of divs that need to be able to be toggled (display hidden and shown). Each div has an action that can be performed so a unique ID will be necessary to know from which div the event came from.</p> <p>To toggle the div I have a button for each div (which is not located within the div to be toggled).</p> <p>Right now without jquery, I use the button's onclick event to pass the ID of the corresponding div to be toggled. Using the unique ID I can do the following:</p> <pre><code>function toggleFlag(divId) { var div = document.getElementById(divId); div.style.display = (div.style.display=="block" ? "none" : "block"); } </code></pre> <p>divId is unique so I also know where the event comes from if action within the div is performed.</p> <p>the anchor code looks something like this:</p> <pre><code>onclick="toggleFlag('id-111');" </code></pre> <p>where the '111' is the unique id</p> <p>First off, is it even worth it to use jquery for this if the extent of my javascsript isn't much more complicated (aside from maybe simple ajax).</p> <p>More importantly, how would this properly be done using jquery?</p> <p>Update: I am very close to solving this. I managed to get it to work using one of the suggestions below requiring unique class names for each button. A couple of the methods suggest implementations where the class name is the same for all buttons (I want this in order to be able to statically assign styles to the button class), but I could not get these to work. Could somebody please elaborate on the solution? Thanks!</p>
javascript jquery
[3, 5]
409,634
409,635
Detect if navigated to by Domain Name or IP address
<p>Is it possible to detect whether a user navigated to my site via Domain Name or by IP Address? Google isn't being very helpful.</p>
php javascript
[2, 3]
4,545,076
4,545,077
Delete image from Folder/Database using RowCommand/RowDeleting events
<p>I am uploading images and display them in a <code>Gridview</code>.I save the images in a folder and the name in the database.Now I want if I uploaded 3 pictures and have to delete one which I select.So I have picture 1 2 3. When I select picture 2 than this will be deleted..How can I do that? This is my code to upload my pictures:</p> <pre><code>string filename = Path.GetFileName(fileuploadimages.PostedFile.FileName); fileuploadimages.SaveAs(Server.MapPath("Images/" + filename)); SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["baza_chestionar"].ToString()); con.Open(); SqlCommand cmd = new SqlCommand("Insert into Images(ImageName,ImagePath) values(@ImageName,@ImagePath)", con); cmd.Parameters.AddWithValue("@ImageName", filename); cmd.Parameters.AddWithValue("@ImagePath", "Images/" + filename); cmd.ExecuteNonQuery(); con.Close(); Response.Redirect("~/upload.aspx"); </code></pre>
c# asp.net
[0, 9]
2,096,255
2,096,256
Getting dropdownlist.selectedvalue trough Postback
<p>I've got this dropdownlist wich i populate using programming code :</p> <pre><code> while (teller &lt; modellen.Length) { SqlCommand cmd2 = new SqlCommand("SELECT Mod_Naam FROM Model WHERE Mod_ID = '" + modellen[teller] + "' ", con); string modnaam = (string)cmd2.ExecuteScalar(); ddlModel.Items.Add(new ListItem(modnaam, modellen[teller])); teller++; } </code></pre> <p>When I select something in the dropdownlist I get an autopostback (wich I use to display a form on the screen for the selected item) but the selecteditem in the dropdownlist get's lost during the postback. How do I keep the selecteditem trough the postback ?</p> <p>thank you, Nico</p>
c# asp.net
[0, 9]
4,078,487
4,078,488
Wait for animation to complete before continuing in jQuery
<p>Is there anyway to wait for a jQuery animation to finish before proceeding with another command?</p> <p>For example, I want to fade out/slide up an element, change some items within the element and then fade them back in/slide back down.</p> <p>If I put the statements one after another, you can see the items change before the animation completes.</p> <pre><code>$('#item').fadeOut(); $('#item').html('Changed item'); $('#item').fadeIn(); </code></pre> <p>Thanks.</p>
javascript jquery
[3, 5]
2,676,200
2,676,201
How to call a jQuery method?
<p>Say for example, using javascript i would normally call a method like this</p> <pre><code>&lt;a href ="" onclick="javascriptMethod()"&gt;Link&lt;/a&gt; </code></pre> <p>and implement the method like this</p> <pre><code>&lt;script type="text/javascript"&gt; function javascriptMethod(){ //codes } &lt;/script&gt; </code></pre> <p>For some reaon on most jQuery documents all I can find is </p> <pre><code>$("").click(function(){ //codes }); </code></pre> <p>Can we not make onclick call on jQuery?</p> <p>CLEARIFICATION: Instead of <code>$().click</code> I need to call the method for the itself due to existing div array which I cannot change. I know how to do it on JavaScript and is quite easy. The question is, can I not call jQuery method for the an element like <code>&lt;img onclick="jQueryMethod" /&gt;</code> ? </p> <p>I need to pass a value to the method, thats the most important bit. Since the elements are in an array, i cannot figure out which element[x]. </p>
javascript jquery
[3, 5]
5,469,793
5,469,794
How to set href to some value if I have <a id='view.php'>
<p>I need to get time in miliseconds and attach that on like get parameter on 'view.php'. How to set href to that value ( <code>href='view.php?time=x</code>) if I have <code>&lt;a id='view.php'&gt;</code> using JQuery ?</p>
javascript jquery
[3, 5]
5,060,740
5,060,741
Need help regards copy image to clipboard in website using ASP.Net or JavaScript?
<p>I need a help regards copy image to clipboard in website. The image is dynamically created one.</p> <p>I found two solutions</p> <p>Solution 1 : </p> <pre><code>using System.Windows.Forms; Bitmap bitmapImage ; protected void buttonClipboard_Click(object sender, System.Web.UI.ImageClickEventArgs e) { MemoryStream memoryStream = new MemoryStream(imageByteArray); // Image byte array is the input bitmapImage = (Bitmap)System.Drawing.Image.FromStream(memoryStream); memoryStream.Flush(); memoryStream.Close(); Thread cbThread = new Thread(new ThreadStart(CopyToClipboard)); cbThread.ApartmentState = ApartmentState.STA; cbThread.Start(); cbThread.Join(); } [STAThread] protected void CopyToClipboard() { if (bitmapImage != null) { //Clipboard.SetData(DataFormats.Bitmap, bitmapImage); Clipboard.SetImage(bitmapImage); } } </code></pre> <p>This is working fine before publishing the website. After publishing this won't work in any website browsers because here STAThread used. Some websites said thread won't work in published website due to internal multi-thread handling in browsers.</p> <p>Solution 2 : </p> <pre><code>&lt;script type="text/javascript"&gt; function CopyToClip() { var imgControl = document.getElementById('imageContent'); imgControl.contentEditable = 'true'; var controlRange; if (document.body.createControlRange) { controlRange = document.body.createControlRange(); controlRange.addElement(imgControl); controlRange.execCommand('Copy'); } imgControl.contentEditable = 'false'; return true; } </code></pre> <p></p> <p>This java-script working fine for IE before &amp; after publishing website. But it is not working in Chrome &amp; Mozilla in any situation.</p> <p>I need one solution for Mozilla &amp; Chrome.</p> <p>Please suggest any solution for this? </p>
javascript asp.net
[3, 9]
1,345,587
1,345,588
Calling multipe Scripts from JavaScript in Android
<p>I am having problems with calling one or more scripts from JavaScript. My application has to login to an external website. I don't have access to that website. It doesn't work with webview.loadUrl(url). Also I could not get it to work with JavaScriptInterface. The best thing would be if I can get it to work without the use of a WebView, but I would also realy glad if it works with a WebView. The functions are:</p> <pre><code>AJS.AEV(window, 'load', function() { $('#Inloggen').dialog('open'); $('#rijschool').val("somVariable"); $('#email').val("myEmailAdress"); $('#password').val("myPassword"); } ); </code></pre> <p>and</p> <pre><code>$("input[type='button']").click(function() { $.ajax({ url : "/", data: {module:'authentication',action:'login',referer:'/',method:'modal','rijschool':$("#rijschool").val(),'email':$("#email").val(),'password':$("#password").val()}, type: "post", success: function(data) { data = filterData(data); $("#Inloggen").html(data); } }); }); </code></pre> <p>(Some variable names are written in Dutch.)</p> <p>Thanks!</p>
javascript android
[3, 4]
1,585,875
1,585,876
Why does php insert backslash while replacing double quotes
<p>I'm wondering why php adds a backslash when i remove double quotes.</p> <pre><code>&lt;input type="text" name="number" id="number" /&gt; &lt;input type="button" name="button" id="button" value="Button" /&gt; </code></pre> <p>Say they user enters the value 5-1/2" and i'm passing it to a processing page via jquery's .get method.</p> <pre><code>$('#button').click(function(){ $.get('determine.php?number='+$('#number').val(),function(data){ $('#response').html(data); }); }); </code></pre> <p>Here is my processing page.</p> <pre><code>determine.php $number = $_GET['number']; $number = str_replace(array('"', "'"), '', $number); echo $number; //echos 5-1/2\ </code></pre> <p>Why is the backslash there?</p>
php javascript jquery
[2, 3, 5]
667,656
667,657
Where to use jQuery.noConflict
<p>I have some code I was given in jQuery and I am really new to it. I need to use the jQuery.noConflict() method because I am using a Mootools framework as well. I just don't know where I should replace the $ symbols in the code for 'jQuery'. Any help would be greatly appreciated!</p> <p>The code for it is at www.cshellarchitecture.com/test/js/flexibg.js</p>
javascript jquery
[3, 5]
3,438,449
3,438,450
android: start in symbol keyboard mode, but don't restrict to numbers-only input
<p>I want to specify that Android should start the soft keyboard for a given EditText in the numeric/symbols mode. I know this can be done by setting the input type of the EditText to be numeric using EditText.setInputType() except that I do not want to restrict the input type for the EditText to numeric input only**. Is there another way to tell Android what keyboard it should open for a given EditText?</p> <p>** I want essentially a Math class of numeric input, accepting arbitrary mathematical expressions, including [0,9.+-/*()@:].</p>
java android
[1, 4]
1,311,861
1,311,862
Send multiple dynamic arguments to jquery event functions
<p>I want to send multiple arguments to JQUERY event functions.For sending one data i put it in value attr in html code. </p> <pre><code>&lt;li id="&lt;?php echo 'v'.$value['vehicleid'] ?&gt;" value="&lt;?php echo $value['vehicleid']; ?&gt;" &gt; </code></pre> <p>And get data in JQuery event function with <code>$(this).val()</code> But i don't know how can i pass multiple php data to JQuery event function!<br> these data are dynamic and produced by php code.</p>
php jquery
[2, 5]
1,508,221
1,508,222
tcp/ip open connection
<p>currently i am using the following code to interact with server</p> <pre><code> public String connectToserverforincomingmsgs(String phonurl, String phno) throws IOException { URL url = new URL(phonurl); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setDoInput(true); // Allow Outputs con.setDoOutput(true); con.connect(); BufferedWriter writer = null; writer = new BufferedWriter(new OutputStreamWriter( con.getOutputStream(), "UTF-8")); // give server your all parameters and values (replace param1 with you // param1 name and value with your one's) writer.write("sender_no=" + phno); writer.flush(); String responseString = ""; BufferedReader reader = null; reader = new BufferedReader(new InputStreamReader(con.getInputStream())); String line; while ((line = reader.readLine()) != null) { responseString = responseString.concat(line); } con.disconnect(); return responseString; } </code></pre> <p>how could i make tcp connection .right now i don't have any idea . i am new to android and java aswell so any sample code about the tcp connection would be appreciated</p>
java android
[1, 4]
5,375,950
5,375,951
Page wise total in grid
<p>Hi I am using a data grid in my page, in which I am displaying a cost column. my page contains 1000s of records. i am displaying 25 records per page. And I have to display the total in the footer. and the problem is i want to display the total by page wise. How can i achieve it?</p>
c# asp.net
[0, 9]
2,153,460
2,153,461
Dropdownlist onselectedindexchanged problem
<p>I have a dropdownlist like this</p> <pre><code>&lt;asp:dropdownlist runat="server" autopostback="true" onselecteditemindexchanged="fire_event" ID="DDL"/&gt; </code></pre> <p>and on codebehind i m doing this</p> <pre><code>page_load : if(!page.postback)I m binding data into dropdownlist fire_event: I am redirecting page to itemselected value. </code></pre> <p>So I am able to do most of the part everything is working perfectly except..</p> <p>when i select item in dropdown it redirects me to the page I wanted..but when i click back it remains at the same item selected value .I want it to be like that it loads again when i click back for e.g. </p> <p>if my dropdown is like state <code>A</code> and other items </p> <pre><code>A B C D </code></pre> <p>when I select <code>D</code> it takes me to page <code>D</code> and when i click back it is at state <code>D</code> i want it to show <code>A</code> instead of <code>D</code></p>
c# asp.net
[0, 9]
4,724,164
4,724,165
What is the difference between Server.MapPath and HostingEnvironment.MapPath?
<p>Is there any difference between <code>Server.MapPath()</code> and <code>HostingEnvironment.MapPath()</code>? Does <code>Server.MapPath()</code> have any advantages over <code>HostingEnvironment.MapPath()</code>?</p> <p>My original problem was mapping the file path on a server when the <code>HttpContext</code> is not present and I cannot pass a <code>Server</code> variable from <code>Global.asax</code> to my method. </p> <p>I used <code>HostingEnvironment.MapPath()</code> instead since it doesn't need <code>HttpContext</code>. Are there any situations when these two methods will give different results?</p>
c# asp.net
[0, 9]
3,866,911
3,866,912
Session in jquery
<p>I am trying to get session value in jquery using following code:</p> <pre><code>function CheckUserType() { var user = '&lt;%= Session["LoginUserType"]%&gt;'; alert(user); if (user == 'Type1') { jQuery("#customizationTool.customization-tool div.CostEstimate div.EstimateDetail div.QtyUpdateSec").hide(); jQuery("#customizationTool.customization-tool div.CostEstimate div.EstimateDetail div.AddCartSec").hide(); } </code></pre> <p>But I am facing the error from my browser:</p> <blockquote> <p>"The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %>)."</p> </blockquote> <p>How can I solve this?? </p>
jquery asp.net
[5, 9]
812,956
812,957
notifydatasetchanged from within listener not working
<p>I am trying to update my Activity's ListView from within the onLocationChanged function of a Location Listener using notifyDatasetChanged() but it doesnt work. I can however use setListAdapter from the same point in my code and this will work.</p> <p>Here is my code:</p> <pre><code>public class TestListeners extends ListActivity { ArrayAdapter adapter; private final LocationListener networkLocationListener = new LocationListener() { @Override public void onStatusChanged(String provider, int status, Bundle extras) { switch (status) { case LocationProvider.AVAILABLE: break; case LocationProvider.OUT_OF_SERVICE: break; case LocationProvider.TEMPORARILY_UNAVAILABLE: break; } } @Override public void onProviderEnabled(String provider) { } @Override public void onProviderDisabled(String provider) { } @Override public void onLocationChanged(Location location) { checkProximity(location.getLatitude(), location.getLongitude(), cx); } }; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //get a list here venueNamesArray //etc adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, android.R.id.text1, venueNamesArray); setListAdapter(adapter); } private void checkProximity(double curLat, double curLon, Context cx) { //get a different list here venueNamesArray //etc adapter = new ArrayAdapter&lt;String&gt;(getApplicationContext(), android.R.layout.simple_list_item_1, android.R.id.text1, venueNamesArray); adapter.notifyDataSetChanged();//this doesnt work and no error is thrown setListAdapter(adapter);//this works } } </code></pre> <p>The reason I want to use notifyDatasetChanged() instead of setListAdapter is because the listview scrolls back to the top upon setting it. No error is throw when I use notifyDatasetChanged() so it is hard for me to see why this isnt working. </p> <p>I have tried using a normal ListView for this instead of extending ListActivity and ran into the same problem.</p>
java android
[1, 4]
2,432,719
2,432,720
javascript alert before php code
<p>page:content display.php</p> <pre><code>&lt;td width="100"&gt;&lt;a onclick="return confirmSubmit()" href="delete.php?id=&lt;?php echo $row['id']; ?&gt;&amp;table=labour_details&amp;return=content_display.php"&gt;&lt;img src="../images/delete.png" border="0" alt="delete"&gt;&lt;/a&gt;&lt;/td&gt; </code></pre> <p>page:delete.php</p> <pre><code>if(isset($_GET['id']) &amp;&amp; isset($_GET['table'])) { $id=$_GET['id']; $tablename=$_GET['table']; $return=$_GET['return']; if($tablename=="labour_details") { $sql=mysql_query("SELECT * FROM `labour_details` WHERE `id`='$id'"); $row_1=mysql_fetch_array($sql); $labour_name= $row_1['labour_name']; if($labour_name!="") { $str=mysql_query("DELETE FROM `labour_details` WHERE `id`='$id'"); if($str) { header("location:$return?msg=Record Deleted Successfully!&amp;id=$id"); }else{ echo "Problem in deleting :"; } } } } </code></pre> <p>my problem is where to add alert so that before deleting record it show javascript massage if allow then it will delete record.</p> <pre><code>function confirmSubmit() { var agree=confirm("Are you sure you wish to Delete this Entry?"); if (agree) return true ; else return false ; } </code></pre>
php javascript
[2, 3]
5,488,017
5,488,018
jQuery Countdown serverSync 15 hours difference
<p>I am using Keith Woods countdown timer (http://keith-wood.name/countdown.html) with the serverSync function. This seems to work great in a single country however when I check the countdown from a different country it seems there is 15 hours ish difference.</p> <p>So in Australia the countdown shows 1 day but in the US it shows 1 day 15 hours. I have implemented the server side code exactly as explained on the site but there is still the time difference. If I change my local clock it changes the countdown time but when hit refresh the countdown shows the correct amount of time so I know its getting the server time. However in the US there is still the time difference.</p> <p>Any ideas why this could be if its reading the server time?</p> <pre><code>function serverTime() { var time = null; $.ajax({url: 'server-time.php?random=' + Math.floor(Math.random() * 1000000), async: false, dataType: 'text', success: function(text) { time = new Date(text); }, error: function(http, message, exc) { time = new Date(); }}); return time; } var launchDate = ""; $(function () { launchDate = new Date( 2012, 5-1, 22, 11 ); $('#launchCountdown').countdown('destroy') $('#launchCountdown').countdown({ until: launchDate, serverSync: serverTime, format: 'DHMS', expiryText: '&lt;p&gt;It\'s all over&lt;/p&gt;' //onTick: highlightLast5 }); }); </code></pre>
php jquery
[2, 5]
2,031,391
2,031,392
loop in javascript
<pre><code>function DC() { var elements = $(".panel"); elements.first().fadeOut(1000, function() { $(this).insertAfter(elements.last()); $(this).fadeIn(1000); }); } $(document).ready(function() { var i =0; for (var i=0; i &lt; 10; i++) { DC(); }; }); </code></pre> <p>I want <code>DC()</code> to loop 10 times, but it only looped once.</p> <p>What did I do wrong?</p>
javascript jquery
[3, 5]
2,900
2,901
jQuery create function and call it on each separately
<p>Hey guys I'm trying to create a function and call it inside another each loop. I got it to work, but the each loop is not working. So I tried to add an extra <code>$(this)</code> and it didn't work either...any help is appreciated.</p> <pre><code>.moveClass { position:relative; } $(function() { $('.a_projectLoad').each(function(evt){ $(this).hover(function(){ $(this).slideRight(); }); }); }); function slideRight () { $('.img_rightArrow') .addClass('moveClass') .animate({"left": "+=50px"}, "fast"); } &lt;table&gt; &lt;tr&gt; &lt;td&gt;&lt;a href="#" class="a_projectLoad"&gt;Title Goes Here&lt;/a&gt;&lt;/td&gt; &lt;td &gt;&lt;img src="images/btn_loadProject.png" class="img_rightArrow"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a href="#" class="a_projectLoad"&gt;Title Goes Here&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;img src="images/btn_loadProject.png" class="img_rightArrow"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>
javascript jquery
[3, 5]
758,532
758,533
Prevent jQuery() from executing javascript
<p>I am working on some code that uses jQuery to parse data out of html documents from the web. This decision was made because jQuery, with its awesome ability to select objects on a page, makes it excellent for parsing.</p> <p>The code works like this (where 'html_string' is the html of a whole web page):</p> <pre><code>var page = $(html_string); </code></pre> <p>The problem I am having is that javascript is being evaluated and executed within the html_string as well. This results in new threads being formed that in some cases, contain infinite loops that make repeated requests to the server and eventually crash the whole client-side of application (not the server).</p> <p>Is there a way to somehow prevent the execution of javascript in this situation. In this situation, the execution of javascript is an unwanted side effect.</p> <p>Thanks so much!</p>
javascript jquery
[3, 5]
318,743
318,744
Difference between String and AttributedString
<p>I am quite confused here. Today I came across this concept of <a href="http://download.oracle.com/javase/7/docs/api/java/text/AttributedString.html" rel="nofollow"><code>AttributedString</code></a>. But I am not able to find the exact difference for <strong>String and AttributedString</strong>. And more ever I am not able to convert this attributed String to String using the <code>toString()</code>. Can anyone help me with this?</p> <p><strong>EDIT 1</strong></p> <p>Actually I want to provide Kerning attrribute for my text. But I don't know how to do it. Can anyone help me?</p>
java android
[1, 4]
148,862
148,863
jQuery Remove table row on $.ajax success
<p>I need to remove a table row after a successful ajax call, not sure how to do it. Here is my code:</p> <pre><code>function closelead(rowid){ var rowid1 = rowid; alert(rowid1); var parent = $(this).parent(); $.ajax({ type: "POST", url: "ajax/close.php", data: "rowid="+ rowid1, success: function(html){ } }); } </code></pre> <p></p> <pre><code>&lt;tr&gt;&lt;td&gt;&lt;input type="button" onclick="closelead(&lt;?php echo $leadlist['ID'];?&gt;)" value="Close" class="searchbutton" /&gt;&lt;/td&gt;&lt;/tr&gt; </code></pre>
php javascript jquery
[2, 3, 5]
5,820,267
5,820,268
jQuery functions inside click events
<p>The following works fine:</p> <pre><code> classes_tab.click(function(evt){ evt.preventDefault(); h_c.filter(':visible').fadeOut(fast, function(){ disactive.removeClass('active'); classes_tab.addClass('active'); classes.fadeIn(fast); }); }); contacts_tab.click(function(evt){ evt.preventDefault(evt); h_cl.filter(':visible').fadeOut(fast, function(){ disactive.removeClass('active'); contacts_tab.addClass('active'); contacts.fadeIn(fast); }); }); home_tab.click(function(evt){ evt.preventDefault(); c_cl.filter(':visible').fadeOut(fast, function(){ disactive.removeClass('active'); home_tab.addClass('active'); home.fadeIn(fast); }); }); </code></pre> <p>Is there a way of writing a function before this click events without repeating every time what is happening inside the click event? </p> <p>Say I have something like:</p> <pre><code>function tabs(x, y){ x.fadeOut(fast); y.fadesIn(fast); } </code></pre> <p>than inside each click event I just call this function by changing parameters </p>
javascript jquery
[3, 5]
4,221,003
4,221,004
Taking Selected Item of ListBox into selected TextBox
<p>I have a ListBox object which allows multiple selection and also for the selected item's to be removed.</p> <p>Now I have an additional problem, which relates to a ListBox and 3 TextBoxes. I want it to work so that when I shift the focus into or mouseover any of the textboxes, I would like for the ListBox selected items to be copied into the textbox which recieved the focus/mouseover.</p> <p>How can I do that? Please Help me.</p>
c# asp.net
[0, 9]
329,966
329,967
How to convert Byte Array to PDF file in Android?
<p>I'm working on an application where i am getting the data in the form of byte array ,and i need to use this byte array for creating a new PDF file.How can i achieve this in android ?</p>
java android
[1, 4]
1,081,665
1,081,666
php + web service
<p>Can someone confirm good performance using PHP + Java webservice (for heavy duty tasks) running on NGINX (or Apache) because PHP is slow in completing some heavy tasks and I want to make a web service in java to communicate with PHP via SOAP or REAT or JSON.</p> <p>The fact I'm asking this question is that I already know PHP at a very good level (and Java and I don't want to start learning ASP or Ruby) and HTML5, CSS3 and I want to develop a big portal that will have increased number of requests (1000 / 2000 request/sec) <strong>and I don't want to code the whole application in Java</strong> (cause PHP has more sense), I only need the heavy work to be done by a webservice. </p> <p><strong>For my project PHP is slow in doing some Math computation and I/O file access every second. It consume a lot of memory and a lot of CPU. At the rate of 1000 req/s it almost crushes.</strong></p> <p>Is this a good practice? Is there another solution?</p>
java php
[1, 2]
3,930,020
3,930,021
Problem adding javascript/jquery to my WebPart
<p>My ascx looks like this:</p> <pre><code>&lt;SharePoint:ScriptLink ID="ScriptLink1" runat="server" Name="/_layouts/1033/MyProject/js/test.js"/&gt; test: &lt;input id="example" /&gt; </code></pre> <p>test.js looks like this:</p> <pre><code>$(document).ready(function () { alert("test"); }); </code></pre> <p>In <code>MyProject</code> I have a folder called <code>js</code> and in that folder I have <code>test.js</code></p> <p>I was under the impression that when I debugged my webpart it would pop up an alert taht said "test" but it does nothing. Am I doing something wrong here?</p>
jquery javascript
[5, 3]
5,254,907
5,254,908
set select option back to default selected
<p>I'm trying to set the select option back to the "choices" every time I finish adding a new row. How can I do it here? Please help. Btw, adding new row(s) works just fine. Here is what I've got so far:</p> <pre><code>$(document).ready(function() { $('#Add-btn').live('click',function() { $("#tabName tr:last").before("&lt;tr&gt;&lt;td class='greyed'&gt;&lt;input type='hidden' name='allele' value='" + a + "'&gt;" + a + "&lt;/td&gt;&lt;td&gt;&lt;input type='button' class='delete' value='Remove'&gt;&lt;/td&gt;&lt;/tr&gt;"); }); }); </code></pre> <p>HTML:</p> <pre><code>&lt;table id="tabName"&gt; ... &lt;select size='1' id="a" name='a'&gt; &lt;option value="None" selected&gt;choices&lt;/option&gt; &lt;option value='1'&gt;first&lt;/option&gt; &lt;option value='2'&gt;second&lt;/option&gt; &lt;/select&gt; ... &lt;/table&gt; &lt;div&gt; &lt;input id="Add-btn" class="button" type="button" value="Add" /&gt; &lt;span&gt;&lt;/span&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
805,169
805,170
database not working with 2.2,working good with 2.3 and Higher Version
<p>my app working on 2.3 and higher version good bt on 2.0 or 2.2 it gives error like "android sqlite returned error code 1 no such table" please help.</p>
java android
[1, 4]
895,576
895,577
How to show a web page in full screen mode without statusbar and addressbar in all browsers?
<p>How to show a web page in full screen mode without statusbar and addressbar in all browsers and it should not show the taskbar also.</p>
c# javascript asp.net jquery
[0, 3, 9, 5]
3,847,561
3,847,562
Differences between Script & Code behind?
<p>Please let me ask something. I just confused for what is the difference of javascript, JQuery and code behind attributes. for example : ASPX</p> <pre><code>&lt;tbody id="toggleSup" runat="server"&gt; </code></pre> <p>C#</p> <pre><code>toggleSup.Visible = false; </code></pre> <p>--------------------------------------- OR ---------------------------</p> <p>C#</p> <pre><code>CallScript((string)(Session["toggle"])); private void CallScript(string str) { string scriptx = "&lt;SCRIPT LANGUAGE='javascript'&gt;"; scriptx += "toggle('" + str + "');"; scriptx += "&lt;/script&gt;"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "scriptx", scriptx, false); } </code></pre> <p>Script</p> <pre><code>function toggle(para1) { if (para1 == 0) { $('#toggleSup').hide(); } else { $('#togglePO').hide(); } } </code></pre> <p>for these two difference things, most of the developers use script. Why? Actually C# code is only one row. different thing is if I use script, no need to use runat="server" but if I used code behind, need to use runat = "server". So I think there may be definately have advantages. Please explain me, if possible...</p> <p>Thanks</p>
c# javascript jquery asp.net
[0, 3, 5, 9]
4,781,842
4,781,843
filestream fileshare access by 2 process to read and write at the same time
<p>I got a primitive website, where the aspx webform and socket server access flat files, which stores the data. The socketserver will be accessing the same exact files to write, which is accessed by the aspx c# code for reading. I think there may be an issue with locking the files. I think it is the higher priority for the server to quick write to the file and release any lock on the file. The webform should be able to read without interrupting the writing process of the server. What is the best way to do this? Is it with the using streamwriter?</p> <p>The server used this call, to only share file for reading while it is writing to the file.</p> <pre><code> if (!File.Exists(filepath)) { using (FileStream fileStream = new FileStream(filepath, FileMode.CreateNew, FileAccess.Write, FileShare.Read)) { using (TextWriter writer = new StreamWriter(fileStream)) { writer.WriteLine(data); m_clientSocket.Send(BitConverter.GetBytes(data.Length)); } } } else { using (FileStream fileStream = new FileStream(filepath, FileMode.Append, FileAccess.Write, FileShare.Read)) { using (TextWriter writer = new StreamWriter(fileStream)) { writer.WriteLine(data); m_clientSocket.Send(BitConverter.GetBytes(data.Length)); } } } </code></pre> <p>The webform read with the following command</p> <pre><code> using (FileStream stream = new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.Read)) { using (TextReader reader = new StreamReader(stream)) { //string fileContents = tr.ReadToEnd(); while ((line = reader.ReadLine()) != null) { if (!string.IsNullOrEmpty(line)) { lines.Add(line); } } } } </code></pre> <p>I am hoping this may work without having to lock the file and manage access, which I am not sure how to do. I want to be able to for the server to lock the file for writing at anytime but also allow the same file to be read by the aspx webpage c# code.</p> <p>Any help is appreciated.</p>
c# asp.net
[0, 9]
3,116,464
3,116,465
To get controls inside static function
<p>I am calling function in codebehind from javascript using webservice.</p> <pre><code>function GetAdmissionType() { InitComponents(); var type=""; type=document.getElementById(dlAdmissionType.id).value; document.getElementById(hdnAdmissionType.id).value=document.getElementById(dlAdmissionType.id).value; else if(type=="2") { InitComponents(); ViewResettingPanel() makeFavorite(1); } } function makeFavorite(id) { PageMethods.SaveInfo(id, CallSuccess, CallFailed); } // This will be Called on success function CallSuccess(res, id) { alert(destCtrl); } // This will be Called on failure function CallFailed(res) { alert(res.get_message()); } </code></pre> <p>Following is my code in codebehind</p> <pre><code>[System.Web.Services.WebMethod] public static void SaveInfo(String Id) { //to get textbox in form } </code></pre> <p>Problem is iam not getting controls in aspx page in SaveInfo.Can anybody help to access controls in form inside saveinfo?</p>
c# asp.net
[0, 9]
1,644,274
1,644,275
Receive form input data with PHP POST
<p>I'm using the jQuery tag-it plugin, which basically has an input field. Everything works well, but I am unable to receive the input field value by submitting the form with PHP.</p> <p>Here's the form part:</p> <pre><code>&lt;form action="&lt;?=$PHP_SELF?&gt;" method="post"&gt; &lt;div class="line"&gt; &lt;label for="tags"&gt;Tags&lt;/label&gt; &lt;ul id="mytags"&gt;&lt;/ul&gt; &lt;/div&gt; &lt;input name="submit" value="Submit" type="submit" /&gt; &lt;/form&gt; </code></pre> <p>Here is PHP part:</p> <pre><code>&lt;? if ($_POST[submit]) { $tags = $_POST[mytags]; echo $tags; } ?&gt; </code></pre> <p>The demo of the plugin is here: <a href="http://levycarneiro.com/projects/tag-it/example.html" rel="nofollow">http://levycarneiro.com/projects/tag-it/example.html</a> and the javascript code is here: <a href="http://levycarneiro.com/projects/tag-it/js/tag-it.js" rel="nofollow">http://levycarneiro.com/projects/tag-it/js/tag-it.js</a> I'll be thankful for any help.</p>
php jquery
[2, 5]
2,687,138
2,687,139
question-suggestion list
<p>i have a asp.net page. i m writing some words in a question textbox named txtTitle, after moving to another txtbox named txtbox2, i want that it should open a question-suggestion page based on that keyword typed in txtbox1 in the space before txtbox2. i hv tried this but it is not working. can anyone provide me the all the codes which are required to do this function.</p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { $("#txtTitle").blur(function() { QuestionSuggestions(); }); }); function QuestionSuggestions() { var s = $("#txtTitle").val(); if (s.length &gt; 2) { document.title = s + " - ABC"; $("#questionsuggestions").load("QuestionList.aspx?title=" + escape(s)); } } &lt;/script&gt; </code></pre>
c# asp.net jquery
[0, 9, 5]
3,635,892
3,635,893
Alternative to jQuery ready() for detecting that the page anchor in the URL changes
<p>Does anyone know how to get a page load event to fire if the page anchor in the URL changes, i.e., going from </p> <pre><code>http://mywebsite.com/#test1 to http://mywebsite.com/#test2 </code></pre> <p>when using the Back button?</p> <p>I tried the code at the bottom (the <code>history.navigationMode</code> line along with the <code>ready()</code> function insures that the onload event fires even when the browsers Back button is used), but it doesn't work if only the page anchor portion of the URL changes and the Back button is used. I know this code works if the URL changes it's query string (or the URL points to a new file/folder) because I use this all the time but it looks like jQuery's ready() function doesn't fire when the Back button is used if only the page anchor location in the URL changes.</p> <p>I'm trying to come up with a solution for making the browser's Back button preserve JavaScript/AJAX manipulations of the page and I'm basing my attempt on this person's idea: <a href="http://www.ajaxonomy.com/2008/web-design/a-better-ajax-back-button-part2" rel="nofollow">http://www.ajaxonomy.com/2008/web-design/a-better-ajax-back-button-part2</a> but without relying on using a repeating timer to check if the URL page anchor has changed - I would rather check this when the page onload event fires.</p> <p>Any ideas/suggestions? </p> <pre><code>&lt;script language="javascript" type="text/javascript" src="/jquery.js"&gt;&lt;/script&gt; &lt;script language="javascript" type="text/javascript"&gt; history.navigationMode = 'compatible'; $(document).ready( function() { if(document.location.hash){ var hashQueryString = document.location.hash; hashQueryString = hashQueryString.replace("#",""); alert(hashQueryString); } }); </code></pre>
javascript jquery
[3, 5]
3,086,389
3,086,390
Why does my spinner GIF stop while jQuery ajax call is running?
<p>I'm just starting to wean myself from ASP.NET UpdatePanels. I'm using jQuery and jTemplates to bind the results of a web service to a grid, and everything works fine. </p> <p>Here's the thing: I'm trying to show a spinner GIF while the table is being refreshed (à la UpdateProgress in ASP.NET) I've got it all working, except that the spinner is frozen. To see what's going on, I've tried moving the spinner out from the update progress div and out on the page where I can see it the whole time. It spins and spins until the refresh starts, and stays frozen until the refresh is done, and then starts spinning again. Not really what you want from a 'please wait' spinner!</p> <p>This is in IE7 - haven't had a chance to test in other browsers yet. Any thoughts? Is the ajax call or the client-side databinding so resource-intensive that the browser is unable to tend to its animated GIFs?</p> <h3>Update</h3> <p>Here's the code that refreshes the grid. Not sure if this is synchronous or asynchronous.</p> <pre><code>updateConcessions = function(e) { $.ajax({ type: "POST", url: "Concessions.aspx/GetConcessions", data: "{'Countries':'ga'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { applyTemplate(msg); }, error: function(XMLHttpRequest, textStatus, errorThrown) { } }); } applyTemplate = function(msg) { $('div#TemplateTarget').setTemplate($('div#TemplateSource').html()); $('div#TemplateTarget').processTemplate(msg); } </code></pre> <h3>Update 2</h3> <p>I just checked the <a href="http://docs.jquery.com/Ajax/jQuery.ajax#options">jQuery documentation</a> and the <code>$.ajax()</code> method is asynchronous by default. Just for kicks I added this</p> <pre><code>$.ajax({ async: true, ... </code></pre> <p>and it didn't make any difference.</p>
javascript jquery
[3, 5]
15,858
15,859
Setting User language for Localization/Globalization
<p>I need to select the language based on the user choice and set it for the entire session. Can anybody suggest where do i need to do these settings and how can i do this?</p>
c# asp.net
[0, 9]
1,101,035
1,101,036
How to handle touch or press down events in Android?
<p>Alright so i have 4 image views..</p> <p>How can i control what happens when they are pressed down and up</p> <p>So say like:</p> <p>one of the images is press down a textview gets changed to 1 but when they let go of that one the text will change back to 0?</p>
java android
[1, 4]
3,069,840
3,069,841
how to instantiate a listener by reflection in Android
<p>I have to develop an application for Android 1.6 (API 4), which should be able to use the OnAudioFocusChangeListener (available since Android 2.2 - API 8) in the phones with Android 2.2 or later.</p> <p>Anyone can tell me how to instantiate a listener by reflection? I have already managed to run static and also non-static methods by reflection, but I don't know how to do with listeners.</p> <p>This is the listener to reflect:</p> <pre><code>AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); OnAudioFocusChangeListener audioListener = new OnAudioFocusChangeListener() { @Override public void onAudioFocusChange(int focusChange) { // code to execute } }; public void getAudioFocus() { audioManager.requestAudioFocus(audioListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN); } public void releaseAudioFocus() { audioManager.abandonAudioFocus(audioListener); } </code></pre> <p>This is a code example with methods I managed to run by reflection:</p> <pre><code>Class BluetoothAdapter = Class.forName("android.bluetooth.BluetoothAdapter"); Method methodGetDefaultAdapter = BluetoothAdapter.getMethod("getDefaultAdapter"); // static method from the BluetoothAdapter class returning a BluetoothAdapter object Object bluetooth = methodGetDefaultAdapter.invoke(null); Method methodGetState = bluetooth.getClass().getMethod("getState"); // non-static method executed from the BluetoothAdapter object (which I called "bluetooth") returning an int int bluetoothState = (Integer) methodGetState.invoke(bluetooth); </code></pre>
java android
[1, 4]
552,423
552,424
Find Every Instance of "<br />" in a page and remove it with jQuery
<p>I'm working within a template using the Cargo Collective platform and it adds unecessary <code>&lt;br /&gt;</code> tags inside the <code>body</code> of my document. </p> <p>How can I write a line or two of jQuery to search for every <code>&lt;br /&gt;</code> tag on my page and remove them, or replace them with nothing?</p>
javascript jquery
[3, 5]
5,366,901
5,366,902
Save value in PHP Session variable
<p>I have an html table which contains records, comes from mysql db. Each row also contains id (PK) wrt db table record. Now I want to save record id in <strong>PHP Session variable</strong>, when I click on a row. To do this I used <strong>onclick</strong> property for each row &amp; call a javascript function with record id as function parameter &amp; it works fine but how could I save this id in <strong>PHP Session variable</strong> ? Thanks.</p>
php javascript
[2, 3]
4,581,499
4,581,500
Applying Bleed effect to an image using jQuery (or) javascript (or) c# coding
<p>Can any one help me how to apply bleed effect for an image using javascript or jQuery or c-sharp.</p>
c# javascript jquery
[0, 3, 5]
1,723,729
1,723,730
How to get information from realtime springer
<p>Realtime Springer updates information about articles being downloaded right now. I think it's being done jquery but I am not sure how to get this information to my computer automatically.</p>
javascript jquery
[3, 5]
5,776,455
5,776,456
session state of checkbox list
<p>Can you please help me in storing the checkbox list items in session.</p> <p>I have a checkbox list as follows</p> <pre><code>asp:CheckBoxList ID="cblScope" runat="server" onselectedindexchanged="cblScope_SelectedIndexChanged"&gt; asp:ListItem ID="liInScope" runat="server" Value="true"&gt;In Scope (Monitored)&lt;/asp:ListItem&gt; &lt;asp:ListItem ID="liOutOfScope" runat="server" Value="true"&gt;Out of Scope (Unmonitored)&lt;/asp:ListItem&gt; /asp:CheckBoxList&gt; </code></pre> <p>I have to store the value of the checkbox in session when they are cheked.</p>
c# asp.net
[0, 9]
327,552
327,553
JavaScript opening new window instead of tab when command run too early
<p>I realize that you cannot control whether a browser opens a new <em>window</em> vs. a new <em>tab</em>, so this may have no solution.</p> <p>The problem is basically that I run something like:</p> <pre><code>function runCommand() { //... window.open(url); } </code></pre> <p>This runs from time to time if the user presses a special key or clicks. That all works fine, and it will open a new window or tab based on the user's browser settings. Great.</p> <p>The problem is, I also have some code:</p> <pre><code>if (x.property) runCommand(); </code></pre> <p>This will <em>always</em> open a the url in a new <em>window</em>, even though if you use <code>runCommand</code> at some other time on the same page, it will use a tab if that's the user's setting.</p> <p>At first, I thought that it may have had to do with the page not being fully loaded, so I both tried wrapping it in <code>document.ready</code> and also using <code>setTimeout()</code> to some high number (like 5 seconds). Even after doing that, <code>runCommand()</code> will <em>still</em> open a new window on the initial run even though it opens a new tab later on. Has anyone experienced this behavior or know how to fix it?</p> <p><strong>EDIT</strong>: I created a fiddle that showcases the problem. Please excuse the popup: <a href="http://jsfiddle.net/csPGU/" rel="nofollow">http://jsfiddle.net/csPGU/</a></p>
javascript jquery
[3, 5]
1,810,943
1,810,944
Check for values in multidimensional input array
<p>I store values in a multi-dimensional hidden input array that looks like this:</p> <pre><code>&lt;input type="hidden" name="tokens[0][Search_Type]" value="a" /&gt; &lt;input type="hidden" name="tokens[0][Search_Term]" value="123" /&gt; &lt;input type="hidden" name="tokens[1][Search_Type]" value="b" /&gt; &lt;input type="hidden" name="tokens[1][Search_Term]" value="456" /&gt; </code></pre> <p>How can I quickly check whether there is a <code>token</code> with <code>Search_Term</code> = X and <code>Search_Type</code> = Y? If there's a way to do it in one jquery line rather than in a loop that'd be awesome.</p>
javascript jquery
[3, 5]
1,898,278
1,898,279
How to get the http://www.blbah.com part of the url in javascript?
<p>My url on a page is like:</p> <pre><code>http://www.example.com/dir1/file.html?a=1 </code></pre> <p>I need to extract:</p> <pre><code>http://www.example.com </code></pre> <p>how can I do this in javascript?</p>
javascript jquery
[3, 5]
5,467,680
5,467,681
How to get the text after the # symbol in a link?
<p>I have a simple link with a hashtag in it. ie:</p> <pre><code>&lt;a class="page_navigation" href="#something"&gt;click&lt;/a&gt; </code></pre> <p>On clicking this, I would like to just end up with the 'something' part (minus the hash) in a var.</p> <p>So far I have</p> <pre><code>$('.page_navigation').click(function(e) { e.preventDefault(); var href = $(this).attr('href'); }); </code></pre> <p>Obviously I just end up with '#something' in my href var with the above code, and I understand I could do some kind of regex (not sure how yet) to strip the #, but I wonder if there is an easier way to access this part of the href I'm unaware of, without having to go through some find and replace code.</p> <p>Any ideas?</p> <p>Note: I also know I could store the 'something' in a data tag, but I'm trying to keep this code as DRY as possible.</p>
javascript jquery
[3, 5]
1,129,124
1,129,125
ASP..NET Hod to hide a Div before Page is loaded?
<p>I have a div on my page - I'd like when that page is being loaded tthat Div is being hidden by jQuery's .hide method. Now I have that when a page is ready then that div is hiding - but that hiding is visible. I don't want that</p> <p>Now I have that code:</p> <pre><code>$(document).ready(function(event) { $('#Div1').hide('fast'); }); </code></pre>
asp.net jquery
[9, 5]