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,601,757
5,601,758
ASP.NET beginner question: How do I use classA's variable in classB?
<p>I want to use variable "iso3166TwoLetterCode"'s value from this class, <a href="http://stackoverflow.com/questions/3690278/fetching-ip-address-and-displaying-country-in-c-and-asp-net">Geolocation error with IP address 127.0.0.1</a></p> <p>In my new test class, how do I use it? Can I even use it? If yes, how? I need this variable to use it in the if statement to check country code and based on the country code, the master page is to be changed.</p>
c# asp.net
[0, 9]
2,331,440
2,331,441
str.replace within a jquery function
<p>I have a simple jquery function as</p> <pre><code>function sendValue(str){ $.post("test.php",{ sendValue: str }, function(data){ $('#display').html(data.returnValue); }, "json"); } </code></pre> <p>I want to replace space within the string. I thought I can do this by adding</p> <pre><code>str.replace(" ", "+"); </code></pre> <p>to the second line of the function. But it did not work. I know very basic of javascript. How to replace " " with "+" in the string before posting data to test.php?</p>
javascript jquery
[3, 5]
5,282,774
5,282,775
Get the title from a popup
<p>This is a jQuery tooltip.</p> <p>In a nutshell, the jQuery creates the popup from another HTML page. </p> <p><strong>EDIT</strong> i put up an example. <a href="http://jsfiddle.net/76hSB/" rel="nofollow">HERE</a></p> <p>So I need to grab the title from the popup. When I use the <code>document.title</code> or whatever, it echos the title from the current page and not the popup.</p> <pre><code>&lt;div id='JT_close_right'&gt;"+title+"&lt;/div&gt; </code></pre> <p>I need the title in a variable:</p> <pre><code>var title = (pop-up page's title) </code></pre>
javascript jquery
[3, 5]
4,435,036
4,435,037
Collect Data from Google Result Stream
<p>I would like to have a stream: Say from google: <a href="http://news.google.com/news/search?aq=f&amp;pz=1&amp;cf=all&amp;ned=en_ke&amp;hl=en&amp;q=C#" rel="nofollow">http://news.google.com/news/search?aq=f&amp;pz=1&amp;cf=all&amp;ned=en_ke&amp;hl=en&amp;q=C#</a></p> <p>I want to be able to give the Seach Parameter: In this instance C# or any other search parameter and then have the results shown in my page. </p> <p>I am faced with a situation where I have to collect info from google and create an msword doc with it. I want to be able to automate the data collection and hopefully the word doc creation from the strings.</p> <p>Thanks</p>
c# asp.net
[0, 9]
2,937,200
2,937,201
Get the next element by selecting element with a class
<p>I have a live search and a list element is given a class of <code>hover</code> I am then trying to get the next li element after the hover class upon pressing the down arrow and adding the <code>hover</code> class to that element. Here is what I have:</p> <pre><code> if(e.keyCode == 40){ var current = results.find('li.hover'); current.removeClass(); current.parent().next('li').addClass('hover'); return false; } </code></pre> <p>It just will not add a class to the next element. It finds the current class just fine. Not sure what I am doing wrong. Appreciate it!</p>
javascript jquery
[3, 5]
4,697,818
4,697,819
Insert image in textarea when button is pressed using javascript or jquery?
<p>i have design one textarea and button in html. i want to insert image in textarea when button is pressed. how it is possible in javascript or jquery?</p>
php javascript jquery
[2, 3, 5]
2,655,490
2,655,491
How do I use a function argument for this jquery code, or is there a better solution?
<p>I have about 50 p tags and next to these are again 50 divs. on click of each p tag, its div should be shown and the rest hidden. How do i acheive this. I can use something like below:</p> <pre><code>$(function() { $('.p1').click(function(){ $('.div1').show(); $('.div2','.div3','.div4','.div5','.div6',.........,'.div50').hide() }) $('.p2').click(function(){ $('.div2').show(); $('.div1','.div3','.div4','.div5','.div6',.........,'.div50').hide() }) ////////////// ////// }) </code></pre> <p>but as you see that this is not an effiecient solution. I am also not sure how the jquery <code>each</code> can be leveraged here or how can this implementation be done using arrays. Can somebody point me in the right direction. I think we should use a function and pass that no. as a parameter, but I dont know how to use custom functions in jquery.</p> <p><strong>UPDATE:</strong></p> <p>This is what I have done</p> <pre><code>$(function() { $('.p1').click(function() { $('.div').hide(); $('.d1').show(); }) }) </code></pre> <p>I have added the class div to all of my 50 divs and I am showing d1 on click of p1. Now how do I replace 1 for each instance till 50.</p>
javascript jquery
[3, 5]
1,215,630
1,215,631
How do I add a php variable to this jquery url setting?
<p>I'm trying to make the URL in the following example contain a php variable like this:</p> <pre><code>http://api.crunchbase.com/v/1/company/$company.js </code></pre> <p>This is my jquery code:</p> <pre><code>$.ajax({ url: "http://api.crunchbase.com/v/1/company/airbnb.js", dataType: 'jsonp', success: function(results){ var number_of_employees = results.number_of_employees; } </code></pre> <p>What do I need to do to achieve this?</p> <p>Thanks!</p>
php jquery
[2, 5]
4,925,792
4,925,793
Toggle form visibility with javascript
<p>I'm using this code to display several forms on my page based on the link chosen by the user:</p> <pre><code>&lt;ul class="nav"&gt; &lt;li&gt;&lt;a href="#" onclick="$('#more_info').toggle(); return false;"&gt; More Information&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#" onclick="$('#road_test').toggle(); return false;"&gt; Book a Road Test&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#" onclick="$('#quote').toggle(); return false;"&gt; Request a Quote&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#" onclick="$('#offer').toggle(); return false;"&gt; Make an Offer&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#" onclick="$('#contact').toggle(); return false;"&gt; General Contact&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>The code works fine, the only issue I'm having with it is that if I select one form then select another one, the previously chosen form remains ie. if I select "More Information" then "Make an Offer", I'll get both forms instead of having just "Make an Offer". How do I fix this?</p>
javascript jquery
[3, 5]
2,200,357
2,200,358
How to change html class after ajax successful response?
<p>I want to toggle the voting arrow class, the same way as stackoverflow's voting arrow. For a logged in user, if already voted up, the html is:</p> <pre><code>&lt;a href="#vote" id="vote-up-%1$d" class="vote vote-up-on"&gt;&lt;/a&gt; &lt;a href="#vote" id="vote-down-%1$d" class="vote vote-down-off"&gt;&lt;/a&gt; </code></pre> <p>After user clicked down arrow, if response success, How to change "vote-up-on" to "vote-up-off", and change "vote-down-off" to "vote-down-one"?</p>
javascript jquery
[3, 5]
677,380
677,381
jQuery selector by position on page available?
<p>Is there a selector available in jQuery to select elements which have a specific position of the page, for example all elements that have an offsetTop bigger than, say, 100px?</p> <p>I tried:</p> <pre><code>$('span[offsetTop&gt;100]') </code></pre> <p>because just as we can check if an attribute equals to some value, I thought it might be possible to check if an attribute is larger than some value. This, however, does not work. Is this possible at all?</p>
javascript jquery
[3, 5]
1,035,662
1,035,663
JQuery question
<p>i want to run some code on all my treeView nodes depending on a value returned from the database and repeat this until a certain value is returned.</p> <p>I was thinking that:</p> <ol> <li>Give all my tree nodes the same css class so I can access them from JQuery</li> <li>have a timer in my JQuery function that used ajax to go to the database, when a certain value is returned then stop the timer</li> </ol> <p>Two questions here. How can I make my function run for each of the nodes and how do I do a timer in JavaScript, so:</p> $(function(){ $('cssClassOfAllMyNodes').WhatFunctionToCallHere?((){ <pre><code>//How do I do Timer functionality in JavaScript? ForEachTimeInterval { //use Ajax to go to database and retrieve a value AjaxCallBackFunction(result) { if (result = 1) //How to stop the timer here? } } }); </code></pre> <p>});</p> <p>Hope i'm clear. Thanks a lot</p>
javascript jquery
[3, 5]
4,664,060
4,664,061
jQuery ie8 attr poor performance
<p>"I have some html similar to below contained within a loop where the parent id is dynamically generated,</p> <pre><code>&lt;t:loop&gt; &lt;div id="demoid-10132165498794631" class="lineItem-container"&gt; &lt;div&gt; &lt;select/&gt; &lt;/div&gt; &lt;/div&gt; &lt;/t:loop&gt; </code></pre> <p>I'm trying to get the id of the parent element containing class lineItem-container. </p> <p>I'm using the following script to get the id, </p> <pre><code>var id = $("select").parents(".lineItem-container").attr("id").substring(6); </code></pre> <p>The html can potentially be looped up to 1000 times which causes very poor performance in ie8. My assumption is the performance issue is caused by the attr selector. </p> <p>JS Log from IE8</p> <pre><code>Function Count Inclusive Time (ms) Inclusive Time % Exclusive Time (ms) Exclusive Time % Avg Time (ms) Max Time (ms) Min Time (ms) attr 431,334 21,609.38 12.65 14,406.25 8.43 0.05 2,234.38 0 attr 431,382 20,265.63 11.86 12,203.13 7.14 0.05 31.25 0 ATTR 239,906 20,531.25 12.02 9,125.00 5.34 0.09 8,156.25 0 attr 241,475 11,531.25 6.75 7,312.50 4.28 0.05 31.25 0 </code></pre> <p>Does anybody have any suggestions on how to potentially speed this process up?</p>
javascript jquery
[3, 5]
2,527,670
2,527,671
How to replace a page by date
<p>There is way to replace page at some date&amp;time ?</p> <p>example: i want that at friday the default.aspx will down, and other page will turn to default.aspx... and then at sunday the first default.aspx will return.</p> <p>someone have an idea? maybe will be better to change the display of the default.aspx. i need to replace the screen to "we down for a while" or something like that.</p> <p>i mean that button will do that... </p> <p>using c#. asp.net</p>
c# asp.net
[0, 9]
1,627,889
1,627,890
get cookie value in the textbox using jquery or javascript
<p>I want to see cookie value in the textbox.</p> <p>I have used this </p> <pre><code>document.getElementsByName('Custom_Field_Custom2')[0].Value=$.cookie('artname',{ path:'/'}); </code></pre> <p>but that cookies value is not displaying in the textbox.</p> <p>What I need to do?</p>
javascript jquery
[3, 5]
2,972,900
2,972,901
Placing PHP within Javascript
<p>I can't seem to get the PHP to echo out within a Javascript tag:</p> <pre><code>places.push(new google.maps.LatLng("&lt;?php echo the_field('lat', 1878); ?&gt;")); </code></pre> <p>What am I doing wrong?</p>
php javascript
[2, 3]
5,562,319
5,562,320
Html editor - Remove tags
<p>I am having a html editor in my page . I want to store the text in word document with the styles like bold,italic etc.. Im using this code to write in word document..</p> <pre><code>object strTextToWrite = txtdocument.Text.Trim(); oWordApplic = new Word.ApplicationClass(); object missing = System.Reflection.Missing.Value; oDoc = oWordApplic.Documents.Add(ref missing, ref missing, ref missing, ref missing); oDoc.Activate(); string test = StripTagsCharArray(txtdocument.Text); string test2 = test.Replace("&amp;nbsp;", " "); oWordApplic.Selection.TypeText(test2); object path =Server.MapPath("~/Documents/"+txtfrom_name.Text + ".doc"); oDoc.SaveAs(ref path, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing); oDoc.Close(ref missing, ref missing, ref missing); oWordApplic.Application.Quit(ref missing, ref missing, ref missing); </code></pre> <p>The split function is</p> <pre><code>public static string StripTagsCharArray(string source) { char[] array = new char[source.Length]; int arrayIndex = 0; bool inside = false; for (int i = 0; i &lt; source.Length; i++) { char let = source[i]; if (let == '&lt;') { inside = true; continue; } if (let == '&gt;') { inside = false; continue; } if (!inside) { array[arrayIndex] = let; arrayIndex++; } } return new string(array, 0, arrayIndex); } </code></pre> <p>Now im getting the plain text without bold,italic.. I need the bold,italic,underline functions in my word document ,,, Please help me</p>
c# asp.net
[0, 9]
2,042,365
2,042,366
Is it a good practice to implement logic in properties
<p>we use ASP.NET with C# and based on open source projects/articles I passed through, I found many properties were including a <strong>logic</strong> but when I did so the team-leader told me it's not good at all to place logic inside properties but to call the logic through methods...</p> <p>is that really bad? and why not to use logic in the properties?</p> <p>thanks,</p>
c# asp.net
[0, 9]
1,596,628
1,596,629
New to asp. Problems connecting to database. Not sure about correct method to use
<p>I've been using asp forms for the past week or so. Mostly I've been getting used to gridview and using the site.master to display menus on each page and using the connectionstring in web.config to access my sql server database.</p> <p>But I'm not finding gridview all that versatile and am a little confused as to how this is all supposed to work. I've come from PHP and ASP seems a world different. What I want to do is to loop a table and print out records but i want to use my own loop and not gridview so i can have custom columns as well. so i can create dynamic links with different gets and things like that. In PHP there was syntax to connect to the DB, write the loop and then print the html inside it by echoing or something like that.</p> <p>In aspx I am using C# as my language so am I to understand that i literally write c# code in between &lt;% --code-- %> for this to happen</p> <p>So asp is basically an abiltiy to script using c# or VB</p> <p>Lastly should I write the DB connection in code behinds Page_load or just at the top of the aspx file...</p> <p>Sorry about the newbie question, I would really appreciate being pointed to a suitable tutorial as well which explains all this if anyone can help. I found the w3schools stuff which I usually use to be quite confusing.</p>
c# asp.net
[0, 9]
3,331,140
3,331,141
How to create a superuser & random user login from a single login page?
<p>Am new to asp.net &amp; C# world. Just joined as a Software Developer. I have to create a website for a forum. So i need to create one login page for three types of login mainly,1. Admin, 2.Receptionist &amp; 3.Random User. So i need your help in this project.</p> <p>Thanks Tourniquet</p>
c# asp.net
[0, 9]
183,447
183,448
Access Javascript from Java
<p>I m trying to access JavaScript function from Servlet code. But I'm getting the error shown below. Here is the code:</p> <pre><code>out.println("&lt;FRAME src=\"javascript:parent.newWindow('" + URL+ "') \" scrolling=No noresize /&gt;"); </code></pre> <p>And this is the error that occurs in JavaScript:</p> <blockquote> <p>Object does not support this property or method;</p> </blockquote>
java javascript
[1, 3]
5,901,345
5,901,346
Accessing from the page in LowerFrame to the page in UpperFrame causes undefined error!
<p>My website consists of two frames, let's say upperFrame and lowerFrame.</p> <p>On the document ready of the page in lowerFrame, it access one of textbox located on the page of upperFrame. Sometimes, since the upperFrame do NOT complete its loading, lowerFrame get the undefined while it access the upperFrame.</p> <p>Let me know if there are Any solutions/checking to prevent this problem?</p>
javascript jquery
[3, 5]
2,336,297
2,336,298
Choose selectbox option by javascript by text
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3541565/selecting-an-option-by-its-text">Selecting an option by its text</a> </p> </blockquote> <p>Is there any way how to choose the option in selectbox <strong>by the text label</strong> of the option (<strong>not the value</strong>)?</p> <pre><code>&lt;select id="form-mySelect" name="number"&gt; &lt;option value="0"&gt;Zero&lt;/option&gt; &lt;option value="1"&gt;One&lt;/option&gt; &lt;option value="2"&gt;Two&lt;/option&gt; &lt;/select&gt; $("#form-mySelect").val("One"); </code></pre> <p>The example above doesn't work in jQuery 1.4.3. I've read somewhere, that in some lower version of jQuery selecting option by >text label&lt; (<strong>not by the value</strong>) works.</p> <p>Is there any way, how to simulate this behavior and make it functional in jQuery 1.4.3?</p>
javascript jquery
[3, 5]
2,671,784
2,671,785
How to use google database to create any mobile application?
<p>I m going to develope an application in which i m not using inbuilt database as well as Web Services. I Want to use google database..means if my user want to search for some query.i must pass that question to google and behalf of google result,i'll display resule to client in my application.e.g in listview.</p> <p>can anyone tell me how can i do that..??</p>
java iphone asp.net android
[1, 8, 9, 4]
4,035,727
4,035,728
<Control>.Focus() from server side doesn't scroll into view
<p>Custom Validation Control:</p> <pre><code>&lt;asp:CustomValidator ID="valSex" runat="server" ErrorMessage="1.2 &amp;lt;b&amp;gt;Sex&amp;lt;/b&amp;gt; not specified" EnableClientScript="true" ClientValidationFunction="ValidateSex" SetFocusOnError="True"&gt;Selection required&lt;/asp:CustomValidator&gt; </code></pre> <p>Client Side validation routine:</p> <pre><code>function ValidateSex(source, args) { var optMale = document.getElementById("&lt;%=optMale.ClientID %&gt;"); var optFemale = document.getElementById("&lt;%=optFemale.ClientID %&gt;"); if (!optMale.checked &amp;&amp; !optFemale.checked) { args.IsValid = false; optMale.focus(); } else args.IsValid = true; } </code></pre> <p>When the page is submitted and Sex is not specified, focus is set but the 2 radio buttons are not quite in view, vertical scrolling is required to bring them into view.</p> <p>Shouldn't the Focus() method have brought the focus control into view?</p>
asp.net javascript
[9, 3]
841,164
841,165
Calling my own function during with onClick
<p>How do I call a user-define function such as this one using the onClick attribute of a input button? More specifically what special steps must I take in JQuery and what would the HTML markup look like? Thanks</p> <pre><code>function simClick(keyCode) { var e = jQuery.Event("keypress"); e.keyCode = 8; $(document).trigger(e); } &lt;input type="button" ID="delBtn" class="calcBtn" value="Del" onclick="???????" /&gt; </code></pre>
asp.net jquery
[9, 5]
1,403,900
1,403,901
Android Development: Name of this view
<p>Hi, I am new to mobile app development, so forgive me if this seems like a stupid question. The screenshot below is from the Sydney airport iPhone app. Could anyone please tell me what kind of View is that? I mean, the one with all the "To and From" info, like "parking" etc.? And is it possible to make such a view in Android?</p> <p><img src="http://i.stack.imgur.com/Ht7yx.jpg" alt="Screen"></p>
android iphone
[4, 8]
1,930,678
1,930,679
JavaScript: Whats the difference between 'Document' and 'HTML'
<p>Example:</p> <pre><code>$(document).click(function() { blah }); // and $('html').click(function() { blah }); </code></pre>
javascript jquery
[3, 5]
4,278,515
4,278,516
Help with showModalDialog together with Selections
<p>I need to use the showModalDialog method to display a message to a user, which will also need to have two buttons, a "Yes" and "No" but unsure how to approach this method.</p> <p>I am using IE8 and unsure how to declare this and how I need to assign this that will also cater for both "Yes" and "No" options.</p> <p>If "No" is pressed, I basically want the showModalDialog closed, with no further action required by the user.</p> <p>If "Yes" is pressed, I then want it to go off and call a javascript function.</p> <p>I have looked online but I can't seem to find any examples relating to what I am after here.</p> <p>Would really appreciate any help with the above, links to good examples or an example the relates to my requirement above.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
4,582,816
4,582,817
Sending Email Using apache commons mail package from android
<p>I am new to android. I am developing the new app with email sending option. To send a mail I have used gmail configurations host "smtp.gmail.com", port 465 with SSL true. To send an email I have apache commons API. <code>OnTouch</code> event mail sending method will call. Whenever touch button it shows following errors,</p> <p><pre>Error : Could not find class 'javax.naming.InitialContext', referenced from method org.apache.commons.mail.Email.setMailSessionFromJNDI Warning: VFY: unable to resolve new-instance 955 (Ljavax/naming/InitialContext;) in Lorg/apache/commons/mail/Email; Warning : org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:465</pre></p> <p>I have added uses-permission android:name="android.permission.INTERNET" in my manifest file.</p> <p>Can i use all java files in android ?</p> <p>My email code executed correctly as a stand alone java program.</p>
java android
[1, 4]
4,928,910
4,928,911
How to disable initial mouseover
<p>With jQuery (or pure javascript), if you set a <code>mouseover</code> handler, it will be triggered even if the mouse is initially on the element. How to disable that?</p> <p>For example, look at facebook - place your mouse over the name of a friend in the feed. A hovercard appears. Now refresh the page (without moving the mouse; F5) - the hovercard does not appear.</p>
javascript jquery
[3, 5]
114,074
114,075
jQuery clearInterval not working
<p>I have the following hover function </p> <pre><code>function tt_attachToBase(){ jQuery.each(bases, function(index,base){ jQuery(base).hover(function() { jQuery(base).showTipTimer = setInterval( function(){tt_locateBase(base);} , 3000 ); }, function() { clearInterval(jQuery(base).showTipTimer); tt_hideTip(); } }); } ); </code></pre> <p>inside tt_locateBase() I also clear interval like this</p> <pre><code>tt_locateBase(base){ clearInterval(jQuery(base).showTipTimer); //code to sidplay tooltip } </code></pre> <p>the tooltip does display after an interval, but the interval it seems is never cleared since the tooltip keep recurring over base. what am I doing wrong? </p>
javascript jquery
[3, 5]
2,833,737
2,833,738
how to reduce the time taken to populate tree node in asp.net c# treeview?
<p>I am binding the XML Data to treeview using XMLDataSource. Its working fime, but when the Number of nodes and childnodes increases, the treenode expand and to display the content in iframe takes moer time.</p> <pre><code>&lt;asp:TreeView ID="TreeView1" OnSelectedNodeChanged = "OnClick" runat="server" ExpandDepth="0" ShowExpandCollapse="true" ForeColor="Red" Font-Underline = "false" ondatabinding="TreeView1_DataBinding" CollapseImageUrl = "Resources/TocColapse.bmp" ExpandImageUrl = "Resources/TocParent.bmp" Font-Names="Arial" &gt; &lt;SelectedNodeStyle Font-Underline="false" BackColor="White" ForeColor="#0483e0" /&gt; &lt;NodeStyle Font-Size="11pt" ForeColor="white" HorizontalPadding="5px" NodeSpacing="0px" VerticalPadding="0px" Font-Underline = "false" /&gt; &lt;ParentNodeStyle ForeColor="#0483e0" Font-Underline = "false" /&gt; &lt;LeafNodeStyle ForeColor="#0483e0" Font-Underline = "false" ImageUrl = "Resources/TocChild.bmp" /&gt; &lt;/asp:TreeView&gt; &lt;asp:XmlDataSource ID="XmlDataSource1" runat="server" XPath="/*/*" EnableCaching = "false" &gt;&lt;/asp:XmlDataSource&gt; </code></pre> <p>In OnDataBinding event of treeview I implemented the following code:</p> <pre><code> TreeNodeBinding[] TreeNode = new TreeNodeBinding[Count]; for (int i = 0; i &lt; Count; i++) { TreeNode[i] = new TreeNodeBinding(); TreeNode[i].DataMember = TableOfContents[i].GetElementName(); TreeNode[i].TextField = TableOfContents[i].GetFirstAttributeName(); TreeNode[i].ValueField = TableOfContents[i].GetSecondAttributeName(); // TreeNode[i].Target = "contentFrame"; TreeView1.DataBindings.Add(TreeNode[i]); } </code></pre>
c# asp.net
[0, 9]
254,836
254,837
javascript setInterval()
<p>I have this code:</p> <pre><code>function noti() { document.title = document.title + " 1" } setInterval("noti()", 1000) </code></pre> <p>The problem is it outputs: </p> <blockquote> <p>My title 1 1 1 1 1 1 1 ..... to infinite.... 1</p> </blockquote> <p>Is there any possible way to output this as "My title 1"</p> <p>the <strong>noti()</strong> function serves as a purpose when everytime an update occurs in the database, <em>whatever is the length gathered from the database</em> it will be outputed into the users <strong>title bar</strong>. </p> <blockquote> <p>So, "My title 1", where "My title" is the name of the user and "1" the length coming from the database</p> </blockquote>
javascript jquery
[3, 5]
2,342,305
2,342,306
displaying a texarea value into another textarea value
<p>I've two input fields, both type textareas. </p> <pre><code>&lt;input id="display" type="text" disabled="disabled" style="border: none; background: none" /&gt; &lt;input id="name" type="text" /&gt; </code></pre> <p>And I'm using jQuery to display the value of <code>#name</code> into <code>#display</code>. The textarea <code>#display</code> is used only for displaying. (It can be changed to any other suitable HTML element)</p> <p>I use the jQuery code to do that:</p> <pre><code>$('#name').keyup( function() { $('#display').val($('#name').val()); }); </code></pre> <p>The problem is, as I type, I want the value inside <code>#display</code> to wrap within its width. When I type long strings in <code>#name</code>, the string wraps and falls down as the next line but in <code>#display</code> it doesn't do so.</p> <p>Again, when I type return, I want the same format to be followed up in the <code>#display</code> text field.</p> <p>Can anyone tell me how do I do that??</p>
javascript jquery
[3, 5]
204,314
204,315
Unable to start activity ComponentInfo: java.lang.NullPointerException
<p>i'm building an android application for my degree. i need to get all contacts from phone for begin the apllication (later i need also to get emails etcetc). so i used two classes </p> <p>Degree_thesisActivity</p> <pre><code> public class Degree_thesisActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); GetFromPhone gf = new GetFromPhone(); gf.getContacts(); } </code></pre> <p>}</p> <p>GetFromPhone.java</p> <pre><code>class GetFromPhone extends Activity { public void getContacts() { // TODO Auto-generated method stub /**Declare a Contacts Cursor which have a list of all contacts*/ Cursor cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); /**Move while cursor has another istance to process*/ while(cursor.moveToNext()){ /**Get the contact name pointed by cursor at that time*/ cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); String contactID = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); /**show the contact pointed.THIS WILL BE MODIFIED FURTHER!!!!*/ new AlertDialog.Builder(this) .setMessage(contactID) .setNeutralButton("ok", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }) .show(); } } </code></pre> <p>}</p> <p>but i get this error :</p> <p>05-05 15:49:20.060: E/AndroidRuntime(824): java.lang.RuntimeException: Unable to start activity ComponentInfo{it.paki.degreethesis/it.paki.degreethesis.Degree_thesisActivity}: java.lang.NullPointerException</p> <p>why?anybody can help me?</p>
java android
[1, 4]
3,679,644
3,679,645
Download file after time from page load?
<p>i have an exe url that i want to download after 2 sec from page load: like this:</p> <pre><code> var handle = 0; function Download() { window.location = "exeUrl"; clearInterval(handle); } $(document).ready(function () { handle = setTimeout('Download()', 5000); }); </code></pre> <p><strong>NOW</strong>: My problem is window.location will reload the page and download function will be recall?</p>
javascript jquery
[3, 5]
1,387,850
1,387,851
Javascript/jQuery function yields undefined in <IE8
<p>A short while back I asked a question here about how I could calculate when a heading was longer than one line within a given container, and subsequently wrap each of these lines in a <code>&lt;span&gt;</code>:</p> <p><a href="http://stackoverflow.com/questions/3960336/use-javascript-jquery-to-determine-where-a-heading-breaks-to-the-next-line">Use Javascript/jQuery to determine where a heading breaks to the next line?</a></p> <p>I chose an answer which worked great for me, at least until I checked in IE7 and IE6, in which all the headings handled by this script rendered as </p> <p>"<strong>undefinedundefinedundefinedundefinedundefinedundefined</strong>[...]"</p> <p>on the page. As I'm not really a JavaScript person (that's why I asked such a question in the first place), it's really tough for me to figure out where the problem is. I assumed an undefined variable or something, but I just can't seem to grasp it.</p> <p>Can anyone help?</p> <p>I'll repeat the code here, but please refer to the link above for context:</p> <pre><code>$(function(){ $h = $('.fixed').find('h3'); $h.each(function(i,e){ var txt = $(e).text(); $th = $('&lt;h3 /&gt;').prependTo($(e).parent()); var lh = $(e).text('X').height(); $(e).text(''); while (txt.length &gt; 0) { $th.text($th.text() + txt[0]); txt = txt.slice(1); if (($th.height() &gt; lh) || (txt.length &lt;= 0)) { var shc = $th.text().split(' '); var ph = shc.slice(0,-1).join(' ')+' '; if (txt.length &lt;= 0) { ph += shc.pop(); } $('&lt;span /&gt;').text(ph).appendTo($(e)); $th.text(shc.pop()); } } $th.remove(); }) }); </code></pre>
javascript jquery
[3, 5]
1,329,246
1,329,247
Transposition table for game tree (connect 4)
<p>I am making a Connect 4 app for Android and right now I am using a minimax algorithm coupled with alpha-beta prunning and heuristic evaluation function for leaf nodes. I also ordered the moves to further maximize the pruning process. Unfortunately with that strategy the algorithm takes too much time in depth 7, leading me to abandon it in favor of using a transposition table.</p> <p>Now, I've read information about transposition tables and have got a general idea of how they work, but I am unsure how to proceed with the actual implementation in code. I am not a Java expert so I need any help you can give me.</p> <p>In my game I am using a int[42] array for the board positions. I thought of using a hash map and storing some kind of data structure objects, where every one of these object will include the board position(array) and an int "score"variable (which would in fact be the score given to this position by the evaluation function). But, that means that every time I want to put a new board position in the table I need to perform some kind of check to see if this position does not exist already(??). And if not, only then insert into the table?</p> <p>I will be glad for any technical help you guys can give me on this subject. I can put some code examples if needed, but this is a general question and I don't think they are really necessary at this point.</p> <p>Thanks in advance.</p>
java android
[1, 4]
1,275,172
1,275,173
function is inaccessible due to its protection level
<p>I am having an issue with C# in ASP.</p> <p>I get an error on the following line of code which starts "string[]"....</p> <pre><code>Label DT33 = (Label)MainContent2.FindControl("data_text"); string[] lines = Strings.Split(DT33.Text, "&lt;br&gt;"); num = lines.Length;The error reads.... </code></pre> <p>Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. </p> <p>Compiler Error Message: CS0122: 'System.Linq.Strings' is inaccessible due to its protection level</p> <p>I have specified the following names space....</p> <pre><code>using Microsoft.VisualBasic; </code></pre> <p>Along with many others. This is a .net 3.5 app, I am out of ideas at this point.</p> <p>thanks,</p>
c# asp.net
[0, 9]
5,465,677
5,465,678
App crashing on count and dialog box
<p>i am using following code.</p> <pre><code>public class MyCount extends CountDownTimer { public MyCount(long millisInFuture, long countDownInterval) { super(millisInFuture, countDownInterval); } @Override public void onFinish() { displayAlertForRestart(); } @Override public void onTick(long millisUntilFinished) { counter.setText("Time Left: " + millisUntilFinished/1000 + " sec"); } } public void displayAlertForRestart() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setCancelable(true); builder.setMessage("Do you want to Restart?"); builder.setTitle("Game Over"); builder.setInverseBackgroundForced(true); builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent myIntent = new Intent(context,Level.class); startActivity(myIntent); dialog.dismiss(); finish(); } }); builder.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); } }); AlertDialog alert = builder.create(); alert.show(); } </code></pre> <p>LogCat error: Error at <code>alert.show();</code></p> <pre><code>36: E/AndroidRuntime(9829): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@43cf1e38 is not valid; is your activity running? </code></pre>
java android
[1, 4]
1,095,543
1,095,544
a little complex Linq2SQl insert operation (Dynamic user control and page insertion)
<p>i am really trying to do this but i am failing to find a way.</p> <p>here is the scenario, i got a blog module i made for my clients, because it is a repeatative task, so i all i have to do is to just upload it to new client and he can start blogging, but some clients need extra custom fields, let us say he wants to add a phone number for each article author, or extra reference, but i don't want to implement it for each client because it is a custom requirement.</p> <p>now to do that i thought of creating a dynamic user control with this extra filed and this code in the user control for example</p> <pre><code>Blog bl = new Blog(); bl.ExtraRefrence = " http://www.something.com"; </code></pre> <p>load it into the blog management panel, but what i want to do is to have the ability to let user control use the data context in the main blog editing page, what i mean is that the main page will have the insert command, so how i let main page insert command see the dynamic user control value without creating 2 Blog objects one in page and one in user control.</p> <p>sorry if i am not clear, but seriously this killing me.</p>
c# asp.net
[0, 9]
3,390,477
3,390,478
Using JavaScript to record a time on the client and then how to compare the time
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/8752575/how-to-apply-a-timeout-if-a-function-hasnt-been-called-1-of-n-records-in-3-seco">How to apply a timeout if a function hasn&#39;t been called 1 of N records in 3 seconds</a> </p> </blockquote> <p>I'm tracking user typing. What I want to do is every time a user types, store the time the even occurred. Then set a timeout that in 3 seconds checks for values that are older than 3 seconds. For any value that is over 3 seconds perform an action.</p> <p>What I need help with is:</p> <ol> <li>Given all the options, the right way to record a time on the client</li> <li>How to compare #1's time against the current time to determine if the time is GTE 3 secs?</li> </ol> <p>Thanks</p>
javascript jquery
[3, 5]
902,560
902,561
Server.mappath confusion
<p>There is a little confusion in my mind about server.mappath which is correct and what's the difference betwwen these two</p> <pre><code>FileUpload1.saveAs(Server.MapPath("~/User/images/")+"ankush.jpg")); FileUpload1.saveAs(Server.MapPath("~/User/images")+"ankush.jpg")); </code></pre>
c# asp.net
[0, 9]
4,276,095
4,276,096
JQUERY Further More Ordering DIV's A-Z
<p>I just asked a question about ordering but it was only the first part of what I needed. I want to ask the full question now to see if its possible:</p> <p>Its for a chat webpage and users can be online (active), offline (noactive) or have a message pending (msg) or no message pending (nomsg). Also keep the ID name in mind for A-Z eg:</p> <pre><code> &lt;div id="chatCenterMembers"&gt; &lt;div id="lee" class="chatmember 10001 active msg"&gt;&lt;/div&gt; &lt;div id="arch" class="chatmember 10008 noactive nomsg"&gt;&lt;/div&gt; &lt;div id="steven" class="chatmember 10041 noactive msg"&gt;&lt;/div&gt; &lt;div id="tim" class="chatmember 10432 active nomsg"&gt;&lt;/div&gt; &lt;div id="ssan" class="chatmember 10007 active msg"&gt;&lt;/div&gt; &lt;div id="yanti" class="chatmember 10034 noactive msg"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>Is it possible to order this as follows: 1. active msg (A-Z) 2. active nomsg (A-Z) 3. noactive msg (A-Z) 4. noactive nomsg (A-Z)</p> <p>thx</p>
javascript jquery
[3, 5]
582,028
582,029
method to take an element out from jquery object
<pre><code> $('li').add('&lt;p id="new"&gt;new paragraph&lt;/p&gt;') .css('background-color', 'red'); </code></pre> <p>Although the new paragraph has been created and its background color changed, it still does not appear on the page.What or which method/procedure i be able to place it on the page.</p>
javascript jquery
[3, 5]
2,555,998
2,555,999
Exchange the position of button in android
<p>So what I want to achieve is to change the position of my buttons. this is my sample picture:</p> <p><strong>Note:</strong> <br> My buttons have background drawable, for example sake, I just uploaded without the background images on buttons. <br><br><strong>Default</strong><br> <img src="http://i.stack.imgur.com/ovkY3.png" alt="de"></p> <p><strong>When shuffled:</strong></p> <p><img src="http://i.stack.imgur.com/joPS5.png" alt="enter image description here"></p> <p>So this is the code I'm working on:</p> <pre><code> List&lt;Integer&gt; objects = new ArrayList&lt;Integer&gt;(); objects.add(0); objects.add(1); objects.add(2); objects.add(3); objects.add(4); // Shuffle the collection Collections.shuffle(objects); List&lt;Button&gt; buttons = new ArrayList&lt;Button&gt;(); buttons.add((Button) findViewById(R.id.bObject1Stage2_1)); buttons.add((Button) findViewById(R.id.bObject2Stage2_1)); buttons.add((Button) findViewById(R.id.bObject3Stage2_1)); buttons.add((Button) findViewById(R.id.bObject4Stage2_1)); buttons.add((Button) findViewById(R.id.bObject5Stage2_1)); Collections.shuffle(buttons); for (int i = 0; i &lt; objects.size(); i++) { //buttons.get(i).setText(objects.get(i).toString()); buttons.get(i); } </code></pre> <p>But it's not changing the position of buttons. What am I missing in here? Any help is truly appreciated. Thanks.</p>
java android
[1, 4]
1,712,530
1,712,531
Javascript Action Order
<p>Say I have:</p> <p><code>&lt;div id="name" class="button"&gt;&lt;/div&gt;</code> </p> <p>and in a javacript file I define click actions for both class button and id name, something like:</p> <pre><code>$("#name").click(function(event){ alert("hi"); }) $(".button").click(function(event){ alert("bye"); }) </code></pre> <p>When I click that div, will I get the "hi" alert before the "bye" alert because "hi" appears above "bye"? Or does something else determine what happens first? What if the 2 functions were in different files? Would it then matter which javascript file was included first (appeared closer to the top of the html file)? I assume jQuery has nothing to do with this, right?</p>
javascript jquery
[3, 5]
4,030,429
4,030,430
Can the closest jquery function find child tags inside other tags
<p>I have this HTML code</p> <pre><code>&lt;td&gt; &lt;div&gt;&lt;p&gt; My Txt &lt;/p&gt;&lt;/div&gt; &lt;div&gt;&lt;a class="linkclass" &gt;link1 &lt;/a&gt;&lt;a&gt; link2 &lt;/a&gt;&lt;/div&gt; &lt;/td&gt; </code></pre> <p>Now i want that if someone click on <code>a.linkclass</code> then i alert the text inside p tag</p> <p>I tried this but it didn't work</p> <pre><code>$(this).closest('p').text(); </code></pre>
javascript jquery
[3, 5]
5,040,353
5,040,354
Add elements to 2D array in jquery
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/966225/how-to-create-a-two-dimensional-array-in-javascript">How to create a two dimensional array in JavaScript?</a> </p> </blockquote> <p>I want to push elements to 2D array, </p> <p>My code is, </p> <pre><code> var results = []; var resultstemp = []; function bindlinks(aamt,id1) { resultstemp=results; imagesArray.push($("#image1").mapster("get")); if(results.length==0) { results.push([id1]); } else { var ck=0; var lng=results.length; for (var i = 0; i &lt; lng; i++) { if(results[i]==id1) { ck=1; results = jQuery.grep(results, function(value) { return value != id1; }); } } if(ck==0) { results.push(id1); } } </code></pre> <p>I want to push <code>id</code> as well as <code>aamt</code> to array. Here i am pushing only id to array. I am not sure about how to add <code>aamt</code> to second position in 2D array. </p> <p>Help me please,</p> <p>Thank you </p>
javascript jquery
[3, 5]
5,514,877
5,514,878
Memory problem in android at run time
<p>I need to display many rows in <code>ListView</code> in my android application . There is more than 2500 rows with each row contains tow images and 11 labels . So I am getting memory error at run time like "VM will not lets you to use more than 120000 bytes" . </p> <p>How can I solved this problem ?</p> <p>Can anybody help me ? </p>
java android
[1, 4]
3,477,258
3,477,259
unterminated string literal Javascript
<p>I'm using the following code in php:</p> <p>PHP:</p> <pre><code> $suggested_sentence[0] = "Hello, how are you?"; echo $suggested_sentence[0] . ' &lt;input type="image" src="button.png" onclick = update_textarea('. $textareacount.','. "'".$suggested_sentence[0]."')/&gt;"; </code></pre> <p>Javascript function:</p> <pre><code>function update_textarea(count, new_sentence) { document.getElementById('sentence' + count).value = new_sentence; } </code></pre> <p>But when i press the button i get the error "unterminated string literal but if i change the value of <code>$suggested_sentence[0] = "Hello"</code> it works fine.</p> <p>What should i do then?</p>
php javascript
[2, 3]
2,712,768
2,712,769
Object scope while attaching an event listener in javascript
<p>I need to do something like this:</p> <pre><code>for(int i =0; i&lt; results.length; i++){ $('ul').append('&lt;li&gt;'+results[i].name+'&lt;/li&gt;').bind('click',function(){ doSomething(results[i]); }) } </code></pre> <p>but when the click happens, the object passed to doSomething is undefined. How do I solve this?</p>
javascript jquery
[3, 5]
425,824
425,825
Advice on onPause and onResume
<p>If i use the code below will this restore text that has been input into EditTextfields and selected spinner items?</p> <pre><code> @Override protected void onPause(){ super.onPause(); } @Override protected void onResume(){ super.onResume(); } </code></pre> <p>or do I have to tell it to save the current values and then restore then when activity is resumed? when I am using the emulator if I don't have these methods in and I go to say home then run my app again it always loads back to the previous state, so my questions is does this actually do antyhing?</p>
java android
[1, 4]
1,095,045
1,095,046
Javascript or jquery confirmation dialog
<p>Hello i have this code :</p> <pre><code>&lt;a href="#" class="removelink" title="&lt;%=id%&gt;"&gt;&lt;button class="btn-icon btn-orange btn-cross"&gt;&lt;span&gt;&lt;/span&gt;Delete&lt;/button&gt;&lt;/a&gt; </code></pre> <p>how could i add a confirmation dialog onclick with yes or no ?</p> <p>thank you</p>
javascript jquery
[3, 5]
1,339,865
1,339,866
Page event is not getting fired at all
<p>I am trying to use the <code>Page_LoadComplete</code> in my user control <code>myusercontrol.ascx.cs</code> but its not getting fired up, I added a break point and nothing, it is possible that the user control does not support this event? and if thats the case what can I use instead?</p>
c# asp.net
[0, 9]
16,529
16,530
Converting Java to C++
<p>I'm new to C++ so I'm having trouble converting this into C++. Is there examples that I could see how a C++ arraylist looks. I know java has several classes that can be made but in C++ how would that be made would it be all under one .cpp file.</p> <pre><code>public class Main { public static void main(String[] args) { Inventory netFlix = new Inventory(); netFlix.add( "Prince of Persia", 140); netFlix.add( "Clash of Titans", 223); netFlix.add( "Avatar", 353); netFlix.add( "Inception", 460); netFlix.add( "Resident Evil", 105); netFlix.add( "Devil", 624); netFlix.add( "Memento", 117); netFlix.add( "D2: The Mighty Ducks", 508); netFlix.add( "The Lord of the Rings",910); netFlix.add( "The Uninvited", 120); </code></pre>
java c++
[1, 6]
3,029,691
3,029,692
Optimising event handling: one large, or many small?
<p>Which pattern is best, and why?</p> <pre><code>$myElements.delegate(selector, 'event1 event2', function () { if (event.type === 'event1') { /* Handle event 1 */ } if (event.type === 'event2') { /* Handle event 2 */ } } </code></pre> <p><strong>OR</strong></p> <pre><code>$myElements .delegate(selector, 'event1', function () { /* Handle event 1 */ } .delegate(selector, 'event2', function () { /* Handle event 2 */ } </code></pre> <p>In other words, is it better to have one large unified handler, or many small separate handlers?</p>
javascript jquery
[3, 5]
5,756,731
5,756,732
what are the pitfalls of storing Viewstate in session or DB
<p>I have read that you can do it, but would this really improve performance of the page, or would it bring more performance overhead?</p>
c# asp.net
[0, 9]
2,568,912
2,568,913
ASP.NET Multi-Lingual Application using Database
<p>I am wondering if anyone would share their experience on what they think as the best strategy to enable dynamic multi-lingual system using .NET</p> <p>I have a customer who wishes to have an semi-MRP system that stores all Product's Materials and specs. These information will later be used for other modules such as Invoices, Purchasing, Marketing (extracting the information for printing purposes) and many more.</p> <p>The thing is, he wants everything to be stored multiple languages. He is also unable to fixed the number of languages. Hence, the number of languages will grow throughout time.</p> <p>So I guess what I am asking is, what is the best strategy to setup a dynamic language enabled website that encompasses the field names (eg, name) and also it's data (eg, Lasker).</p> <p>Many thanks in advance, Lasker</p>
c# asp.net
[0, 9]
5,903,090
5,903,091
Onmouseover running multiple times while hovering on element?
<p>Why does onmouseover run multiple times while I hover over one element?</p> <p>I'm trying to run a simple animation when the user hovers over an icon but it runs multiple times.</p> <p>I'm testing it here:</p> <p><a href="http://lujanventas.com/test.php" rel="nofollow">http://lujanventas.com/test.php</a></p> <p>Anyway, any ideas on how to fix it? maybe using a listener instead?</p> <p>This is the javascript running onmouseover:</p> <pre><code>function upIcon(n) { console.log("Mouseover icon: " + n); $('#icon' + n).animate({ backgroundPositionY : "-=15px" }, 200 ); $('#icon' + n).animate({ backgroundPositionY : "+=15px" }, 200 ); } </code></pre>
javascript jquery
[3, 5]
454,447
454,448
can anybody help me find what is the js error i get in explorer 7 and 8?
<p>If i run the link in ieTester, in ie7 pops up a js error and the site doens't work, if i try ie8 i don't get a pop msg but it doesn't work neither. It says: Line 219 Char 1 Error expected identifier, string or number Code 0</p> <p>in here: link off - issues was the answer below</p> <p>Thanks</p>
javascript jquery
[3, 5]
1,722,955
1,722,956
What should I do for devloping a great project?
<p>I am going to start a new project as a project trainee. And my project is making a job-portal site. And I have done some work with winform but I am a newbie to asp.net,css,html and java script. And my expection is to make this project is very very great at all, and I am ready to work a lot and lot to make this project successfull. Amd reason to make good project is learning. </p> <ol> <li>Now I want to know that how should I start ?</li> <li>What should I do first ?</li> <li>Which things I should keep in my mind by doing this project ?</li> <li>Which structure I should follow ?</li> <li>Should I use mvc (I dont know more about mvc) ?</li> <li>How my database should be ?</li> <li>Which database I should use as a backend ?</li> <li>Which facilities should be provided to the user for more user freindliness ?</li> <li>What shoud I use for validation like javascript or ajax or regex ?</li> <li>Will there be a need of providing reporting services, if yes what should I use to do that ?</li> <li>And how can I know that what will be there at the side of admin and at the side of the employers as we can know at the side of the job seeker ? </li> <li>Give me other suggestions that this website should include as a functionality. </li> <li>Should my database has normalization ? </li> <li>How can I know more and requirement about this project ?</li> </ol> <p>I am asking these type of number of questions because I want to learn as possible as more. And want to involve as possible as more functionalities in this project. And second reason for knowing the answers of above question is I can come to know that which thing I should follow like one question is which database I should use then as an answer of this question I can come to know that which database is more used in the industry and is required to learn first. Thanks...</p>
c# asp.net
[0, 9]
466,881
466,882
How to get HTML from a current request, in a postback
<p>I have a report that I generate with HTML. </p> <p>I'd like to get the HTML output of the page, and be able to send it via email. I'm having problem with session, because the report redirect me to the login page because when I create a new WebRequest, it doesn't use the information of the current session.</p> <p>Is there a way to get the HTML of the report without having to code a work-around for the security ?</p> <p>Thank you</p>
c# asp.net
[0, 9]
2,105,946
2,105,947
Orkut style div update on click
<p>I am trying to update a div on click similar to orkut .. The div is updating fine. But when the user clicks on the textbox its value becomes null initially. So the user has to again type the whole thing. So what I need is a facililty for the user to add the text with the existing one. So when he clicks on the textbox, the existing value of textbox would remain there and allows user to append new text. Please find the code below for that..</p> <pre><code>$(document).ready(function () { $('.photo_title').click( function(e){ var text = $(this).text(); $(this).val(''); $('&lt;input type="text" value="sdfsdfsdfsdf" /&gt;').appendTo($(this)).val(text).select().blur( function(){ var newText = $(this).val(); if(newText==""){newText="enter text "} $(this).parent().text(newText),find("form input:text" ).remove(); }); }); }); </code></pre> <h1> HTML</h1> <pre><code>&lt;div class="photo_title"&gt;My text goes here and type here to add more&lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
5,527,862
5,527,863
asp.net Page loading twice when making an underlying connection
<p>I have a aspx page that seems to be loading twice when I enter the Url to the page.</p> <p>In this page's loading event, I'm making an connection to a server to retrieve a document and then I output the downloaded bytes to the output stream of the page.</p> <p>This is causing the page to load twice for some strange reason. If I hard code a byte array without making this connection, the page loads once and all is well.</p> <p>Here are the methods used to retrieve the external document. Maybe you can see something I can't.</p> <pre><code>public static byte[] GetDocument(string url) { HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse(); Stream stream = myHttpWebResponse.GetResponseStream(); byte[] _Data = StreamToBytes(stream); return _Data; } private static byte[] StreamToBytes(System.IO.Stream theStream) { if (theStream == null) throw new ArgumentException("URL null."); int bytesRead = 0; byte[] buffer = new byte[8096]; MemoryStream bufferStream = new MemoryStream(); try { do { bytesRead = theStream.Read(buffer, 0, 8096); bufferStream.Write(buffer, 0, bytesRead); } while (bytesRead &gt; 0); } finally { bufferStream.Flush(); theStream.Close(); theStream.Dispose(); } return bufferStream.ToArray(); } </code></pre>
c# asp.net
[0, 9]
1,815,772
1,815,773
JavaScript in Android
<p>Is it possible to use JavaScript in Android?? if so, how? Please provide some examples.</p> <p>Thanks.</p>
java javascript android
[1, 3, 4]
5,453,602
5,453,603
JQuery 'undefined' is not a function error
<p>I am using some JQuery on my website and all my other functions work the same way and don't give me an error but this one in particular gives me the error:</p> <pre><code> TypeError: 'undefined' is not a function (evaluating '$('.main-scn .livecontainer').delay(200).aniamte({left:'+=200'}, 500, function() {extend = 0})') </code></pre> <p>Heres the code:</p> <pre><code>var extend = 1; $('.main-scn .controls .icon').click(function() { if (extend == 1) { $('.main-scn .right .content').fadeOut(200).delay(550).fadeIn(200); $('.main-scn .livecontainer').delay(200).aniamte({left:'+=200'}, 500, function() {extend = 0}); } else if (extend == 0) { $('.main-scn .right .content').fadeOut(200).delay(550).fadeIn(200); $('.main-scn .livecontainer').delay(200).animate({left:'-=200'}, 500, function() {extend = 1}); } }); </code></pre> <p>I've tried finding the error but I can't find it anywhere. Why wouldn't this work? Thanks!</p>
javascript jquery
[3, 5]
4,981,379
4,981,380
How to put the link to the last created quiz in the email that will be sent to all users automatically?
<p>I could be able to let the web application sends automatic emails using Windows Task Scheduler. Now I want to put the link to last created quiz by admin in that email. <strong>How to do that? Should I add any column in the Quiz table in the database?</strong></p> <p>The table schema:</p> <p><em><strong>Employee Table: Username, Name, Job, Email</em></strong></p> <p><em><strong>Quiz Table: QuizID, Title, Description</em></strong></p> <p>My code-behind:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { SmtpClient sc = new SmtpClient("mail address"); MailMessage msg = null; try { msg = new MailMessage("xxxx@gmail.com", "yyyy@gmail.com", "Message from PSSP System", "This email sent by the PSSP system"); sc.Send(msg); } catch (Exception ex) { throw ex; } finally { if (msg != null) { msg.Dispose(); } } } </code></pre>
c# asp.net
[0, 9]
5,767,853
5,767,854
How to Hide Sliding div on Document Ready
<p>I am trying to slide up and down a div (<code>.nav</code>) by clicking on another div (<code>#toggleMenu</code>) </p> <p>Now my problem is when I run the page the (<code>.nav</code>) div pops up very fast. I used the <code>$(".nav").hide();</code> to hide the div but this is happening after loading the (<code>.nav</code>) very fast.</p> <p>here is the code I have </p> <pre><code>$(document).ready(function() { $(".nav").hide(); $("#toggleMenu").click(function () { $('.nav').slideToggle(); }); }); </code></pre> <p>and the css style is as:</p> <pre><code>.nav { border: 0px solid #ccc; border-width: 0px 0; list-style: none; margin: 0; padding: 0; text-align: left; } </code></pre>
javascript jquery
[3, 5]
3,144,235
3,144,236
hide a message after 30 seconds.?
<p>How can after click on button show a message and next <strong>hide it after 30 seconds</strong>?</p> <p><strong>Like:</strong></p> <pre><code>$('#message').live('click', function() { $('#sm').hide(); $('#sm').hide().show('slow').html('You have successfully registered'); // how is hide "$('#sm')" after 30 seconds?? }); </code></pre> <p>Please give me example in <a href="http://jsfiddle.net/" rel="nofollow">http://jsfiddle.net/</a></p>
javascript jquery
[3, 5]
796,233
796,234
Android Calendar problem with day of the week
<p>I'm trying to list all days of the week for current week from Monday to Sunday. For example, today (day of this posting) is September 4th, 2011 and it's Sunday.</p> <p>I'm starting calendar and setting first day of the week to Monday:</p> <pre><code>Calendar cal = Calendar.getInstance(); cal.setFirstDayOfWeek(Calendar.MONDAY); </code></pre> <p>When I check day of the month, I get correct result:</p> <pre><code>int check = cal.get(Calendar.DAY_OF_MONTH); // check is equal to 4 </code></pre> <p>But when I set weekday to Monday, it jumps to the next week instead of returning Monday of this week:</p> <pre><code>cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); int mon = cal.get(Calendar.DAY_OF_MONTH); // mon is equal to 5, when expected to be 29 (last Monday of August) </code></pre> <p>Even setting weekday to Sunday returns next Sunday and not today.</p> <p>Can someone explain why it works that way and what's the best way to solve this problem?</p>
java android
[1, 4]
2,457,684
2,457,685
populate a select dropdown on the basis of other other select dropdown
<p>How would I populate a select dropdown whose values are dependent on what is selected in the parent dropdown. E-g, First dropdown has country names in it, and on selection the next dropdown would load the corresponding states of that country, selected in first dropdown. And then say I have a third dropdown, where I am putting the image of that particular state, that corresponds to what is selected in second dropdown.</p> <p>How can this be done in JQuery. </p> <p>E-g </p> <p>Country>>>>> States>>>>>>Map of This State</p>
javascript jquery
[3, 5]
3,102,054
3,102,055
How to ensure that a function is executed completely, before navigating to another page?
<p>I'm removing certain records using a webservice. The jquery ajax request is written in the onclick of a hyperlink. When im executing the script, line by line using firebug, it's getting removed otherwise it's not. Does any one meet any situation like this before? Please help</p> <p>Code sample:</p> <pre><code> $(".target").click(function() { func(); //This function should be executed completely before navigating to another page }); var func = function() { var items = $("#flag").find('td input.itemClass'); id = items[0].value; var status = items[1].value; var type = items[2].value; var params = '{' + 'ID:"' + id + '" ,Type:"' + type + '" ,Status:"' + status + '"}'; $.ajax({ type: "POST", url: "WebMethodService.asmx/DeleteItem", data: params, //contentType: "plain/text", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { $("#deleteNotificationMessage").val("Item has been removed"); // keep a separate label to display this message } //Event that'll be fired on Success }); } </code></pre>
javascript jquery asp.net
[3, 5, 9]
3,585,796
3,585,797
Pageload and Postback problem for Visual Studio(ASP.Net)
<p>I have a page that calls a control. The control has 3 tables. For the first time when the page is loading, it displays 1 &amp; 2 tables. There is a next button, when the user clicks , takes you to the same page but with just 3rd control. In table 1, I have an update button, and even in table 2,i have an update button. When any of these buttons are clicked, it takes me to the page with 3rd table. But it should take me to the same page with 2 tables. Can you guys help me out on this, please!! Thanks so much in advance!!!</p> <pre><code>protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Page.IsPostBack) { string strCheckOrderandPackageHideStatus = Session["HidePackageAndOrderSummary"].ToString(); if(!(string.IsNullOrEmpty(strCheckOrderandPackageHideStatus))) { if(string.Equals(strCheckOrderandPackageHideStatus, "PleaseHide")) { tdOrderSummary.Visible = false; trpackage.Visible = false; trCCandBilling.Visible = true; UpdatePanel3.Visible = false; imgbtnSubmit.Visible = true; } } } } protected void Page_Load(object sender, EventArgs e) { if (isAdmin) HandleAdminRestrictions(); HandleLoad(); RecalculateClick(); } Update1_Click(object sender, eventargs e) { PromoCode(); } Update2_Click(object sender, eventargs e) { Recalculate(); } Next_Click(object sender, eventargs e) { Takes me to the same page but with just 3rd table } </code></pre> <p>Here when you click Update1_Click() or Update2_Click(), I want same page with 2 same controls but updated!! </p> <p>Please help me out!!</p>
c# asp.net
[0, 9]
883,535
883,536
RadTreeView OnClientNodeClicking corfirm
<p>I have problem confirming if node should be changed or not, with jConfirm.</p> <p>This is my js code:</p> <pre><code>function OnClientNodeClicking(sender, args) { var calcelTrue = confirm('Can you confirm this?') if (calcelTrue == false) { args.set_cancel(true); return true; } } </code></pre> <p>and it works fine. But now i want to use jConfirm. And the program does not want to wait for me to click OK or Cancel (it just fire the event). So I am trying to stop the event and if I will click Ok then the event of clicking on node should fire again from js.</p> <pre><code>function OnClientNodeClicking(sender, args) { var node = args.get_node(); jConfirm('Can you confirm this?', 'Confirmation Dialog', function (r) { if (r){ * Fire the event of clicking } }); args.set_cancel(true); } } </code></pre> <p>How can I fire the event from js or how can I prevent jConfirm to wait for me to chose and then triger the event.</p>
c# javascript jquery
[0, 3, 5]
1,288,921
1,288,922
Embed a windows media player in a web page during runtime in c# and asp.net
<p>i want to embed windows media player in my own created web page. can any one please guide me how can i do it in c# and Asp.net. that also should be supported in all browsers.</p> <p>Thanks in advance, Arun</p>
c# asp.net
[0, 9]
5,647,493
5,647,494
jQuery textarea word count on form submit
<p>I have been looking around for a function that counts the number of words in a textarea when I click the form submit button.</p> <p>I am trying to display a message to the user that if they click submit and have only entered 50 or less words. This will be a confirm message basically saying "You have entered less than 50 words, are you sure you would like to continue?"...or something.</p> <p>Cheers</p>
javascript jquery
[3, 5]
2,002,321
2,002,322
Advice for Python programmer writing C#
<p>I've seen this <a href="http://stackoverflow.com/questions/683273/advice-for-c-programmer-writing-python">question</a> about advice for C# programmers writing Python code but I am going the opposite direction.</p> <p>What are some tips, tricks, caveats for a Python programmer writing C# code?</p>
c# python
[0, 7]
3,889,264
3,889,265
Prevent variable update after page refresh without javascript
<p>A friend of mine is developing a web application that's more of an online learning facility. On each page is a set of questions. He wants that when the use has answered all the questions on a page and submitted (and taken to the next page for the next set of questions), he shouldn't be able to go back to answer and resubmit those questions again. The idea is that "opportunity comes but once". </p> <p>He doesn't want to use javascript because it can be disabled which leaves him with server-side coding. He uses PHP. </p> <p>Is there a solution?</p>
php javascript
[2, 3]
3,470,345
3,470,346
Android: Opening an email application on clicking the label
<pre><code>&lt;TextView android:id="@+id/TextView03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/header" android:layout_alignLeft="@+id/button1" android:layout_marginBottom="127dp" android:text="@string/email" android:textColor="#000000" android:textSize="12dp" android:typeface="sans" /&gt; </code></pre> <p>I have a test view which holds my email information. How do i open an default email client on the click of the message. </p> <pre><code>&lt;string name="email"&gt;E-mail:email@gmail.com&lt;/string&gt; </code></pre> <p>Here is my Override method. </p> <pre><code> @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView t2 = (TextView) findViewById(R.id.TextView03); email.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub } }); } </code></pre> <p>What should i do from here?</p>
java android
[1, 4]
2,898,934
2,898,935
How to Redirect to Login page while click on logout
<p>I am developing a application in asp .net 4.0.</p> <p>Here when I am logged in to my application, go to inner pages, say "Manage Role" and copy the link and click on Logout button it displays my login page. Now i paste that link in another tab and expect it to display me the login page but it does not happen, it shows me Manage Role page.</p> <p>So please give me some solution, how can i show login page in this case?</p>
c# asp.net
[0, 9]
3,831,268
3,831,269
Calculate Pecentage in C#
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4585166/simple-division">Simple division</a> </p> </blockquote> <p>I juz wanna ask how to represent this kind of math expression in C#</p> <p><strong>a/b*100.0</strong></p> <p>i try doing this. but it does not work as the percentage display this kind of value (19) not (19.00);</p> <pre><code>int gradeA; int students; int percentage; percentage = (gradeA/students*100.0); percentLabel.Text=Convert.ToString(percentage); </code></pre> <p>thanks in advance</p>
c# asp.net
[0, 9]
5,360,598
5,360,599
Why browser doesn't cache java script(Ajax)?
<p>I have made a cascade drop down list box using jquery. user selects state from first drop down and according to selected state the second drop down will fll by appropriate cities. my problem is about caching of second drop down. when user clicks on back browser button and then click on forward button the city drop down contents is empty. Is there any way to tell browser cache the data?</p>
javascript asp.net
[3, 9]
1,973,609
1,973,610
Can I refactor if - else with a switch or case statement in javascript?
<p>I have the following code:</p> <pre><code>var btns1 = { 'Submit': function (win) { submitHandler(oLink.$link, $('#main-form'), false); }, 'Submit &amp; Close': function (win) { submitHandler(oLink.$link, $('#main-form'), true); }, 'Close': function (win) { modal.closeModal() } } var btns2 = { 'Submit &amp; Close': function (win) { submitHandler(oLink.$link, $('#main-form'), true); }, 'Close': function (win) { modal.closeModal() } } if (oLink.title.substr(0, 4) == "Crea") { if (content.match(/data-RowKey="(.{3}).*/)) { oLink.title += " " + content.match(/data-RowKey="(.{3}).*/)[1] } var btns = btns1; } if (oLink.title.substr(0, 4) == "Edit") { var btns = btns1; } if (oLink.title.substr(0, 4) == "Dele") { var btns = btns2; } </code></pre> <p>Is there a way that I could refactor the code. What I was thinking was to put this into a function called "adminModalBtns", have it take oLink and content as a parameter and have it return btns. Would it be most clear to do this with if-else or a case statement?</p>
javascript jquery
[3, 5]
5,579,400
5,579,401
Implementing lazy loading in homepage posts instead of pagination
<p>I have lots of posts in <a href="http://blog.kushaljoshi.com.np" rel="nofollow">my website</a>. I have used <code>default pagination</code> function for paging the post list in <em>homepage</em>. But I wanted to implement <code>lazy loading</code> instead of pagination just like in <em>twitter</em>. I don't have any idea about it's implementation in <em>Wordpress</em>.</p> <p>Please help me with this.</p>
jquery javascript
[5, 3]
5,348,521
5,348,522
Jquery window.location - how to open a blank window
<p>I have a login script and currently when all is done the client is redirected to the billing page.</p> <p>I'd like this page to open in a new browser window not the existing one as the current code does.</p> <p>Thank you for your help</p> <p>Dave</p> <pre><code>function go_to_private_pageb() { window.location = '../########/billing.php'; // Members Area } </code></pre>
javascript jquery
[3, 5]
3,518,102
3,518,103
jQuery Get Attribute Value even when it changes
<p>I have the following:</p> <p><img src="http://i.stack.imgur.com/TahKM.png" alt="enter image description here"></p> <p><strong>Javascript:</strong></p> <pre><code>$(".bg .thumb_wrapper").click(function() { $(".bg .thumb_wrapper").removeClass("active"); $(this).addClass("active"); }); </code></pre> <p>So every time I click on a new background, it is highlighted and is given a class "active" and the previous active class is removed.</p> <p>Now all I need to do is create a variable and set it to the data-name attribute for that active item.</p> <p><strong>Here is the HTML:</strong></p> <pre><code>&lt;div class="thumb_wrapper active"&gt; &lt;img src="images/backgrounds/thumb/bg2.jpg" data-name="bg2.jpg"&gt; &lt;/div&gt; </code></pre> <p>So if I put it in the click function, it will work fine:</p> <pre><code>var bg = $(".bg .thumb_wrapper.active img").attr("data-name"); console.log(bg); </code></pre> <p>so every time it is clicked, it tells me the value. But I need to access that variable outside of that function.. so it needs to be global.</p> <p>Is there anything I can do to grab the value of data-name on the start of the page, not on a click function? And when I do click a new BG and the active class is updated, then the variable will be updated also?</p> <p>Hope that makes sense.</p> <p>Thanks!</p>
javascript jquery
[3, 5]
4,002,639
4,002,640
ASP.NET - How to check value of a textbox in a user control from a page?
<p>I have an aspx page that contains a user control. The user control has a textbox and the page has a submit button.</p> <p>How can I check if the textbox in the user control is not null and display an alert if it is - from the page?</p>
javascript asp.net
[3, 9]
3,148,191
3,148,192
selectbox without submit button
<p>I want to POST my values from selectbox without submit button. And want to get values as automatically drop down menu selects value</p> <p>Trying below sample code but isnt getting required output</p> <pre><code>&lt;form action="cal1.php" method="post"&gt; &lt;select name="modelS" onChange="submit();"&gt; &lt;option value="all" selected&gt;Show All&lt;/option&gt; &lt;option value="3 Dr"&gt;3 Dr&lt;/option&gt; &lt;option value="5 Dr"&gt;5 Dr&lt;/option&gt; &lt;option value="Cabriolet"&gt;Cabriolet&lt;/option&gt; &lt;/select&gt; &lt;input type="submit" value="confirm bike" name="alldetails"&gt; &lt;/form&gt; </code></pre> <p>Now, able to get post values with below code: But just 1 more query that incase if i remove submit line (remove submit button) and need to get POST value how can i retieve them (ie. without submit button). I tried by using hide but not able to resolve. </p> <pre><code> &lt;?php if(isset($_POST['submit'])){ echo $_POST['modelS'];}?&gt; &lt;form action="cal1.php" method="post"&gt; &lt;select name="modelS" onchange="this.form.elements['submit'].click();"&gt; &lt;option value="A" selected&gt;Show All&lt;/option&gt; &lt;option value="B"&gt;B&lt;/option&gt; &lt;option value="C"&gt;C&lt;/option&gt; &lt;option value="D"&gt;D&lt;/option&gt; &lt;/select&gt; &lt;INPUT TYPE="hidden" name=post VALUE=$_POST['modelS']&gt; &lt;INPUT TYPE="submit" VALUE="search" name="submit"&gt; &lt;/form&gt; </code></pre>
php javascript jquery
[2, 3, 5]
3,693,369
3,693,370
Window resizing problem
<p>When i resize my window popup stays at center position. It show adjust depending on the window size. Whats wrong in my code </p> <pre><code>.Popup { display: none; height: 400px; width: 400px; position: fixed; background-color: white; z-index: 9999; } &lt;/style&gt; &lt;script type="text/javascript"&gt; onload = function () { var height = "innerHeight" in window ? window.innerHeight : document.documentElement.offsetHeight; $('#popup').css({ 'margin-top': (height / 2) - (200), 'margin-left': (document.body.offsetWidth / 2) - (200) }); document.getElementById("popup").style.display = "inline"; } &lt;/script&gt; </code></pre>
javascript asp.net
[3, 9]
733,444
733,445
interesting news article/blog post scraping problem
<p>i need to scrape the text of blog posts to build a summary description of the blog posts similar to what techmeme.com does. not a problem when it's one or a handful of blog posts. however, the possible blogs from which to scrape the text is variable and unlimited. how would you go about doing this?</p> <p>i've used the html agility pack and yql in the past, but there's nothing built-in either of those solutions to handle this requirement.</p> <p>one thought i had was to search for div ids and div attributes named things like content, post, article etc and see how that worked - not really leaning this direction. the other idea was to search for the biggest text node in the html document and assume that's the node i want - could lead to some false positives. the final idea was to endeavor to create a crowdsourced data repository on google apps that would allow for the community to manage (read: create, update, delete) the xpath mappings for most of the popular news/blog platforms then you could query this list by domain or blog platform type and get the requisite xpath - but this seems like a hella undertaking.</p> <p>of course, i know some of you have ideas that will work better than any of my hare-brained ideas.</p> <p>what are your thoughts?</p>
c# asp.net
[0, 9]
3,540,464
3,540,465
How to put the link to the last created quiz in the email that will be sent to all users automatically?
<p>I could be able to let the web application sends automatic emails using Windows Task Scheduler. Now I want to put the link to last created quiz by admin in that email. <strong>How to do that? Should I add any column in the Quiz table in the database?</strong></p> <p>The table schema:</p> <p><em><strong>Employee Table: Username, Name, Job, Email</em></strong></p> <p><em><strong>Quiz Table: QuizID, Title, Description</em></strong></p> <p>My code-behind:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { SmtpClient sc = new SmtpClient("mail address"); MailMessage msg = null; try { msg = new MailMessage("xxxx@gmail.com", "yyyy@gmail.com", "Message from PSSP System", "This email sent by the PSSP system"); sc.Send(msg); } catch (Exception ex) { throw ex; } finally { if (msg != null) { msg.Dispose(); } } } </code></pre>
c# asp.net
[0, 9]
3,752,070
3,752,071
Get element at point in entire page (even if it's not visible)
<p>I have a page and on it are some widgets. There are 2 columns. Widgets will auto-resize themselves if there is no widget to their left (or right).</p> <p>I'm using <a href="https://developer.mozilla.org/En/DOM%3adocument.elementFromPoint" rel="nofollow"><code>document.elementFromPoint</code></a> (after getting the widget's offset) to detect if there is a widget next to it.</p> <p>There is a problem with <code>document.elementFromPoint</code> though.</p> <blockquote> <p>If the specified point is outside the visible bounds of the document... the result is <em>null</em>.</p> </blockquote> <p>It only works if the element is in the viewport. How can I detect what element is at a certain position even if it's not visible?</p> <p><strong>EDIT</strong>: Here's an example:</p> <p><img src="http://i.stack.imgur.com/NLvSm.png" alt="Crappy Mockup"></p> <p>The red line is the viewport, and the grey box (with the red writing) is Widget D's <em>original position</em> (the other Widget D is where it is when the page is done loading). When the page loads, it checks Widgets B, C, and D. It gets their offsets, and then uses <code>document.elementFromPoint</code> to see if Widget A is to their right. If Widget A is to their right, the Widget is half width, if not it's full width.</p> <p>Widget D is full width because <code>document.elementFromPoint</code> returns null because it's outside the viewport. How can I detect that Widget A is to the right of Widget D even though it's outside the viewport?</p>
javascript jquery
[3, 5]
4,276,926
4,276,927
setText of a TextView array
<p>What I'm trying to do is have an EditText where people enter their names. As people press the "Add Player" button, the name which they just typed appears below in the list form. So I've created 8 textviews which are initially invisible but as people type the name press the "Add Player" button, the text changes to their names and becomes visible.</p> <p>So I set up a TextView array of the list of names, which are all text views</p> <pre><code>TextView[] nameList = new TextView[]{name1, name2, name3, name4, name5, name6, name7, name8}; </code></pre> <p>Later on in the code in the onClick section, I had</p> <pre><code>for (int i = 0; i &lt; 8; i++) { String name = etName.getText().toString(); nameList[i].setText(name); nameList[i].setVisibility(View.VISIBLE); } </code></pre> <p>However, with this, whenever I press the "add player" button, the app crashes and I get a NullPointerException. How would I solve this?</p> <p>The problem isn't with the for loop as the app crashed without it. The problem seems to be with the array as if I put</p> <pre><code>name1.setText(name); name1.setVisibility(View.VISIBLE); </code></pre> <p>the code worked fine.</p>
java android
[1, 4]
3,071,582
3,071,583
How can I stop this setTimeout function from running?
<p>I use the function below to check on the status of a JSON file. It runs every 8 seconds (using setTimeout) to check if the file has changed. Once the JSON's status becomes 'success' I no longer want to keep calling the function. Can someone please show me how to do this? I suspect it involves the use of clearTimeout, but I'm unsure how to implement this.</p> <p>Cheers!</p> <pre><code> $(function() { var checkBookStatus = function() { var job_id = "#{@job.job_id}"; var msg = $('.msg'); var msgBuilding = $('#msg-building'); var msgQueuing = $('#msg-in-queue'); var msgSuccessful = $('#msg-successful-build'); var msgError = $('#msg-error'); $.ajax({ url: '/jobs/'+job_id+'/status.json', datatype: 'JSON', success:function(data){ if (data.status == "failure") { msg.hide(); msgError.show(); } else if (data.status == "#{Job.queue}") { msg.hide(); msgQueuing.show(); } else if (data.status == "#{Job.building}") { msg.hide(); msgBuilding.show(); } else if (data.status == "#{Job.failure}") { msg.hide(); msgError.show(); } else if (data.status == "#{Job.success}") { msg.hide(); msgSuccessful.show(); } }, }).always(function () { setTimeout(checkBookStatus, 8000); }); }; checkBookStatus(); }); </code></pre>
javascript jquery
[3, 5]
5,716,415
5,716,416
bind Day (1-31) to dropdown programmatically and 0's to day < 10?
<p>I have the current method in a helper file to bind monthly days to a dropdown and I wonder how I should modify it to add a leading 0 to 1-9?</p> <pre><code>public DropDownList PopulateDay(DropDownList ddlControlDay) { for (int i = 0; i &lt;= 31; i = i + 1) ddlControlDay.Items.Add(i.ToString("D2")); return ddlControlDay; } </code></pre> <p>I could convert to string, check length/modify and parse to int but is there a better way?</p> <p>Thanks in advance.</p>
c# asp.net
[0, 9]
3,075,630
3,075,631
Contacts photo is not displayed in Android?
<p>Hi I have a problem in displaying the contacts image in android. Following is the code snippet I have used,</p> <pre><code>public String getCallersInfo(ContentResolver cnt,String phoneNumber) { mContentResolver = cnt; lNumber = phoneNumber; System.out.println("Start test"); Cursor l_Cur = mContentResolver.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.NUMBER +" = ?", new String[]{lNumber }, null); while (l_Cur.moveToNext()) { cid = l_Cur.getString(l_Cur.getColumnIndex( ContactsContract.CommonDataKinds.Phone.CONTACT_ID)); } System.out.println("The contact ID for person with phone number "+ lNumber + " is " + cid); if(!(cid.equals("Unknown"))) { Cursor cursor_contacts = mContentResolver.query(ContactsContract.Contacts.CONTENT_URI, null, ContactsContract.Contacts._ID + " = ?", new String[]{cid }, null); while(cursor_contacts.moveToNext()) { displayname = cursor_contacts.getString(cursor_contacts.getColumnIndex( ContactsContract.Contacts.DISPLAY_NAME)); photoid = cursor_contacts.getString(cursor_contacts.getColumnIndex( ContactsContract.Contacts.PHOTO_ID)); } System.out.println("The display name &amp; photo id for person with phone number " + lNumber + " is " + displayname + " &amp; " + photoid); Uri contactPhotoUri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, Integer.parseInt(cid)); // Uri photoUri = Uri.withAppendedPath(contactPhotoUri, Contacts.Photo.CONTENT_DIRECTORY); // contactPhotoUri --&gt; content://com.android.contacts/contacts/1557 InputStream photoDataStream = Contacts.openContactPhotoInputStream(mContentResolver,contactPhotoUri); // &lt;-- always null if(photoDataStream == null) { System.out.println("No photo available "); } Bitmap bt = BitmapFactory.decodeStream(photoDataStream); setmPhoto(bt); } return displayname; } </code></pre> <p>Thanks in advance.</p>
java android
[1, 4]
1,160,277
1,160,278
How To Compare My Actual MasterPage
<p>I have 2 MasterPage in my project.</p> <p>The <code>MasterPage to common pages</code> and the <code>MasterPage to PopUp pages</code>. </p> <p>And I have a class <code>BasePage</code> that is inherited by all pages, and in BasePage I need to verify which is the actual MaterPage that is used.</p> <p>Ex:</p> <p><code>if(Master.GetType() == typeof(Master)</code> ....</p> <p>How do I test it?</p>
c# asp.net
[0, 9]
5,253,914
5,253,915
Where do I put the jQuery script tag?
<p>In all the documentation I see the jQuery script tag beneath <code>&lt;title&gt;</code> in the head, but then when I go into some other sites (the <a href="http://initializr.com/">initializr</a> template is the first off the top of my head), they drop it into the bottom of the body (you know, right before <code>&lt;/body&gt;</code>).</p> <p>Which of these two is right?</p>
javascript jquery
[3, 5]