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,774,074
5,774,075
How to reset background colour after it is changed by jQuery?
<p>First, a jsfiddle... <a href="http://jsfiddle.net/therocketforever/jYba3/11/" rel="nofollow">http://jsfiddle.net/therocketforever/jYba3/11/</a></p> <pre><code>// Highlight selected linker link &amp; set all others to default. $('a.linker').click(function(){ $(this).addClass('selected'); $(this).parent('li').siblings().find('.selected').removeClass('selected'); // Selects a random colour from the 'colors' array by getting a random value // between 0 and the length of the color array. rand = Math.floor(Math.random()*colors.length); $(this).css("background-color", colors[rand]); </code></pre> <p>Now a Question,</p> <p>Firstly this code works almost exactly the way that I would like it to, A user clicks a link, the selected colour is applied to the link text, removed from the others &amp; the background of the link is set to a random color from the array of colours. Cool.</p> <p>What I would like to know is... How would I make it so that the randomly set background colour is removed from the non selected links (ie. Only the link with the .selected class has the background colour.)</p> <p>EXTRA CREDIT</p> <p>Bonas points if the same background colour is never used twice in a row. (ie. If click one sets to yellow, click two is any other colour except yellow. </p>
javascript jquery
[3, 5]
4,035,877
4,035,878
How to lock the device in a service?
<p>I have this code by which I can easily lock the device from an activity:</p> <pre><code>WindowManager.LayoutParams lp = getWindow().getAttributes(); lp.screenBrightness = 0; getWindow().setAttributes(lp); getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); </code></pre> <p>but I want to do this from a service or a broadcasrreciever so that if an sms is recieved the phon will be locked, but I cant solve this, any help?</p>
java android
[1, 4]
295,510
295,511
Java, what do you call this? and why )};
<p>I am going through Hello Android (Android PDF/tutorial) and have now seen this syntax a couple of times. Can someone please explain to me what Java syntax is used when run Runnable is defined? </p> <pre><code>private class AndroidBridge { public void callAndroid(final String arg) { // must be final handler.post(new Runnable() { public void run() { Log.d(TAG, "callAndroid(" + arg + ")" ); textView.setText(arg); } ... </code></pre> <p>Is the code defining a Runnable object and overriding it's run method?</p>
java android
[1, 4]
3,874,631
3,874,632
How to separate data received from $.get() callback function
<p>I have this:</p> <pre><code>&lt;div &gt;&lt;span id="compareResult"&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span id="result"&gt;&lt;/span&gt;&lt;/div&gt; $.get( 'data.php', { valA: $(this,'option:selected').val() , valB:$(this,'option:selected').val()}, function(childData){ $('#result').html(childData).css('display', 'none')});&gt; </code></pre> <p>PHP:</p> <pre><code>function getData($names,$id,$flag){ if($flag==0){ $strResult = '&lt;select multiple class="sel" id="selectname" size='.count($names).'&gt;'; } if($flag==1){ $strResult = '&lt;select multiple class="sel" id="selname" size='.count($names).'&gt;'; } for($i=0; $i&lt;count($names); $i++) { $strResult.= '&lt;option value='.$id[$i].'&gt;'.$names[$i].'&lt;/option&gt;'; } echo $strResult.= '&lt;/select&gt;';} </code></pre> <p>How do I break apart/parse the response inside .html(childData) so I can put it in different span(i.e. id="compareResult")?</p> <p>Thanks in advance.</p>
php jquery
[2, 5]
1,408,191
1,408,192
What can I use to let users build their own avatar character?
<p>How would you go about providing users with the ability to build a custom avatar character, something like <a href="http://messenger.yahoo.com/features/avatars/" rel="nofollow">Yahoo! Avatars</a>?</p> <p><strong>EDIT</strong> - Let me be more specific about what Yahoo! Avatars does:<br> It lets you <em>create</em> an avatar by selecting a face, hair style, eyes, etc.<br> This is what I'm looking for.</p> <p>I am interested in: </p> <ul> <li>Libraries, free or paid</li> <li>Outsourcing to an external website, provided this can be well integrated into our website</li> <li>Any other suggestions</li> </ul>
c# asp.net
[0, 9]
4,701,556
4,701,557
Run PHP Remotely
<p>I have a PHP script that i want to run on users sites remotely, that ties in with their account on mine. So basically it is software-as-a-service. The user would copy and paste certain code to their site and it would run strictly php. I am unsure how to do this.</p> <p>Are you able to run php remotely and how would you do it if for example my site was:</p> <p>mydomain.com</p> <p>and the users domain would be:</p> <p>customerdomain.com</p>
php javascript
[2, 3]
2,301,576
2,301,577
want to show place on google map when input lat,longitude value
<p>I want to show place on google map, when input latitude , longitude value. I want to write that with C#. If anyone has sample, please share me.. thanks in advance...</p>
c# asp.net
[0, 9]
4,034,784
4,034,785
I need help developing a form
<p>I'm trying to create a form that will create a table of pricing for t-shirts. </p> <p>There are 10 shirts to choose from and each one is a different price. The S through XL are the same price but the XXL is a different price. </p> <p>Next there is a selection for the color of the garment which also varys the price and there are 3 options White, Athletic, and Color.</p> <p>The 3rd selection is the number of colors in the print for the shirt. Which there are 5 options (1-2, 3-4, 5-6, 7-8, 9-10 which affects the price.</p> <p>Then I also have a few checkboxes which are add-ons that add to the price also.</p> <p>The final data I want to show is a 2 row table showing in each column the price for 48pc, 72pc, 96pc, 144pc, 288pc. The first row will be the price for S-XL and the 2nd row would be for the XXL price.</p> <p>I've created a super huge file that does the calculations and comes up with a cost but I know there is a easier way and a correct way that what I did. How would you guys do a file like this and can anyone help me out? I'm about to go crazy I been working on it for the past week and half straight.</p> <p>I didn't post it because it was to long. I uploaded it to gitHub though heres the link: <a href="https://gist.github.com/1708558" rel="nofollow">https://gist.github.com/1708558</a><a href="https://gist.github.com/1708558" rel="nofollow">GitHub</a></p>
php javascript
[2, 3]
2,277,233
2,277,234
how to check the string array is empty or null android?
<p>I am new to java. Am unable to check for null. Could you enlighten me on this? I have string array which has no elements.</p> <p>I tried this code</p> <pre><code>String[] k = new String[3]; if(k==null){ System.out.println(k.length); } </code></pre>
java android
[1, 4]
4,174,671
4,174,672
replace "\\' to '\' in C#
<p>I'm using PayWay payment gateway. I want to put the pay certificate File path in the web.config file. so I add like this</p> <pre><code> &lt;add key="PayWayPath" value="c:\payway\ccapi.q0&amp;amp;logDirectory=c:\payway"/&gt; </code></pre> <p>the I call in my web form like this.</p> <pre><code> String initParams = WebConfigurationManager.AppSettings["PayWayPath"]; </code></pre> <p>My initParams like this</p> <pre><code>initParams = c:\\payway\\ccapi.q0&amp;amp;logDirectory=c:\\payway </code></pre> <p>but I need to get like this output.</p> <pre><code>initParams = c:\payway\ccapi.q0&amp;amp;logDirectory=c:\payway </code></pre> <p>I try this things. But non of the work</p> <pre><code> initParams = initParams.Replace("\\\\", "\\"); initParams = Regex.Replace(initParams, @"[\\ ]", "\"); </code></pre> <p>So how can I do it?</p>
c# asp.net
[0, 9]
5,589,219
5,589,220
Can someone explain what is a HelperClass and what does in Java or in C++?
<p>I want to know what the HelperClass used for. Can someone please explain it with examples?</p> <p>Thank You</p>
java c++
[1, 6]
4,832,841
4,832,842
number formatting in JS?
<pre><code>jQuery(function() { jQuery( "#slider-range-min" ).slider({ range: "min", value: 1, step: 1000, min: 100000, max: 3000000, slide: function( event, ui ) { jQuery( "#amount" ).val( "$" + ui.value ); } }); jQuery( "#amount" ).val( "$" + $( "#slider-range-min" ).slider( "value" ) ); }); </code></pre> <p>The field "amount" on our page is filled with the value, but we want this value to be formatted similar to PHPs <code>number_format</code> (with commas, etc).</p> <p>How would I go about doing this in javascript?</p>
javascript jquery
[3, 5]
5,979,755
5,979,756
Why can't I compare these 2 strings?
<p>For some reason, no matter what I type into my two textboxes, I get the matches response. At first I was using <code>==</code> and that didn't work, so I tried switching to <code>if( a.equals( b ))</code></p> <p>I'm still stuck.</p> <p>Please help!</p> <pre><code>package net.2TextboxesStringCompare; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; import android.widget.EditText; /* * 2TextboxesStringCompare */ public class Code8 extends Activity implements OnClickListener { Button accept; EditText numberStudents, numberStudents2; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); numberStudents = new EditText(this); numberStudents2 = new EditText(this); // find our button in the UI by its ID accept = (Button)findViewById(R.id.accept); // set listeners for the button. Since our current class // implements the OnClickListener interface // we can simply pass the current object ("this") into // the listener. The appropriate method will therefore // be called when the event fires. accept.setOnClickListener(this); } /* implement an event handler that responds to click events */ public void onClick(View v){ String a = numberStudents.getText().toString(); String b = numberStudents2.getText().toString(); if( a.equals( b ) ) Toast.makeText(getApplicationContext(), "Matches", Toast.LENGTH_SHORT).show(); else Toast.makeText(getApplicationContext(), numberStudents.getText()+" != "+numberStudents2.getText(), Toast.LENGTH_SHORT).show(); } } </code></pre>
java android
[1, 4]
3,815,760
3,815,761
what is the meaning of the word "this" in Jquery script
<p>Hello I'm a newcomer in JavaScript and JQuery language. I started to see some examples of JQuery script.</p> <p>i have the following code segment:</p> <pre><code> &lt;script type="text/javascript"&gt; $(document).ready(function(){ $("p").click(function(){ $(this).hide(); }); }); &lt;/script&gt; </code></pre> <p>My question: what is the meaning of word <strong>"this"</strong> in this line of code:</p> <pre><code> $(this).hide(); </code></pre>
javascript jquery
[3, 5]
2,618,540
2,618,541
jQuery $.inArray doesn't seem to work with associative arrays
<p>I have made this fiddle: <a href="http://jsfiddle.net/benhowdle89/CANX8/1/" rel="nofollow">http://jsfiddle.net/benhowdle89/CANX8/1/</a></p> <p>Which creates an assoc array and then runs a test for a value that is in the array. The wrong results are reached!</p> <p>Outline of code:</p> <pre><code>$(document).ready(function(){ var newArray = []; newArray['first'] = 1; newArray['second'] = 1; $('button').click(function(){ if($.inArray(1, newArray) != -1){ $('#dump').css('border', '1px solid red'); } else { $('#dump').css('border', '1px solid blue'); } }); }); </code></pre>
javascript jquery
[3, 5]
2,153
2,154
jQuery rebind function
<p>I want to have a div that animates the currently active image out of the view and instead animates in another image. There are several of these divs, and each one should have the same basic functionality but linked to different images. The problem I'm having is that you can click many of the divs before the animation is complete, which fires the other animations at the same time. My goal is to only be able to fire one animation at a time, and when the animation finishes you're able to fire the next animation. I've tried using unbind which works OK but then I'd have to rebind it later and I don't know how to do this. I'm really a jQuery noob so I would greatly apreciate an answer. Thanks!</p> <p>My code:</p> <pre><code>$('.div1').click(function clickevent() { $('.img2, .img3').animate({ opacity: 0.1, left: 600 }, 1000, function() { $('.img1').animate({ opacity: 1, left: 0 }, 500, function() { $('.div2, .div3').bind('click', clickevent); /* Here I want to rebind the function */ }); }); $(this).addClass("active"); $('.div2, div3').removeClass("active"); $('div2, .div3').unbind('click', clickevent); }); </code></pre> <p>I have two other codeblocks for .div2 and .div3 which look the same but with different classes in different places. Is there any way to make the images finish their animation before being able to animate again? Thanks.</p>
javascript jquery
[3, 5]
5,390,341
5,390,342
how to toggle any text with JQuery?
<p>My question is very short:</p> <p>If I click "show", I want to change this to "hide". Similarly, if I click "hide", I want to change this to "show"?</p> <p>Such as toggleClass.</p>
javascript jquery
[3, 5]
5,107,402
5,107,403
Truncate text with jQuery based on pixel width
<p>I'm trying to use jquery to write a fast function that calculates the pixel width of a string on a html page, then truncates the string until it reaches an ideal pixel width...</p> <p>However it's not working (the text doesn't truncate)...</p> <p>Here is the code I have:</p> <pre><code> function constrain(text, original, ideal_width){ var temp_item = ('&lt;span class="temp_item" style="display:none;"&gt;'+ text +'&lt;/span&gt;'); $(temp_item).appendTo('body'); var item_width = $('span.temp_item').width(); var ideal = parseInt(ideal_width); var smaller_text = text; while (item_width &gt; ideal) { smaller_text = smaller_text.substr(0, (smaller_text-1)); $('.temp_item').html(text); item_width = $('span.temp_item').width(); } var final_length = smaller_text.length; if (final_length != original) { return (smaller_text + '&amp;hellip;'); } else { return text; } } </code></pre> <p>Here's how I'm calling it from the page:</p> <pre><code> $('.service_link span:odd').each(function(){ var item_text = $(this).text(); var original_length = item_text.length; var constrained = constrain(item_text, original_length,175); $(this).html(constrained); }); </code></pre> <p>Any ideas on what I'm doing wrong? If there is a way to do it faster (ie bubble sort), that would be great too.</p> <p>Thanks!</p>
javascript jquery
[3, 5]
1,897,713
1,897,714
How can I split data read from a json file?
<p>I have this json data in <code>data.json</code> file.</p> <pre><code>[ "1009 2000", "1009 2001", "1002 2002", "1003 2002" ] </code></pre> <p>I am looping through this data and spliting the data based on <code>,</code> as in the following code</p> <pre><code>var show = function () { var span = $('.input'); var c = $('ul'); $.getJSON('data/data.json', function (id) { var j = id.split(','); var hsl = j[0]; var ny = j[1]; $('&lt;li&gt;' + id + '&lt;/li&gt;').appendTo(c); $(c).appendTo(span); console.log(hsl); }); } </code></pre> <p>but this gives me this error in console</p> <pre><code>Object 1009 2000,1009 2001,1002 2002,1003 2002 has no method 'split' </code></pre> <p>How can I split this data so that I could display it like this</p> <pre><code> 1009 2000 1009 2001 1002 2002 1003 2002 </code></pre>
javascript jquery
[3, 5]
2,689,983
2,689,984
Why doesnt this run continuously when i push the continuous button?
<pre><code>public class TestingActivity extends Activity implements View.OnClickListener { ScheduledThreadPoolExecutor scheduler = new ScheduledThreadPoolExecutor(1); ScheduledFuture now = null; public void onCreate(Bundle savedInstanceState) { //oncreate } public void rollthedice() { //rollthedice } public void onClick(View view) { Runnable runner = new Runnable() { public void run() { rollthedice(); } }; if(view.equals(continuous)) { if(now == null) now = scheduler.scheduleAtFixedRate(runner, 0, 250, TimeUnit.MILLISECONDS); else return; } if(view.equals(stop)) { if(now != null) { now.cancel(true); now = null; } else return; } if(view.equals(roll)) rollthedice(); if(view.equals(exit)) System.exit(0); } </code></pre> <p>I used it in a Java application and it worked fine, i put it into android project and it doesnt work i want the continuous button to run rollthedice() continuously and the stop button to stop it then continuous to start it again and stop back and forth</p>
java android
[1, 4]
4,931,446
4,931,447
Android code to pure java
<p>I want to know which is the tag used in pure java instead of the following codes in android</p> <pre><code>Looper ViewerApp inputMgr getWindowToken() InputMethodManager </code></pre> <p>For example in pure java we use JOptionPane instead of toast in android. What is the use of ViewerApp in android and also looper in android. Please help....</p>
java android
[1, 4]
5,289,410
5,289,411
Control overriding in a .net app
<p>Ok, here we go..</p> <p>I have a control, which in the assembly.. lets call it "ControlAssembly".</p> <p>There are a load of controls in this, under the namespace ControlAssembly.Controls.</p> <p>So, I want to use this in my website, by adding the </p> <pre><code> &lt;add tagPrefix="ARC" namespace="ControlAssembly.Controls" assembly="ControlAssembly" /&gt; </code></pre> <p>line, as per usual.</p> <p>However, I would like to override one of the controls in here in the web app.</p> <p>I have added a load of instances this control to all the pages.</p> <p>However, in this app, I want to add a language feature, in which it will translate the text value on the OnPreRender method.</p> <p>I am a lazy lazy man, and I would like to be able to do something like have a new "Control" that inherits ControlAssembly.Controls.Control, and have that go round and effectively replace all the instances of ARC:Control with this Control in this web app.</p> <p>e.g. Control : ControlAssembly.Controls.Control{ OnPreRender { update text property } }</p> <p>Having just written this, I guess I could use a render adapter (I suppose) to do this, but I don't really want the stuff that comes with a render adapter attached to my site.</p> <p>Any suggestions of approaches to this? (I know I <em>could</em> just rename all my controls to TranslatedControl and that would do the job.. but I'd be interested to hear other ideas.</p>
c# asp.net
[0, 9]
798,885
798,886
Jquery mousedown vs click
<p>today I discovered something that was quite confusing for me. I just tried to hide s.th via jquery... first I tried to use this </p> <pre><code>$(".specificdiv li:nth-child(3)").click(function(){ $(".anotherdiv").hide(); }) </code></pre> <p>....but it does not work.</p> <p>After a time I tried it this way:</p> <pre><code>$(".specificdiv li:nth-child(3)").mousedown(function(){ $(".anotherdiv").hide(); }) </code></pre> <p>Can anyone explain me why mousedown works instead of click? Would be great to find out</p> <p>EDIT</p> <p>edited the anotherdiv.</p>
javascript jquery
[3, 5]
3,310,538
3,310,539
Do the benefits of Resin/Quercus outweigh the overhead?
<p>Lately, I've been looking more and more into Resin + Quercus as a technology to develop an application of mine.</p> <p>The reason I started looking into it was that this application has high reporting needs, a lot of which cannot (or realistically, should not) be created in real-time. Java would offer a nice backend to queue and generate reports. Also, with Quercus I would be able to develop my data models in Hibernate, and use them "from PHP", thus effectively stretching these models across front and back-end. This same concept would also apply to any front/back-end common business logic, which could be developed in Java libraries.</p> <p>Now, the downside is that whichever front-end (PHP) MVC Framework I choose (my goal was Symfony 2), it is unlikely to work without some heavy modification, if it can work at all. Quercus is a pretty close implementation of PHP, and is supposed to be compatible with PHP5.3, so namespaces and closures SHOULDN'T be a problem, but when I tried to run an existing Symfony 1.4 app, I failed miserably.</p> <p>So, my question to you is, do you think the benefits of Resin + Quercus outweigh the overhead of using a not-so-perfect/stable implementation of PHP? If this were your application, and your goal was and end-product, rather than educational purposes, what would you decide?</p>
java php
[1, 2]
1,468,451
1,468,452
How to get a detailed data of a specific list view item
<p>hi i have build a rss by watching ibm tutorial . In this i get a list view of rss feeds. i have a class showdescription in which i am taking the description of the specific list view item.</p> <p>But it does not show the descriton on item click.</p> <p>here is my code for onclicklistener</p> <pre><code> public void onItemClick(AdapterView parent, View v, int position, long id) { Log.i(tag,"item clicked! [" + feed.getItem(position).getTitle() + "]"); Intent itemintent = new Intent(this,ShowDescription.class); Bundle b = new Bundle(); b.putString("title", feed.getItem(position).getTitle()); b.putString("description", feed.getItem(position).getDescription()); b.putString("link", feed.getItem(position).getLink()); b.putString("pubdate", feed.getItem(position).getPubDate()); itemintent.putExtra("android.intent.extra.INTENT", b); startSubActivity(itemintent,0); } </code></pre> <p>and this code shows error in startSubActivity and ask to implement its method which is</p> <pre><code>private void startSubActivity(Intent itemintent, int i) { // TODO Auto-generated method stub } </code></pre> <p>but it does not shows the details of particular item </p>
java android
[1, 4]
5,010,785
5,010,786
Prevent user from holding f5 for more than x seconds?
<p>Is there a way to bind a jQuery event to pop off after a visitor holds a button for more than, say, 3 seconds? In this case I'd like to do something after a user holds f5 for 3 seconds.</p> <p>I've found a solution that prevents the refresh when user presses f5 here:</p> <p><a href="http://stackoverflow.com/questions/2482059/disable-f5-and-browser-refresh-using-javascript">disable f5 and browser refresh using javascript</a></p> <p>However, this isn't quite what I'm looking for as I'd like to allow my users to refresh pages but prevent them from placing a rock on the f5 button so to speak (it's an online game where you can do tasks by refreshing the page).</p> <p>Is what I'm trying to do even possible?</p> <p>EDIT: I am looking for a short-term, quick, client-side fix. The server side of things will be solved later on.</p>
javascript jquery
[3, 5]
2,348,794
2,348,795
Browser based online game question
<p>I am developing a small browser based game in asp.net. Think of a game room which has a capaticy of 22 players and players join the room by clicking a button. ( I am saving the number of players in the room in database) I need to call a method when the number of players in the room is 22. The problem is I don't know how to control the number of players in the room. I mean I think like there need to be a bacground code which has to run all the time at the server and that code controls the number and call the function. It's my first web project(school project) and I hope you all can help me. </p>
c# asp.net
[0, 9]
4,817,426
4,817,427
How and where do I learn programming languages?
<p>I really want to learn a ton of programming languages like javascript and c++, but I have no idea where or how. I watched a tutorial series for C++ on Youtube and I read the javascript tutorial on W3schools, but I need more detailed tutorials and a way to practice. </p> <p>How did you guys learn? I'll take the college courses when I get a chance, but how else?</p>
javascript c++
[3, 6]
342,374
342,375
Refresh page data when button is clicked inside a usercontrol
<p>I have a page which displays data from a web service. It first checks if the data exists in session, and then gets it from the WS if not.</p> <p>My control calls the web service and adds another row to the data (an SP list in this case). If the new item was added successfully, I want to refresh the list in session. If not, no refresh is needed.</p> <p>I want the page to get the new data from the web service, even if the data exists in session. My problem is that the event handler for the button fires after the page load event of the page containing the control, where the data is retrieved and bound to a repeater.</p> <p>I was thinking of using some client side tricks, like checking the event target or checking for a button name in the post params list, but my button is a server side control, and I would like it to remain that way.</p> <p>Is there some best practice solution for this type of situation? </p>
c# asp.net
[0, 9]
5,421,699
5,421,700
undefined error in jquery
<p>I get here as x undefined error. In my <code>tr</code> tag I have used this code (in <code>a.php</code>):</p> <pre><code>echo "&lt;tr data-x'some php value'&gt;"; </code></pre> <p>In <code>b.php</code> I'm using code like this: </p> <pre><code>window.location = 'c.php?x=' + $(this).data('x'); </code></pre>
php jquery
[2, 5]
4,031,669
4,031,670
Developing for iPhone or Android? (As a C# developer)
<p>I'd like to start developing for iPhone or Android in my spare time, as a chance to learn something new but also hoping make some extra income. </p> <p>I'm not sure which is the best development for me to start developing on. I own an iPhone, but I don't have a Mac (which I would need to use the SDK), plus with the iPhone I believe there's an annual charge to develop for it.</p> <p>As far as I understand Android, the SDK is free and can be used on Windows.</p> <p>Professionally I develop using .net and C#, which sounds more similar to the Java based Android enviroment.</p> <p>Another negative I perceive against iPhone is it has a much more crowded App Store, I would think apps get better exposure on Android?</p>
iphone android
[8, 4]
3,055,825
3,055,826
problem in Labels with asterisk!
<p>I have the following ASP.NET markup:</p> <pre><code>&lt;td align="right" valign="top" style="width: 130px"&gt; Answer: &lt;asp:Label ID="lblanswer" runat="server" CssClass="errorMessage" ForeColor="Red" Text="*"&gt; &lt;/asp:Label&gt; &lt;/td&gt; </code></pre> <p>I want it to say "Answer:*" with only the asterisk in red. </p> <p>How to do that if I want Answer to be inside the <code>&lt;asp:label/&gt;</code>. </p>
c# asp.net
[0, 9]
5,877,029
5,877,030
How come the answer to every javascript question ends up being "jQuery"
<p>I've been following the javascript questions here for the last few weeks, and I've found a common recurring theme.</p> <p>Almost any question asked on here that involves JavaScript gets answered with:</p> <ol> <li>"jQuery can do that"</li> <li>"there's a plugin for that"</li> <li>"jQuery can make your bed for you." </li> </ol> <p>Even questions referencing other libraries are answered by saying "Use jQuery instead".</p> <p>Is jQuery replacing JavaScript as a whole?<br> This is a serious question. Are we really looking at JavaScripts future. Obviously this community has a strong bias towards jQuery (is that because there's alot of .NET developers?), but does the web development community as a whole share this bias?</p>
javascript jquery
[3, 5]
2,751,925
2,751,926
PHP equivalent to JavaScript's string split method
<p>I'm working with this on JavaScript:</p> <pre><code>&lt;script type="text/javascript"&gt; var sURL = "http://itunes.apple.com/us/app/accenture-application-for/id415321306?uo=2&amp;mt=8&amp;uo=2"; splitURL = sURL.split('/'); var appID = splitURL[splitURL.length - 1].match(/[0-9]*[0-9]/)[0]; document.write('&lt;br /&gt;&lt;strong&gt;Link Lookup:&lt;/strong&gt; &lt;a href="http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/wa/wsLookup?id=' + appID + '&amp;country=es" &gt;Lookup&lt;/a&gt;&lt;br /&gt;'); &lt;/script&gt; </code></pre> <p>This script takes the numeric ID and gives me 415321306.</p> <p>So my question is how can I do the same thing but using PHP.</p> <p>Best regards.</p>
php javascript
[2, 3]
1,128,332
1,128,333
muliple markers
<p>i am getting this err: </p> <pre><code> "Multiple markers at this line - Syntax error, insert ";" to complete LocalVariableDeclarationStatement - Syntax error, insert "}" to complete ClassBody - Syntax error, insert "}" to complete ClassBody - Syntax error, insert ";" to complete LocalVariableDeclarationStatement" </code></pre> <p>i am not getting any thig missing </p> <pre><code>TimerTask getMessagesTask=new TimerTask() { this.runOnUiThread(new Runable(){ @Override public void run() { newMessages=connectToserverforincomingmsgs( getmsgurl, chatnumber); TextView tv=new TextView(Chat.this); tv.setText(chatnumber+":"+newMessages); LayoutParams param=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT); tv.setLayoutParams(param); ((LinearLayout)findViewById(R.id.ll_chat)).addView(tv); }}); </code></pre> <blockquote> <p><em><strong>Blockquote</em></strong></p> </blockquote>
java android
[1, 4]
5,482,598
5,482,599
Post Form After Server Code Execution
<p>I have created a Webform which will be posted to another Webform after executing the server side code(C#).</p> <p>I want to execute server code and based on the result of that I want to post the Webform to another Webform otherwise Webform should not be posted.</p> <p>So, What should i do to achieve the above result?</p> <p>Thanx in advance.</p>
c# javascript asp.net
[0, 3, 9]
253,338
253,339
Java compiler asking for semicolon
<p>I've looked through this code for awhile, counted brackets, all that stuff. And I can't find an error. I'm using Eclipse, developing for Android, and it's asking for a semicolon (commented, it's near the bottom). </p> <pre><code>package com.example.lesson1; import android.app.Activity; import android.os.Bundle; import android.text.InputType; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.ToggleButton; public class TextPlay extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.text); final Button checkCommand = (Button) findViewById(R.id.bResults); final ToggleButton passToggle = (ToggleButton) findViewById(R.id.tbPassword); final EditText input = (EditText) findViewById(R.id.etCommands); final TextView display = (TextView) findViewById(R.id.tvResults); passToggle.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (passToggle.isChecked()) { input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); } else { input.setInputType(InputType.TYPE_CLASS_TEXT); } } }); checkCommand.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String check = input.getText().toString(); if (check.toLowerCase().equals("boss")) { display.setText("Yup, pretty damn boss!"); } else if (check.toLowerCase().equals("password")) { display.setText("Simple"); } } }); // here is the semicolon it wants } } </code></pre> <p>Screenshot: <a href="https://dl.dropbox.com/u/986549/error.png" rel="nofollow">https://dl.dropbox.com/u/986549/error.png</a></p>
java android
[1, 4]
1,734,769
1,734,770
get value using jquery
<p>i want to get value of h:outputText label using jquery, for</p> <pre><code>&lt;h:outputText id="cal_att_to_date" binding="#{Attendance_Calculation.cal_att_to_date}"&gt; &lt;f:convertDateTime type="date" pattern="dd-MMM-yyyy" timeZone="GMT+5:30"/&gt; &lt;/h:outputText&gt; </code></pre>
java jquery
[1, 5]
3,748,118
3,748,119
Problem in deloyment asp.net
<p>I already published my client's site and i received problem during loading page.</p> <p>here's the error.</p> <pre><code>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. Compiler Error Message: CS1501: No overload for method 'UpdateBookInfo' takes '5' arguments </code></pre> <p>Source Error:</p> <pre><code>Line 33: //Update Book Info Line 34: Book BookProcess = new Book(); Line 35: BookProcess.UpdateBookInfo(SKU, Title, Description, Price, Status); Line 36: Line 37: //Update Book Picture </code></pre>
c# asp.net
[0, 9]
3,314,012
3,314,013
Logging switch realization
<p>This code:</p> <pre><code>public class MyActivity extends Activity { private final boolean logging = getResources().getBoolean(R.bool.logging); @Override public void onCreate(Bundle savedInstanceState) { if(logging) Log.d("my_log", "some text here"); // some onCreate code... } } </code></pre> <p>generates NullPointerException.</p> <p>But this one:</p> <pre><code>public class MyActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { final boolean logging = getResources().getBoolean(R.bool.logging); if(logging) Log.d("my_log", "some text here"); // some onCreate code... } } </code></pre> <p>Does not.</p> <p>The main idea to switch logging in entire application with a boolean resource.</p> <p>I can successfully declare this variable for every function in class, but can it be done for entire class just once?</p>
java android
[1, 4]
269,351
269,352
How to get the textbox value from a hidden field value assigned
<p>I have written the following script to get the value of hidden field to a text box when text box is empty on hitting tab but it did not works so can any one tell what's wrong in this</p> <pre><code>&lt;script type="text/javascript"&gt; function Tab() { var PayDate = document.getElementById('txtDate').value; var hdn1 = document.getElementById('hdn1'); if (PayDate == null) { // Retreive the next field in the tab sequence, and give it the focus. document.getElementById('txtDate').value = hdn1.value; } } &lt;/script&gt; &lt;asp:HiddenField ID="hdn1" runat="server" /&gt; &lt;asp:TextBox ID="txtDate" runat="server" onChange="Tab();"&gt;&lt;/asp:TextBox&gt; &lt;asp:Button ID="btn" runat="server" Text="Button" /&gt; </code></pre> <p>On my page load i write this</p> <pre><code>if (!IsPostBack) { hdn1.Value = "1-2-2001"; } </code></pre> <p>But i am not getting the value of hidden field assigned to text box when i am hitting tab can any one help me</p>
javascript asp.net
[3, 9]
1,989,823
1,989,824
C# equivalent of PrivilegedAction
<p>What is C# equivalent of <a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/security/PrivilegedAction.html" rel="nofollow">PrivilegedAction</a> and <a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/security/PrivilegedExceptionAction.html" rel="nofollow">PrivilegedExceptionAction</a> class of Java?</p>
c# java
[0, 1]
1,574,615
1,574,616
when the page scroll to certain point, how to make a second fixed header appear
<p>I have a page that will be responsive and I also want to add a header that appears once the visitor scrolls for a bit. The header will supplant the main header in order to be visible as the user travels down the page. </p> <p>I think this was a convention that people have used, and I need some help, as i can't really code it from scratch. </p> <p>Has anyone seen examples or tutorials on this. I've looked but can't come up with it. </p>
javascript jquery
[3, 5]
610,478
610,479
Prevent user download Videos from my web site
<p>I make a new web application and I'll display more videos on it, but I need to prevent the users from downloading these videos by the browser or any download program. Is there a way to do this by java script, JQuery, C# or asp.net?</p>
c# javascript asp.net
[0, 3, 9]
4,809,330
4,809,331
Java Protected method in an Interface?
<p>i am trying to create a interface where its methods are protected or only visible to the class that implements it.</p> <p>The issue is this. i have two classes that do more or less the exact same thing but with different parameters and behaviour, but the actual steps it takes is identical.</p> <p>i was thinking ok i have two similar classes so lets just create a interface that both these classes implement. Should be ok right? well it is. it does the job but with a serious flaw, All and i mean all of the methods it overrided in these two classes are now visible to the naked eye.</p> <p>They can be accessed as they are defined "public". there goes encapsulation :(</p> <p>Another solution i thought of was using a abstract class but wait, you can only extend one abstract class and the two classes i am using already extend a class(in my case a android Service class) so out goes that idea too.</p>
java android
[1, 4]
5,794,948
5,794,949
Creating an enum from web.config
<p>I'd like to mimic the behavior of the "profile provider" that is available in .Net. The profile provider acquires profile properties from the <code>web.config</code> and those properties are immediately available as an <code>enum</code> for use in the code behind.</p> <p>I'm unsure how to do this, and wondered whether someone may be able to help.</p> <p>Essentially I'd like to allow developers to enter <code>Role</code> information into the <code>web.config</code>, and then have this role information available for use within an <code>enum</code> in the codebehind.</p> <p>Thanks in advance!</p>
c# asp.net
[0, 9]
2,584,941
2,584,942
ASP.NET:Update sql table row programmatically
<p>I have a data conduit class where I want to create an update method that takes list of parameter names, their values and a stored procedure name. Up on execution, I want to update a particular row in sql db.</p> <p>The code so far in data conduit class is:</p> <pre><code>public class clsDataConduit { SqlConnection Conn= new SqlConnection(); SqlDataReader rdr= null; SqlDataAdapter dataChannel = new SqlDataAdapter(); SqlCommandBuilder commandBuilder = new SqlCommandBuilder(); SqlCommand cmd = null; List&lt;SqlParameter&gt; SQLParams = new List&lt;SqlParameter&gt;(); DataTable queryResults = new DataTable(); DataRow newRecord; public void NewRecord(string SProcName) { //works fine } public void UpdateRecord(string SProcName) { Conn= new SqlConnection(connectionString); //open the database Conn.Open(); //initialise the command builder for this connection SqlCommand dataCommand = new SqlCommand(SProcName, Conn); //add the parameters to the command builder //loop through each parameter for (int Counter = 0; Counter &lt; SQLParams.Count; Counter += 1) { //add it to the command builder dataCommand.Parameters.Add(SQLParams[Counter]); } dataCommand.CommandType = CommandType.StoredProcedure; dataChannel = new SqlDataAdapter(SProcName, Conn); dataChannel.UpdateCommand = dataCommand; commandBuilder = new SqlCommandBuilder(dataChannel); dataChannel.Update(queryResults); /////////////////////////////////////////////////////////// // Method runs fine till above code, BUT I am not too sure // how to write the rest of the code so that It updates a // a particular row in sql /////////////////////////////////////////////////////////// //get the structure of a single record //newRecord = queryResults.NewRow(); //from previous method - new data Conn.Close(); } } </code></pre> <p>I am not too sure how can I continue further from this point. If someone can help me out please.</p> <p>Thanks</p>
c# asp.net
[0, 9]
1,061,561
1,061,562
Asp.net Source Code Compare Software
<p>I want to compare two asp.net sources and find different could you introduce me a software inside or outside of visual studio ? </p>
c# asp.net
[0, 9]
4,081,258
4,081,259
How to modify the width of the GridView?
<p>I am using a GridView inside a Repeater control to generate three GridViews with 3 similar columns and different number of different columns between them. Everything works fine and well. I am just facing one probelm with the width of GridView. The porblem is the following:</p> <p>The second GridView has many columns and this is why its width goes outside the border of the page and this is also happened with the third gridview. I solved this prblem by making the headers of each column to be displayed virtcally but the customer did not like it. Then, I tried to minimize the size of font and I reached to 7px and they said its too small. Now, I wondered what the solution to this problem. Any help please?</p> <p>By the way, I don't have a problem to use the scroller from left to right, but if I can set the first four columns to be fixed. I don't know how to do that, too:). So how to do it if it is this the only solution to this problem</p> <p>See the image below that shows the first GridView and the second one: <img src="http://i.stack.imgur.com/Okz1N.png" alt="enter image description here"></p>
c# asp.net
[0, 9]
4,096,333
4,096,334
resize image in div tag when broser resize
<pre><code>&lt;div id="banner"&gt; &lt;script type="text/javascript" src="gallery/js/jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="gallery/js/swfobject.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="gallery/js/flashgallery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; jQuery.flashgallery('gallery/gallery.swf', 'gallery/config.xml',{ width:'100%', height:'100%', background: 'transparent'}); &lt;/script&gt; &lt;/div&gt; </code></pre> <p>can some body help me to resize image in div tag it is displayed using jqurery.flassgallery from last one day i am trying for this plz if any body gives me mail i will mail the code</p>
php javascript jquery
[2, 3, 5]
4,417,474
4,417,475
document.referrer encoding issue
<p>referrer` and saving the value in a cookie. The result is coming like this with strange characters: </p> <pre><code>http%3A//www.rzammit.com/props/testpage.asp%3Fadv%3D123%26loc%3D45 </code></pre> <p>How I can remove those strange characters so the link will show correctly please?</p> <p>thanks</p>
javascript jquery
[3, 5]
5,848,100
5,848,101
Check if button is active
<p>I'm really struggling with this piece of code.</p> <p><em>What I'm trying to achieve: I have an "edit button". If I press it, it'll go active and edit mode goes active. I can edit the list on the fly and it updates automatically.</em></p> <p><strong>Problem: I can get it to work for 50%. If I try to activate the button I can edit the objects. But when I deactivate the button again I can still edit the objects. Of course that shouldn't be possible.</strong></p> <p>Here some messy code. Yeah most of it is found online and I'm trying to edit it myself... </p> <pre class="lang-js prettyprint-override"><code>$("#editButton").click(function() { $("#editButton").toggleClass("active"); if ($("#editButton").hasClass("active")) { $(".moveLi").on("click", function() { var ID = $(this).attr('id'); $("#move_"+ID).hide(); $("#move_edit_"+ID).show(); }).change(function() { var ID = $(this).attr('id'); var first = $("#move_edit_"+ID).val(); var dataString = 'id=' + ID + '&amp;name=' + first; $("#move_"+ID).html('&lt;p&gt;Saving...&lt;/p&gt;'); // Loading image if (first.length &gt; 0) { $.ajax({ type: "POST", url: "table_edit_ajax.php", data: dataString, cache: false, success: function(html) { $("#move_"+ID).html(first); } }); } else { alert('Enter something.'); } }); $(".editbox").mouseup(function() { return false }); $(document).mouseup(function() { $(".editbox").hide(); $(".text").show(); }); } }); </code></pre> <p>Thanks in advance!</p>
javascript jquery
[3, 5]
3,685,823
3,685,824
Finding an div in JQuery
<p>this is what i am working on this is a rough design and now sure it will come when i post it.</p> <pre><code>-------------------------------------------------------------------- first name goes here..... --------------------------------------------------------------------- datetime buttons --------------------------------------------------------------------- </code></pre> <p>the below code works if using with <code>tr</code> but now i am using the <code>divs</code> what exaclty do i need to put, <code>div id</code>?</p> <pre><code> &lt;script type="text/javascript"&gt; function OnSave(obj) { debugger // Find the row this button is in var tr = $(obj).closest("tr"); // Get the value from the edit control var firstNameEdit = tr.find("[id*='firstNameEdit']").val(); // assign value to hidden input tr.find("[id*='firstNameHidden']").val(firstNameEdit); var lastNameEdit = tr.find("[id*='lastNameEdit']").val(); tr.find("[id*='lastNameHidden']").val(lastNameEdit); } &lt;/script&gt; </code></pre> <p>here is my new html code with div:</p> <pre><code>&lt;div class='columns'&gt; &lt;div class='subj'&gt; &lt;div id="container"&gt; &lt;asp:PlaceHolder runat="server" ID="firstNameEditPlaceholder" /&gt; &lt;input type="hidden" runat="server" id="firstNameHidden" visible="false" /&gt; &lt;br /&gt; &lt;br /&gt; &lt;div id="left"&gt;&lt;/div&gt; &lt;!-- left --&gt; &lt;div id="right"&gt;&lt;/div&gt; &lt;!-- right --&gt; &lt;div class="clear"&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- container --&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
jquery asp.net
[5, 9]
392,269
392,270
Not including whitespace when detecting text width with `<span>` trick
<p>I have implemented a jQuery pluggin to correct the width of <code>&lt;input/&gt;</code> elements depending on how much text they have, as shown:</p> <pre><code>$.fn.correctWidth = function () { var tempSpan = $('&lt;span&gt;') .html(this.val()) .css('font-size', this.css('font-size')) .insertBefore(this); this.width(tempSpan.width()); tempSpan.remove(); return this; }; </code></pre> <p>The problem is that, sometimes, the <code>&lt;span&gt;</code> element's width is much larger than the actual text width.</p> <p>It seems that this occasional problem is because the detected width includes the whitespace between the end of the text and the end of the line.</p> <p>How can I make sure that the whitespace is not included? Is there an alternative approach?</p>
javascript jquery
[3, 5]
101,137
101,138
Toggle and fadeIn
<p>Hello everyone this is the first time I write on this site. Let me explain my problem right away.</p> <p>I have this code:</p> <pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).scroll(function() { $('#menu-fixed').toggle($(this).scrollTop() &gt; 100 ); }); &lt;/script&gt; </code></pre> <p>to show a menu when you shake 100px</p> <p>I would like to add a "fadeIn" effect but I'm not able to write javascript.</p>
javascript jquery
[3, 5]
757,523
757,524
migrating to C# from Java
<p>I saw a thread similar to this, but the reason I'm asking this is because my situation is different.</p> <p>I've been a tester (automated and manual) but I have a good Java programming knowledge although I haven't worked as a programmer.</p> <p>My company is considering to move me to a C# programming role. Will it be hard for me to learn C# without any prior experience in programming?</p> <p>Thanks</p>
c# java
[0, 1]
2,292,509
2,292,510
Resolve an IFrame serverside
<p>Is it possible to resolve an Iframe server side and then display the page as the server would see it?</p> <p>I have a company intranet and an extranet, and as part of some upcoming work, a page that is on the intranet needs to be made accessible externally through the extranet portal.</p> <p>This internal page is quite complex and is subject to change, so this isn't something that i want to duplicate for the purpose of making it available.</p> <p>i did search for answers online, but im fairly new to Asp.net, so i'm unsure how to word this to get good results.</p> <p>Any other, better, suggestions are welcome.</p> <p>Thanks</p>
c# asp.net
[0, 9]
5,087,125
5,087,126
How to enable a button in aspx when a user types into a textbox
<p>In an aspx page i need to do a validation where i need to enable a button when user types into a particular textbox</p>
javascript asp.net
[3, 9]
4,811,388
4,811,389
learning getjson
<p>I'm trying to get a grasp on using <code>$.getJSON</code> with an array from PHP. </p> <p>Here's a simple example where all I want to do is output the requested info. Should the <code>alert(data)</code> return the array object? I am not alerting anything.</p> <p>PHP file (account.php):</p> <pre><code>$arr = array('items' =&gt; 5,'others' =&gt; 6); echo $arr = json_encode($arr) </code></pre> <p>HTML file:</p> <pre><code>$("#unsubscribe").click(function() { $.getJSON("account.php?", function(data) { alert(data); }); }); </code></pre>
php jquery
[2, 5]
3,225,612
3,225,613
Updating database from an EditText
<p>I have a text field in SQLite database, which I want the user to be able to update.</p> <p>So I extract and display the text in an EditText view. The user edits it and presses "Update" button. At this point I want to update the text field in database with whatever user has in the EditText.</p> <p>Here's the problem, EditText returns the type <strong>Editable</strong>.<br> And the <em>put(String key, String value)</em> function of ContentValues, that I use while updating the record, expects a <strong>String</strong>. So how to put an Editable in a String?</p> <p>I tried upcasting the Editable to CharSequence and then casting that to String, but that gives me a runtime exception, ClassCastException, which it very well should (because the object was an Editable to begin with, I cannot make it a String).</p> <p>So how to get around this? Here's the code I am using. I know it is wrong, but I cannot figure out how to do this.</p> <pre><code>@Override public void onClick(View v) { // update logic CharSequence strNewName = editTextName.getText(); //Update record in the table ContentValues newRecord = new ContentValues(); newRecord.put(GIDatabase.Students.NAME, (String strNewName); //ClassCastException here int rowsEffected = db.update(GIDatabase.Students.STUDENTS_TABLE_NAME, newRecord, GIDatabase.Students._ID + "=?", new String[]{strId}); if (rowsEffected != 1) { // This should never be reached throw new RuntimeException("Error updating name"); } </code></pre> <p>}</p>
java android
[1, 4]
2,639,275
2,639,276
Developing Android outside of the SDK
<p>It seems as if every Android application I really want to make is impossible to make with the current SDK. It doesn't give me access to certain things I would like to work with. <a href="http://stackoverflow.com/questions/3571814/accessing-the-android-media-stream-for-audio-visualization">This</a> is an example of one of these things.</p> <p>I know it is possible since I've seen apps in the market that do things that the SDK cannot do. My basic question is can someone point me in the direction of how to create such an application. I've searched around, but all of the links I've found are for developing with the SDK. A simple link to a tutorial that can show me how to access Android elements that aren't available through the SDK would be great.</p> <p>Thanks.</p>
java android
[1, 4]
5,390,463
5,390,464
Render C# class as javascript
<p>I'm looking for a way to render a C# class object to javascript. For instance this class definition:</p> <pre><code>public class Foo { public string Bar1 { get; set; } public string Bar2 { get; set; } } </code></pre> <p>should render (an object of class Foo with values filled) as:</p> <pre><code>foo: { bar1: 'bar1value', bar2: 'bar2value' } </code></pre> <p>I know my way around reflection, but before reinventing the wheel all over again I was wondering if there are any libraries already doing these kind of things.</p>
c# javascript
[0, 3]
3,256,844
3,256,845
Whats wrong with this syntax?
<p>Hi im getting an error for this line </p> <pre><code>sound.setOnTouchListener(new OnTouchListener() { </code></pre> <p>says:</p> <pre><code>Multiple markers at this line - Syntax error, insert "}" to complete ClassBody - Syntax error, insert ";" to complete Statement - Syntax error, insert ")" to complete Expression </code></pre> <p>heres full code:</p> <pre><code>package android.app; import android.app.R; import android.app.Activity; import android.content.Intent; import android.media.MediaPlayer; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class activity2 extends Activity{ MediaPlayer mp = null; /** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main2); //back button that takes u to main.xml Button next = (Button) findViewById(R.id.Back); next.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Intent intent = new Intent(); setResult(RESULT_OK, intent); finish(); } } ); mp = MediaPlayer.create(activity2.this, R.raw.whippingsound); //Button that plays sound (whippingsound) Button sound = (Button) findViewById(R.id.sound); sound.setOnTouchListener(new OnTouchListener() { } public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: mp.setLooping(true); mp.start(); break; case MotionEvent.ACTION_UP: mp.pause(); break; } return true; } } </code></pre>
java android
[1, 4]
2,521,964
2,521,965
How to putExtra() in Searchable Dictionary Example
<p>based on the <a href="http://developer.android.com/resources/samples/SearchableDictionary/index.html" rel="nofollow">Searchable Dictionary</a> sample I tried to put extra data to a different activity. </p> <pre><code> public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Spinner distance = (Spinner) findViewById(R.id.distanceSpinner); ArrayAdapter&lt;CharSequence&gt; adapterDistance = ArrayAdapter.createFromResource( this, R.array.distance, android.R.layout.simple_spinner_item); adapterDistance.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); distance.setAdapter(adapterDistance); Intent intent = getIntent(); if (Intent.ACTION_VIEW.equals(intent.getAction())) { // handles a click on a search suggestion; launches activity to show word mapIntent = new Intent(this, Map.class); mapIntent.setData(intent.getData()); mapIntent.putExtra("Distance", distance.getSelectedItemPosition()); startActivity(mapIntent); finish(); } } </code></pre> <p>In my Map Class Distance is always zero because distance.getSelectedItemPostion() gets the initialized value. How can I putExtra data with a click on a search suggestion? Thanks</p>
java android
[1, 4]
2,720,183
2,720,184
jquery get not passing values
<p>My html form: </p> <pre><code>&lt;input id="captcha_response" name="captcha_response" type="text" value="" size="5" maxlength="5"&gt; &lt;div class="new_comment"&gt;&lt;input id="comment" name="comment" type="text" value="your comment here..."&gt;&lt;/div&gt; &lt;div class="author"&gt;&lt;input name="name" type="text" value="your name"&gt;&lt;/div&gt; &lt;div class="email"&gt;&lt;input name="email" type="text" value="email"&gt;&lt;/div&gt; </code></pre> <p>My jquery:</p> <pre><code>$.ajax({ type: "GET", url: "ajax/check_captcha.php", data: ({ captcha : captcha , comment:comment , name:name, email:email }), dataType: "json", success: function(data) { </code></pre> <p>This is returning a 'not enough arguments' error in firebug.</p> <p>It was working with just the 'captcha' value being passed but no longer.</p> <p>Email seems to be the value that is not being passed on.</p>
php jquery
[2, 5]
3,103,641
3,103,642
I want to validate when time selected from drop down list is past current time
<p>I'm new to java script. I want to validate wether the time selected from drop down list is past the current time. </p> <p>For example:<br> The user selects <code>2:00pm</code> while the current time is <code>1:00pm</code>, now the following error should popup:</p> <blockquote> <p>The time you have selected is before the current time.</p> </blockquote> <p>How can I do this? Below is my drop down list.</p> <pre><code>&lt;?php $start = strtotime('12:00am'); $end = strtotime('11:30pm'); echo '&lt;select name="time"&gt;'; for ($i = $start; $i &lt;= $end; $i += 1800) { echo '&lt;option&gt;' . date('g:i a', $i); } echo '&lt;/select&gt;'; ?&gt; </code></pre> <p>I have tried the following however I could not make this working. </p> <pre><code> &lt;script type="text/javascript" language=JavaScript&gt; function validate_time(elmnt) { var date_in = new date(elmnt); var date_now = new date(); //returns current date by default; if( date_in&lt;date_now ){ alert('The time you have selected is before the current time.'); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div align="left"&gt; &lt;?php $start = strtotime('12:00am'); $end = strtotime('11:30pm'); echo '&lt;select name="time"&gt;'; for ($i = $start; $i &lt;= $end; $i += 1800) { echo '&lt;option&gt;' . date('g:i a', $i); } echo '&lt;select name=time onchange="OnChange(this.form.select)"&gt;'; echo '&lt;/select&gt;'; ?&gt; </code></pre>
php javascript
[2, 3]
4,833,109
4,833,110
JQuery method execution order?
<p>I am trying to use the below to load data from a specific <code>&lt;div&gt;</code> from a page that contains <code>&lt;ul&gt;&lt;li&gt;</code> structure into a <code>&lt;div&gt;</code> on this page. What is currently happening is that it "seems" to try and load the menu before the data is there. I say this because my menu pops up on the page first with a <code>NULL</code>, which is the default, and THEN the list I was expecting gets populated into <code>&lt;div id="hierarchy"&gt;</code> under my empty Fly Out Menu. </p> <p>I am new to <strong>JQuery</strong> so hopefully this is a simple, ignorant, mistake.</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ $('div.ms-quickLaunch').replaceWith('&lt;div id="hierarchy" style="border:solid 1px white; width:0px;"&gt;&lt;/div&gt;'); }); $(function(){ $('#hierarchy').load('http://wwcshare/icenter/Pages/wwcMenuContent.aspx #menuContent'); // grab content from another page $('#hierarchy').menu({ autoShow: true, content: $('#hierarchy').next().html(), backLink: false, crumbDefaultText: ' ' }); }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
238,188
238,189
Browsing and upload file in ASP.net / Jquery / Javascript
<p>From the Page, user can browse and select a folder on their local drive. after selection it populate list of file names in listbox.</p> <p>Then I will use these file paths randomly to upload to server.</p> <p>Is this possible?</p> <p>I am asking because what i know due to security browser prevent to access client files.</p>
javascript jquery asp.net
[3, 5, 9]
887,569
887,570
Getting the value of a text or checkbox with jQuery and putting it into a variable
<p>I have the following code:</p> <pre><code>$("input[id^='Order_'], input[id^='Default_']") .change(function (e) { var type = $(this).attr('id').split('_')[0]; updateField('Menu', $(this), type); }); The input with an id of 'Order_' has a type="text" The input with an id of 'Default_' has a type="checkbox" </code></pre> <p>In my updateField I have a problem:</p> <pre><code>function updateField(entity, obj, type) { var val = obj.val(); var idArr = obj.attr("id"); var idTmp = idArr.split("_"); var id = idTmp[1]; var pkrk = $("span[id='refKey_" + id + "']").html(); </code></pre> <p>The problem is that the code works good for the text but not for the checkbox. If the checkbox is checked or not then it still returns true. Is there a way that I can get the value of if the checkbox is checked or not and either put the string "true" or "false" into the variable val while still having the correct value put into val if the date is coming from the Order_ ?</p> <pre><code>So if the value of Order_ field is 25 then val = "25" So if the value of Default_ checkbox is true the val = "true" So if the value of Default_ checkbox is false the val = "false" </code></pre>
javascript jquery
[3, 5]
1,131,315
1,131,316
Call a Class file inside App_code folder using usercontrol page?
<p>I want to to call a class inside <code>App_code folder</code> using <code>Usercontrol</code> page how to do it?</p> <pre><code>namespace Project.Folder { public partial class DefaultMenu2 : System.Web.UI.UserControl { public void Page_Load(object sender, EventArgs e) { Util.Function();/*this is what i wan to call but cannot call it in my project */ } } } </code></pre>
c# asp.net
[0, 9]
2,076,526
2,076,527
form jquery prevent default
<p>I want to prevent the form from submitting, but execute other form handlers, preventDefault stops all.</p> <p>here's an example:</p> <pre><code>&lt;form id="example"&gt; &lt;input type="text" name="name" /&gt; &lt;/form&gt; &lt;form id="example2"&gt; &lt;input type="text" name="name2" /&gt; &lt;/form&gt; /* generic form handling */ $('form').submit(function(e) { alert('hello'); }); /* specific example i want this handler to prevent the form from submitting normally, but at the same time, i want it to execute the above code with the alert "hello" */ $('form#example').submit(function(e) { e.preventDefault(); // this stops the generic form handling (above) and standard form submission }); </code></pre>
javascript jquery
[3, 5]
4,951,887
4,951,888
call server function in server tag
<p>can i call my function inside my server tag? </p> <pre><code>public string Mytext() { } </code></pre> <p>And </p> <pre><code>&lt;asp:Label ID="lbl" runat="server" Text="Mytext()"&gt;&lt;asp:Label&gt; </code></pre>
c# asp.net
[0, 9]
2,153,782
2,153,783
Smooth scroll to top of page after an asp.net ajax postback
<p>I have an error message area at the top of a long page. After an ajax postback in asp.net (using an update panel), sometimes I need to display an error message and it will be displayed outisde the viewport and the user might not notice it. </p> <p>I would like the return (same) page to scroll smoothly to the top of the page, rather than a sudden jump. It's a better user experience in my opinion.</p> <p>I am looking for c# + Javascript code to do this effect or at least the JS smooth scrolling effect.</p>
asp.net javascript
[9, 3]
2,109,563
2,109,564
how to access the checkbox.click inside a list of panels using jquery
<p>I have this hierarchy, a tabcontainer(tcmain) under that a tabpanel(tpnlRaiseMRF) under that an asp panel(RaiseMRF) under that a checkbox(cbxRecNote). I want to add this function on click. I am adding like this : </p> <blockquote> <p>$(document).ready(function () { $("#pnlRecNote").hide(); $("#cbxRecNote").click(function () { $("#pnlRecNote").slideToggle(); }); });</p> </blockquote> <p>the pnlRecNote is directly under form, so its hiding. The cbxRecNote click is not getting fired(above code). but its not working, please help me. I am very new to jquery. Thanks in advance.</p>
jquery asp.net
[5, 9]
4,899,840
4,899,841
only one radio buttons
<p>I have read in an example that if you use more than one radio button you should use <code>RadioGroup</code> like this:</p> <pre><code>&lt;RadioGroup android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"&gt; &lt;RadioButton android:id="@+id/radio_pirates" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="14dp" android:layout_marginLeft="100dp" android:onClick="onRadioButtonClicked" android:text="@string/attendance" android:textSize="8dp" /&gt; &lt;RadioButton android:id="@+id/radio_pirates2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="14dp" android:layout_marginLeft="100dp" android:onClick="onRadioButtonClicked" android:text="@string/attendance" android:textSize="8dp" /&gt; &lt;/RadioGroup&gt; </code></pre> <p>If I have only one radio button, can I remove <code>&lt;RadioGroup&gt;</code> or that is wrong ?</p>
java android
[1, 4]
4,507,127
4,507,128
QueryString for redirection!
<p>I have used a query string parameter to redirect from Page 1 to Page 2. From Page 2, i wanted to redirect it to Page 3 if Page 2 has been called from Page 1. What should be the condition to check if the querystring is used?? Please help me out!! Thanks guys!</p>
c# asp.net
[0, 9]
5,244,434
5,244,435
Jquery - Too Much recursion
<p>Getting this error with jquery &amp; jquery.form. Site has been live for awhile..upgraded to latest version of jquery &amp; jquery form and still having same issue. </p> <p>This is the error in firebug</p> <p>too much recursion [Break on this error] (function(){var l=this,g,y=l.jQuery,p=l....each(function(){o.dequeue(this,E)})}});\n</p> <p>And in IE8 it's a popup error that says "Stack Overflow: Line 12"</p> <p>Here's the url to the website. Any idea what part of our jquery code could be causing this? </p> <p><a href="http://www.caromalcolours.com/" rel="nofollow">http://www.caromalcolours.com/</a></p> <p>thanks</p>
php jquery
[2, 5]
842,199
842,200
why the javascript variable doesn't change among function?
<p>my problem with the following javascript function:</p> <pre><code>function ValidateDates() { var valid = false; birthD = $("#cp1_txtBirthDate").val(); initialD = $("#cp1_txtInitialDate").val(); var regexp = new RegExp("^([1-9]|(0|1|2)[0-9]|30)(/)([1-9]|1[0-2]|0[1-9])(/)((20|19|18)[0-9]{2})$"); if (birthD != "__/__/____" &amp;&amp; initialD != "__/__/____") { if (regexp.test(initialD) &amp;&amp; regexp.test(birthD)) { $.get("ValidateDates.aspx?BirthD=" + birthD + "&amp;InitialD=" + initialD, function (data) { if (data == 0) { valid = true; $("#Dates_span").html(""); } else { $("#Dates_span").html("*" + data); valid = false; } }); } } return valid; } </code></pre> <p>here when i check the variable valid i found it "false" even if its true, because the initial for it is false from the beginning of function so how to solve it and what is wrong?</p>
javascript jquery
[3, 5]
2,985,671
2,985,672
Android - visible and invisible buttons
<p>I am trying to get a button to become visible if there is one or more objects in an array, otherwise it will stay invisible.</p> <p>I am used:</p> <pre><code>if (positionOverlay.geoPointsArrayList.size() &lt;= 0){ buttonClear.setVisibility(View.GONE); System.out.println("Clear button hidden"); } else if (positionOverlay.geoPointsArrayList.size() &gt;= 1) { buttonClear.setVisibility(View.VISIBLE); System.out.println("Clear button visible"); } </code></pre> <p>The problem I am having is that it runs and on start up the array i am using is empty, so the button stays invisible, however when I add objects to the array it still stays invisible, suggesting that it doesnt run the code again.</p> <p>I have placed the code above in the onCreate, could anyone tell me where i have gone wrong?</p>
java android
[1, 4]
1,568,180
1,568,181
Simple Event example
<p>i only know basic javascript and not even basic jquery, but i would like to know something that is probably really trivial in jquery.</p> <p>I would like a very simple example of how to create a function in a js file and execute that with a dom class parameter(like .sample) from my main script. Something like :</p> <pre><code>$('.sample').execute(200); </code></pre> <p>How would you go about writing this type of function in the jquery js file ? Simply put, i want an example to better understand how $() is used with jquery methods and how .sample is passed as a parameter to execute() and how it's used in it.</p>
javascript jquery
[3, 5]
838,600
838,601
Use OR `||` between two string
<p>I want use or between two string as <code>or</code>, but it don't work for me, What do i do?</p> <p><strong>DEMO:</strong> <a href="http://jsfiddle.net/NP8E3/" rel="nofollow">http://jsfiddle.net/NP8E3/</a></p> <pre><code>&lt;input type="checkbox" id="DA"&gt; &lt;input type="checkbox" id="DE"&gt; $('#DA'+ OR +'#DE').live('click', function () { alert('ok'); })​ </code></pre>
javascript jquery
[3, 5]
1,417,534
1,417,535
Converting a byte swapping/shifting code snippet from C++ to .NET
<p>I have a short code snippet in C++ and I need to have the same functionality in C#:</p> <pre><code>typedef enum {eD=0x0, eV=0x1, eVO=0x2, eVC=0x3} eIM; #define htonl(x) ( ( ( ( x ) &amp; 0x000000ff ) &lt;&lt; 24 ) | \ ( ( ( x ) &amp; 0x0000ff00 ) &lt;&lt; 8 ) | \ ( ( ( x ) &amp; 0x00ff0000 ) &gt;&gt; 8 ) | \ ( ( ( x ) &amp; 0xff000000 ) &gt;&gt; 24 ) ) int value = htonl(eV); </code></pre> <p>Unfortunately I'm no big programmer, so I need some help. </p>
c# c++
[0, 6]
4,842,543
4,842,544
loop over the PHP data Returned to jquery AJAX Call
<p>below is my $.ajax call to php</p> <pre><code>$(document).ready(function() { $('ul.sub_menu a').click(function(e) { e.preventDefault(); var txt = $(this).attr('href'); $.ajax({ type: "POST", url: "thegamer.php", data:{send_txt: txt}, success: function(data){ $('#container').fadeOut('8000', function (){ $('#container').html(data); $('#container').fadeIn('8000'); }); } }); }); }); </code></pre> <p>my php code</p> <pre><code> if(mysql_num_rows($result) &gt; 0){ //Fetch rows while($row = mysql_fetch_array($result)){ echo $row['img']; } } </code></pre> <p>I m getting this output </p> <pre><code>images/man/caps/army-black.pngimages/man/caps/army-brown.pngimages/man/caps/army-grey.pngimages/man/caps/army-lthr.pngimages </code></pre> <p>these are basically image paths now how to loop over them in jquery and fit each image in image tag </p> <p>any code will be useful</p> <p>Plz Note I DONT NEED JSON</p> <p>regards sajid</p>
php jquery
[2, 5]
2,924,229
2,924,230
Parsing an Input value using Split
<pre><code>&lt;input type="text" id="personName" /&gt; </code></pre> <p>Given possible values like:</p> <ul> <li>James</li> <li>James Bond</li> <li>James Van Bond</li> <li>James Van Bond the Very First</li> </ul> <p>I want to learn how to split the value by space, and then obtain the first value as FirstName and all the remaining values as Last name.</p> <p>Possible? Is split the way to do this?</p> <p>Thanks</p>
javascript jquery
[3, 5]
2,558,323
2,558,324
Web Application Class Design Advice?
<p>My web application is going to consist of some people information. Basically in my database I will have fields such as </p> <pre><code>personid autoid clubid personalinfoid fname carmodel clubname personid mname cartype clubaddress height lname carcolor ethnicity address license# driverslicense# address2 boattype homephone boatsize cellphone </code></pre> <p>I am not worried about the table design just did this for an example. </p> <p>Edited my question to try to make it more clear. How would you approach designing classes for a web application of this nature. Should I have separate classes for each table? </p> <p>What I had in mind was to create a properties class that holds all the fields and properties gets and sets everything from the db. Then creating a person.cs, auto.cs, personinfo.cs, and clubs.cs classes would this be the right way to do this?</p> <p>Thanks</p>
c# asp.net
[0, 9]
5,898,086
5,898,087
Visibility.js - How to usefall back?
<p>I have looked for a solution on How to check active tab in javascript/jquery and I found this post.</p> <p><a href="http://stackoverflow.com/questions/12489986/how-to-check-active-tab-in-javascript-jsquery">How to check active tab in javascript/jsquery?</a></p> <p>I tried using the plugin at <a href="https://github.com/ai/visibility.js" rel="nofollow">https://github.com/ai/visibility.js</a> and it works!</p> <p>I am currently availing of the CDN minified version for my pages.</p> <p>However some things is bugging me. Is the fallback plugin included in the minified version? Do I need to do something to use the fallback? Or does it work behind the scenes?</p> <p>EDIT: This is the paragraph that confused me.</p> <blockquote> <p>In most cases you don’t need to check whether the Page Visibility API is actually supported in the browser as, if it does not, the library will just assume that the page is visible all the time, and your logic will still work correctly, albeit less effective in some cases.</p> </blockquote> <p>So it is saying that we don't need to check but if it is not supported, just assume that the page is visible all the time? How is that a fallback?</p>
javascript jquery
[3, 5]
749,931
749,932
jQuery to open independently content of each button with the same class
<p>I don't think my question is difficult but I'm just a newbie in jQuery and this forum so hope that you can help me with this problem. I just want to open seperately the content of two divs by two button with the same class name and for easier to understand I will show my code snippet first:</p> <pre><code>&lt;div id="CNN"&gt; &lt;div id="article1"&gt; &lt;div class="content"&gt; My content of CNN goes here &lt;/div&gt; &lt;div class="more"&gt; My button goes here &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="Bloomberg"&gt; &lt;div id="article1"&gt; &lt;div class="content"&gt; My content of bloomberg goes here &lt;/div&gt; &lt;div class="more"&gt; My button goes here &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>And here is my current jQuery code which is not working:</p> <pre><code>$(document).ready(function() { $("div.more").each(function() { $(this).click(function() { var target = $(this).parent().next(".content"); $(target).slideDown("slow"); }); }); }); </code></pre> <p>Here I want to click more button and it will show only the content belongs to it. You are free not to follow my current code :). So that's all of my question, hope you all can help me to improve my programming skill and thanks you so much in advanced! </p>
javascript jquery
[3, 5]
3,128,437
3,128,438
Need to render a div per letter typed
<p>I need to be able to render a div per the letter typed in a input field in real time (maybe with a delay?</p> <p>Example if some one types: "House" in the input field</p> <p>i need something like this to be displayed</p> <pre><code>&lt;div id="h"&gt;&lt;/div&gt; &lt;div id="o"&gt;&lt;/div&gt; &lt;div id="u"&gt;&lt;/div&gt; &lt;div id="s"&gt;&lt;/div&gt; &lt;div id="e"&gt;&lt;/div&gt; </code></pre> <p>also as they type/delete the divs update</p> <p>Seems simple but im still learning...</p> <p>EDIT: the divs will be on the page just hidden, as the person types the letters should be shown and when a letter if a letter is deleted, the div should be back hidden.</p>
javascript jquery
[3, 5]
2,284,591
2,284,592
How to intercept HTTP requests made by a 3rd party library on Android?
<p>For my project I have to use a 3rd party Java library which makes some HTTP requests to a well known server. I need to add my own header to those requests and wonder how I can realize it?</p> <p>An HttpRequestInterceptor seems to be the answer, but how can I 'register' this one globally, so that the 3rd party library would use it? Is it perhaps possible using reflection?</p> <p>I do not want to use a proxy app. Just my application should intercept and modify the HTTP requests of that 3rd party library.</p> <p>Thanks for your help, Michael</p>
java android
[1, 4]
4,468,609
4,468,610
Sort int (not Integer) array with custom ordering rules
<p>I need to sort about 100000 ints with custom ordering rules. If I use Comparator, I need to have an array Integer instances, which is slower to create, slower to sort and takes more memory.</p> <p>Quick benchmark on Galaxy Nexus with Android 4.2:</p> <pre><code>createIntArrayAndFillWith1to100000; // 18 ms createIntegerArrayAndFillWith1to100000; // 191 ms (using Integer.valueOf(i)) Arrays.sort(randomInts); // 354 ms Arrays.sort(randomIntegers, simpleComparator); // 1734 ms </code></pre> <p>Is implementing custom sort my best option?</p>
java android
[1, 4]
2,039,301
2,039,302
Cancel step if validation fails in asp.net wizard
<p>I am using asp.net wizard in my project which is new to me. I have validations in one of the steps in my wizard. If the validation fails i should not allow the user to go to next step. And i am using a asp.net button which navigate between the steps in wizard. I would really appreciate if anyone could help me.</p>
c# asp.net
[0, 9]
5,255,593
5,255,594
jQuery .slideUp() effect running issue
<p>Can anybody tell me why the Effect is running so often is hovered. I mean you hover 3 times without to wait that the Effect is finished and than you can wait until the Effect has run 3 times. </p> <pre><code> $(function() { $('#dropdown_nav li').find('.sub_nav').hide(); $('#dropdown_nav li').hover(function() { $(this).find('.sub_nav').slideDown(300); }, function() { $(this).find('.sub_nav').delay(2000).slideUp(300); }); }); </code></pre> <p>Here can it be tested: <a href="http://jsfiddle.net/QTGvJ/" rel="nofollow">http://jsfiddle.net/QTGvJ/</a></p>
javascript jquery
[3, 5]
4,019,166
4,019,167
How to get the visible dimensions of a scrollable div?
<p>I am trying to get the visible height of a div and I can't find the way to do it. <a href="http://jsfiddle.net/MVupa/1/" rel="nofollow">http://jsfiddle.net/MVupa/1/</a></p> <p>Even the library fracs: <a href="http://larsjung.de/fracs/" rel="nofollow">http://larsjung.de/fracs/</a></p> <p>Does not seem to give me the right number: <a href="http://jsfiddle.net/MVupa/2/" rel="nofollow">http://jsfiddle.net/MVupa/2/</a></p> <p>Any ideas? </p> <p>(End goal is to adjust an element max-height dynamically, depending on the window height.)</p>
javascript jquery
[3, 5]
3,574,343
3,574,344
What should I get the height() of to make list fill the screen?
<p>IT WAS THE DEFAULT MARGIN ON THE <code>&lt;UL&gt;</code>!! SORRY I've got a list of anywhere between 5 and 20 items and I want to make the whole list fill the height of the screen. So I'm finding the height of <code>&lt;html&gt;</code> and dividing it by the number of <code>&lt;li&gt;</code>s and setting this number as the height of each <code>&lt;li&gt;</code>. The problem is there is this roughly 20px white space at the bottom that comes up after the list. I think I need to find the height of the window or body or something instead. Here is some of my code:</p> <pre><code>var numRootOptions = $('.wrapper &gt; ul &gt; li').size(); var htmlHeight = $('html').height(); var newliHeight = htmlHeight / numRootOptions; $('.wrapper &gt; ul &gt; li').css('height', newliHeight); setInterval(function() { var htmlHeight = $('html').height(); var numRootOptions = $('.wrapper &gt; ul &gt; li').size(); var newLiHeight = htmlHeight / numRootOptions; var liHeight = $('.wrapper &gt; ul &gt; li').height(); if (liHeight != newliHeight) { console.log('Different'); } }, 2000); </code></pre>
javascript jquery
[3, 5]
54,780
54,781
Parsing date string in Java of format [2012-07-15T20:55:33+00:00]
<p>Im trying to parse a String thats a date "2012-07-15T20:55:33+00:00", however I keep getting illegal argument exception. I don't know what I'm doing wrong.</p> <pre><code>SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-ddzHH:mm:SS+00:00"); String date = "2012-07-15T20:55:33+00:00"; Log.e("res",sdf.format(date)); </code></pre> <p>Throws</p> <pre><code> 07-15 12:37:28.436: E/AndroidRuntime(20985): FATAL EXCEPTION: main 07-15 12:37:28.436: E/AndroidRuntime(20985): java.lang.IllegalArgumentException 07-15 12:37:28.436: E/AndroidRuntime(20985): at java.text.DateFormat.format(DateFormat.java:365) 07-15 12:37:28.436: E/AndroidRuntime(20985): at java.text.Format.format(Format.java:93) </code></pre>
java android
[1, 4]
1,882,587
1,882,588
Getting user input with CONFIRM
<p>i need to get the user to click OK or CANCEL:</p> <pre><code>protected void Button1_Click(object sender, EventArgs e) { CallRecursive(TreeView1); string confirmationMessage; confirmationMessage = @"Please review the data before submitting:" + "\r\n" + "Sample Received Date: " + received_dateTextbox.Text + "\r\n" + "Site of Ocurrence: " + site_of_occurrenceTextBox.Text + "\r\n" + "Occurrence Date: " + occurrence_dateTextBox.Text + "\r\n" + "Report Date: " + report_byTextBox.Text + "\r\n" + "Specimen ID: " + spec_idTextBox.Text + "\r\n" + "Batch ID: " + batch_idTextBox.Text + "\r\n" + "Report Initiated By: " + report_byTextBox.Text + "\r\n" + "Problem Identified By: " + RadioButtonList1.SelectedValue + "\r\n" + nodetexts; HiddenFieldConfirmation.Value = confirmationMessage; ************i need function ConfirmWithUser() to run here from javascript************* if (HiddenFieldUserConfirmed.Value != "no") { SubmitData(); CallRecursive(TreeView1); nodetexts += ";"; } } </code></pre> <p>here is the javascript:</p> <pre><code>function ConfirmWithUser() { if (confirm(document.getElementById('HiddenFieldConfirmation').value) == true) { document.getElementById('HiddenFieldUserConfirmed').value='yes'; } else { document.getElementById('HiddenFieldUserConfirmed').value='no';} </code></pre> <p>how do i run this function <code>ConfirmWithUser()</code> on the button click inside of the code behind code as shown above:</p> <p>another words i need:</p> <ol> <li>after user clicks button, first part of codebehind execeutes</li> <li>javascript inside of codebehind exeuctes</li> <li>the last part of code behind executes</li> </ol>
c# javascript asp.net
[0, 3, 9]
4,724,476
4,724,477
How to reference assemblies that are in the GAC
<p>In 2005 you need to add a new registry setting in order to see it in the Add Ref dialog box. </p> <p>BUT</p> <p>can you add a reference an assemble that are in the GAC in the web.config file?</p> <p>i.e.</p> <p> </p>
c# asp.net
[0, 9]
5,427,924
5,427,925
Change Label Text during long Code Behind Process
<p>I Have <code>Label</code> And <code>Button</code> In One <code>UpdatePanel</code> ,Now I call Long Process with <code>ForEach</code> Loop <code>On Button Click</code> What I want is to Update Text Of <code>Label</code> after Completion Of Loop.Is there any Easy Way to Change Text Of <code>Label</code> At runtime.I heard Something that we can do this with <code>Iframe</code> But I dont have any idea about that.</p> <p><strong>CODE</strong></p> <p><strong>aspx</strong></p> <pre><code> &lt;asp:UpdatePanel ID="UpdatePanelUpdate" runat="server" UpdateMode="Conditional"&gt; &lt;ContentTemplate&gt; &lt;div&gt; &lt;asp:Button ID="ButtonUpdate" runat="server" Text="Update" onclick="ButtonUpdate_Click" /&gt; &lt;br /&gt; &lt;br /&gt; &lt;asp:Label ID="LabelUpdateCount" runat="server" Text=""&gt;&lt;/asp:Label&gt; &lt; /div&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p><strong>aspx.cs</strong></p> <pre><code> protected void ButtonUpdate_Click(object sender, EventArgs e) { int count = 0; foreach() { do my stuff(); count = count + 1; LabelUpdateCount.Text = count.ToString(); } } </code></pre> <p>SO,I want to show change of label at runtime.....</p>
c# asp.net
[0, 9]
1,484,524
1,484,525
asp.net looping through javascript files
<p>I want to loop through my javascript files. In the global.asax file on application start, I have this:</p> <pre><code>void Application_Start(object sender, EventArgs e) { //bugs this line System.IO.DirectoryInfo info = new System.IO.DirectoryInfo("\\Scripts"); StringBuilder sb = new StringBuilder(); foreach (var item in info.GetFiles("*.js")) { sb.Append(System.IO.File.ReadAllText(item.FullName)); sb.Append(Environment.NewLine); } } </code></pre> <p>However, it's not working, it says it can't find files. How do I programmatically get to a directory and its files?</p> <p>Thanks for your suggestions.</p>
c# asp.net
[0, 9]
3,682,066
3,682,067
Disabling enter key for selected submit buttons within a form
<p>i have a page that contains several submit buttons however i only want one of them to be activated by the enter key</p> <pre><code> echo "&lt;form method=\"post\" action=\"fish.php\"&gt;\n"; echo "&lt;tr&gt;&lt;td&gt;North Pot&lt;/td&gt;&lt;td&gt;&lt;input type=\"text\" name=\"northpot\"&gt;&lt;input type=\"submit\" name=\"north_all\" value=\"All\"&gt;&lt;/td&gt;\n"; echo "&lt;tr&gt;&lt;td&gt;South Pot&lt;/td&gt;&lt;td&gt;&lt;input type=\"text\" name=\"southpot\"&gt;&lt;input type=\"submit\" name=\"south_all\" value=\"All\"&gt;&lt;/td&gt;\n"; echo "&lt;tr&gt;&lt;td&gt;&lt;input type=\"submit\" name=\"submit4\" value=\"Place\"&gt;&lt;input type=\"submit\" name=\"clear\" value=\"Clear\"&gt;&lt;/td&gt;\n"; echo "&lt;td colspan=\"2\" align=\"center\"&gt;&lt;/td&gt;&lt;/tr&gt;\n"; echo "&lt;/form&gt;"; </code></pre> <p>The button i want to be actived by the return key is <code>submit4</code> </p> <p>i can disable the enter key for all the submit buttons but i'm struggling to do this selectively</p>
php javascript
[2, 3]