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
5,967,201
5,967,202
Enable/Disable Submit Button based on radio buttons
<p>I have a form layed out like this: </p> <pre><code>&lt;form action="join-head-2-head.php" method="POST" enctype="application/x-www-form-urlencoded"&gt; &lt;table border="0" cellspacing="4" cellpadding="4"&gt; &lt;tr&gt; &lt;td colspan="2"&gt;&lt;input name="player1rules" type="radio" id="tandcy" value="y" /&gt; &lt;label for="tandcy"&gt;I Have Reviewed The Rules And The Terms &amp;amp; Conditions And Agree To Abide By Them&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="2"&gt;&lt;input name="player1rules" type="radio" id="tandcn" value="n" checked="checked" /&gt;&lt;label for="tandcn"&gt;I Do Not Agree To The Terms And Condtions And/Or Have Not Read The Rules&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="100"&gt;&lt;input name="player1" type="hidden" value="&lt;? $session-&gt;username; ?&gt;" /&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="submit" name="join" id="join" value="Take Available Slot" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>What I am hoping to do is disable the submit button if id="tandcn" is selected, and enable it when id="tandcy". Is there an easy way to do that using javascript?</p>
php javascript jquery
[2, 3, 5]
1,083,492
1,083,493
How to convert Int to constant for res/raw?
<pre><code> InputStream inputStream = getResources().openRawResource(R.raw.ac); </code></pre> <p>here, ac is constant file name from res/raw.</p> <pre><code>int books = cursor.getColumnIndexOrThrow(DictionaryDatabase.BOOK_DETAILS) </code></pre> <p>is an int contains name: ac also.</p> <p>Is it possible to use </p> <p><code>InputStream inputStream = getResources().openRawResource</code>(<strong>Int books</strong>); ???</p> <p>If yes how??</p>
java android
[1, 4]
5,617,539
5,617,540
Getting loop to work in my script
<p>I basically want this loop to produce random spaces in a grid I am developing, but cannot get it to work in my script.</p> <p>I have the correct loop I just can't get it to work with the rest of my script</p> <p>I have just edited and it still doesn't work, any other ideas? </p> <pre><code> var listOfWords = {}; var ul = document.getElementById("wordlist"); var i; for(i = 0; i &lt; ul.children.length; ++i){ listOfWords[ul.children[i].getAttribute("data-word")] = { "pic" : ul.children[i].getAttribute("data-pic"), "audio" : ul.children[i].getAttribute("data-audio") }; } console.log(listOfWords); var chosenWords = new Array(); for(var x = 0; x &lt; 6; x++) { var rand = Math.floor(Math.random() * (listOfWords.length+1)); chosenWords.push(listOfWords[rand]); if (chosenWords.length &lt; 12){ chosenWords.push(' '); } } var shuffledWords = Object.keys(listOfWords).slice(0).sort(function() { return 0.5 - Math.random(); }).slice(0, 6); var guesses = {}; console.log(shuffledWords); var tbl = document.createElement('table'); tbl.className = 'tablestyle'; var wordsPerRow = 2; for (var i = 0; i &lt; Object.keys(shuffledWords).length - 1; i += wordsPerRow) { var row = document.createElement('tr'); for (var j = i; j &lt; i + wordsPerRow; ++j) { var word = shuffledWords[j]; guesses[word] = []; for (var k = 0; k &lt; word.length; ++k) { var cell = document.createElement('td'); $(cell).addClass('drop').attr('data-word', word); cell.textContent = word[k]; row.appendChild(cell); } } tbl.appendChild(row); } document.body.appendChild(tbl); </code></pre> <p>Thanks</p>
javascript jquery
[3, 5]
3,278,782
3,278,783
When clicking on on the LI then automatically click on input radio
<p>When you click on li, I want input radio to be clicked.</p> <p>However, I am getting an error from conole log saying:</p> <pre><code>Uncaught RangeError: Maximum call stack size exceeded </code></pre> <p>How to fix this?</p> <p>Here the html code:</p> <pre><code> &lt;ul class="Method"&gt; &lt;li class="shipping_today active"&gt; &lt;label&gt; Label 1 &lt;/label&gt; &lt;input value="shipping_today" name="shipping" type="radio" /&gt; &lt;/li&gt; &lt;li class="shipping_next_month"&gt; &lt;label&gt; Label 2 &lt;/label&gt; &lt;input value="shipping_next_month" name="shipping" type="radio" /&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Jquery:</p> <pre><code>$(".Method li").click(function() { var thisLi = $(this); var radio = $(this).find("input:radio"); if (radio.val() == "shipping_today") { $(".Method li").eq(1).removeClass("active"); $(this).addClass("active"); } if (radio.val() == "shipping_next_month") { $(".Method li").eq(-2).removeClass("active"); $(this).addClass("active"); } radio.click(); //problem here... }); </code></pre> <p>Is my jQuery code good? what can be improved?</p> <p>thanks.</p>
javascript jquery
[3, 5]
3,048,097
3,048,098
It is my life's ambition to get this jQuery to work
<p>I'm trying to write some jQuery for my first-ever mobile version of a particular page. If I detect a small browser size, I'm showing only a list of articles. Once a user clicks on an article, I want the list to minimize and the article to be shown in the main content. I'm trying to do this by hiding the list when an article is clicked on, but I can barely get beyond the basic step of making the page to anything at all. Here's my attempt to merely put a border around the article list on mouseover: </p> <pre><code>&lt;script&gt; if( $(window).width() &lt; 481 &amp;&amp; $(window).width() &gt; 0 ) { $("div.st_tabs_container").mouseover(function () { alert("asdfasd"); $("div.st_tabs_container").css("border", "3px double red"); alert("swear words"); }); } else { } &lt;/script&gt; </code></pre> <p>The only way I can get this to do anything, at all, is by writing ("*").mouseover(function){ . If I'm selecting everything, the mouseover will work and the st_tabs_container will get a red border and the alerts will go off. If I try to select anything else (.i.e $("div.st_tabs_container") ) it does not work. Can anyone explain this? I'm sure it's something simple, but I am not getting it. To make matters worse, the actual element I need to do things on click is div.st_vertical ul.st_tabs a.st_tab_active . I have had no luck writing code that selects that. Any and all wisdom would be much appreciated!</p>
javascript jquery
[3, 5]
4,965,283
4,965,284
Referencing a drop down menu in jQuery from ASP.NET
<p>This is a newbie question. I've been using jQuery for a day or so.</p> <p>I simply want to capture each change in a drop down menu.</p> <p>Here's my drop down menu and reference:</p> <pre><code> &lt;script src="Scripts/insertRootCauseElements.js" type="text/javascript"&gt;&lt;/script&gt; &lt;asp:DropDownList ID="DropDownListRootCause" runat="server" &gt; &lt;/asp:DropDownList&gt; </code></pre> <p>Here's my handler:</p> <pre><code> $(document).ready(function () { // var selectedValue = $('#DropDownListRootCause').selectedValue; //var selectedIndex = $('#DropDownListRootCause').selectedIndex; alert("HERE"); $('#DropDownListRootCause').change(function () { alert("Changed " + $('#DropDownListRootCause').selectedIndex); }) .change(); // if ($('#DropDownListRootCause').change) { // alert("dd change " + selectedIndex); // } }) </code></pre> <p>I've tried a lot of variations but nothing is working for me. On debugging, it seems my jQuery doesn't know what "DropDownListRootCause" is. </p> <p>I set AutoPostBack=true in my dd control which finds my jQuery but</p> <pre><code>$('#DropDownListRootCause').change(function () { alert("Changed " + $('#DropDownListRootCause').selectedIndex); }) </code></pre> <p>Still evals to false.</p> <p>I added DropDownListRootCause to 'Watch' when debugging which reveals 'DropDownListRootCause' is undefined'. I've tried double and single quotes but no luck.</p> <p>It must be something simple but I can't see it. Can someone help?</p>
jquery asp.net
[5, 9]
807,290
807,291
Formatting string in Java
<p>Hi I'm new to java so this is going to seem a bit tame. Anyway, in objC, when I want to insert a variable into a string, I would do it like this:</p> <pre><code>NSString *string = [NSString stringWithFormat:@"test%i", variable]; </code></pre> <p>How do I do this in java?</p>
java android
[1, 4]
4,532,588
4,532,589
Usercontrol doesnt support Webmethod?
<p>I want to call a Scriptmanager webmethod in usercontrol. But Webusercontrol does not support WebMethod. Can it be achieved by Jquery Ajax or any other way?</p>
javascript jquery asp.net
[3, 5, 9]
2,204,968
2,204,969
Gowalla java-android, get access token?
<p>please give me tutorial about How to use OAuth2 and Checkin with gowalla-java. <a href="http://code.google.com/p/gowalla-java/wiki/OAuth2Example" rel="nofollow">http://code.google.com/p/gowalla-java/wiki/OAuth2Example</a> i don't understand how to Request Authorization, The callback code , and get acsess token.</p> <p>thanks</p>
java android
[1, 4]
1,373,146
1,373,147
Fileupload Data Loses when checkbox is checked?
<p>any help Please.How can I fix problem like when ever I check check box at that time file path is losing from file upload. How can I retain the vlue of my fileupload ? I am using asp.net c#</p>
c# asp.net
[0, 9]
4,151,161
4,151,162
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]
2,977,461
2,977,462
Make button with function in jquery?
<p>I am trying to make a button with click function to run my jquery:</p> <pre><code>Function tester(){alert("test")} </code></pre> <p>My raw html button code is:</p> <pre><code>&lt;button class="t1" id="52" onClick="tester()"&gt;sometext&lt;/button&gt; </code></pre> <p>But i want to make the button using just jquery code...</p> <p>How can I make this button with jquery?</p>
javascript jquery
[3, 5]
685,230
685,231
Android Debugging InetAddress.isReachable
<p>I am trying to figure out how to tell if a particular ipaddress is available in my android app during debugging ( I haven't tried this on an actual device ).</p> <p>From reading it appears that InetAddress.isReachable should do this for me.</p> <p>Initially I thought that I could code something like:</p> <p>InetAddress address = InetAddress.getByAddress( new byte[] { (byte) 192, (byte) 168, (byte) 254, (byte) 10 ); success = address.isReachable( 3000 );</p> <p>This returns false even though I am reasonably sure it is a reachable address.</p> <p>I found that if I changed this to 127, 0, 0, 1 it returned success.</p> <p>My next attempt was same code, but I used the address I got from a ping of www.google.com ( 72.167.164.64 as of this writing ). No success.</p> <p>So then I tried a further example:</p> <pre><code>int timeout = 2000; InetAddress[] addresses = InetAddress.getAllByName("www.google.com"); for (InetAddress address : addresses) { if ( address.isReachable(timeout)) { success = true; // just set a break point here } } </code></pre> <p>I am relatively new to Java and Android so I suspect I am missing something, but I can't find anything that would indicate what that is.</p>
java android
[1, 4]
779,681
779,682
Make flashlight app work when the application is closed
<p>I have this code that allows me to press a button to turn on my phones flashlight. What would be the best way to keep the light on, while the application is closed? I heard asynctask is good, but I read that it's meant for a background task that will communicate with the UI. What kind of "thread" should I use for this type of "application".</p> <p>My onClickListener code:</p> <pre><code>button.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { //If Flag is set to true if (isFlashOn) { Log.i("info", "torch is turned off!"); //Set the flashmode to off p.setFlashMode(Parameters.FLASH_MODE_OFF); //Pass the parameter ti camera object camera.setParameters(p); //Set flag to false isFlashOn = false; //Set the button text to Torcn-ON button.setText("Torch-ON"); } //If Flag is set to false else { Log.i("info", "torch is turned on!"); //Set the flashmode to on p.setFlashMode(Parameters.FLASH_MODE_TORCH); //Pass the parameter ti camera object camera.setParameters(p); //Set flag to true isFlashOn = true; //Set the button text to Torcn-OFF button.setText("Torch-OFF"); } }}); } </code></pre>
java android
[1, 4]
478,365
478,366
Local class definitions: why does this work
<p>Why does the following style of code work:</p> <pre><code>BroadcastReceiver receiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { //do something based on the intent's action } } </code></pre> <p>I would expect it to be:</p> <pre><code>private class MyBroadcastReceiver extends BroadcastReceiver () { public void onReceive(Context context, Intent intent) { //do something based on the intent's action } } MyBroadcastReceiver receiver = new MyBroadcastReceiver(); </code></pre> <p>In the 1st code piece above, how does the compiler know that <code>receiver</code> is of type <code>MyBroadcastReceiver</code> and not <code>BroadcastReceiver</code>? Isn't this ambiguous? Why is this allowed?</p> <p>If I define:</p> <pre><code>BroadcastReceiver receiver2 = new BroadcastReceiver(); </code></pre> <p>Now is <code>receiver == reciver2</code>?</p> <p><strong>EDIT:</strong><br> BroadcastReceiver <a href="http://developer.android.com/reference/android/content/BroadcastReceiver.html" rel="nofollow">http://developer.android.com/reference/android/content/BroadcastReceiver.html</a></p>
java android
[1, 4]
4,870,411
4,870,412
ConfigurationSection with multiple projects
<p>In my asp.net solution i have a couple of class library-projects that act as modules of the site.<br> In main project I have SiteConfigurationSection class that derives from ConfigurationSection. </p> <p>I want all projects to be able to access and use this SiteConfigurationSection.<br> But class library projects can't access it because they obviously don't have a reference to the website itself.</p> <p>Should create a special library-project for SiteConfigurationSection of maybe it's better to create a mini SiteConfigurationSection class in every project and encapsulate only the needed values?</p>
c# asp.net
[0, 9]
5,480,168
5,480,169
Concerned with datalist
<p>I have a datalist. My designer code is like this.</p> <pre><code>&lt;asp:DataList ID="dlView" runat="server" CssClass="basix" RepeatColumns="4" &gt; &lt;ItemTemplate&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:Image ID="imgPlan" runat="server" ImageUrl='&lt;%#GetImage(Eval("ImageName")) %&gt;' /&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:LinkButton ID="lnkChangeLogo" runat="server" Text="ChangeLogo" CommandName="Select"&gt; &lt;/asp:LinkButton&gt;&amp;nbsp; &lt;asp:LinkButton ID="lnkRemoveLogo" runat="server" Text="RemoveLogo" OnClientClick="javascript:ConfirmChoice();return false;"/&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:FileUpload ID="FileUpload1" runat="server" /&gt; &lt;asp:Button ID="btnUpload" runat="server" Text="Upload"/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/ItemTemplate&gt; &lt;/asp:DataList&gt; </code></pre> <p>When I click btnUpload, I want to call one function in javascript, suppose its uploadimages(). I have to pass Eval("ImageName") in imgPlan, and ImageName also to javascript. How can I do that?</p>
javascript asp.net
[3, 9]
3,916,582
3,916,583
count of tr with style property empty
<p>Here is my html</p> <pre><code>&lt;table id="tbl1"&gt; &lt;tbody &gt; &lt;tr class="hide_grid_header"&gt;&lt;/tr&gt; &lt;tr style="display: none;"&gt;&lt;/tr&gt; &lt;tr style="display: none;"&gt;&lt;/tr&gt; &lt;tr &gt;&lt;/tr&gt; &lt;tr style=""&gt;&lt;/tr&gt; &lt;tr &gt;&lt;/tr&gt; &lt;tr style=""&gt;&lt;/tr&gt; &lt;tr &gt;&lt;/tr&gt; &lt;tr style="display: none;"&gt;&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>From this, I want count of tr which dont have style property OR with style=" " property.</p> <p>i'm using below code, but its giving me count as 8 instead of 5.</p> <pre><code> var docs = jQuery("#tbl").find('tbody').find('tr:visible'); alert(docs.length); </code></pre>
javascript jquery
[3, 5]
3,017,214
3,017,215
Php: Detect if user included the javascript-snippet or not, on their website
<p>I got a simple javascript-file, wich my users need to include on their website for example. I want to detech if the snippet is include or not. The way I'm going to detect it, is by using a unique key in the js-file, for anyone who needs to know.</p> <p>Been searching a lot for this, but haven't come up with any results yet.</p>
php javascript
[2, 3]
958,986
958,987
Different ways of saying document ready in jQuery?
<p>Are these both the same thing, i.e. ways of saying document ready:</p> <pre><code>$(function() { // }); </code></pre> <p>and </p> <pre><code>$(function($) { // })(jQuery); </code></pre> <p>or is there a difference between the two, if so then when should I use which?</p>
javascript jquery
[3, 5]
5,408,701
5,408,702
How can I validate a sentence using PHP and JavaScript?
<p>I am currently trying to validate if the sentence a user enters matches the expected sentence. The expected sentence is stored in a PHP variable <code>$rebuiltSentence</code>, for example 'the cat sat'.</p> <p>The problem is that when I try to call my JavaScript function <code>formSubmit()</code> I need to give it the sentence to check, therefore ideally I would call formSubmit($rebuiltSentence). I think this won't work because it thinks it is being passed several separate strings.</p> <p>Here is what I've got:</p> <pre><code>//sentence.php &lt;input type='button' value='Submit' onClick=formSubmit('$rebuiltSentence') </code></pre> <p>and</p> <pre><code>//validate.js function formSubmit(correct) { var contents = document.getElementById('sentenceBuilder').value; if(contents==correct){ alert('The Sentences Match'); }else{ alert('The Sentences Dont Match'); } window.location.reload(true); } </code></pre> <p>Any ideas how I can solve this?</p>
php javascript
[2, 3]
4,754,353
4,754,354
Counting table row tags in text
<p>I'm trying to count how many starting table row tags <code>&lt;tr&gt;</code> that would be in the following text. Keep in mind that I said text, not html. I get this data back in a textarea (don't ask) and I need to count how many starting tr tags are in this textarea. How would I do that? Whats the appropriate method in jquery to achieve this?</p> <pre><code>&lt;textarea name='details' id='details'&gt; &lt;table&gt; &lt;tbody&gt; &lt;tr&gt; &lt;th&gt;&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;th&gt;&lt;/th&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/textarea&gt; </code></pre>
javascript jquery
[3, 5]
3,385,641
3,385,642
How do I get my page to remember user's last action?
<p>We have a search form which allows users to search for items on the page.</p> <p>There is also another form with checkboxes that allows users to refine their searches with the hope of reducing the number of search results.</p> <p>For instance, if I enter McCland on the search box and 13 results marching McCland are returned, I can click on <code>Advanced search</code> and a bunch of checkboxes are rendered.</p> <p>I can then check <code>"Street"</code>, <code>"Road"</code>, <code>"LandMarks"</code>, etc. I can then click search on McCland again.</p> <p>This time, only addresses with Street or Road or LandMarks will be displayed if available.</p> <p>This works great.</p> <p>Then there is a <code>Remember This Action</code> icon.</p> <p>My biggest challenge so far is to allow users to click on this <code>Remember This Action</code> icon and save their current results.</p> <p>This way, next time they visit the page, the results they searched for previously are presented to them unless they choose to search with another option.</p> <p>If they click on this <code>Remember This Action</code> icon, they will be prompted with a message explaining that they are about to save their current Results.</p> <p>They can click Yes to save or Cancel to not save.</p> <p>I suspect this will be done with cookies(jquery or Javascriot) but I am not sure how to do this.</p> <p>Any assistance is greatly appreciated.</p>
javascript jquery
[3, 5]
2,634,394
2,634,395
android If else statements
<p>So my issue is, I get a wierd sound problem (it repeats the hit sound really fast) when I use an if statement to determine if I hit the monster and lived or if I hit the monster and died. Using classic mario logic, if I land on top I live, if not then I die. I didn't have a problem until I added two different if statements. If you need more info let me know. I think my problem is how I am using the if statement.</p> <pre><code>private void checkGhostCollisions() { int len = ghosts.size(); for (int i = 0; i &lt; len; i++) { Ghost ghost = ghosts.get(i); if (hero.position.y &lt; ghost.position.y) { if (OverlapTester.overlapRectangles(ghost.bounds, hero.bounds)) hero.hitGhost(); listener.hit(); } else { if(hero.position.y &gt; ghost.position.y) if (OverlapTester.overlapRectangles(hero.bounds, ghost.bounds)) { hero.hitGhostJump(); listener.jump(); break; } } } } </code></pre>
java android
[1, 4]
408,274
408,275
Webform_SaveScrollPositionSubmit is not defined
<p>Cut a short story even shorter, Have a asp.net page with MaintainScrollPositionOnPostback="true" in the page directive (And I tried setting the same to true in page_load), but I get the above javascript error (Webform_SaveScrollPositionSubmit is not defined) and im guessing the page dosent scroll because that js function is "not defined"...</p> <p>Using asp.net 2.0 and firefox 3...dosent work in internut exploader too. Have tried running aspnet_regiis -c, but no joy...</p>
asp.net javascript
[9, 3]
2,078,856
2,078,857
Php Validation for TextArea Number of Lines Limitation
<p>I have this wonderful piece of code from <a href="http://stackoverflow.com/questions/556767/limiting-number-of-lines-in-textarea?rq=1">here</a></p> <p>But if some one edits the form through firebug or disable the js then this wont work, I want to have server side validation for this function, can anyone direct me to the right path please</p>
php jquery
[2, 5]
398,628
398,629
Beautiful Soup [Python] and the extracting of text in a table
<p>i am new to Python and to Beatiful Soup also! I heard about BS. It is told to be a great tool to parse and extract content. So here i am...: </p> <p>I want to take the content of the first td of a table in a html document. For example, i have this table</p> <pre><code>&lt;table class="bp_ergebnis_tab_info"&gt; &lt;tr&gt; &lt;td&gt; This is a sample text &lt;/td&gt; &lt;td&gt; This is the second sample text &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>How can i use beautifulsoup to take the text "This is a sample text"? I use soup.findAll('table' ,attrs={'class':'bp_ergebnis_tab_info'}) to get the whole table.</p> <p>Thanks... or should i try to get the whole stuff with Perl ... which i am not so familiar with. Another soltion would be a regex in PHP. </p> <p>See the target [1]: <a href="http://www.schulministerium.nrw.de/BP/SchuleSuchen?action=799.601437941842&amp;SchulAdresseMapDO=142323" rel="nofollow">http://www.schulministerium.nrw.de/BP/SchuleSuchen?action=799.601437941842&amp;SchulAdresseMapDO=142323</a></p> <p>Note; since the html is a bit invalid - i think that we have to do some cleaning. That can cause a lot of PHP code - since we want to solve the job in PHP. Perl would be a good solution too. </p> <p>Many thanks for some hints and ideas for a starting point zero</p>
php python
[2, 7]
4,978,240
4,978,241
calculating the number of first level UL LI in a page using jquery
<p>I have some jquery which will calculate the items in my menu and assign the li with a calculated width in px. </p> <p>here is the code:</p> <pre><code>$(document).ready(function(){ $('div#new-menu-lower ul li').css('width', ($('div#new-menu-lower ul').width() / $('div#new-menu-lower ul li').length)); $(function() { var menuWidth = $('div#new-menu-lower ul').width(); var listItems = $('div#new-menu-lower ul li').length; var itemWidth = Math.floor(menuWidth * (1/listItems)) - 40; $('div#new-menu-lower ul li').css('width', itemWidth); }); }); </code></pre> <p>The problem is <code>listItems</code> shows up as 38 items and it seems to calculate every single li which is wrong. It should just count the first ul li's NOT the child elements.</p> <p>Is there anything i can do to stop this happening?</p>
javascript jquery
[3, 5]
1,762,861
1,762,862
Error in sending fax
<p>I use the following code for sending a FAX:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { FaxDocument(@"E:\ss.doc", "04428257363"); } } public int FaxDocument(String TheFile, string faxnumber) { int JobID = 0; FAXCOMEXLib.FaxServer faxsrv = new FAXCOMEXLib.FaxServerClass(); try { faxsrv.Connect(Environment.MachineName); FaxDocumentClass faxdoc = new FAXCOMEXLib.FaxDocumentClass(); //*** How can I add 2 or more attachments to my fax Body with the use of one coverpage? faxdoc.Body = @"E:\ss.doc"; //****************************************************************************************** faxdoc.Priority = FAX_PRIORITY_TYPE_ENUM.fptNORMAL; faxdoc.CoverPageType = FAXCOMEXLib.FAX_COVERPAGE_TYPE_ENUM.fcptLOCAL; faxdoc.CoverPage = "TestCoverPage"; faxdoc.ScheduleType = FAXCOMEXLib.FAX_SCHEDULE_TYPE_ENUM.fstNOW; faxdoc.DocumentName = "Fax Transmission"; faxdoc.Recipients.Add(faxnumber, "Lexicon"); faxdoc.AttachFaxToReceipt = false; faxdoc.Note = "Here is the info you requested"; faxdoc.Subject = "Today's fax"; faxdoc.ConnectedSubmit(faxsrv); } catch (Exception ex) { Response.Write(ex.Message); } finally { faxsrv.Disconnect(); } return JobID; } } However, I get the following error: Retrieving the COM class factory for component with CLSID {CDA8ACB0-8CF5-4F6C-9BA2-5931D40C8CAE} failed due to the following error: 80040154. </code></pre> <p>Any help into solving this error is greatly appreciated.</p>
c# asp.net
[0, 9]
464,064
464,065
How to use PagerAdapter
<p>im trying to use PagerAdapter in my android application but im having difficulty with knowing where to place my code correctly. Its loading the views (xml files) correctly but not sure what code is meant to go were and anywere i have tried just makes the application crash (I know the code works fine because i have it working on standalone pages) - ive been on the android development page but its not very clear to me. Many thanks (sorry if its a stupid question but no idea)</p> <p>pivate class MyPagerAdapter extends PagerAdapter {</p> <pre><code> public int getCount() { return 3; } public Object instantiateItem(View collection, int position) { LayoutInflater inflater = (LayoutInflater) collection.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); int resId = 0; switch (position) { case 0: resId = R.layout.left; break; case 1: resId = R.layout.middle; break; case 2: resId = R.layout.right; break; } View view = inflater.inflate(resId, null); ((ViewPager) collection).addView(view, 0); return view; } @Override public void destroyItem(View arg0, int arg1, Object arg2) { ((ViewPager) arg0).removeView((View) arg2); } @Override public void finishUpdate(View arg0) { // TODO Auto-generated method stub } @Override public boolean isViewFromObject(View arg0, Object arg1) { return arg0 == ((View) arg1); } @Override public void startUpdate(View arg0) { // TODO Auto-generated method stub } </code></pre> <p>}</p>
java android
[1, 4]
997,807
997,808
How to see if an element in offscreen
<p>I have a list of divs, and everytime I want to go to the next div I press a key. I need to check if that div is offscreen, and if so, I need to move the screen to show that div either using anchors or another method.</p> <p>What is my best option for doing this?</p> <p>Just to clairify, offscreen in my case means something that can't be seen right now without scrolling down. So if you are on the StackOverflow Home Page at the top, the last question on the entire page is offscreen.</p>
javascript jquery
[3, 5]
1,326,464
1,326,465
Convert data- string into an object?
<p>Thinking along the lines of using language resources (especially in SharePoint), I want to bind the text of my HTML tags to a value in one of my resource JavaScript objects (SharePoint has a handler that will do this). I would like to do something like this:</p> <p>HTML: </p> <p><code>&lt;div id="helloMessage" data-stringResource="helloString" /&gt;</code></p> <p>JS: </p> <pre><code> $('div').each(function() { $(this).text(SP.Publishing.Resources. + $(this).attr('data-stringResource')); }); </code></pre> <p>Ideally, what I would want that to is in that text function pass in <code>SP.Publishing.Resources.helloString</code>. I think I can use <code>eval()</code> to accomplish this, but I read everywhere it's evil. Is there anything I can do?</p>
javascript jquery
[3, 5]
3,095,357
3,095,358
The type or namespace name 'function' could not be found?
<p>I am writing a function proc in my C# 2008 ASP.Net application and I get the following error:</p> <blockquote> <p>The type or namespace name 'function' could not be found (are you missing a using directive or an assembly reference) ?</p> </blockquote> <p>Any idea what this means?</p>
c# asp.net
[0, 9]
4,731,167
4,731,168
Highlight Arrival Date to Departure Date Asp Calendar
<p>How can i highlight Dates from StartDate to EndDate using asp Calendar C#</p> <p>when i first Click a Date to Calendar it will be the first Date and when i Click another Date i will be the last Date and highlights the Date</p> <p>from StartDate to EndDate</p> <p>this is the example <a href="http://reservations.directwithhotels.com/reservation/selectDates/171" rel="nofollow">http://reservations.directwithhotels.com/reservation/selectDates/171</a></p> <p>when he click first it will be the Arrival then when he clicks a date again it will be the Departure and its highlight all the date between Arrival and Departure Date</p> <p>anyone knows how to do it int ASP Calendar C#?</p>
c# asp.net
[0, 9]
3,961,957
3,961,958
How jQuery do "fade" in IE8 and below?
<p>I just wanted to know how jQuery can generate a fade effect in IE browsers when they don't support <code>opacity</code>? Animating <code>opacity</code> is the way they do the fade in other browsers like Firefox and Chrome. I went into the code but honestly I couldn't find anything understandable to me!</p>
javascript jquery
[3, 5]
4,309,603
4,309,604
javascript sliding div left/right
<p>Hy guys! I want to make a slide toggle effect of a div. Below is the code in my html file. My div is 500px wide by 50px height. I want to make it slide left/right over the screen when pressed on the first image inside the div. This is a toolbox that contains a couple of icons inside. The first image at the left - left.jpg should be a swop image(some kind of button - this is an arrow pointing left and after moving the div this arrow should point right - I mean the picture should be changed). I looked over the web and saw different examples with jQuery but could not find the exact solution for my needs. I know this is a great community and hope that somebody will help to deal with this! Thank you in advance!!!</p> <pre><code>&lt;script&gt; $(function(){ $("#clicky").click(function(){ $("#slide").animate({marginLeft:'500px'},'slow'); }); }); &lt;/script&gt; &lt;div id="slide"&gt; &lt;img id="clicky" src="left.jpg" width="15" height="15" /&gt; Div Content here...&lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
2,178,712
2,178,713
NoSuchMethodError: String.isEmpty
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4396844/scala-on-android-java-lang-nosuchmethoderror-java-lang-string-isempty">Scala on Android: java.lang.NoSuchMethodError: java.lang.String.isEmpty</a> </p> </blockquote> <p>I've just released a new app on Android</p> <p>I've optimized and obfuscated the code with proguard and tested extensively on my Anroid 2.3.3 phone. It works all right.</p> <p>However, I keep getting really strange crash reports in the developer console, such as </p> <pre><code>java.lang.NoSuchMethodError: java.lang.String.isEmpty </code></pre> <p>Isn't <code>String.isEmpty()</code> a framework function on all Android devices?</p>
java android
[1, 4]
872,391
872,392
Android and calling JavaScript. Partial execution :)
<p>There is a problem that may be you can help me with.</p> <p><strong>What I used to have:</strong></p> <p>1) A web page with &lt; div >, javascript array with content, 2 images representing forth and back buttons. When user presses on a button a simple function is executed: increment/decrement a counter, find div by id, assign a content from array. Very easy, always worked </p> <p>2) And app which just a webview to load the webpage from 1)</p> <p><strong>What I wanted to make</strong></p> <p>1) Add gesture recongnition to my app and on fling - directly call javasctipt functions from my webpage (functions used to be called from a button press)</p> <p>2) hide buttons on a webpage</p> <p><strong>What I got</strong></p> <p>1) Fling always worked</p> <p>2) Javascript always called</p> <p>3) the counter in the functions always increased/decresed</p> <p>4) BUT: the content of div not always updated. in 90% it works, but in 10% it seems like fling did not work. If you keep flinging - then div will be update but there will be a jump. Just with the correct number of "failed" flings performed.</p> <p>I was trying to add "debug facility": add callback from webpage to my app at the bottom fo the functions - it works. I am sure that the functions are being executed completely.</p> <p>But why the hell div is not always updated?!</p> <p>Known issue? </p>
javascript android
[3, 4]
4,178,095
4,178,096
Disable the asp button after first click because it save multiple records in slow connection
<pre><code>&lt;asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" Text="Update" CssClass ="btn" ToolTip="Update" Width="58px" /&gt; </code></pre> <p>`This is my code for button, want to use javascript..help plz</p>
c# javascript
[0, 3]
3,642,164
3,642,165
How to decrypt a .net encypted string in php
<p>I am Encrypting a string in c# and sending this to a php page like this.</p> <pre><code>sfplr.Attributes.Add("href", "http://sml.com.pk/a/sfpl/reports.php?id=" + Convert.ToBase64String(Encoding.Unicode.GetBytes(emailid))); </code></pre> <p>and the url genrated from this code is like this</p> <pre><code>http://sml.com.pk/a/sfpl/reports.php?id=bQBhAGwAaQBrAC4AYQBkAGUAZQBsAEAAcwBoAGEAawBhAHIAZwBhAG4AagAuAGMAbwBtAC4AcABrAA== </code></pre> <p>Now I want to decrpyt again this <code>bQBhAGwAaQBrAC4AYQBkAGUAZQBsAEAAcwBoAGEAawBhAHIAZwBhAG4AagAuAGMAbwBtAC4AcABrAA==</code> in php o display in php page.Please any one help me to do this</p>
c# php asp.net
[0, 2, 9]
5,515,885
5,515,886
Embed js file in another
<p>How to embed the following inside a js file</p> <pre><code> &lt;script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"&gt;&lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
205,334
205,335
Image content of HashMap won't appear
<p>So i come up with this code </p> <pre><code>Map&lt;Integer, Integer&gt; images = new HashMap&lt;Integer, Integer&gt;(); images.put(1,R.drawable.a); images.put(2,R.drawable.b); images.put(3,R.drawable.c); String[] abcd = {"a","b","c"}; Integer count = 3; for(int inte = 0; inte==count;inte ++ ){ if(strn.get(inte).equalsIgnoreCase(abcd[inte])){ image.setImageDrawable(getResources().getDrawable(images.get(inte))); } } </code></pre> <ol> <li>to put images from drawables to hashmap with integer keys</li> <li>i made an array[] to compare with user input,a for loop to traverse with the content of hashmap and </li> <li>to display the image if the condition is true.</li> </ol> <p>this is the insight of what i want to be done but... now my problem is that the image wont appear prior to my code. i think my question is a bit similar to <a href="http://stackoverflow.com/questions/3871366/how-can-i-loop-thorugth-a-hashtable-keys-in-android">loop through hashtable</a>, or <a href="http://stackoverflow.com/questions/6036413/cant-see-the-contents-of-the-hashmap">Can't See Contents</a> and notice <code>Enumeration</code>, <code>Iterator</code> but can't manage to apply them in my code. can somebody guide me or any suggestion will be fine to solve my problem.</p>
java android
[1, 4]
5,373,271
5,373,272
Yet Another "Object doesn't support this property or method" - jQuery
<p>I just switched my App to run on MVC3 and the Razor view engine, and now I'm getting a JavaScript error. The thing is, nothing has changed on the JavaScript side of things... it worked before.</p> <p>Here's the code</p> <pre><code>&lt;script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var json_region = [{"value":365,"label":"Calgary"},{"value":368,"label":"Canmore"},{"value":393,"label":"Edmonton"}] $(function() { $('#UserRegion').autocomplete({ source: json_region, selectFirst: true, select: function( event, ui ) { $('#RegionID').val( ui.item.value ); $('#UserRegion').val( ui.item.label ); return false; } }); }); &lt;/script&gt; &lt;script type="text/javascript" src="/Extras/urbannow.js/1"&gt;&lt;/script&gt; &lt;script src="/Assets/Scripts/jquery.ui.autocomplete.selectfirst.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="/Assets/Scripts/wmd.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="/Assets/Scripts/showdown.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js"&gt;&lt;/script&gt; &lt;script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"&gt;&lt;/script&gt; &lt;script src="/Assets/Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>And this is erroring </p> <pre><code>$('#UserRegion').autocomplete({ </code></pre> <p>The console says</p> <blockquote> <p>SCRIPT438: Object doesn't support this property or method</p> </blockquote> <p>And I just can't figure this one out.</p>
javascript jquery
[3, 5]
4,764,430
4,764,431
how to convert text file to xml
<p>I want to convert the <code>text file</code> into <code>xml file</code>.I have a large amount of string but i dont want to write in xml directly.</p> <p>So that I have made a text file now i want to convert this </p> <p>text file into xml format but when i am running this file getting no output. here is my </p> <p>code:</p> <pre><code>public void convert() throws Exception { String text[]=new String[10]; FileOutputStream fout = new FileOutputStream("res/values/mysml.xml"); OutputStreamWriter out = new OutputStreamWriter(fout); InputStream in= getAssets().open("myText.txt"); Scanner scn = new Scanner(is); for(int i=0;i&lt;10;i++) text[i]=bin.readLine(); out.write("&lt;?xml version=\"1.0\"?&gt;\r\n"); out.write("&lt;resources&gt;\r\n"); for (int i = 0; i &lt; 10; i++){ out.write("&lt;item&gt;"+text[i]+"&lt;/item&gt;"); } out.write("&lt;/resources&gt;"); out.flush(); out.close(); </code></pre> <p>}</p>
java android
[1, 4]
5,282,759
5,282,760
Error in doing drag and drop
<p>My code is`</p> <pre><code>&lt;script&gt; $(function(){ var xco,yco,sen,ple,pto; document.onmouseup=function(){document.onmousemove=null;}; $(".pcre").mousedown(function(e){sen=$(this); ple=sen.offset().left; pto=sen.offset().top; xco=e.clientX; yco=e.clientY; $(document).mousemove(function(e){fle=ple+e.clientX-xco; fto=pto+e.clientY-yco; sen.css("top",fto); sen.css("left",fle); }); }); });&lt;/script&gt; </code></pre> <p>`When I move the div it moves but on mouseup nothing happens and it keeps on following mouse</p>
javascript jquery
[3, 5]
689,429
689,430
is it a good idea to put all javascript file's content into one file to reduce server request and keep at bottom to increase performance?
<p>I use simple javascripts, jquery library and many plugins , should i make one file for all if yes then what we need to "just copy and paste and code from all file into one in needed order" or any thing else need to be considerd.</p> <p>as stated here <a href="http://developer.yahoo.com/performance/rules.html#num_http" rel="nofollow">http://developer.yahoo.com/performance/rules.html#num_http</a></p> <blockquote> <p>Combined files are a way to reduce the number of HTTP requests by combining all scripts into a single script, and similarly combining all CSS into a single stylesheet. Combining files is more challenging when the scripts and stylesheets vary from page to page, but making this part of your release process improves response times.</p> </blockquote> <p>and this <a href="http://developer.yahoo.com/performance/rules.html#js_bottom" rel="nofollow">http://developer.yahoo.com/performance/rules.html#js_bottom</a></p> <blockquote> <p>The problem caused by scripts is that they block parallel downloads. The HTTP/1.1 specification suggests that browsers download no more than two components in parallel per hostname. If you serve your images from multiple hostnames, you can get more than two downloads to occur in parallel. While a script is downloading, however, the browser won't start any other downloads, even on different hostname</p> </blockquote> <p>It these are god practices then </p> <h2>How to combine multiple javascript ito one without getting any conflict?</h2> <p><strong>Is it just same as i copy all css code from all files into one or it's tricky?</strong></p>
asp.net javascript jquery
[9, 3, 5]
3,860,255
3,860,256
javascript/jquery checkbox comparison using "and"
<p>I have a two checkboxes as follows:</p> <pre><code>&lt;input type="checkbox" name="options_v[]" id="you_pick_v" value="you_pick" /&gt; &lt;input type="checkbox" name="options_v[]" id="owner_picks_v" value="owner_picks" /&gt; </code></pre> <p>I want my javascript function to make another element grey if the boxes are unchecked and black if either box is checked. For some reason, when I try to use "and" or "or" in the if/else statement, my html editor is showing that there is a problem. Am I not allowed to use these comparison operators in javascript? If so, what might you suggest? Sorry if anything that I'm writing is ambiguous. </p> <p>Here is my javascript function:</p> <pre><code>$(document).ready(function() { $('#you_pick_v, #owner_picks_v') .click(function(){ var ypv = $('#owner_picks_v').is(':checked'); var opv = $('#owner_picks_v').is(':checked'); if(ypv == true and opv == true) { alert('both checked'); } </code></pre>
javascript jquery
[3, 5]
5,290,341
5,290,342
event not working in firefox
<p>I have the following function which works fine in chrome:</p> <pre><code>function updateUserID(element) { var username = $("#viewColTasks").val(); var currentEvent = window.event; if (currentEvent.keyCode === 13){ if (username == ''){ $("#viewColTasks").attr("placeholder", "Please enter a valid username"); $("#viewColTasks").val(""); } else{ var text = $(element).val(); changeUserTo = text; socket.emit('getUserID', text); $("#viewColTasks").attr("placeholder", "Viewing " + username + "'s work"); $("#viewColTasks").val(""); } } } </code></pre> <p>is this not supported in FF? I have been researching and it seems something in relation to using e as the event but I haven't managed to get anything working on both chrome and firefox</p> <p>Any ideas?</p>
javascript jquery
[3, 5]
5,755,880
5,755,881
my hover function in jquery it's not working
<p>i am trying to append p tag with some text and i trying to show alert message when hover that p tag content but here it's not working here is my code:<a href="http://jsfiddle.net/sureshpattu/37TUN/" rel="nofollow">code</a></p>
javascript jquery
[3, 5]
2,466,051
2,466,052
Android:Change the z-order of the view
<p>I have many views in my xml, and now I wanna <strong><em>change one view's z order</em></strong> in code in order to bring it to other views' front but <strong>not all</strong> the other views' front.</p> <p>Is there any way to achieve this?</p> <p>Thanks in advance!</p>
java android
[1, 4]
4,983,601
4,983,602
Passing custom objects between activities?
<p>How do I pass custom objects between activites in android? I'm aware of bundles but I can't seem to see any functionality for this in them. Could anyone show me a nice example of this?</p>
java android
[1, 4]
914,654
914,655
What Javascript / jQuery pattern is this to enclosing and hiding everything but still can alter the page?
<p>Did somebody come up with this pattern so it is a famous and well-known pattern? I see this pattern for using Javascript / jQuery, such as in <code>init.js</code>:</p> <pre><code>var Initializations = {}; Initializations = (function($) { function doSomething(i, domElement) { // ... } $(function() { $("#foo").click(function() { // ... }); $(".bar").each(doSomething); }); })(jQuery); </code></pre> <p>So it looks like it can "hide" almost everything from the global scope, avoid conflict if another library also uses <code>$</code> as a variable, and the HTML page can be altered by this code using jQuery. The code does almost nothing to the global scope (except the variable <code>Initializations</code>), and even if there are 2 jQuery versions, and if they can be denoted by 2 variables <code>jQuery142</code> and <code>jQuery161</code>, then the code can be even using 2 jQuery libraries just by changing the last line of the code above to <code>jQuery161</code> (say, if some 3rd party code needs jQuery 1.4.2 and your code has been using jQuery 1.6.1 for new features and/or bug fixes).</p> <p>Can the above code be improved? I am wondering why the extra variable <code>Initializations</code>, why not just:</p> <pre><code>(function($) { function doSomething(i, domElement) { // ... } $(function() { $("#foo").click(function() { // ... }); $(".bar").each(doSomething); }); })(jQuery); </code></pre> <p>?</p>
javascript jquery
[3, 5]
4,869,215
4,869,216
Split Panel using javascript
<p>I'm trying to code a split panel, Left and right. Each will have a button which you can click on and it will toggle that panel, while expanding the other. </p> <p>I am clueless as to where to start off? Is there an example that already does this?</p> <p>Can someone help me out. </p> <p>Thanks</p>
php javascript jquery
[2, 3, 5]
4,749,432
4,749,433
Javascript calling so fast
<p>I have an annoying little issue here. I have code which loads content from page2 and appends it to <code>#content</code>. That works, but sometimes it happens twice, then appends page3 before page2. Thats because in page3, there is just one post, but in page2, 4 posts.</p> <p>How can I make my code wait until the append finishes to run again? Here's my code:</p> <pre><code>$(window).scroll( function(){ if(browserName != "safari") { var curScrollPos = $('html').scrollTop(); } else { var curScrollPos = $('body').scrollTop(); } if(curScrollPos &gt; 218) { $("#sidebar").addClass("open"); } if(curScrollPos &lt; 218) { $("#sidebar").removeClass("open"); } var scrollBottom = $(document).height() - $(window).height() - $(window).scrollTop(); if(scrollBottom == 0) { if(home != 0 || search != 0 || category != 0) { if(currentPage &lt; numPages) { $("#main .loader-posts").fadeIn(); currentPage++; if(search == 1) { var getPostsUrl = "page/"+currentPage+"/?s="+searchTerm; } else { var getPostsUrl = "page/"+currentPage; } $.get(getPostsUrl, function(data) { $("#main .loader-posts").fadeOut( 'slow', function(){ var newPosts = $(data).find("#content").html(); $("#content").append(newPosts); $('#container.tiles').masonry('reload'); }); }); } } else { } } </code></pre>
javascript jquery
[3, 5]
420,194
420,195
string to double
<p>i try to read text from screen and change it to double and it crash</p> <pre><code>public void equesionOperation(int signNum1) { S_numInTV=TV_calcScreen.getText().toString(); S_numUp=TV_calcUp.getText().toString(); D_numIn=Double.parseDouble(S_numInTV); D_numToCalc=Double.parseDouble(S_numUp); switch (signNum1){ case 1: D_sum=D_numIn+D_numToCalc;break; case 2: D_sum=D_numIn-D_numToCalc;break; case 3: D_sum=D_numIn*D_numToCalc;break; case 4: D_sum=D_numToCalc/D_numIn;break; case 5: D_sum=Math.pow(D_numToCalc, D_numIn);break; default: break; } S_sum=(""+D_numToCalc+" "+D_numIn); } </code></pre>
java android
[1, 4]
3,698,112
3,698,113
Split this array in jQuery
<p>I have an array of cities and ID's looking like: </p> <pre><code>Brønderslev|810,Frederikshavn|813,Hjørring|860,Jammerbugt|849,Læsø|825,Mariagerfjord|846,Morsø|773,Rebild|840,Thisted|787,Vesthimmerland|820,Aalborg|851 </code></pre> <p>I <strong>do not</strong> want this:</p> <pre><code>&lt;option value="810"&gt;Frederikshavn&lt;/option&gt; </code></pre> <p>I <strong>do</strong> want this:</p> <pre><code>&lt;option value="813"&gt;Frederikshavn&lt;/option&gt; </code></pre> <p>The commas separate the key/value <em>pairs</em> and the pipes separate the keys from the values.</p> <p>I've come this far, however it doesnt seem to loop ? </p> <pre><code>//Get cities by Region </code></pre> <p>function GetCitiesByRegion(args) {</p> <pre><code>var params = '{"regionGuid":"' + args + '"}' var request = { type: "POST", async: false, cache: false, url: "http://" + location.hostname + "/webservices/services.svc/GetCitiesByRegion", contentType: "application/json; charset=utf-8", dataType: "json", data: params, success: function (result) { //alert("Data Loaded: " + result.d); var resultData = result.d; alert(resultData); $jq.each(resultData.split('|'), function (city, value) { //alert(this); alert(city + ': ' + value); }); }, error: function (xhr, status, error) { alert('Fejl ved webservice: error: ' + error); } }; $jq.ajax(request); </code></pre> <p>} </p>
javascript jquery
[3, 5]
2,224,619
2,224,620
Server variable in javascript
<p>Is there any way to access server side asp.net variable in javascript? I want to do something like</p> <pre><code>function setBookmark(val) { document.getElementById('&lt;%# hBookmark.ClientID %&gt;').value=val; } </code></pre> <p>Is it possible in anyway?</p> <p><strong>*Note*</strong>: hBookmark is a server side html hiddent control, I want to use client ID as IDs are changed as the server controls are rendered.</p>
asp.net javascript
[9, 3]
2,488,198
2,488,199
jQuery check detection, hiding previous (jsFiddle enclosed)
<p>I am trying to remove text fields with checkboxes as shown in the jsFiddle. However, as you can see, one of the boxes is checked but its corresponding text field exists. Can someone help me edit this to get this to hide the corresponding text fields for already checked items on load?</p> <p>Thanks!</p> <p><a href="http://jsfiddle.net/masedesign/jdbmK/1/" rel="nofollow">http://jsfiddle.net/masedesign/jdbmK/1/</a></p>
javascript jquery
[3, 5]
985,717
985,718
How to create this Popup form in ASP.Net using JavaScript?
<p>I'm working with a web site in <code>ASP.NET</code> for the practice and I want to make the popup form like <a href="http://beemp3.com/" rel="nofollow">beemp3</a>. When we click on <code>Playlist Login</code> or <code>Playlist SignUp</code> a popup form comes on with transparent background but we can't access the controls on the page given behind.<br> I'm not much familiar with the <code>JavaScript</code> or other scripting languages. My teacher told me that they are using <code>JQuery</code> to creating this popup menu but I know little bit <code>JavaScript</code> so I want to know that how can I accomplish this task using <code>JavaScript</code>.</p>
javascript asp.net
[3, 9]
5,148,753
5,148,754
Using Alert in Response.Write Function in ASP.NET
<p>I have database code like this </p> <pre><code>try { string strConnectionString = ConfigurationManager.ConnectionStrings["SqlServerCstr"].ConnectionString; SqlConnection myConnection = new SqlConnection(strConnectionString); myConnection.Open(); string hesap = Label1.Text; string musteriadi = DropDownList1.SelectedItem.Value; string avukat = DropDownList2.SelectedItem.Value; SqlCommand cmd = new SqlCommand("INSERT INTO AVUKAT VALUES (@MUSTERI, @AVUKAT, @HESAP)", myConnection); cmd.Parameters.AddWithValue("@HESAP", hesap); cmd.Parameters.AddWithValue("@MUSTERI", musteriadi); cmd.Parameters.AddWithValue("@AVUKAT", avukat); cmd.Connection = myConnection; SqlDataReader dr = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection); Response.Redirect(Request.Url.ToString()); myConnection.Close(); } catch (Exception) { Response.Write("&lt;h2&gt;ERROR&lt;/h2&gt;"); } </code></pre> <p>It works fine but what I want, in the catch function, is to call the javascript alert function.</p> <p>I've tried this</p> <pre><code>Response.Write("&lt;script language=javascript&gt;alert('ERROR');&lt;/script&gt;); </code></pre> <p>But there is an error <img src="http://i.stack.imgur.com/eW7g6.jpg" alt="enter image description here"></p> <p>How can I show error message in <code>javascript</code> <code>alert</code> function?</p>
c# javascript asp.net
[0, 3, 9]
5,615,405
5,615,406
My condition doesn't read selected variable
<p>So I'm working on a search page where I have a block that displays the next 10 items in a list. What I want to do is to hide this block when I reached the end of my list.</p> <pre><code>function loadMore() { //Load the content var urlPortion = searchQuery.split("?"); var urlString = "?hits=10&amp;offset="; var offset = 0; var pageCounter = 1; $(".box-footer").click(function () { offset += 10; pageCounter++; var urlBuilder = urlPortion[0] + urlString + offset + "&amp;" + urlPortion[1]; $.get(urlBuilder, function (data) { var content = $(".search-result-list li", data); $('.search-result-list').append(content); }); }); //Visibility of "Show more"-bar var textString = $(".search-result-totalhits").html(); var totalHitsString = /\d+/; var totalHits = textString.match(totalHitsString); var numberOfPages = (Math.ceil(totalHits/10)); if ((totalHits &gt; 10) &amp;&amp; (pageCounter &lt; numberOfPages)) { $(".p-sok .box-footer").show(); } else { $(".p-sok .box-footer").hide(); } }; </code></pre> <p>My problem here is that the last condition that does the actual check whether to display the block or not always remains true. I'm guessing that the variable "pageCounter" isn't available outside the click function above, but I am not sure. I've tried to output the variable to the console in line 18 but it does not output anything.</p> <p>Someone care to give me som hints?</p>
javascript jquery
[3, 5]
4,366,650
4,366,651
Missing assembly reference error in web application in VS2008
<p>I have a page called ProfileInfo.aspx and the codebind looks like this - </p> <pre><code> using System; using System.Web; namespace myservice { public partial class ProfileInfo : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { // if no postback but user is authenticated, grab info from database if (!IsPostBack) { if (System.Web.Profile.**IsAnonymous** == false) { } } } protected void btnSave_Click(object sender, EventArgs e) { } } } </code></pre> <p>And I am getting an error from the Profile.IsAnonymous statement, as follows - </p> <p>The type or namespace name 'IsAnonymous' does not exist in the namespace 'System.Web.Profile' (are you missing an assembly reference?)</p> <p>What am I doing wrong? Do I need to add a .NET dll reference to the web application project? I tried to look for System.Web.Profile but there is no such DLL. Please help and thanks in advance.</p>
c# asp.net
[0, 9]
4,238,877
4,238,878
2 IntentServices accessing the same data on file system.. safe?
<p>I'm relatively sure with this, but I need your opinion. I have two IntentServices on Android, both have access to the application's private file system.</p> <p>The filesystem works like a queue - the first IntentService only performs write operations, that means it does nothing other than creating new files. The second IntentService only reads and deletes files from the application's filesystem.. similar to the "producer/consumer" principle. </p> <p>In my opinion, there is no need to do any syncing or locking operations, even if both services have their own threads. I am correct here?</p> <p>Thank you</p>
java android
[1, 4]
3,587,163
3,587,164
Webview doesn't download files
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/10069050/download-file-inside-webview">Download File inside WebView</a> </p> </blockquote> <p>I'm trying to navigate to a download url with the webview, and it doesn't download the file... I tried other links, and the problem is the same... I tried something like 20 direct link... nothing works... Does someone knows what might be the problem?</p>
java android
[1, 4]
817,928
817,929
Uncaught TypeError when trying to alter image states
<p>I am trying to write a piece of code that when a button is clicked, it checks through a list of images, checks if it has an id of 'video' and if it does then display an overlay and remove the player that is there.</p> <p>I keep getting this error:</p> <pre><code>Uncaught TypeError: Cannot call method 'indexOf' of undefined </code></pre> <p>Here is the code:</p> <pre><code>$("#actions .btn").click(function(){ $('.span img').each(function(){ if($(this).attr('id').indexOf('video') != -1){ var spanid = $(this).attr('id').replace(/video/, ''); $(this).removeClass('hideicon'); $('#mediaplayer' + spanid + '_wrapper').remove(); } }); }); </code></pre>
javascript jquery
[3, 5]
634,725
634,726
Store Dropdown list old values and re populate them
<p>Please tell me how can i store the old value of the drop down list.</p>
javascript jquery
[3, 5]
1,024,415
1,024,416
How to change the color of few nodes of treeview in asp.net?
<p>I need to programmatically change the color of nodes in treeview. Is there any solution with asp.net or jquery? PS: I am binding the treeview nodes on demand.</p> <pre><code> private void BindTreeViewControl() { try { DataTable dt = new DataTable(); dt = GetData(); for (int i = 0; i &lt; dt.Rows.Count; i++) { TreeNode root = new TreeNode(dt.Rows[i]["Name"].ToString(), dt.Rows[i]["Name"].ToString()); root.SelectAction = TreeNodeSelectAction.SelectExpand; root.ShowCheckBox = true; child.PopulateOnDemand = Convert.ToUInt32(dt.Rows[i]["Count"]) &gt; 0; TreeViewDemo.Nodes.Add(root); } } catch (Exception Ex) { throw Ex; } } </code></pre>
jquery asp.net
[5, 9]
5,438,726
5,438,727
Cycle to get the source of a list of images
<p>I have a list with 8 thumbnails images. When I click in one of them the bigger image gets the source of the that thumbnail. I can do this one by one. </p> <pre><code>$('#img_1').click(function(){ var temp = $('#img_1').attr('src'); $('#bigger_image').attr('src', temp); }); </code></pre> <p>I tried to use a for loop but I always get the last thumbnail source</p> <pre><code>for(var i=0; i&lt;$('#thumbsContainer').children().length;i++){ $('#img_'+i).click(function(){ var temp = $('#img_'+i).attr('src'); $('#bigger_image').attr('src', temp); }); } </code></pre> <p>How should I do it in a once?</p>
javascript jquery
[3, 5]
3,014,930
3,014,931
Remove null value in javascript for $.ajax POST
<p>I have</p> <pre><code>var pageData = { query: null, pageNumber: 0, pageSize: 30}; </code></pre> <p>When I make an ajax get:</p> <pre><code>$.ajax({ type: 'GET', url: '/Ajax/GetSuggestions', data: pageData, success: function (response) {} </code></pre> <p>The request show in firebug: <code>http://localhost:31198/Ajax/GetSuggestions?query=null&amp;pageNumber=1&amp;pageSize=30</code></p> <p>At server side (ASP .NET MVC3), I received query = null in string, not null data(what I need). How can I fix it without using delete method of javascript to remove null value?</p>
javascript jquery
[3, 5]
1,115,442
1,115,443
Unexpected token while using jquery on event
<p>I'm trying to bind on to a click event for a class but continue to get this error:</p> <pre><code>Uncaught SyntaxError: Unexpected token ; </code></pre> <p>My jquery and HTML</p> <pre><code>function loadData() { isLoading = true; $('#loaderCircle').show(); $.post(apiURL, { f: 'gridview', start: pgStart, end: pgEnd, params: $("#search_basic_form_id").serialize() }, function(data){ if (data.success) { // Create HTML for the images. var html = ''; $.each(data.profiles, function() { html += '&lt;li&gt;&lt;div class="image-wrapper"&gt;'; html += '&lt;div class="image-options"&gt;'; html += '&lt;a href="#" id="imgoption_'+this.user_id+'" class="favoriteButton" title="Add Favorite"&gt;&lt;br&gt;Favorite&lt;/a&gt;'; html += '&lt;/div&gt;'; html += '&lt;a href="/view_profile.php?id='+this.user_id+'"&gt;'; html += '&lt;img src="'+this.file_name+'" width=200px; height="'+this.height+'px" style="border:0;"&gt;'; html += '&lt;/a&gt;'; // Image title. html += '&lt;p&gt;'+this.name+' '+this.age+'&lt;/p&gt;'; html += '&lt;p&gt;'+this.city+', '+this.state+'&lt;/p&gt;'; html += '&lt;/div&gt;'; html += '&lt;/li&gt;'; }); // Add image HTML to the page. $('#tiles').append(html); // Apply layout. applyLayout(); pgStart = data.start; pgEnd = data.end; } }, "json"); }; $(document).ready(function() { // Load first data from the API. loadData(); $('.favoriteButton').on('click', function(e) { e.preventDefault(); alert("Favorite Clicked"); }); ... </code></pre> <p>Not sure why I'm getting this error but it points to the last semi colon in the jquery call. </p>
javascript jquery
[3, 5]
2,500,032
2,500,033
Using BufferedWriter and DataOutputStream in java together
<p>How can I simply write big-endian typed data into an OutputStream and still use buffering? (I'm developing for android if it makes any difference)</p> <p>I tried</p> <pre><code>out = new BufferedWriter(new DataOutputStream(new OutputStreamWriter(sock.getOutputStream()))); </code></pre> <p>but it looks like I'm in no luck, because this cannot be done. I'm new to Java.</p>
java android
[1, 4]
5,218,108
5,218,109
get the closest value from a list jquery
<p>i need to get the closest class html from my list, but its always returning null if i put directly the <code>closest</code>. i try some other thinks, but its not working.</p> <p>the <strong>html:</strong></p> <pre><code>&lt;ul id="ulId"&gt; &lt;li class='effectLeg'&gt; Stuffs &lt;/li&gt; &lt;li class='test legColor' style=''&gt;&lt;/li&gt; &lt;li class='effectLeg'&gt; Stuffs 2 &lt;/li&gt; &lt;li class='test legColor'&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>so, if i hover the last LI (for exp.) the hover will get the closest class <code>effectLeg</code> and give me the HTML or anything inside ( in that case the STUFFS 2 ).</p> <p>the <strong>js</strong>: </p> <pre><code>$(".legColor").live("hover", function(){ alert($(this).closest("#ulId").find(".effectLeg").html()); }); </code></pre> <p>the closest i get was using find, but the find only get the first value of my <code>li</code></p> <p>i made a exp: check the <a href="http://jsfiddle.net/eC5YE/7/" rel="nofollow"><strong>Demo</strong></a></p>
javascript jquery
[3, 5]
4,202,329
4,202,330
SOAP - namespace, what is this used for?
<p>What is the namespace used for in a SOAP web service?</p>
c# asp.net
[0, 9]
420,802
420,803
Detecting when the @ key is pressed
<p>I am trying to detect when a user pressed the @ key in a text box. I can use JQuery to handle the keyup event like so...</p> <pre><code>$('#target').keyup(function(event) { }); </code></pre> <p>But what do I do from here to test for the @ character? I know I can use <code>event.which</code> to get a key code. But in this instance I would need to also check for shift - technically this is not a problem, but I know the @ key can move around with different language settings and I am worried that this may prove to be inconsistent. Maybe I am worried wrongly, and I can rely on it always being <code>SHIFT + 192</code>?</p> <p>Ideally I would like something like the following to allow for easier configuration later on...</p> <pre><code>event.something == "@"; </code></pre> <p>Thanks for any help</p>
javascript jquery
[3, 5]
598,988
598,989
javascript form validation - positioning
<p>I have little snippet for validatin' my form. I need help to position the error messages, because now all message appear in the filed, so the user can't see it, and so its very annoying.</p> <pre><code>$(document).ready(function() { jQuery.validator.addMethod("lettersonly", function(value, element) { return this.optional(element) || /^[a-zőöüóúéáűí ]+$/i.test(value); }, "&lt;?php echo $lettersonly; ?&gt;"); $("#regval").validate({ rules: { name: { required: true, minlength: 5, maxlength:30, lettersonly: true }, nick: { required: true, minlength: 3, maxlength:12 }, pass1: { required: true, minlength: 5 }, pass2: { required: true, minlength: 5, equalTo: "#pass1" }, messages: { full: { required: ".....", minlength: "....", maxlength: "...." }, nick: { required: "....", minlength: "....", maxlength: "...." }, pass1: { required: "....", minlength: "..." }, pass2: { required: "....", minlength: "....", equalTo: "...." }, }); }); &lt;/script&gt; </code></pre>
php javascript jquery
[2, 3, 5]
2,683,940
2,683,941
Upload file using python simply using HTTPLIB
<pre><code>conn = httplib.HTTPConnection("www.encodable.com/uploaddemo/") conn.request("POST",path, chunk,headers) </code></pre> <p>Above is the site "www.encodable.com/uploaddemo/" where I want to upload an image. Now problem which I am facing is I am tyro in php so I am unbale to understand the meaning of path and headers in above code, chunk is an object that consist of my image file. Following code ofcourse produces error as I was trying to implement without any knowledge of headers and path</p> <pre><code>import httplib </code></pre> <p>def upload_image_to_url():</p> <pre><code>filename = '//home//harshit//Desktop//h1.jpg' f = open(filename,"rb") chunk = f.read() f.close() headers = {”Content−type” : ”application/octet−stream”,”Accept”:”text/plain”} conn = httplib.HTTPConnection("www.encodable.com/uploaddemo/") conn.request("POST","/uploaddemo/files/", chunk) response = conn.getresponse() remote_file = response.read() conn.close() print remote_file </code></pre> <p>upload_image_to_url()</p>
php python
[2, 7]
4,822,963
4,822,964
Use a custom URL with ShareThis social share plugin
<p>i would like to know how to use a custom URL with ShareThis social share plugin. for a example i have a post summery on my index.php page taht is linking to my-post.php so what i want to do is to make users share my-post.php from my index page. </p> <p>here is the code from sharethis.com</p> <p>Buttons:</p> <pre><code>&lt;span class='st_facebook_hcount' displayText='Facebook'&gt;&lt;/span&gt; &lt;span class='st_twitter_hcount' displayText='Tweet'&gt;&lt;/span&gt; &lt;span class='st_googleplus_hcount' displayText='Google +'&gt;&lt;/span&gt; &lt;span class='st_pinterest_hcount' displayText='Pinterest'&gt;&lt;/span&gt; </code></pre> <p>JS:</p> <pre><code>&lt;script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt;stLight.options({publisher: "ur-448a73fe-e6c1-f7a5-f0a5-3912c860fc9e"});&lt;/script&gt; </code></pre>
php javascript
[2, 3]
5,066,274
5,066,275
changing the values of height attribute of table cells using jquery or javascript
<p>I have two tables say table 1 and table 2.(both having equal number of rows) For each of the rows in table 1, I wish to set the height of the corresponding cells in table 2 equal to the corresponding cell in table 1. i.e table2-row1-col1 = table1-row1-col1 and similar.</p> <p>Please help me .</p>
javascript jquery
[3, 5]
1,347,975
1,347,976
Javascript variables within attributes
<p>With php it's easy to do something like this</p> <pre><code>&lt;? $x = "Joe"; echo "My name is $x"; ?&gt; </code></pre> <p>But I'm having trouble doing something similar with javascript</p> <pre><code>var div = document.createElement("DIV"); x="SomeValue"; div.setAttribute("id", (x)); div.setAttribute("onMouseDown", "SomeFunction((x))"); </code></pre> <p>where obviously I want x to be "SomeValue", but every time I look at the output, it just says x instead of the value.</p>
php javascript
[2, 3]
3,983,674
3,983,675
manipulating the screen from subclass
<p>So I have created an android app and things are working alright.</p> <p>In my main class I do a </p> <pre><code>new Game(); </code></pre> <p>Now from the constructor of the game object I try and manipulate the screen, but it does not seem to do anything. Is it even possible?</p> <pre><code>public class Game extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.board); } } </code></pre>
java android
[1, 4]
5,096,823
5,096,824
How to get milliseconds from a date picker?
<p>In my project I am saving milliseconds in a sqllite databse, by default I am saving</p> <pre><code>System.currentTimeMillis() </code></pre> <p>in the database, but there is an option for the user to select previous date from a date picker? But what sould I save then when user selects a previous or up comming days from the date picker? How can I get that day as a long(milliseconds) format?</p>
java android
[1, 4]
4,996,962
4,996,963
Jquery $.getJSON no results done
<p>Here is my funciton: </p> <pre><code>function getEmployeeList() { alert("hello world3!"); $.getJSON(serviceURL + 'getemployees.php', function(data) { alert("hello world4!"); $('#employeeList li').remove(); employees = data.items; $.each(employees, function(index, employee) { $('#employeeList').append('&lt;li&gt;&lt;a href="employeedetails.html?id=' + employee.id + '"&gt;' + '&lt;img src="pics/' + employee.picture + '"/&gt;' + '&lt;h4&gt;' + employee.firstName + ' ' + employee.lastName + '&lt;/h4&gt;' + '&lt;p&gt;' + employee.title + '&lt;/p&gt;' + '&lt;span class="ui-li-count"&gt;' + employee.reportCount + '&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;'); }); $('#employeeList').listview('refresh'); }); } </code></pre> <p>When the page is ready, it will run this function, however, nothing is appended.<br> I have tested, all php can return correct format. What wrongs?? Please please help me...</p>
php jquery
[2, 5]
2,231,172
2,231,173
How to get a name of the clicked <a> tag
<p>This is my HTML code :</p> <pre><code>&lt;div class="span4"&gt; &lt;div class="hero-unit" style="padding:10px 10px 10px 10px"&gt; &lt;div class="accordion" id="accordion2"&gt; &lt;div class="accordion-group"&gt; &lt;div class="accordion-heading"&gt; &lt;a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne"&gt; North Delhi &lt;/a&gt; &lt;/div&gt; &lt;div style="height: 0px;" id="collapseOne" class="accordion-body collapse"&gt; &lt;div class="accordion-inner"&gt; &lt;ol&gt; &lt;li&gt;&lt;a id='link' href="#" name="Some name1 "&gt;Some link1&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a id='link' href="#" name="Some name2"&gt;Some link2&lt;/a&gt; &lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>and this is my jQuery code </p> <pre><code>$(document).ready(function() { $('#link').click(function() { var n = $(this).attr(name); //alerts undefined alert(n); $('#results').html('&amp;nbsp;').load('/donate/?n=' + n); }); }); </code></pre> <p>My HTML code has several accordion-inner divs with multiple links. I want to get the name attribute of the clicked link. This code alerts me undefined check my jQuery code and please tell me what am i doing wrong?</p> <p>I am new to jquery so please help.</p>
javascript jquery
[3, 5]
3,824,368
3,824,369
If parent element does not contain certain child element; jQuery
<pre><code>&lt;div class="test"&gt; &lt;div class="example"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="test"&gt; &lt;/div&gt; </code></pre> <p>How can I apply jQuery to an element with the class <code>test</code> only if it doesn't contain a child element with the class <code>example</code>?</p>
javascript jquery
[3, 5]
3,965,062
3,965,063
jquery populate select box with key:value pair?
<p>I am using jquery to the server code returns the following values</p> <pre><code>0:SELECT ONE;1:VALUE1;2:VALUE2 etc </code></pre> <p>how do i populate this into a select box?</p> <pre><code>var="0:SELECT ONE;1:VALUE1;2:VALUE2"; $("#targetSelectBox"). ??????? </code></pre>
javascript jquery
[3, 5]
426,845
426,846
rewrite css after div in jquery
<p>i have this:</p> <pre><code>&lt;dl id='1'&gt;&lt;/dl&gt; &lt;p&gt;text from database&lt;/p&gt; </code></pre> <p>i would like this after the div id 1:</p> <pre><code>&lt;dl id='1'&gt;&lt;/dl&gt; &lt;p style='float:left';&gt;text from database&lt;/p&gt; </code></pre> <p>is that possible to rewrite the css in javascript or jquery?</p> <p>regards</p> <p>Frank</p>
javascript jquery
[3, 5]
2,742,499
2,742,500
Javascript object within object
<p>I'm having a few issues with creating an object within an object, it's syntax related but can't seem to remember how I can achieve this. </p> <pre><code>ajaxRequest = { that: null, request: null, multiRun: null, multiRunTimer: null, defaults={ ext: '', url: '', type: "POST", dataType: "json", payload: null, beforeSend: 'handleBefore', error: 'handleError', complete: 'handleCompletion', pass: false, debug: false, multiRunBlock: false }} </code></pre> <p>I get a syntax error of Uncaught SyntaxError: Unexpected token =</p>
javascript jquery
[3, 5]
3,105,191
3,105,192
regarding sending mail to user
<pre><code>MailMessage message = new MailMessage(); message.From = new MailAddress("[email protected]"); </code></pre> <p>Now for fetching email entered by the user in the textbox, I wrote:-</p> <pre><code> message.To.Add(Convert.ToString(txtEmail)); </code></pre> <p>but this is not working..isn't this the correct way to add email address in "To" ? txtEmail is the textbox's name..Its not giving any error or something..just not working..when I comment out this line of code..the code line next to it works..otherwise code stops working when it encounters this "To.Add " method..plz help..thnx</p> <p><em><strong>[edit] I changed it to</em></strong></p> <pre><code>message.To.Add(txtEmail.ToString()); </code></pre> <p>still not working</p>
c# asp.net
[0, 9]
3,009,911
3,009,912
How to check browser support for capabilities / events?
<p>In the past we used browser sniffing to infer if certain events or capabilities were available. I understand that browser sniffing has been 'deprecated' or 'shunned' in favor of feature sniffing. I would like to know how I can check if a certain event can be handled.</p> <p>Take <code>DOMNodeInserted</code> for example. It is supported by Chrome, FF and Safari, but not by IE. How can I sniff if this event is available? Is there a library present? How do you guys do proper feature sniffing?</p>
javascript jquery
[3, 5]
232,167
232,168
android deleting a file from internal storage
<p>I have created a file stored on internal storage from an activity. How can I delete this file from another activity? </p> <p>I'm thinking I'll have to get the file's directory (which I'm not sure how to) and delete it. I tried using </p> <pre><code>context.deleteFile(); </code></pre> <p>but it won't work because I'm trying to call it from a non-static method.</p> <p>Any help is appreciated.</p>
java android
[1, 4]
2,537,303
2,537,304
Difference in methods for testing undefined in javascript
<p>I've never understood the difference in these two ways for testing the existence of an object...</p> <pre><code>typeof obj == "undefined" </code></pre> <p>vs.</p> <pre><code>obj == undefined </code></pre> <p>Is one preferred? I'm almost always using jQuery, is the second a jQuery only feature?</p>
javascript jquery
[3, 5]
965,238
965,239
Image editing in Android
<p>In my application image editor I want to implement image brightness, contrast, sharpness, zooming, rotating, and save the image to my gallery. </p>
java android
[1, 4]
1,784,521
1,784,522
ASP.NET- Prompt confirmation only if needed
<p>I have a button. And I have a Session["actionMode"]. Here what I do in my buttonClick event:</p> <pre><code>protected void Button1_Click(object sender, EventArgs e) { if ((int)Session["actionMode"]==1) { //Do something } else if ((int)Session["actionMode"]==3) { //After confirmation delete a record } } </code></pre> <p>As you can see if value of Session["actionMode"] equals 3 a record is deleted. But before deletion I want to prompt the user to confirm the action. So if value of Session["actionMode"] does not equal 3 I don't need any confirmation because it does not do anything that can't be undone. Is there a way I can achieve this? Javascript maybe?</p>
javascript asp.net
[3, 9]
2,062,256
2,062,257
Textarea - new lines to br tags and then special characters
<p>I have a text area with the following id: <code>#openingHours</code></p> <p>The text area contains information, for example:</p> <pre><code>&lt;textarea id="openingHours"&gt; Mon-Fri 8am - 6pm Sat-Sun 9am - 3pm &lt;/textarea&gt; </code></pre> <p>I want to get the value of the textarea and replace new lines with break tags.</p> <pre><code>Mon-Fri 8am - 6pm&lt;br/&gt;Sat-Sun 9am - 3pm </code></pre> <p>Notice how it is all on one line.</p> <p>How can I achieve this? All of the data must be on the same line, separated by <br /> tags and html encoded to special characters.</p> <p>Thank you.</p>
javascript jquery
[3, 5]
3,900,211
3,900,212
android resize layout when keyboard appears
<p>I would like to reposition layout when keyboard appears, for example when editing a text field, in order to get visibility on focused field. I tried windowSoftInputMode but I cannot get any difference. How to reach it? Thank you.</p> <pre><code>&lt;activity android:name="com.xxxx.projecte1.TabBar_Activity" android:theme="@android:style/Theme.NoTitleBar" android:configChanges="keyboardHidden|orientation|screenSize" android:windowSoftInputMode="adjustResize" /&gt; </code></pre>
java android
[1, 4]
5,952,457
5,952,458
dynamically adding check box asp.net( csharp) and retain its value on postback
<p>I need to add dynamically checkboxlist to a section of web page. I also need to retain its value on post back. How this should be done?</p>
c# asp.net
[0, 9]
5,679,112
5,679,113
jQuery function bounces element - not very smooth
<p>I am using the following jQuery plugin on my website. ( <a href="http://jqueryfordesigners.com/demo/plugin-slide-demo.html" rel="nofollow">http://jqueryfordesigners.com/demo/plugin-slide-demo.html</a> ). Now if you closely examine the demo slider, you will see a slight bump/bounce at the bottom every time a header element opens. Now I have the same problem on my website except the bounce is much worse. </p> <p>How can I minimize/eliminate that effect? the initialization code is:</p> <pre><code>$(function () { $('UL.drawers').accordion({ // the drawer handle header: 'H2.drawer-handle', // our selected class selectedClass: 'open', // match the Apple slide out effect event: 'mouseover' }); }); </code></pre> <p>Also how can I change the above code so that the 'drawer' <strong>closes</strong> when I do not hover over any header element(tab). </p> <p>Thank You</p>
javascript jquery
[3, 5]
2,434,228
2,434,229
parse json news feed array android
<p>I have an json feed from bbc in this format</p> <pre><code>{ "name": "ticker", "entries": [ { "headline": "text", "prompt": "LATEST", "isBreaking": "false", "mediaType": "Standard", "url": "" }, { "headline": "text", "prompt": "LATEST", "isBreaking": "false", "mediaType": "Standard", "url": "" }, etc........... </code></pre> <p>My code is as follows:</p> <pre><code>ArrayList&lt;HashMap&lt;String, String&gt;&gt; mylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); JSONObject json = JSONfunctions.getJSONfromURL("http:/......"); try{ JSONArray item = json.getJSONArray("entries"); for (int i = 0; i&lt;item.length(); i++) { HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); JSONObject e = item.getJSONObject(i); JSONObject title = e.JSONObject("headline"); map.put("title", "Title:" + e.getString("headline"); } } </code></pre> <p>It gives me the error <code>"java.lang.String cannot be converted to JSONObject"</code> </p> <p>I also tried leaving out <code>JSONObject title = e.JSONObject("headline");</code> and it gives me a path error (note</p>
java android
[1, 4]
2,380,162
2,380,163
Change part two class in div
<p>I want change part two of class name in each div into tag <code>&lt;span&gt;</code> from '.myclass_2' to 'yourclass', (in following html code). Here is my try with jQuery but they doesn't work true. How is fix it?</p> <p>Demo: <a href="http://jsfiddle.net/sTF3U/" rel="nofollow">http://jsfiddle.net/sTF3U/</a></p> <pre><code>&lt;span&gt; &lt;div class="myclass_1 myclass_2"&gt; &lt;a href="" class="click"&gt;Click Me_1&lt;/a&gt; &lt;/div&gt; &lt;div class="myclass_1 myclass_2"&gt; &lt;a href="" class="click"&gt;Click Me_2&lt;/a&gt; &lt;/div&gt; &lt;/span&gt; var $this = $('.click'), $clone_1 = $('span').clone(); alert($clone_1.html()); $('.click').live('click', function (e) { e.preventDefault(); $clone_2 = $('span').clone(); $clone_2.find('div').split(" ")[1].addClass('youClass'); $clone.find('.auto_box2:last .mediumCell').each(function () { $(this).split(" ")[1].removeClass().addClass(unique()); }); var $result = $('span').clone(); alert('ok'); }) </code></pre>
javascript jquery
[3, 5]
1,284,491
1,284,492
Error in JavaScript when inplementing input field shadow
<p>I want to implement shadow into input field. This is the JavaScript code that I use:</p> <pre><code>&lt;!-- input field shadow --&gt; var placeholder = "test field" $("input").on({ focus: function() { if (this.value == placeholder) { $(this).val("").removeClass("shadow"); } }, blur: function() { if (this.value == "") { $(this).val(placeholder).addClass("shadow"); } } }).trigger("blur");​ </code></pre> <p>When I run the code into Firefox I get this error message into Firebug:</p> <pre><code>illegal character }).trigger("blur"); </code></pre> <p>Maybe there is a bug into the code? How I can fix it?</p> <p>Best Wishes</p>
javascript jquery
[3, 5]