Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
1,981,034
1,981,035
Cannot perform instanceof check against parameterized type ArrayList<Foo>
<p>The following code:</p> <pre><code>((tempVar instanceof ArrayList&lt;Foo&gt;) ? tempVar : null); </code></pre> <p>causes:<br> <code>Cannot perform instanceof check against parameterized type ArrayList&lt;Foo&gt;. Use the form ArrayList&lt;?&gt; instead since further generic type information will be erased at runtime</code></p> <p>Can someone explain me what is meant by <code>"further generic type information will be erased at runtime"</code> and how to fix this?</p>
java android
[1, 4]
250,604
250,605
Javascript Loop Restrict to only 1
<p>I am using:</p> <pre><code>$.each(data.mydata, function(index, value){ output += '&lt;li&gt;'+value.title+'&lt;/li&gt;'; } </code></pre> <p>I need to test something and only want the loop to get 1 off the list.</p> <p>Is there any simple way to do this?</p>
javascript jquery
[3, 5]
5,483,731
5,483,732
selecting proper value of spinner accroding to my Class
<p>i am making an edit Screen of my Account.</p> <p>My account class has some properties. Now i want to show these properties and then edit them. I Have made a spinner that shows the account type.</p> <p>Right now i am using this code</p> <pre><code> ArrayAdapter&lt;CharSequence&gt; typeOfAccountAdapter = ArrayAdapter.createFromResource( this, R.array.typeOfAccountArray, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); typeOfAccount.setAdapter(typeOfAccountAdapter); typeOfAccount.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1,int arg2, long arg3) { if (typeOfAccount.getSelectedItem().toString().equals("Income")) myAccount.accountType = AccountType.kAccountTypeIncome; else if(typeOfAccount.getSelectedItem().toString().equals("Asset")) myAccount.accountType = AccountType.kAccountTypeAsset; else if(typeOfAccount.getSelectedItem().toString().equals("Cash")) myAccount.accountType = AccountType.kAccountTypeAssetCash; else if(typeOfAccount.getSelectedItem().toString().equals("Bank")) myAccount.accountType = AccountType.kAccountTypeAssetBank; else if(typeOfAccount.getSelectedItem().toString().equals("Liability")) myAccount.accountType = AccountType.kAccountTypeLiability; else myAccount.accountType = AccountType.kAccountTypeLiabilityOther; setStrDeatilOfAccount(); } </code></pre> <p>This code actually instead of displaying <code>myAccount.accountType</code>, sets the first element of <code>spinner</code> as <code>accountType</code> of my account.</p> <p>How can i display not the first item of array of <code>typeOfAccountArray</code> but <code>accountType</code> of <code>myAccount</code></p> <p>And then i can edit and change it accordingly.</p> <p>Best Regards</p>
java android
[1, 4]
5,411,073
5,411,074
Date Format Conversion in Java?
<p>I have a date coming in JSON feeds in the format below:</p> <pre><code> mm/dd/yyyy for example today's date 10/26/2011 </code></pre> <p>I want to convert it to another format, which is, infact a detailed date format as:</p> <pre><code> Wed, 26 OCT 2011 </code></pre> <p>How can i do that..??? I know this could be very simple, but am still a newbie, Any help is appreciated. </p>
java android
[1, 4]
5,581,964
5,581,965
having trouble using setInterval and with random number generation
<p>I'm trying to create a random quote generator. I have created a function called timer that runs another function pickQuote every 400ms but at the moment this doesn't seem to work. in pickQuote I run a function randomNumberGen that creates a random number. My problem in the randomNumberGen is that I want to have an if or if..else in place that checks whether or not the new random number is different from the current quotes[randomNumber] but i'm unsure how to do this. </p> <p>Can anyone provide me with some insight on how I can achieve this?</p> <p>My current effort can be viewed here: <a href="http://jsbin.com/aqinud/12/edit" rel="nofollow">http://jsbin.com/aqinud/12/edit</a></p>
javascript jquery
[3, 5]
2,594,871
2,594,872
C# asp.net parameters cast to a page
<p>if you please help me out i am trying to pass 3 different parameters in a page but i am new in asp.net C# and i don't know the correct syntax if you please help me out</p> <p>;</p> <p>For one parameter like this it works:</p> <pre><code> Response.Redirect("~/WebPage2.aspx?q=" + ListBox1.SelectedValue); </code></pre> <p>how can i write it for 3 parameters like this don't seem to work?</p> <pre><code>Response.Redirect("~/WebPage2.aspx?q=" + ListBox1.SelectedValue+"&amp;cr="+ListBox3.SelectedValue+"&amp;p="+ListBox1.SelectedValue) </code></pre> <p>thanks in advance</p>
c# asp.net
[0, 9]
3,977,251
3,977,252
Why my listview adapter doesn't show the right layout on new view?
<p>I have a custom Cursor Adapter that is based off of the MMS and SMS database in android. code looks like this as follows:</p> <pre><code>@Override public View newView(Context context, Cursor cursor, ViewGroup parent) { Message m = Message.getMessage(context, cursor); // gets message from cursor int t = m.getType(); // this gets the type of message it is .. 2 = recv, 1 = sent switch(t){ case Message.MMS_IN: // 128 return mInflater.inflate(R.layout.messagelist_item_recv, parent, false); case Message.MMS_OUT: // 132 return mInflater.inflate(R.layout.messagelist_item_sent, parent, false); case Message.SMS_IN: // 2 return mInflater.inflate(R.layout.messagelist_item_recv, parent, false); case Message.SMS_OUT: // 1 return mInflater.inflate(R.layout.messagelist_item_sent, parent, false); default: return null; } } </code></pre> <p>The <code>R.layout.messagelist_item_sent</code> is for sent messages and the <code>R.layout.messagelist_item_recv</code> is for received messages. But looking at my messages, the rows that are first shown when the listview are shown correctly, but when I go up the listview to new views, the layouts are mixed up. The recv layout is where the sent layout is supposed to be and vice versa. Any one know why this kind of problem would be occuring?</p> <p><strong>* EDIT **</strong></p> <pre><code>@Override public int getItemViewType(int position) { // move the cursor to the position Cursor c = (Cursor)getItem(position); Message m = Message.getMessage(context, c); if (isInbox(m.getType())){ inflater.inflate(recv view); // it's been shortened } else { inflater.inflate(send view); // and determine the correct type of row layout // return 0 or 1 // use the code that you currently have from the newView method } </code></pre>
java android
[1, 4]
1,501,973
1,501,974
Mono for Android WebClient Special characters
<p>I'm using Mono for Android (C#) and WebClient DownloadString to get source code of a HTML website, that uses special characters (č,š,ž). But when displaying the code, it shows � instead of the characters. Is there a way to show the correct characters?</p>
c# android
[0, 4]
1,167,132
1,167,133
how to animate div from its center
<p>I am trying to animate a div tag from center. Initially I want the div tag to be none visible. when user clicks on link then this div tag should animate from its center. How can I achieve this using jquery. Here is my current code.</p> <pre><code>&lt;a href="#" class="linkone"&gt;link one&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt; &lt;section class="one"&gt;one&lt;/section&gt; </code></pre> <p>here is css</p> <pre><code>.one { margin: 0 auto; width: 200px; height: 200px; border: 1px solid red; background: lightblue; } </code></pre> <p>and here is my jquery</p> <pre><code>$('a').on('click', function (e) { e.preventDefault(); var w = 200; //$('.one').outerWidth(); var h = 200; //$('.one').outerHeight(); var x = $('.one').width() / 2; var y = $('.one').height() / 2; var startW = h - y/2; var startH = w - x/2; var endTop = y - h/2; var endLeft = x - w/2; $('.one').animate({ opacity: 1, width: (w+200) + 'px', height: (h+200) + 'px', top: endTop+'px', left: endLeft+'px' }, 1000); console.log(endLeft); }); </code></pre>
javascript jquery
[3, 5]
2,161,583
2,161,584
method with ref object parameter
<p>Hi i have to call a method that has this signature:</p> <pre><code>int MethodName(ref object vIndexKey) </code></pre> <p>If i try to call it with</p> <pre><code>String c = "690"; MethodName(ref (object) c); </code></pre> <p>It doesn't work.</p> <p>How can i do?</p> <p>thanks</p>
c# asp.net
[0, 9]
1,702,643
1,702,644
jquery slide show plugin like this
<p>please see that site: <a href="http://www.top-pcb.com/" rel="nofollow">link</a> and watch the slideshow.</p> <p>How can I create a slideshow like that with jQuery? (is there plugin?)</p> <p>thanks ..</p>
javascript jquery
[3, 5]
4,890,143
4,890,144
Checking datareader to be empty
<p>How do I check if my datareader is completely empty ?</p> <p>Not talking about nullvalues but completely empty (no records).</p> <p>Thanks!</p>
c# asp.net
[0, 9]
69,464
69,465
Creating select list with script
<p>I have got this far with my coding:</p> <pre><code> success: function(data) { $.each(data, function(item){ if (item=="") { $(select_element).append($(document.createElement("option")).attr("value", (item)).html(data[item])); } else { $(select_element).append($(document.createElement("option")).attr("value",(item)).html(data[item]+" ")); } </code></pre> <p>'item' is an object with two attributes, description and id. Created select list works basically just find, but it returns the whole object now. Can I modify the createElement function so that id would be the returnable itemValue and description itemLabel? I'm newbie.</p>
javascript jquery
[3, 5]
2,322,020
2,322,021
jquery postback failing
<p>I'm trying to initiate a postback invoking the click function of a server-running element, as to run some C# code, in the event of a particular jquery dialog button click.</p> <p>I am using a modal dialog with buttons as per <a href="http://jqueryui.com/demos/dialog/#modal-form" rel="nofollow">this</a> jQuery UI example. I have attempted using all of the different answers for javascript/jquery postback invocations in <a href="http://stackoverflow.com/questions/751415/asp-net-postback-with-jquery">this</a> question. </p> <p>I've set a couple of breakpoints in my C# code to see if these postbacks are getting called, but nothing is getting hit.</p> <p>I have this dummy element in my ascx file to use:</p> <pre><code>&lt;a id="anchorId" runat="server" onclick="return true;" onserverclick="TryLogin"&gt;&lt;/a&gt; </code></pre> <p>I've attempted to get this postback to occur a few different ways:</p> <pre><code>$("#anchorId").click(); //just simply does nothing document.getElementById("anchorId").click(); //This one gives me a null javascript error $("document").getElementById("#anchorId").click(); //tells me [object] doesn't have a getElementById __doPostBack('&lt;%=anchorId.UniqueID %&gt;', '');//Also does nothing in the jQuery code, but works in standard javascript code </code></pre> <p>Lastly I did try retrieving the unique ID in the code behind as:</p> <pre><code>string id = anchorId.UniqueID; </code></pre> <p>and replaced in the javascript this way:</p> <pre><code>__doPostBack('Softening_Main$anchorId', '');//Still does nothing, and no javascript error </code></pre> <p>I really need some help here, any ideas?</p>
javascript jquery
[3, 5]
4,146,519
4,146,520
jQuery submit function not triggered
<p>I have a form</p> <pre><code>&lt;form id="solicitud" action="ventas.php?content=nuevo" method="post"&gt; ... &lt;/form&gt; </code></pre> <p>Then I have to submit my submit using jQuery but I can't get it working</p> <pre><code> $("#nombres").click(function(){ alert('clicked'); $("form").submit(function(event){ event.preventDefault(); }); }); </code></pre> <p>The alert function is called but my form isn't submited, what am i doing wrong?</p>
javascript jquery
[3, 5]
5,452,275
5,452,276
jQuery replace first string match
<p>I have an array, like<br> <code>var acronyms = {<br> 'NAS': 'Nunc ac sagittis',<br> 'MTCP': 'Morbi tempor congue porta'<br> };</code> </p> <p>I need to find first match of each acronym and wrap around with tag via jQuery.<br> E.g.<br> <code>&lt;div id="wrap"&gt;NAS dui pellentesque pretium augue. MTCP pellentesque pretium augue. NAS ac ornare lectus MTCP nec.&lt;/div&gt;</code></p> <p>becomes<br> <code>&lt;div id="wrap"&gt;&lt;acronym title="Nunc ac sagittis"&gt;NAS&lt;/acronym&gt; dui pellentesque pretium augue. &lt;acronym title="Morbi tempor congue porta"&gt;MTCP&lt;/acronym&gt; pellentesque pretium augue. NAS ac ornare lectus MTCP nec.&lt;/div&gt;</code></p> <p>Thanks.</p>
javascript jquery
[3, 5]
4,515,170
4,515,171
Accessing parent control from child control - ASP.NET C#
<p>I have a parent user control with a label. On the parent's OnInit, I dynamically load the child control. From the child control, I will need to set the parent's label to something.</p> <p>Using the Parent property returns the immediate parent which is actually a PlaceHolder in my case. Theoretically, I can recursively loop to get the reference to the Parent User control. Am I heading in the right direction here? Is there a straightforward way of doing this?</p>
c# asp.net
[0, 9]
489,531
489,532
traverse through whole table and check span tag atrribute name
<p><em>HTML:</em></p> <pre><code>&lt;table id="mytable"&gt; &lt;tr&gt; &lt;td class="cssred"&gt;&lt;span name='478'&gt;john&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="cssred"&gt;&lt;span name='478'&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="cssred"&gt;&lt;span name='478'&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="cssred"&gt;&lt;span name='521'&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="cssred"&gt;&lt;span name='522'&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p><em>JavaScript:</em></p> <pre><code>$(this).find('span').attr('name'); </code></pre> <p>i have to traverse through whole table and check any span tag atrribute name value be 478 then make its parent cell class <code>cssgreen</code>.</p>
javascript jquery
[3, 5]
1,468,718
1,468,719
Is it possible to retrieve the username and password in one page to another page in asp.net?
<p>I am using a login control where user enters the username and passwords.I want to retrieve those values of username and password into another page in the application? Is there a way to do that in C#.I am using asp.net login control?</p>
c# asp.net
[0, 9]
1,444,116
1,444,117
Optimal Method of Changing Order of Elements using jQuery
<p>Given the following:</p> <pre><code>&lt;a id="moveElementUp"&gt;Move Up&lt;/a&gt; &lt;a id="moveElementDown"&gt;Move Dowm&lt;/a&gt; &lt;div id="elementHolder"&gt; &lt;a id="element-1"&gt;1&lt;/a&gt; &lt;a id="element-2"&gt;2&lt;/a&gt; &lt;a id="element-3"&gt;3&lt;/a&gt; &lt;a id="element-4"&gt;4&lt;/a&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; function reOrder (el){ // Change IDs of Elements to be Sequential } $('#moveElementUp').click(function(e){ // Move Clicked Element Up One Spot in List reOrder(); }); $('#moveElementDown').click(function(e){ // Move Clicked Element Down One Spot in List reOrder(); }); &lt;/script&gt; </code></pre> <p>What is the optimal (and fastest) way of going about changing the order of the elements and changing the IDs of all elements to maintain sequential order using jQuery?</p> <p>Any help would be greatly appreciated!</p>
javascript jquery
[3, 5]
2,974,205
2,974,206
jQuery - trim the variable
<p>I have following example:</p> <p><code>var VarFull = $('#selectror').attr('href')</code> where <code>.attr('href') = "#tabs1-1"</code></p> <p>How can I trim that to <code>"tabs1-1"</code> ( without <code>#</code>)??</p> <p>Any suggestions much appreciated.</p>
javascript jquery
[3, 5]
2,365,868
2,365,869
Implementing AutoCad viewer in web project
<p>I need to implement an AutoCad viewer in my web project which will help the clients view AutoCad file without the need to install it in their PC.</p>
php jquery
[2, 5]
1,193,780
1,193,781
Is anything wrong in the source i written
<p>I write a code to print the value of a textbox to another textbox but i am unable to achieve this can any one tell what's wrong or can any give me equivalent <code>JavaScript</code> to achieve this</p> <pre><code> &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:TextBox ID="TextBox2" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jQuery/1.2.6/jQuery.min.js"&gt; &lt;/script&gt; &lt;script type="text/javascript"&gt; $('#TextBox1').keyup(function(){ $('#TextBox2').val(this.value); }); &lt;/script&gt; &lt;/div&gt; &lt;/form&gt; </code></pre>
javascript jquery asp.net
[3, 5, 9]
1,184,030
1,184,031
$(document).ready() not working
<p>Code: </p> <pre><code>var names = [ 'Abstract', 'Animals', 'Beach', //etc. (removed because it was too long) 'Volcano' ]; var links = [ 'http://i.imgur.com/MFkuQ.jpg', 'http://i.imgur.com/QEt72.png', 'http://i.imgur.com/nmrqv.jpg', //etc. (removed because it was too long) 'http://i.imgur.com/7uy15.png' ]; $(document).ready(function() { alert('test'); for (i = 0; i &lt; names.length; i++) { var row = document.createElement('tr'); var col = document.createElement('td'); col.appendChild(document.createTextNode(names[i])); row.appendChild(col); document.getElementById('imagenametable').appendChild(row); } }); function expandbar(s) { resetbars(); $('#' + s).show('slow'); } function resetbars() { for (i = 1; i &lt;= 3; i++) { $('#sec' + i).hide('slow'); } } </code></pre> <p>The <code>$(document).ready()</code> is not working; I do not get an alert that says 'test' when my page loads. Help?</p> <p>I have included jQuery.</p>
javascript jquery
[3, 5]
4,140,283
4,140,284
How to run a loop on a bunch of Android buttons that need to control their neighbors?
<p>I have a list of text inputs that each contain numbers. To the left of each is a button that says " - " to the right one that says " + ".</p> <p>So, it looks like this:</p> <pre><code>[ - ] [ 1111 ] [ + ] [ - ] [ 1112 ] [ + ] [ - ] [ 1113 ] [ + ] etc... </code></pre> <p>I want each [-] to alter the value of the field next to it, reducing it by 1, and each [+] to increment the value of the field left of it.</p> <p>Is there a way that I can write a generic listener that would, upon instantiation, take as a param the id of the text field to be edited? setOnClickListener only takes a View.OnClickListener as a param, and that can't be given any extra params to hang onto either. Do I have to extend View.OnClickListener with my own custom listener to do this? Or is there some obvious way to accomplish this task that I'm overlooking?</p> <p>TIA.</p>
java android
[1, 4]
1,601,805
1,601,806
Creating a Button at Run-time in C# After a CheckBox is Checked?
<p>I got a problem while implementing following functionality:</p> <p>I need to add a functionality in C# for my ASP.NET project:</p> <p>a) When the CheckBox is checked, I need to generate a Button on my form dynamically and when the button on the web form is clicked, it should uncheck the CheckBox again.</p> <p>I am not able to generate the button after the CheckBox is checked. Kindly, help.</p> <p>P.S. - I am a Mainframe Developer and new to .NET world. Kindly, bear with me! Thanks!</p>
c# javascript jquery asp.net
[0, 3, 5, 9]
3,656,875
3,656,876
Masonry for Rails asset pipeline
<p>How to catch "GET" parameter of masonry infinite scrolling for show number of page in url address.</p> <p>JS:</p> <pre><code>$(function(){ var $container = $('#masonry-container'); $container.imagesLoaded(function(){ $container.masonry({ itemSelector: '.box', columnWidth: 100 }); }); $container.infinitescroll({ navSelector : '#page-nav', // selector for the paged navigation nextSelector : '#page-nav a', // selector for the NEXT link (to page 2) itemSelector : '.box', // selector for all items you'll retrieve loading: { finishedMsg: 'No more pages to load.', img: 'http://i.imgur.com/6RMhx.gif' } }, // trigger Masonry as a callback function( newElements ) { // hide new items while they are loading var $newElems = $( newElements ).css({ opacity: 0 }); // ensure that images load before adding to masonry layout $newElems.imagesLoaded(function(){ // show elems now they're ready $newElems.animate({ opacity: 1 }); $container.masonry( 'appended', $newElems, true ); }); } ); }); </code></pre> <p>How to find <code>vk_posts?page=2</code><br> and save to var.</p> <p>After scrolling I have localhost:3000/vk_posts in all loaded pages. Masonry deletes selector <code>$(".pagination a")</code> and I cant to find href of this selector.</p>
javascript jquery
[3, 5]
4,753,987
4,753,988
get youtube link between two values and replace with iframe
<p>if there's a html like the following</p> <pre><code>&lt;div class="comment"&gt; [youtube]http://www.youtube.com/watch?v=videoid1[/youtube] random text &lt;/div&gt; &lt;div class="comment"&gt; [youtube]http://youtu.be/videoid2[/youtube] random text2 &lt;/div&gt; </code></pre> <p>how using jquery could you extract the youtube video id from links for each <code>.comment</code> element between <strong>[youtube]</strong> to <strong>[/youtube]</strong> to create an embedded player so the outcome will be</p> <pre><code>&lt;div class="comment"&gt; &lt;iframe width="420" height="315" src="http://www.youtube.com/embed/videoid1?rel=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt; random text &lt;/div&gt; &lt;div class="comment"&gt; &lt;iframe width="420" height="315" src="http://www.youtube.com/embed/videoid2?rel=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt; random text2 &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
2,124,619
2,124,620
Trying to check if a file exists in internal storage
<p>The following code is how I am trying to identify if a file exists in the internal storage, <code>MODE_PRIVATE</code>.</p> <pre><code>public boolean isset(String filename){ FileInputStream fos = null; try { fos = openFileInput(filename); //fos = openFileInput(getFilesDir()+"/"+filename); if (fos != null) { return true; }else{ return false; } } catch (FileNotFoundException e) { return false; } //File file=new File(mContext.getFilesDir(),filename); //boolean exists = fos.exists(); } </code></pre> <p>However, it goes into the exception and doesn't continue with the code. It doesn't do the return. Why?</p>
java android
[1, 4]
2,567,737
2,567,738
what is the difference between the below two syntaxes?
<p>1.</p> <pre><code> $(function () { function foo() { return true; } log(bar()); // getting error var bar = function() { return true; }; }); </code></pre> <p>2.</p> <pre><code>$(function () { function foo() { return true; } log(bar()); // working function bar() { return true; }; }); </code></pre> <p>in above snippets <strong>log</strong> is my custom function to log the result.</p>
javascript jquery
[3, 5]
3,894,434
3,894,435
Resize textbox everytime to fit the text length
<p>In my <a href="http://en.wikipedia.org/wiki/ASP.NET" rel="nofollow">ASP.NET</a> page I have a text box which shows data which is bind to an (JavaScript) object variable. I want that textbox to resize everytime, the JavaScript object, e.g. result.title will change everytime.</p> <p><strong>Important</strong>: I want to fit the textbox exactly to the text length inside.</p>
asp.net javascript
[9, 3]
5,636,418
5,636,419
javascript value before @ sign
<p>I'm trying to suggest username for sign up page with jquery. im just wondering how can i get the value of email address before <code>@</code> sign. right now i can get complete value with </p> <pre><code>$("#email").val(); </code></pre> <p>should i split it by <code>@</code> or some other way?</p>
javascript jquery
[3, 5]
1,822,164
1,822,165
visual studio desktop application for iphone/Android apps
<p>i want to develop one desktop application using c# sql lite, this application i want to submit this app to Apple store in case of iphone/ likewise for Android. please let me know if it is feasible to do, if so please let me know the steps that need to be incorporated in order to achieve this.</p>
iphone android
[8, 4]
5,997,049
5,997,050
Android/Java question. How are these two decision trees different?
<p>I'm very confused as to how these two decision trees are different. I'm building an app that needs to decide which view to load based on the position selected from a ListView. I've tried to build the logic into a single controller module and found that the switch-case will cause a NullPointerException and FC while the if-else will work perfectly. Can anyone enlighten me as to why? I've got a strong background in C and C++ and am used to being able to easily re-write switches to if-else's and vice versa.</p> <p>Defined vars:</p> <pre><code>private final int VALUEA = 0; private final int VALUEB = 1; private final int VALUEC = 2; </code></pre> <p>Switch-case:</p> <pre><code>TextView t = new TextView(null); switch(value){ case VALUEA: setContentView(R.layout.valuealayout); t = (TextView) findViewById(R.id.valuealayout); t.findViewById(R.id.valuealayout); break; case VALUEB: setContentView(R.layout.valueblayout); t = (TextView) findViewById(R.id.valueblayout); t.findViewById(R.id.valueblayout); break; case VALUEC: setContentView(R.layout.valueclayout); t = (TextView) findViewById(R.id.valueclayout); t.findViewById(R.id.valueclayout); break; default: break; } </code></pre> <p>The block above will cause a NullPointerException.</p> <p>If-else:</p> <pre><code>if(value == VALUEA ){ setContentView(R.layout.valuealayout); TextView t = (TextView) findViewById(R.id.valuealayout); t.findViewById(R.id.valuealayout); }else if(value == VALUEB){ setContentView(R.layout.valueblayout); TextView t = (TextView) findViewById(R.id.valueblayout); t.findViewById(R.id.valueblayout); }else if(value == VALUEC){ setContentView(R.layout.valueclayout); TextView t = (TextView) findViewById(R.id.valueclayout); t.findViewById(R.id.valueclayout); }else{ } </code></pre> <p>This version works perfectly. Does the second block work because of some funky Java scoping rule that allows each branch of the decision tree to create and properly initialize the TextView in a way that the first block doesn't?</p>
java android
[1, 4]
3,537,967
3,537,968
ajax tabs and event handling
<p>I have an app that contains a dropdownlist and tabs. What I what it to do is when I click on the tab, it should change the dropdownlist to relfect the active tab and visa-versa. I have tried javascript but since the ddl is on the server and javascript invokes from the client, it doesn't work. Any help is appreciated.</p> <p>Thanks</p> <p>RV</p>
c# javascript
[0, 3]
777,088
777,089
jQuery Validator, programmatically show errors
<p>I can do something like this:</p> <pre><code>validator.showErrors({ "nameOfField" : "ErrorMessage" }); </code></pre> <p>And that works fine, however if I try and do something like this:</p> <pre><code>var propertyName = "nameOfField"; var errorMessage = "ErrorMessage"; validator.showErrors({ propertyName : errorMessage }); </code></pre> <p>It throws an 'element is undefined' error.</p>
javascript jquery
[3, 5]
1,371,680
1,371,681
Showing confirmation box not working
<p>I am having issues making this javascript box come up, I think i am doing it wrong but cant figure out what it is. Please excuse have not worked with the Page.ClientScript much before. Basically, I want to display this box and if they click OK it will continue processing my logic otherwise if they click cancel it will keep them on the same page</p> <p>This is what i have.</p> <pre><code>Page.ClientScript.RegisterStartupScript(this.GetType(), "ConfirmBox", "Confirm('The numbers selected are not in the directory, Do you wish to continue?');", true); </code></pre> <p>I would appreciate any help. Thank you</p>
c# asp.net
[0, 9]
4,593,361
4,593,362
String Formatting C#
<p>I have a drop down control and the items look like this</p> <pre><code>Books(10) Glasses(230) Notebooks(27) </code></pre> <p>so basically i am grabbing the SelectedItem.Text; but I want to grab only the value before the amount in stock so when I grab it from SelectedItem.Text; it should look like this</p> <pre><code>string myString = (some code to get just the name without the stock i.e Books); </code></pre> <p>Thank you</p>
c# asp.net
[0, 9]
569,360
569,361
jquery POST selector issue
<pre><code>$("#submit_js").click(function() { $.post( "user_submit.php", {score: $('input[name=vote]:checked').val() }, function(data){ $("#ques"+qn).hide(); ++qn; $("#ques"+qn).show(); }); }); </code></pre> <p>the above jquery function posts some value to the user_submit.php file. what i am doing here is i pre-load 10 divs and cycle through them through the callback function. </p> <p>the problem is for </p> <pre><code>{score: $('input[name=vote]:checked').val() }, </code></pre> <p>i want to be able to select the input values in a particular div. is it possible.</p> <p>To be more clear, I want to first select a div by id and then select the checked inputs inside that div. I know it is possible. Just need help with the syntax.</p>
javascript jquery
[3, 5]
3,601,485
3,601,486
Creating DOM elements in jQuery
<p>Let's say we have the following JavaScript/jQuery code below</p> <pre><code>function createElement(i, value) { return $('&lt;div&gt;', { id: "field" + i, text: value}); } </code></pre> <p>I have a div with an id of "container" and then I do:</p> <pre><code>var c=$("container"); c.append(createElement(1, "hello, world!"); </code></pre> <p>Now I've got 2 questions</p> <ol> <li><p>Does the createElement function use jQuery to return an HTML string that gets appended to container or does it dynamically create a DOM element that gets appended to the container?</p></li> <li><p>I'm unfamiliar with this kind of jQuery where you actually create the HTML string (or DOM element) via the $() selector. I tried looking for the documentation on this subject in jQuery's website but I couldn't find it. Can somebody point me in the right direction?</p></li> </ol>
javascript jquery
[3, 5]
3,954,941
3,954,942
Serialize an intent in Android?
<p>i want to serialize an intent after i rcv it using <code>ObjectOutputStream</code> , but i got this exiption </p> <p><code>java.io.NotSerializableException: android.content.Intent</code></p> <p>is there away so i could serialize the intent, thanks. </p>
java android
[1, 4]
3,805,582
3,805,583
How to add 5 Textboxes and 1 button to GridView in footer ASP.NET?
<p>Like in title? have no idea how to do it</p> <p>I wrote something like this:</p> <pre><code>&lt;Columns&gt; &lt;asp:TemplateField&gt; &lt;FooterTemplate&gt; &lt;asp:TextBox ID="TextBox1" runat="server" /&gt; &lt;asp:TextBox ID="TextBox2" runat="server" /&gt; &lt;asp:TextBox ID="TextBox3" runat="server" /&gt; &lt;asp:TextBox ID="TextBox4" runat="server" /&gt; &lt;asp:TextBox ID="TextBox5" runat="server" /&gt; &lt;asp:Button ID="Button1" runat="server" /&gt; &lt;/FooterTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:CommandField ShowEditButton="True" /&gt; &lt;asp:BoundField DataField="id" HeaderText="ID" Visible="False" /&gt; &lt;asp:BoundField DataField="Name" HeaderText="Name" /&gt; &lt;asp:BoundField DataField="LastName" HeaderText="LastName" /&gt; &lt;asp:BoundField DataField="something" HeaderText="something" /&gt; &lt;asp:BoundField DataField="country" HeaderText="country" /&gt; &lt;asp:CommandField ShowDeleteButton="True" /&gt; &lt;/Columns&gt; </code></pre> <p>but it gives me extra column i want to add this textbox in the column that already exists.</p>
c# asp.net
[0, 9]
5,951,042
5,951,043
How to store and pull internally on android?
<p>I am having trouble trying to store a username string internally on an android devices. My code is written to store the username and read it into a string and then display that string in a toast text box. I'm having errors creating the bold_username.txt file. Here is my code so far:</p> <pre><code>package hello.tab.widget; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.Toast; public class DisclaimerActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.disclaimer); final EditText et = (EditText)findViewById(R.id.et_username); et.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { et.setText(""); } }); final Button button = (Button) findViewById(R.id.btn_accept); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { final CheckBox checkBox = (CheckBox)findViewById(R.id.cb_disclaimer); if (checkBox.isChecked()) { String username = et.getText().toString(); String FILENAME = "bold_username.txt"; try { FileOutputStream fos = new FileOutputStream(new File("bold_username.txt")); fos = openFileOutput(FILENAME, Context.MODE_PRIVATE); fos.write(username.getBytes()); fos.close(); InputStream inputStream = new FileInputStream("bold_username.txt"); BufferedReader r = new BufferedReader(new InputStreamReader(inputStream)); StringBuilder total = new StringBuilder(); String line; while ((line = r.readLine()) != null) { total.append(line); Toast.makeText(DisclaimerActivity.this, line, Toast.LENGTH_SHORT).show(); } } catch (IOException e){ e.printStackTrace(); } } else { Toast.makeText(DisclaimerActivity.this, "Please Check the Checkbox", Toast.LENGTH_SHORT).show(); } } }); } public void onCheckboxClicked(View v) { } } </code></pre>
java android
[1, 4]
1,865,824
1,865,825
JQuery flyout menu pointer
<p><a href="http://jsfiddle.net/6Jhaw/" rel="nofollow">This (JSFiddle)</a> is that code I have now. I want to animate a pointer so that when the user clicks the list item the pointer slides to the right/left and stays in the middle of the sub list items. How I thought of doing it was to find the amount of pixels to the left of the main list item and then width/2 and add them. Does this sound right? or should I do something different. Thank you.</p> <pre><code> (function(){ var closetimer = 0; var menuitem = 0; var arr_position = 0; function arrow () { var ele = $('.a'); &lt;----// how can I make this a variable // according to which link I select? var pos = ele.position(); var width = ele.width()/2; var left = pos.left; } function flyout_open(event) { flyout_close(); var submenu = $(this).find('ul'); var arr = $('.arrow'); if(submenu){ menuitem = submenu.fadeIn(200); return false; } return true; } function flyout_close() { if(menuitem) menuitem.fadeOut(200);} $(document).ready(function() { $('#flyout li').bind('click', flyout_open); }); document.onclick = flyout_close; </code></pre> <p>})();</p>
javascript jquery
[3, 5]
4,873,881
4,873,882
android: Extract Text from Image
<p>I am working on an application Which need to convert the jpeg image to text so that I can identify the text written there in the image. plz give me a guidence to do that . </p>
java android
[1, 4]
3,429,523
3,429,524
(PHP)how to hold javascript alertbox on screen
<p>when user changes password I want to show message "Successfully changed!" and when user clicks on <strong>OK</strong> button of <strong>alert box</strong> I call <strong>logout.php</strong> and force user to login with new password.But the problem is PHP <strong>header()</strong> is not waiting for alertbox and directly goes to logout.php. my code-</p> <pre><code>if($count==1) { $sqlchange="UPDATE $tbl_name SET password='$newpassword' WHERE userId='$myusername'"; unset($result); $result=mysql_query($sqlchange,$link); if($result&gt;0) { ?&gt; &lt;script type="text/javascript"&gt; alert("Your Password has been changed successfully.Please login again."); &lt;/script&gt; &lt;?php header("location:logout.php"); exit; } else {.... </code></pre>
php javascript
[2, 3]
1,590,656
1,590,657
validation expression for datetime like month/date/year
<p>I need a validation expression for datetime like month/date/year.I tried many expressions.But all contains validation for time also...So please help me...</p>
c# asp.net
[0, 9]
2,699,738
2,699,739
How do I populate one listbox from another listbox using JavaScript?
<p>Can anyone tell me how to populate one listbox from another listbox item using JavaScript or ASP.NET 2.0?</p> <blockquote> <h3>Duplicate</h3> <p><a href="http://stackoverflow.com/questions/204140/how-to-add-move-one-list-box-items-to-another-listbox-items-in-javascript">How would I move one list box items to another listbox items in JavaScript?</a></p> </blockquote> <p>For ex--My 1st listbox is Region then accourding to region selection the second listbox country will be display and accourding to country seletion state listbox will display all will come from database depends on Region Id or Country id n all</p>
asp.net javascript
[9, 3]
4,879,024
4,879,025
Can someone explain why this happens in dynamically loaded UCs?
<p>I got this working by trial and error but would really appreciate an explanation.</p> <p>Summary: I am dynamically loading usercontrols from the host page.</p> <p>Host Page .aspx</p> <p>OnInit does a LoadControl and loads the control</p> <pre><code>User control .ascx On Page_Load -&gt; First time load --&gt; I set a value to a hidden input type variable --&gt; I set a value to a ViewState object (using ViewState["test"] = "test") -&gt; Subsequent post backs --&gt; Hidden var still persists --&gt; ViewState is NULL !! (Why?) If i move the code from Page_Load to Oninit: -&gt; Subsequent post backs --&gt; Both hidden var and Viewstate is NULL! </code></pre> <p>Why??</p>
c# asp.net
[0, 9]
1,863,939
1,863,940
Setting a select value in a fieldset
<p>I am using awesome_nested_fields (rails gem) and do this to insert some item:</p> <pre><code>$('#orderlines').nestedFields('insert', function(item) { console.log(item) }, {skipBefore: true}); </code></pre> <p>This gets returned to the console:</p> <pre><code>[fieldset.item, constructor: function, init: function, selector: "", jquery: "1.7.2", size: function…] . 0: fieldset.item . accessKey: "" . attributes: NamedNodeMap . elements: HTMLCollection[6] . firstElementChild: div.control-group . form: form#new_client_order.simple_form new_client_order . 0: input . 1: input . 2: input#client_order_order_date.custom_datepicker optional custom_datepicker_selector . 3: input#order_date_hidden.custom_datepicker optional . 4: fieldset.item . 5: select#client_order_order_lines_attributes_1358562768745_product_id . 0: option . 1: option . accessKey: "" . attributes: NamedNodeMap . value: "12" ... cut out fields that were irrelevant </code></pre> <p>My question:</p> <p>How can I set the value (that is now 12) to 16 ? The select always ends on _product_id</p>
javascript jquery
[3, 5]
752,094
752,095
Modify tag value using JavaScript
<p>I have this tag on a webpage </p> <pre><code>&lt;input type="hidden" name="ctl00_ed3327f9_e1db_40db_9d66_15946cead7ae_STATEFIELD" id="ctl00_0g_ed3327f9_e1db_40db_9d66_15946cead7ae__STATEFIELD" value="0" /&gt; </code></pre> <p>I want to modify its value, i.e. from <code>value="0"</code> to <code>value="1"</code> using JavaScript. I have tried:</p> <pre><code>document.getElementById("ctl00_0g_ed3327f9_e1db_40db_9d66_15946cead7ae__STATEFIELD"); </code></pre> <p>but it returns <code>null</code>. I guess that's because it is a hidden field </p>
javascript jquery
[3, 5]
2,290,613
2,290,614
Programatically Add Control to ASP.NET C# Page on Button Click
<p>I want to be able to add fixtures to a particular gameweek on my asp.net c# page.</p> <p>When a user clicks the add button, it should create two drop downs so they can select the home and away team. I want to be able to allow as many fixtures as the user wants to add, so therefore I need a dynamic way of adding controls to the page. Once all of the fixtures have been added, I want them all to be saved to the database.</p> <p>Scrolling trough forums I have found the following method to get a control to be added programatically:</p> <p>c#</p> <pre><code> protected void AddTeamButton_Click(object sender, EventArgs e) { DropDownList homeTeamName = new DropDownList(); homeTeamName.Items.Add("Arsenal"); homeTeamName.Items.Add("Aston Villa"); homeTeamName.ID = "homeTeam"; PlaceHolder1.Controls.Add(homeTeamName); DropDownList awayTeamName = new DropDownList(); awayTeamName.Items.Add("Arsenal"); awayTeamName.Items.Add("Aston Villa"); awayTeamName.ID = "awayTeam"; PlaceHolder1.Controls.Add(awayTeamName); } </code></pre> <p>aspx:</p> <pre><code>&lt;asp:PlaceHolder ID="PlaceHolder1" runat="server"&gt;&lt;/asp:PlaceHolder&gt; </code></pre> <p>This however only creates one set of controls, the second time you click add, nothing happens. It also does not create uniques IDs to access when I need to save. </p> <p>Any ideas how I can solve these issues I am having?</p>
c# asp.net
[0, 9]
5,370,583
5,370,584
returnTrue and returnFalse functions in jQuery source
<p>I can't help but notice there are two seemingly useless functions in the source code of jQuery (For v1.9.1, it's line 2702 and line 2706):</p> <pre><code>function returnTrue() { return true; } function returnFalse() { return false; } </code></pre> <p>Which both are called quite often within jQuery. Is there a reason why they don't simply substitute the function call with a boolean <code>true</code> or <code>false</code>?</p>
javascript jquery
[3, 5]
3,281,726
3,281,727
Why is the javascript object prototype referred to as `fn`?
<p>What's the etymology of such terminology? Where does it come from? What does it stand for?</p>
javascript jquery
[3, 5]
3,830,969
3,830,970
jQuery actions on ajax loaded content
<p>I have loaded some data into a boostrap.</p> <pre><code>$(".open_modal").live('click', function () { var $url = $(this).attr('data-url'); var $title = $(this).attr('title'); var $modal_data = $('&lt;div class="modal" id="my_modal"&gt;&lt;div class="modal-header"&gt;&lt;button class="close" data-dismiss="modal"&gt;×&lt;/button&gt;&lt;h3&gt;&lt;img src="/assets/imgs/loading.gif" /&gt; Loading....&lt;/h3&gt;&lt;/div&gt;&lt;div id="modal_content"&gt;&lt;/div&gt;&lt;/div&gt;') $modal_data.modal({ show: true, backdrop: 'static' }); $modal_data.find("#modal_content").load($url,function(){ $modal_data.find("h3").text($title); }); return false; }); </code></pre> <p>The content I am loading contains a form...</p> <p>I am trying to fire a jquery code block the submit event.</p> <pre><code>$("body").delegate("#post_status_frm", 'submit', function (e) { var $this = $(this); var $status = $("#shout_field").val(); $.ajax({ type: "POST", url: "/do/post_status.asp", data: $this.serialize(), success: function (data) { if (data === 'true') { $("#my_modal").modal('hide'); $("#activity").load('/content/activity.asp'); } else { alert(data); } } }); return false; }); </code></pre> <p>But its not working?</p> <p>I tried throwing up an <code>alert("")</code> on the event to check it is firing. it isn't.</p> <p>I'm stumped.</p>
javascript jquery
[3, 5]
1,033,899
1,033,900
Is it possible to check whether a request is from <script> tag in PHP?
<pre><code>&lt;script src="test.php"&gt;&lt;/script&gt; </code></pre> <p>I want my <code>test.php</code> executed only when it's from <code>&lt;script&gt;</code>, is it possible?</p>
php javascript
[2, 3]
716,458
716,459
JQuery how do I add new divs using .load?
<p>This replaces the content in #message_here, each time. How do I get it to keep adding the content, by creating new divs for each message?</p> <pre><code> var last_mess_id = 1; $('#load_mess').click(function(){ $('#messages_here').load('ajax/get_message.php?last_mess_id='+last_mess_id); last_mess_id++; }) </code></pre>
php jquery
[2, 5]
1,000,486
1,000,487
Retrying an http connection
<p>I'm making an http request. I'm on a platform (android) where network operations often fail because the network connection might not be immediately available. Therefore I'd like to try the same connection N times before completely failing. Was thinking of something like this:</p> <pre><code>DefaultHttpClient mHttp = ...; public HttpResponse runHttpRequest(HttpRequestBase httpRequest) throws IOException { IOException last = null; for (int attempt = 0; attempt &lt; 3; attempt++) { try { HttpResponse response = mHttpClient.execute(httpRequest); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode == 200) { return response; } } catch (IOException e) { httpRequest.abort(); last = e; } } throw last; } </code></pre> <p>I'm mostly worried about the connection being in some state which is invalid on subsequent retries. In other words, do I need to completely recreate 'httpRequest', should I avoid calling httpRequest.abort() in the catch block, and only call it in the final failure?</p> <p>Thanks</p>
java android
[1, 4]
1,467,687
1,467,688
validate CKEditor with jQuery Validation plugin
<p>how to validate CKeditor with jQuery validation plugin.</p> <p>This is my code</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ $("#newpost").validate({ debug: false, rules: { title: "required", cat_id: "required", editor1:"required" }, messages: { title: " Title name cannot be blank.", cat_id: " Please select a category.", editor1: " Post keywords cannot be blank." }, submitHandler: function(form) { // do other stuff for a valid form $.post('new_post.php', $("#newpost").serialize(), function(data) { $('#msgw').html(data); }); } }); }); &lt;/script&gt; </code></pre> <p>PHP code:</p> <pre><code>&lt;?php include ('../db.php'); $title = mysql_real_escape_string($_POST['title']); $editor1 = $_POST['editor1']; $date= date("Y-m-d"); $cat_id = mysql_real_escape_string($_POST['cat_id']); $qu = mysql_query("INSERT INTO blogposts(title,post,date,catid)VALUES ('".$title."','".$editor1."','".$date."','".$cat_id."')") or die (mysql_error()); ?&gt; </code></pre> <p>problem is it dosent even post the contain in the editor. how can i fix this problem. thank you.</p>
php jquery
[2, 5]
5,012,394
5,012,395
toggle an input field
<p>i am trying this code:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $('#individual,#company').hide(); $('input[name=radios]:radio:checked').change(function() { $('#individual').toggle(this.selectedIndex === 0); $('#company').toggle(this.selectedIndex === 1); }); }); &lt;/script&gt; &lt;div class="radio-toolbar"&gt; &lt;input type="radio" name="radios"&gt; &lt;input type="radio" name="radios"&gt; &lt;/div&gt; &lt;div id="x"&gt; &lt;form method="post" id="customForm" action=""&gt; &lt;div id="individual"&gt; &lt;input name="individual" type="text" /&gt; &lt;/div&gt; &lt;div id="company"&gt; &lt;input name="company" type="text" /&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>basically i want to show only an input field. if i choose the first radio btn, then, i want display the div individual. If i choose the second radio, should be showed the company content.</p> <p>thanks</p> <p>demo <a href="http://jsfiddle.net/S5sEv/2/" rel="nofollow">here</a></p>
javascript jquery
[3, 5]
244,127
244,128
can I view two separate aspx files in one webpage?
<p>I have an issue where I have two pages that deal with very similar things and as such quite a few of their methods and aspx server controls have identical method names and variables. In short, it's pretty obvious that the code was copy/pasted and the innards were merely altered. I have a pending request that the two pages be merged so I've explored a number of options as to how I should best merge them.</p> <p>First I thought that perhaps I could put one of the pages in a masterpage that will allow for a content place holder wherein I'd then put the code/controls, but it looked to be a bad idea once I started to make plans. For one the similar names would probably still be a problem and second it seems a rather clunky way to merge two pages together.</p> <p>I've considered renaming all the methods and controls but on the other hand it's going to take a lot of time picking over the code and the controls to rename them all. My worry is that if I try to change the problematic method names, controls, IDs, I'll introduce a lot of bugs in the code. </p> <p>Is there a better way to view two pages in one webpage?</p>
c# asp.net
[0, 9]
302,095
302,096
storing a dynamic array of values inside an object looped within a for statement
<p>I am looking to create a set of dynamically created arrays stored inside an object. the outcome would be something similar to this... </p> <pre><code>object.array0.length = 5, object.array1.length = 4, etc </code></pre> <p>the name of the array would be generated from within a for loop based on a numerical value declared elsewhere in the application.</p> <p>Here is the code that I have...</p> <pre><code>var obj = {}; var weekNum = 4; for(i=0; i &lt; weekNum.length;i++) { obj['week'+i] = []; obj['week'+i].push(day); console.log('days stored in week0: '+obj.week0.length); } </code></pre> <p>What seems to be happening is that <code>obj['week'+i]</code> doesn't realize that it is an array, and the push command doesn't seem to be enough to make it think so. So as a resulting value of <code>obj.week0.length</code> is always 1 with the actual value just being replaced each time as opposed to the array being incremented.</p> <p>Also fyi, The parameter <code>day</code> in the above code would be passed in from another function representing any chosen day (Mon, Tues, etc)... However, the sequence and the amount of days passed in could differ but will never exceed 5 (m-f).</p>
javascript jquery
[3, 5]
1,193,906
1,193,907
.css function does not work inside of handler function
<p>I want to change css properties inside of a named function thant handles the click event. If I call .css in an anonymous function defined in the click event, it works. However, I want to call .css inside of a named function defined inside the handler function. Here's my code. </p> <pre><code>$(document).ready(function () { $('#popup').click(partial(coolTransition, $(this))); }); function coolTransition(elem) { shrink(); function shrink() { elem.css('background-color', '#000000'); } } //used to implement partial function application so that I can pass a handler reference that takes arguments. //see http://stackoverflow.com/questions/321113/how-can-i-pre-set-arguments-in-javascript-function-call-partial-function-applic function partial(func /*, 0..n args */ ) { var args = Array.prototype.slice.call(arguments, 1); return function () { var allArguments = args.concat(Array.prototype.slice.call(arguments)); return func.apply(this, allArguments); }; } </code></pre> <p>Thanks in advance for help. </p>
javascript jquery
[3, 5]
2,082,510
2,082,511
height property
<p>I have 2 div tag: <code>&lt;div class="right"&gt;</code> and <code>&lt;div class="left"&gt;</code> both right class and left class have height property is auto. I want <code>height of left = height of right</code>. Sorry I not enough lever to post code. </p>
javascript jquery
[3, 5]
1,291,833
1,291,834
what data should I store in the FormsAuthentication Ticket?
<p>I need to store a list of user's friends so I can use it in every page (without the need to make a database query every time). </p> <p>I thought about <code>SessionState</code> but I think this is gonna be heavy, since the database is huge.</p> <p>So I need to know if using <code>FormsAuthenticationTicket</code> is the right way to do it? Or should I use <code>HttpOnly</code> Cookies too?</p>
c# asp.net
[0, 9]
259,492
259,493
alert in php echo
<p>I'm using Javascript alert box in echos. The problem is that after the message box appears the page still goes to another page instead og staying on the same page.This is how I write it: </p> <pre><code>if(!isset($studii)) { echo "&lt;script&gt;alert('Te rugam alege ultima scoala absolvita!!');&lt;/script&gt;"; echo '&lt;script language="javascript"&gt;return false;&lt;/script&gt;'; } </code></pre> <p>Any idea on how I can make this work and after clicking ok to stay on the same page and not going to another? the problem I guess is that the return false isn't working.</p>
php javascript
[2, 3]
1,080,734
1,080,735
mask phone number, show full phone number on mouse over
<p>I'm building a little application that displays a bunch of phone numbers.</p> <p>The javascript object looks something like this:</p> <pre><code>myObject.phoneNumber = model.phoneNumber; </code></pre> <p>Then i display myObject.phoneNumber on the screen. However, I'd like to mask it so look something like XXX-XXX-1234. Then, whenever you mouse over the phone number, you see the whole phone number!</p> <p>I was thinking of doing something like this...</p> <pre><code>myObject.phoneNumber = model.phoneNumber; myObject.maskedNumber = model.phoneNumber.replaceFirst6WithX's //psuedoCode </code></pre> <p>Then on mouse over, </p> <pre><code> $(".phoneNumber") .mouseOver(function (e) { $(".phoneNumber").hide(); $(".maskedNumber").show() }); </code></pre> <p>and on mouse out do the opposite.</p> <p>So my question is: how do i mask (or hide the first 6) numbers of the phone number to accomplish this?</p>
javascript jquery
[3, 5]
1,027,177
1,027,178
Name convention Controls on Forms Tips
<p>I found out this article I would like share with you.</p> <p><a href="http://10rem.net/articles/net-naming-conventions-and-programming-standards---best-practices" rel="nofollow">http://10rem.net/articles/net-naming-conventions-and-programming-standards---best-practices</a></p> <p><a href="http://stackoverflow.com/questions/642759/naming-convention-for-controls">http://stackoverflow.com/questions/642759/naming-convention-for-controls</a></p> <p>Regarding name conventions for "Controls on Forms", I thought to use this:</p> <pre><code>ux-Description-GeneralType </code></pre> <p>Example:</p> <pre><code>uxUserIdInput </code></pre> <p>PRO:</p> <ol> <li>have IntelliSense group all my Controls</li> <li>possibility to identifu the type in IntelliSense</li> <li>If I change the Type I do not need to update my code</li> </ol> <p>Because I am pretty new at developing, I would like start with the right foot and using solid practices.</p> <p>Do you guys agree with that. Would you advice some other name convention?</p> <p>Thanks for your time! bye </p>
c# asp.net
[0, 9]
4,078,923
4,078,924
Dynamic div with jQuery that shows content on click
<p>I've been trying to work out the demo at this site <a href="http://www.designgala.com/demos/collapse-expand-jquery.html" rel="nofollow">http://www.designgala.com/demos/collapse-expand-jquery.html</a></p> <p>I'm having issues though. here's the code:</p> <pre><code>jQuery(document).ready(function() { jQuery(".content").hide(); jQuery(".heading").click(function() { jQuery(this).next(".content").slideToggle(500); }); }); var el = document.createElement('div'); el.className = "heading"; el.innerHTML = "whatever you want"; $('.listResults').append(el); var el2 = document.createElement('div'); el2.className = "content"; el2.innerHTML = "whatever you want shown"; $('.listResults').append(el2); jQuery(".content").hide(); </code></pre> <p>html has a div class called listResults which everything gets appended to. Currently the jaavscript is ran after the load so i'm calling the jqeury.hide on .content one's its generated.</p> <p>The problem is that when i click one of the header divs it doesn't drop down the content. Any ideas?</p>
javascript jquery
[3, 5]
2,615,539
2,615,540
jQuery.fadeOut() - How to apply sequentially to a set of elements?
<p>I've 'n' buttons </p> <p>I need to </p> <pre><code>$('BUTTON').fadeOut(); </code></pre> <p>... but I'd like to see one button at time disappear.. </p> <p>how to ?</p> <p>I tried using next, but in the following way ALL disappears in one moment</p> <pre><code>$(".genresButton").first().fadeOut().next().fadeOut() ; </code></pre> <p>I tried to use fadeOut to fadeOut the next, but I've not inital knowledge of total number of buttons. </p> <p>I tried using $.each() but without success</p> <p><em>EDIT:</em></p> <p>This is the working solution i choosed:</p> <pre><code>$("body").on('click', '.genresButton', function(event) { $(".genresButton").not($(this)).each(function(index){ $(this).delay(index * 500).fadeOut(450); }); }); </code></pre>
javascript jquery
[3, 5]
482,754
482,755
Java Script / jQuery, how to go do different pages and trigger clicks at different interval times?
<p>i have 3 pages with 3 buttons:</p> <p>index1.php <code>&lt;input type="submit" value="button1" id="submit_btn"/&gt;</code></p> <p>index2.php <code>&lt;input type="submit" value="button2" id="submit_btn"/&gt;</code></p> <p>index3.php <code>&lt;input type="submit" value="button3" id="submit_btn"/&gt;</code></p> <p>what i want is to create a script that goes to <code>index1</code> and clicks on the <code>button1</code> then waits 10 min and goes to <code>index2.php</code> and clicks to <code>button2</code>.</p> <p>i could use <code>$('#button1').click();</code> and the <code>setTimeout(function(){..}</code> function, but how do i handle errors like if the page is not loaded, or if there is a server error and the page needs to be refreshed...</p> <p>thanks</p>
javascript jquery
[3, 5]
5,179,048
5,179,049
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]
4,085,501
4,085,502
how to fetch userID
<p>how do I fetch a user ID that is associated with the email address entered by the user in the text box?</p>
c# asp.net
[0, 9]
607,680
607,681
jQuery making selection
<p>I have a nested div like this</p> <pre><code>&lt;div id="one"&gt; &lt;div id="two"&gt; id two goes here &lt;/div&gt; &lt;div id="three"&gt; id three goes here &lt;/div&gt; &lt;div id="four"&gt; id four goes here &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Now i want to handle click and doubleclick events on all divs except in div#four, like this </p> <pre><code>$('#one').live('dblclick', function() { my javascript code goes here }); ('#one').live('click', function() { my javascript code goes here }); </code></pre> <p>How can i use the above script and exclude the last nested div #four.</p> <p>Thanks</p>
javascript jquery
[3, 5]
2,629,438
2,629,439
jquery - Array of objects inside double brackets
<p>Im trying to create a node.js chat application and when someone joins the chat room I want to push the last 100 messages to their browser. I have node.js adding each chat message as an object with the username and text of the message into an array. When node.js pushes the array of objects it looks like this.</p> <pre><code>[ [ { "username": "Warren2", "text": "test1" }, { "username": "Warren2", "text": "test2" }, { "username": "Warren2", "text": "test3" }, { "username": "Warren2", "text": "hello" } ] ] </code></pre> <p>I'm having trouble parsing that with jquery and I think jquery is throwing errors because the objects are inside an extra set of brackets. The code I'm using to create the array of objects is as follows:</p> <pre><code>// chat history var history = []; // when the client emits 'sendchat', this listens and executes socket.on('sendchat', function (data) { // we tell the client to execute 'updatechat' with 2 parameters io.sockets.emit('updatechat', socket.username, data); // we add the message to the chat history var obj = {username:socket.username,text:data}; history.push(obj); history = history.slice(-100); }); </code></pre> <p>Am I doing something wrong or is there a way to remove the extra set of brackets or parse this with jquery? When I log the history data node.js is sending to the browser to the console it looks like this:</p> <pre><code>[Object { username="Warren2", text="test1"}, Object { username="Warren2", text="test2"}, Object { username="Warren2", text="test3"}, Object { username="Warren2", text="hello"}, Object { username="Warren", text="test"}, Object { username="Warren", text="test again"}, Object { username="Warren", text="test"}, Object { username="Warren", text="Hey"}] </code></pre>
javascript jquery
[3, 5]
5,428,539
5,428,540
Write File as Response in C# in ASP.NET
<p>I have an ASP.NET Web Forms app written in C#. On one of the screens, the user can click a button. When that button is clicked, I need to generate some XML and open it in a custom app. I'm trying to understand how I can take the XML that I have generated, and automatically open the app that can understand it.</p> <p>The app that uses this XML is a custom app. This app uses a proprietary file format. The file is really just XML. But, I've noticed that the file extension is .ctm. </p> <p>Is there a way for me to just open this XML in the custom app when someone presses the button in my ASP.NET web form?</p> <p>Thank you!</p>
c# asp.net
[0, 9]
4,589,638
4,589,639
How to get "this" form content by name?
<p>In the following example I get <code>title</code> from <code>this</code> form using html <code>id=title</code>.</p> <p>How do I do the same, but instead of using ID then using name?</p> <pre><code>$(document).ready(function(){ $('form').live('submit', function(){ var aform = $('form[name="create_form"]'); // get the entire form var form = $(this); // get form title field by ID var title = this.elements.title.value; // get selected radio button using name instead if ID var type = $(this).find('input:radio[name="ctype"]:checked').val() || ''; alert(title); </code></pre> <p>In the case of the radio button, is it gotten by name, but I can't figure out how to translate that syntax to a normal form field of</p> <pre><code>&lt;input name="title" id="55544_title" type="text" /&gt; </code></pre>
javascript jquery
[3, 5]
4,862,826
4,862,827
How to fire hover for anchor tag through jquery?
<p>I have a link. It hover has some background effects.</p> <p>I want to fire this hover through jquery.</p>
javascript jquery
[3, 5]
3,319,452
3,319,453
If else minifier
<p>I have many lines of code like this.. this is just a 1 thing i am trying right now.</p> <pre><code>if (RI2.Text.Contains("SOS") || RI2.Text.Contains("WAR")) { Response.Redirect("http://mydomain.com/rabat"); } if (RI2.Text.Contains("sos") || RI2.Text.Contains("war")) { Response.Redirect("http://mydomain.com/rabat"); } </code></pre> <p>How do i minify this code. i mean, its very ugly and there many lines of code similar to this.</p> <p>is there any better way of doing this which i dont know.</p> <p>please help. appreciate your time and help.</p>
c# asp.net
[0, 9]
3,331,814
3,331,815
Loop over elements in jQuery when element is double clicked
<p>I'm new to jQuery and Javascript. I'm trying to make a button that I can double click which then loops through all elements in the webpage with a certain class and fades them.</p> <p>Currently, I'm trying this:</p> <pre><code>$(".fadeall").dblclick(function() { $("div.section").each(function(idx,item) { item.fadeTo(25,inactiveOpacity); }); }); </code></pre> <p>In my debugger I see the double click happening, but the function in the <code>each</code> call is not being triggered.</p> <p>I'm believe I'm not matching the <code>div.section</code> elements correctly, but don't know the correct approach.</p>
javascript jquery
[3, 5]
3,372,854
3,372,855
how to get dynamically created elements width and apply style to that?
<p>I am creating an <code>li</code> element dynamically like this:</p> <pre><code>$(data).find('slide').each(function(numSlide){ var slideLink = $(this).attr('link'); var slideimage = $(this).children('slideimage').text(); var slidedesc = $(this).children('slidedesc').text(); $('.slider ul').append('&lt;li&gt;&lt;a href="'+slideLink+'"&gt;&lt;img src="'+root+"images/top-slider-image/"+slideimage+'" alt="welcome to Burger Davis Blog" /&gt;&lt;/a&gt;&lt;div class="note"&gt;'+slidedesc+'&lt;/div&gt;&lt;/li&gt;'); }) </code></pre> <p>But I'd like to calculate the width of the <code>li</code>, and I need to apply some style to it -- how can I do that? If I add styles via the <code>css</code> method, it does not work for dynamically created elements...</p> <p>Please help me to get dynamic elements' width and how to apply styles into that?</p> <p>I know we can use the <code>live</code> function, but I can't get even by that..</p>
javascript jquery
[3, 5]
1,838,959
1,838,960
how to put two function together
<p>I want to write a function to make user click the table header double click and change into descending or ascending order, and I have finished the sorting function, but don't know how to put together, now I just put one of them into the header as following:</p> <pre><code>function sortBy(sKey) { document.sortResultsForm.sSortBy.value=sKey; document.sortResultsForm.submit(); } if($sSortBy=="District") { usort($tempArr, 'sortDistrictNameascend'); } &lt;table border="0" width="100%" cellspacing="2" cellpadding="2"&gt; &lt;tr&gt; &lt;td class="headTable" width=15%&gt; &lt;a href="javascript:sortBy('District');" &gt;&lt;font color=white&gt;District&lt;/font&gt;&lt;/a&gt; &lt;/td&gt; </code></pre> <p>and I don't know how to put the other function into the header let user can double click to change sorting order, the order function as following:</p> <pre><code>function sortDistrictNamedescend($a, $b) { if ($a-&gt;DistrictName == $b-&gt;DistrictName) { return 0; } return ($a-&gt;DistrictName &lt; $b-&gt;DistrictName) ? 1 : -1; } usort($tempArr, 'sortDistrictNamedescend'); </code></pre> <p>anybody can help me, thank you very much.</p>
php javascript
[2, 3]
1,531,676
1,531,677
URLConnection when device is in sleep mode not working
<p>I am having problems with a background service while the device is in sleep mode. I have set an alarm that will start a service every morning at 9 AM. This service works fine while the device is awake, but fails when the device is asleep.</p> <p>I've traced the issue to a URLConnection.openConnection() call shown below. The device cannot seem to open this connection while in sleep mode, it throws an IOException. <strike>I've used URL.openStream() to perform network calls when the device is asleep, and they work fine.</p> <p>Can anyone explain why openStream() would work in sleep mode but openConnection() does not? Is there a way to get it working?</p> <p>This works in sleep mode:</p> <p>return new BufferedReader(new InputStreamReader(new URL(url).openStream()), 8192);</strike></p> <p>This does not seem to work in sleep mode:</p> <pre><code>URL actualURL = new URL(url.toString()); URLConnection c = actualURL.openConnection(); c.setConnectTimeout(10000); c.setReadTimeout(20000); InputStreamReader inputStreamReader = new InputStreamReader(c.getInputStream()); bufferedReader = new BufferedReader(inputStreamReader); </code></pre> <p>EDIT: Fixed! I was making these calls in a background thread started by the service. When I took the functionality out of the background thread and into the service it started working in sleep mode. Strange behavior -> I was able to log all events in the thread but wasn't able to connect to the internet.</p>
java android
[1, 4]
3,063,308
3,063,309
"Uncaught SyntaxError: Unexpected token [" all of a sudden in Chrome
<p>It was working fine up until very recently. Chrome tells me this is incorrect with "Uncaught SyntaxError: Unexpected token ["</p> <pre><code>$.each($regions, function(index, [value1, value2]) { $("#regions .options").children("#r").append("&lt;div class='brick' id='" + index + "' name='" + value2 + "'&gt;" + value1 + "&lt;/div&gt;"); }); </code></pre> <p>Firefox and firebug do not raise a stink and everything is working alright. I don't understand what happened in Chrome. I swear this exact code worked before.</p> <p>Chrome v.12.0.742.122</p>
javascript jquery
[3, 5]
298,279
298,280
How do I enable chrome debugging when inserting a script tag into the head using jquery
<p>I came across this case while trying to dynamicly load a bunch of script files, and where I was getting no errors returned when the JavaScript was failing. This will hopefully save someone a lot of time.</p> <p>How do I enable chrome debugging when inserting a script tag into the head using jquery. This does not allow for debugging (no errors are returned).</p> <pre><code>$(function(){ $('head').append('&lt;script type="text/javascript" src="example.js"&gt;&lt;/script&gt;'); }); </code></pre>
javascript jquery
[3, 5]
1,810,551
1,810,552
Page changed in JQUERY
<p>I am trying to found out how to see if a php file has changed and then show a div with saying Page changed in JQUERY</p>
php jquery
[2, 5]
4,978,093
4,978,094
how to format number the using jquery
<p>I am trying to remove the number which are coming after "." then i want to format the number <strong>(16810900.211233)</strong> to like this <strong>(16,810,900)</strong> but i dont know how to do that here is my html is this:</p> <pre><code>&lt;link rel="stylesheet" type="text/css" href="http://cdn.webrupee.com/font" /&gt; &lt;div class="main"&gt; &lt;p class="active"&gt;10200.00&lt;/p&gt; &lt;p class="in_active"&gt;16810900.211233&lt;/p&gt; &lt;p class="active"&gt;0&lt;/p&gt; &lt;p class="in_active"&gt;-&lt;/p&gt; &lt;p class="active"&gt;1278200.543554&lt;/p&gt; &lt;p class="in_active"&gt;-&lt;/p&gt; &lt;p class="active"&gt;-&lt;/p&gt; &lt;p class="in_active"&gt;9,890.656&lt;/p&gt; &lt;p class="active"&gt;10,200&lt;/p&gt; &lt;p class="in_active"&gt;16810900&lt;/p&gt; &lt;p class="active"&gt;0&lt;/p&gt; &lt;p class="in_active"&gt;-&lt;/p&gt; &lt;p class="active"&gt;1278200.09&lt;/p&gt; &lt;p class="in_active"&gt;-&lt;/p&gt; &lt;p class="active"&gt;-&lt;/p&gt; &lt;p class="in_active"&gt;9890.00&lt;/p&gt; &lt;/div&gt;​ </code></pre> <p>i tried here <a href="http://jsfiddle.net/sureshpattu/Hrac3/2/" rel="nofollow">jsfiddle</a></p>
javascript jquery
[3, 5]
2,113,556
2,113,557
Launch an anchor after index is load
<p>Well, I´m not programmer so I can´t handle this at all. I need to launch a part of a website after index is loaded. I´ve been trying some jquery without any luck, ie this: </p> <pre><code>$("document").ready(function() { setTimeout(function() { $('#tensa-inicio').trigger('click'); },1000); }); </code></pre> <p>You can see the site in this url: 3w[dot]tensa[dot]es. I need to display the HOME link after index is loaded, but can´t see how to do this.</p> <p>Any help is really appreciated.</p> <p>TIA!</p>
javascript jquery
[3, 5]
4,052,982
4,052,983
how can i add image effect on div
<p>How can I add loading effect on <code>&lt;div&gt;</code>. In this code my <code>members.php</code> is so big file so its take time to load. So I want to show that loading… in my member <code>&lt;div&gt;</code> with effect. my javascript skills are so poor so I don’t know is this a right idea to do this or I have to code in <code>member.php</code>. I am so new and try to learn so please help me. I have tried with some free text javascript effect but I couldn’t find what I looking for. I want some image effect like rounding circle or something like that. Here is my code. I appreciate all answers.</p> <pre><code>&lt;head&gt; &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $('#member').load('members.php').show(); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id member&gt;Loading…&lt;/div&gt; &lt;/body&gt; </code></pre>
javascript jquery
[3, 5]
5,840,970
5,840,971
Server Error in '/' Application. Key cannot be null. Parameter name: key
<p>Sometimes I'll come back to the problem of making the report,i use this for report in stimulsoft:</p> <pre><code>Key cannot be null. Parameter name: key Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentNullException: Key cannot be null. Parameter name: key Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [ArgumentNullException: Key cannot be null. Parameter name: key] System.Collections.Specialized.HybridDictionary.get_Item(Object key) +6238250 System.Web.Security.RolePrincipal.IsInRole(String role) +231 System.Web.Configuration.AuthorizationRule.IsTheUserInAnyRole(StringCollection roles, IPrincipal principal) +132 System.Web.Configuration.AuthorizationRule.IsUserAllowed(IPrincipal user, String verb) +264 System.Web.Configuration.AuthorizationRuleCollection.IsUserAllowed(IPrincipal user, String verb) +201 System.Web.Security.UrlAuthorizationModule.OnEnter(Object source, EventArgs eventArgs) +9025485 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +75 </code></pre> <p>How do we fix it?</p> <p>tnx</p>
c# asp.net
[0, 9]
1,525,317
1,525,318
Javascript / jQuery: How to prevent active input field from being changed?
<p>how do I prevent the user to change the value in an input field (which contains a certain value to be copied into the clipboard) without using disabled="true"? The text should be selected once the user clicks in the field (that's working already) but entering anything should have no effect.</p> <p>Thanks</p> <pre><code>jQuery('input.autoselect[value]').focus(function() { jQuery(this).select(); }); </code></pre>
javascript jquery
[3, 5]
5,801,287
5,801,288
Activating an user and Cannot modify header information
<p>How to activate a user name width the next code:</p> <pre><code>&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; //index.phtml:10 ... //a piece from content.php define("COOKIE_HASH",'myfsthpemail'); define("COOKIE_EMAIL",'myfsthpehash'); define("LOGIN_EXPIRES",60 * 60 * 24 * 365); header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"'); //content.php on line 135 $time = time() + LOGIN_EXPIRES; setcookie (COOKIE_EMAIL, trim($_POST['email']), false, '/'); //content.php on line 137 setcookie (COOKIE_HASH, trim($_POST['hash']) , false, '/'); //content.php on line 138 $scr = "setTimeout(function(){ window.location.href = 'http://www.myfirsthomepage.com'; },4000);"; $scr = '&lt;script type="text/javascript"&gt;' . $scr . '&lt;/script&gt;'; $str = '&lt;h1&gt;Activated&lt;/h1&gt;'; echo $str . $scr; </code></pre> <p>That it doesn't show a warning message:</p> <pre><code>Warning: Cannot modify header information - headers already sent by (output started at /home/.../index.phtml:10) in /home/.../content.php on line 135 Warning: Cannot modify header information - headers already sent by (output started at /home/.../index.phtml:10) in /home/.../content.php on line 137 Warning: Cannot modify header information - headers already sent by (output started at /home/.../index.phtml:10) in /home/.../content.php on line 138 </code></pre> <p>I try with server containing php 5.2.17.</p> <p>Thank you</p>
php javascript
[2, 3]
4,582,659
4,582,660
Form in master page not submitted
<p>I am working on asp.net application. In master page of my application, I have a sidebar div. I have inserted a form in it for subscription which looks like this:</p> <pre><code>&lt;form method="post" action="https://app.icontact.com/icp/signup.php" name="icpsignup" id="icpsignup3297" accept-charset="UTF-8" onsubmit="return verifyRequired3297();" &gt; ... &lt;input type="submit" name="Submit" value="Get Deals"&gt; &lt;form&gt; </code></pre> <p>And javascript function which is called on button click looks like this:</p> <pre><code>&lt;script type="text/javascript"&gt; var icpForm3297 = document.getElementById('icpsignup3297'); if (document.location.protocol === "https:") icpForm3297.action = "https://app.icontact.com/icp/signup.php"; function verifyRequired3297() { alert('testing'); if (icpForm3297["fields_email"].value == "") { icpForm3297["fields_email"].focus(); alert("The Email field is required."); return false; } return true; } &lt;/script&gt; </code></pre> <p>when I hit submit button, page reloads but form is not redirected to other page (redirection url) Is it because the code is in master page? Even test alert is not shown.</p> <p>If I use this code in a new asp.net page without master page, it works perfectly</p>
c# asp.net
[0, 9]
2,028,186
2,028,187
jQuery - trigger event when "unhover" on elements for a period of time
<p>I am writing some default animations that will only be triggered when none of the 4 buttons are being hovered for 1 second. <br/><br/>The timer should reset if any of the buttons are hovered during the waiting period (i.e. that 1 second). Any idea? Thanks!</p> <p>[UPDATE] See my snippets in below comment, hope someone find it useful.</p>
javascript jquery
[3, 5]
2,788,382
2,788,383
Retrieving month name with the month number
<p>I'm modifying a calendar and there is a case where I'm given a month number and I need to compare it with a month name. </p> <p>Of course, I could create a switch statement, but I was wondering if I can obtain the month name from the number or vice versa to do the conditional.</p> <p>Thanks!</p>
java android
[1, 4]
2,596,739
2,596,740
Assigning an element an id when document is loaded so it can perform a different function when clicked?
<p>I'm trying to manipulate an <code>id</code> to use the same button to do more then 2 actions.</p> <p>its something like:</p> <pre><code>var id; if(something == 2){ id = "id"; }else{ id = "id2"; } $(".myClass").attr("id", id); </code></pre> <p>but, its not good, because if i try to use the <code>id</code> that i set, won't work, maybe because the document was already loaded with no <code>id</code> in the button.</p> <p>dont think this need a example, <a href="http://jsfiddle.net/SWZMd/15/" rel="nofollow">but i made it</a>.</p> <p>have another way to do this ?</p>
javascript jquery
[3, 5]
1,207,810
1,207,811
Add class to selected option of a select element
<p>To demonstrate that I could even use a Class attribute on an option elem I tried adding class attributes to options of a select elem in a static page and that works fine. I noticed that not many online resouces documented this so I figured I would explicitly set the record.</p> <p>here is the jquery code attempting to add a class to the selected option</p> <pre><code> ChangeDdlItemBG : function(obj, compLev) { var ddl = $(obj); var index = ddl.attr('selectedIndex'); switch(compLev) { case ComplianceLevel.Compliant : $(ddl.attr('id') + ': selected').addClass('Compliant'); break; case ComplianceLevel.OtherThanSerious : $(ddl.attr('id') + ': selected').addClass('OtherThanSerious'); break; case ComplianceLevel.Serious : $(ddl.attr('id') + ': selected').addClass('Serious'); break; case ComplianceLevel.Critical : $(ddl.attr('id') + ': selected').addClass('Critical'); break; } } var ComplianceLevel = { Compliant : function() { return 0; }, OtherThanSerious : function() { return 1; }, Serious : function() { return 2; }, Critical : function() { return 3; }, }; </code></pre> <p>New information, I found the reason nothing occured was a simple mistake in the value being passed in for compLev. However, now it runs through the code for the correct case and does nothing to the color of the item.</p>
asp.net jquery
[9, 5]
24,260
24,261
How to select a input field in next TD with Jquery?
<p>I want to select a input field in next TD with Jquery. I can not use ID or class because the table's row can be add or removed.</p> <p>like ,</p> <pre><code> &lt;tr&gt; &lt;td&gt;&lt;input type='text' name='price[]' onkeyup = 'getTest(this)' /&gt; &lt;/td&gt; &lt;td&gt;&lt;input type='text' name='qty[]' onkeyup = 'getPrice(this)' value='1' /&gt; &lt;/td&gt; &lt;td&gt;&lt;input type='text' name='amount[]' /&gt; &lt;/td&gt; &lt;/tr&gt; function getTest(obj){ //I want to select qty[] and amount[] } function getPrice(obj){ //I want to select price[] and amount[] } </code></pre> <p>anybody know how to select the input fields, please help~!</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,298,827
3,298,828
Variables and math operators
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1416633/strange-javascript-addition-problem">Strange javascript addition problem</a> </p> </blockquote> <p>I know there's obviously a solution for this, and I've done it before, but I can't remember it and now I can't find it.</p> <pre><code>​&lt;div&gt;1&lt;/div&gt;​​​​​​​​ $(function() { var number = $('div').text(); var math = number + 2; $('body').text(math); });​ </code></pre> <p><a href="http://jsfiddle.net/G5zdx/" rel="nofollow">http://jsfiddle.net/G5zdx/</a></p> <p><code>number</code> is not being treated as an integer so <code>math</code>'s value is "12" instead of "3". How can I correct this?</p>
javascript jquery
[3, 5]
5,864,520
5,864,521
Weird parsing date string error in Android 2.0 emulator
<p>I have a simple test code for testing SimpleDateFormat. This code works well on Eclipse and Android 1.5 emulator, but it failed at Android 2.0 emulator. Does anyone know why? Thanks.</p> <pre><code>public class TemplateActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText(R.string.hello); setContentView(tv); SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz"); String dateStr = "Mon, 17 May 2010 01:45:41 GMT"; try { Date parsed = format.parse(dateStr); Log.v("Test", parsed.toString()); } catch (ParseException pe) { Log.v("Test", "ERROR: Cannot parse \"" + dateStr + "\""); } } } </code></pre> <p>Log message:</p> <pre><code>V/Test( 400): ERROR: Cannot parse "Mon, 17 May 2010 01:45:41 GMT" </code></pre>
java android
[1, 4]