Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
1,975,678
1,975,679
Jquery: syntax for inserting a function
<p>I'm trying to integrate an animation by using the bezier path plug-in and I can't seem to implement it right.</p> <p>Stripped down, here's what I have:</p> <pre><code> $('#next2btn').live('click', function(){ $(this).attr('id','next3btn'); $('#content2').show(300, function() { $('#account').fadeTo(500,1.0) var arc_params = { center: [278,120], radius: 186, start: -90, end: 90, dir: -1 }; }); $("#account").animate({path : new $.path.arc(arc_params)},1000); }); </code></pre> <p>So, I'm trying to add this piece of code into what I have:</p> <pre><code> var arc_params = { center: [278,120], radius: 186, start: -90, end: 90, dir: -1 }; }); $("#account").animate({path : new $.path.arc(arc_params)},1000) </code></pre> <p>which works on its own as does the other.</p> <p>I'm thinking it's something about declaring that variable and where I do that.</p> <p>I'm essentially chaining a few different animations/actions upon a button click.</p> <p>Thanks for any insight- kj</p>
jquery
[5]
3,008,067
3,008,068
PHP class method named print... not allowed?
<p>I am writing a Controller for Codeigniter with a method named "print". The name is important, because I would like to be able to access the page at "http://www.mysite.com/mycontroller/print".</p> <p>However, I cannot do this because there is the syntax error:</p> <pre><code>Parse error: syntax error, unexpected T_PRINT, expecting T_STRING </code></pre> <p>Is there any special syntax to make the PHP interpreter "think" that when I say:</p> <pre><code>class MyClass extends Controller { function print() { // print method here } } </code></pre> <p>... that I am talking about a method with a T_STRING name of "print" and not the T_PRINT that it is expecting it to be?</p>
php
[2]
2,084,499
2,084,500
php-cgi.exe has 16 and more instances in task manager
<p>Can someone tell me if 16 running processes of <strong>php-cgi.exe</strong> is normal behavior, and if not what might causing that? The server gets a lot of requests and uses HttpRequestPool for sending parallel requests.</p>
php
[2]
3,927,064
3,927,065
email queueing with c#
<p>not sure it is possible but I am looking for a solution that will queue email messages. </p> <p>Is there any way to write some sort of web app that will run and send certain amounts of emails to email server for delivery even after I submit my message and close webpage. May be some sort of daemon?</p>
c#
[0]
2,912,828
2,912,829
Header cannor be sent
<p>I got some error when I uploaded my site to server. The error is:</p> <p>Cannot modify header information - headers already sent by (output started at.....)</p> <p>My site works fine on my localhost. Whats the possible error?</p>
php
[2]
5,808,713
5,808,714
JavaScript tree / treegrid libraries
<p>I'm looking for a good JavaScript tree / treegrid package. Now -- before you answer:</p> <p>It needs to be able to perform well with <em>lots</em> of nodes. Perhaps 1,000 sibling nodes. It needs to be able to draw to a usable state within 2 or 3 seconds with 1,000 nodes. It doesn't necessarily need to draw all 1,000 nodes at once -- if it supports some sort of "smart rendering" or fake scrolling.</p> <p>Beyond that, column resizing, drag and drop, inline editing would all be nice, although I could probably add that functionality myself. </p> <p>I've already tried dojo's tree and yahoo's YUI treeview. Both are too slow.</p>
javascript
[3]
5,184,479
5,184,480
Is there a jquery event for handling edits of text boxes?
<p>I am looking for a way to bind to an event whenever the text of a text box changes. Right now, I have something like this:</p> <pre><code>$("#inputPane").change(function() { alert("Changed!"); }); </code></pre> <p>However, this only gets called when the text box loses focus. I want to get an event whenever a new character is added, deleted, or a cut/paste occurs.</p> <p>I'd prefer not to use any third party plugins for this. Using pure jquery would be nicer.</p>
jquery
[5]
90,276
90,277
jQuery Focus on Div with contentedible
<p>When I hit the enter key I cannot change the focus on the divs. Can anyone help?</p> <pre><code>&lt;div contenteditable="true" id="t" tabindex="-1"&gt; &lt;div class="me" spellcheck="true" content="inhert" &gt;Hello &lt;span style="font-weight: normal;"&gt;world2!&lt;/span&gt;&lt;/div&gt; &lt;div class="me" spellcheck="true" content="inhert" &gt;Hello &lt;span style="font-weight: normal;"&gt;world3!&lt;/span&gt;&lt;/div&gt; &lt;div class="me" spellcheck="true" content="inhert" id="last"&gt;Hello &lt;span style="font-weight: normal;"&gt;world4!&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; $("div").bind("keypress", function(event){ if(event.keyCode == 13){ event.preventDefault(); $("#last").focus(); } }); </code></pre>
jquery
[5]
4,461,172
4,461,173
Can you use the JavaScript engine in web browsers to process local files?
<p>I have a number of users with multi-megabyte files that need to be processed before they can be uploaded. I am trying to find a way to do this without having to install any executable software on their machines. </p> <p>If every machine shipped with, say, Python it would be easy. I could have a Python script do everything. The only scripting language I can think of that's on every machine is JavaScript. However I know there are security restrictions that prevent reading and writing local files from web browsers. </p> <p>Is there any way to use this extremely pervasive scripting language for general purpose computing tasks?</p> <p><hr /></p> <p>EDIT: To clarify the requirements, this needs to be a cross platform, cross browser solution. I believe that HTA is an Internet Explorer only technology (or that the Firefox equivalent is broken).</p>
javascript
[3]
3,306,613
3,306,614
PHP Problem reading the hex values between these addresses?
<pre><code>&lt;?php $file = 'file.dat'; $file_contents = file_get_contents($file); for ($i = 0x000481; $i &lt;= 0x00048B; $i++) { print $i; } ?&gt; </code></pre> <p>I am creating an online file analyzer but I have a small problem. It outputs (which is the actual position the hex is in)</p> <blockquote> <p>1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163</p> </blockquote> <p>when it should be</p> <blockquote> <p>44 72 48 79 64 72 61 6C 69 73 6B</p> </blockquote> <p>which his hex for DrHydralisk (me). Can anyone help me output the latter or just have it strait output ASCII (but hex is fine, I can just convert it)?</p> <p><strong>edit</strong></p> <p>Here is an image of what I am trying to do that I think will help.</p> <p><a href="http://imgur.com/nwenA.png" rel="nofollow">http://imgur.com/nwenA.png</a></p> <p>Here is the file I am trying to read, its a Starcraft replay (file.SC2Replay). Just search for DrHydralisk in a hex editor and that is where I am trying to read from.</p> <p><a href="http://www.mediafire.com/?6w8wi35q3o6ix8q" rel="nofollow">http://www.mediafire.com/?6w8wi35q3o6ix8q</a></p>
php
[2]
1,709,241
1,709,242
How do I change the View's visibility based on another View's animation in a custom layout?
<p>I created a custom RelativeLayout called WheelLayout which contains two ImageViews. The first View, WheelView, is a custom View that calls RotateAnimation a couple times. </p> <p>WheelView has a custom interface called WheelListener.</p> <pre><code> public interface WheelListener { public void wheelStarted(); public void wheelStoppedOnSlice(int sliceNum); } </code></pre> <p>In WheelView, I implement Animation.AnimationListener as follows:</p> <pre><code>@Override public void onAnimationStart(Animation animation) { mListener.wheelStarted(); } @Override public void onAnimationEnd(Animation animation) { mListener.wheelStoppedOnSlice(mCurrentSlice); } @Override public void onAnimationRepeat(Animation animation) { } </code></pre> <p>Where mListener is a WheelListener.</p> <p>WheelLayout implements WheelListener like so:</p> <pre><code>@Override public void wheelStarted() { mSliceImage.setVisibility(View.GONE); } @Override public void wheelStoppedOnSlice(int sliceNum) { mSliceImage.setBackgroundResource(mSlices[sliceNum]); mSliceImage.setVisibility(View.VISIBLE); } </code></pre> <p>When WheelView animates, I expect to see mSliceImage disappear and WheelView to continue its animation to completion. Instead, neither occurs. My WheelView does not animate and mSliceImage does not disappear.</p> <p>However, after the animation would finish, I <em>do</em> see mSliceImage change its background resource.</p> <p>I also tried the same thing where mSliceImage was <em>not</em> a child of custom layout and it worked perfectly.</p> <p>Does anyone have any ideas?</p>
android
[4]
3,659,834
3,659,835
How to replace more strings in a variable?
<p>In Php it's easy:</p> <pre><code>str_replace (array(...), array(...), $subject) </code></pre> <p>But how to do it in javascript?</p> <p>thanks in advance,</p>
javascript
[3]
4,592,118
4,592,119
Tree Implementation in Python
<p>I found two similar questions(infact same question) for implementing tree in python. Can anyone point me to good references to implement trees. The link given in previous answers is not working.Thanks!</p>
python
[7]
5,435,710
5,435,711
how can I automatically stop all background tasks when app is coming in foreground state
<p>i am using following code</p> <pre><code>#if __IPHONE_OS_VERSION_MAX_ALLOWED &gt;= 40000 if ([[UIApplication sharedApplication] respondsToSelector:@selector(beginBackgroundTaskWithExpirationHandler:)]) { UIBackgroundTaskIdentifier bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{}]; // Perform work that should be allowed to continue in background [self changeCounter]; //[NSThread detachNewThreadSelector:@selector(changeCounter) toTarget:self withObject:_viewController]; [[UIApplication sharedApplication] endBackgroundTask:bgTask]; } #endif </code></pre> <p>changeCounter contains loops which may end after some time .But before ending the loop if app comes in foreground then i can see only black screen untill loop finishes. So how can I stop all tasks as app comes in foreground </p> <p>this is code for changeCounter</p> <pre><code> -(void)changeCounter{ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; while(back==1.0f){ NSLog(@"loop is runnig"); [NSThread sleepForTimeInterval:1.0]; if(_viewController.minutes&lt;0){ if(_viewController.fadeSeconds&gt;0){ float div=_viewController.deviceVolume/[_viewController.volumeData.fadeTime floatValue]; _viewController.musicPlayer.volume=_viewController.musicPlayer.volume-div; _viewController.fadeSeconds-=1; } else { [self stop]; //self.musicPlayer.volume=0.0f; // counter=0; NSLog(@"closing the sound"); [_viewController.musicPlayer pause]; NSLog(@"fade seconds %i minutes ",_viewController.fadeSeconds); if(_viewController.dvol==0){ _viewController.musicPlayer.volume=deviceVolume; _viewController.dvol=1; } back=0.0f; }// end of the else } </code></pre>
iphone
[8]
3,395,233
3,395,234
Windows Event log file
<p>I have a program which reads a file every time and now I want to read the event log file of windows ,how can I get the location and read its contents.</p> <p>The logs are stored in the <strong>%SystemRoot%\System32\Config</strong> directory with a .evt extension. Within the Computer Manager you can also export them to a .txt or .csv file. </p> <p>Windows Vista/7/Server2008 location, here it is: <strong>%SystemRoot%\system32\winevt\logs</strong></p> <p><strong>My Code is:</strong></p> <pre><code>String fileSeperator = File.separator; String filePath = "C:" + fileSeperator + "WINDOWS" + fileSeperator + "system32" + fileSeperator + "winevent" + fileSeperator + "logs"; System.out.println("FilePath :" + filePath); File f = new File(filePath); System.out.println("Is Directory :" + f.isDirectory()); </code></pre> <p><strong>The Output:</strong></p> <p>FilePath : <code>C:\WINDOWS\system32\winevent\logs</code></p> <p>Is Directory :false</p> <p>Why does it return it is not a directory?</p>
java
[1]
4,101,744
4,101,745
Sort ObservableCollection by Date
<p>I have a collection</p> <pre><code>private ObservableCollection&lt;ContentItemViewModel&gt; _contentTree; public ObservableCollection&lt;ContentItemViewModel&gt; ContentTree { get { return _contentTree; } } </code></pre> <p>class ContentItemViewModel has property:</p> <pre><code> private string _published; public string Published { get { return _published; } set { _published = value; NotifyPropertyChanged("Published"); } } </code></pre> <p>that is - <code>node.Published= Convert.ToDateTime(date.Value).ToString("dd MMM yyyy", new DateTimeFormatInfo());</code></p> <p>I need to sort ContentTree collection by date? how can I do this?</p>
c#
[0]
5,828,300
5,828,301
Autocentering picture in a control
<p>I'm trying to do a kind of gallery wich can center to the most closer picture. The controls that I think I can use are the HorizontalScrollView, but I need the trasition effect of centering in the middle of the closest picture. Any idea of examples or the control that I need to use? </p> <p>Thank you!</p>
android
[4]
279,256
279,257
"Minimal" source files to create Android app using Eclipse + ADT
<p>I am trying to understand the anatomy of a MINIMAL Android application, using Eclipse + ADT (Android Development Toolkit).</p> <p>Please can you advise what is the MINIMAL set of source files I need, for example :-</p> <pre><code>src / package / MainActivity.java res / layout / activity_main.xml res / menu / activity_main.xml (??) AndroidManifest.xml (any other source files needed?) </code></pre> <p>Please can you advise what is the MINIMAL that I need to put into each file in order for it to run on the AVD (Android Virtual Device) ?</p> <p>For example, which of these files needs to contain reference(s) to which other files, etc?</p> <p>Thank you for your time and help,</p> <p>Best regards,</p> <p>James</p>
android
[4]
5,733,856
5,733,857
Why does Python return negative list indexes?
<p>If I have this list with 10 elements:</p> <pre><code>&gt;&gt;&gt; l = [1,2,3,4,5,6,7,8,9,0] </code></pre> <p>Why will l[10] return an IndexError, but l[-1] returns 0?</p> <pre><code>&gt;&gt;&gt; l[10] Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; IndexError: list index out of range &gt;&gt;&gt; l[0] 1 &gt;&gt;&gt; l[-1] 0 &gt;&gt;&gt; l[-2] 9 </code></pre> <p>What I want to do is throw an error if there are no previous elements in the list.</p>
python
[7]
1,367,870
1,367,871
How to retrieve a Bitmap/image from videoview
<p>I'm trying to get a snapshot of the current position of playback of a video, but I couldn't find an appropriate way to do that. Is there a method I can use? </p> <p>Any help would be appreciated. Thanks.</p>
android
[4]
2,253,795
2,253,796
How to generate passwords?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4290889/get-all-possible-word-combinations">Get all possible word combinations</a> </p> </blockquote> <p>I have a string <code>"abcdefgklmno0123456789"</code></p> <p>I need to enumerate all the possible combinations with sizes ranging from 6 to 7 characters.</p> <p><code>aaaaaa aaaaab aaaaac ... 999999</code></p>
c#
[0]
5,568,805
5,568,806
How to get the size of the browser inner space if it were maximized in pixels through javascript
<p>I need to know the client available screen size, I mean the size of the browser inner space if it were maximized in pixels. I need some code that works on both IE and Firefox at least.</p> <p>Thanks in advance</p>
javascript
[3]
4,545,206
4,545,207
Help regarding android 1.5 and 2.1 (beginner, issue of Book Version)
<p>I am new to android and last year i bought two books of <strong>android 1.5</strong>. But at that time i was busy in my project so was not able to work on android. Now i want to start android again. Should i go for those books or should i buy new editions Is there any major change regarding basic learnings? Two books i am having are:-</p> <p><a href="http://pragprog.com/titles/eband2/hello-android" rel="nofollow">Pragmatic Hello Android</a> (New addition of this book is available, But still in beta phase)</p> <p><a href="http://apress.com/book/view/9781430224198" rel="nofollow">Apress begining Android</a> (Dont know about this whether new edition is available or not)</p> <p>Please let me know. Thanks</p> <p><strong>EDIT</strong> here i am not asking about the good books of android, as there are lot of questions regarding that. I can find out from them. My question is purely related to <strong>change in version</strong></p>
android
[4]
4,998,903
4,998,904
iPhone+want tapku libarary calender cell color
<p>I'm using tapku library for displaying a calender in my application I have done all of the date calculations and amrked the cells properly according to my need, but I want to give diff diff color to the cell according to my choices.</p> <p>Please help me, I have to solve this issue as early as possible..</p>
iphone
[8]
5,274,062
5,274,063
How to call on text from a textbox to set a variable in javascript
<p>I have a bit of a predicament. I am trying to run a variable on a loop so that it can change the loop. Here is the code that I have at the present time.</p> <pre><code>&lt;FORM NAME="myform" ACTION="" METHOD="GET"&gt; &lt;INPUT TYPE="text" NAME="inputbox" id="Variable"&gt;&lt;P&gt; &lt;/FORM&gt; &lt;script type="text/javascript"&gt; document.getElementById("Variable").value = i; var i=5; for (i=0;i&lt;=5;i++) { document.write(" " + i); document.write("&lt;br /&gt;"); } &lt;/script&gt; </code></pre> <p>I am trying to call upon the text in the textbox from the form in order to define var i. I would also like to point out that I am no master of HTML, and if you see that I have done this all wrong, feel free to tell me that it cannot be done.</p>
javascript
[3]
1,330,802
1,330,803
How do I prevent users from being able to "back" into page from a destroyed session?
<p>I have created login functionality on my site, and when I click logout the page redirects and destroys session, which is fine.</p> <p>However when I click the back button I can still view the page. If I refresh it, then it will redirect me to login as the session has been destroyed and the user does not have access to the page like expected.</p> <p>Is there a way I can prevent the user from being able to view the page when they click the back button?</p>
php
[2]
3,624,655
3,624,656
how do I add if statement in linq statement
<p>Can someone please help me add the if statement that's commented in the code snippet below?</p> <pre><code>Dictionary&lt;string,int&gt; toReturn; List&lt;string&gt; lookup = GetIt(); foreach (string test in lookup) { var testDictionary = ToGroupDictionary(test); testDictionary.Keys.ToList().ForEach(k =&gt; //if(true){add toReturn list} ); } </code></pre>
c#
[0]
2,469,832
2,469,833
How to get Bing 'daily mobile wallpaper' address
<p>is There anyone know how to get the Bing 'daily mobile wallpaper' address. if you visit bing.com via your IPhone, you will see a beautiful wallpaper. Bing change it everyday, and provide two resolution format for Portrait and landscape.</p> <p>for example, today's Bing mobile wallpaper are from <a href="http://www.bing.com/fd/hpk2/LouetLighthouse_EN-US2132342110_360x480.jpg" rel="nofollow">http://www.bing.com/fd/hpk2/LouetLighthouse_EN-US2132342110_360x480.jpg</a> http://www.bing.com/fd/hpk2/LouetLighthouse_EN-US2132342110_480x360.jpg</p> <p>appreciate your help in advance.</p> <p>Eric</p>
iphone
[8]
2,887,657
2,887,658
Removing inserted numbers from a String in java
<p>Ok, so i have created a program that defines if the inserted word is a palindrome or not. But i need help on removing numbers that where to be inserted in the string.</p> <pre><code>import java.util.*; import java.util.Scanner; class Palindrome { public static void main(String args[]) { String reverse = ""; Scanner scan = new Scanner(System.in); System.out.print("Type a sentence and press enter: "); String input = scan.nextLine(); // use regex to remove the punctuation and spaces String Input = input.replaceAll("\\W", " "); System.out.println(Input); int length = input.length(); for ( int i = length - 1 ; i &gt;= 0 ; i-- ) reverse = reverse.replaceAll("\\W", "") + input.charAt(i); System.out.println(reverse); if (input.equals(reverse)) System.out.println("Entered string is a palindrome."); else System.out.println("Entered string is not a palindrome."); } } </code></pre>
java
[1]
695,360
695,361
List of Strings unable create
<p>I am trying to understand how to create array lists in Java, for some reason I am getting an error saying to change the type of myList to ArrayList even though I saw this example from a different post on stack overflow and it seemed to work. </p> <p>What I am trying to do is simply create a List, add three strings to it and iterate through it and print it out.</p> <p>On a side note, is it possible to add integers, strings, and objects all to the same list?</p> <p>I'd appreciate any guidance in this regard.</p> <pre><code> List myList = new ArrayList(); myList.add("hello"); myList.add("World"); myList.add("!"); //print contents System.out.println(myList); </code></pre>
java
[1]
83,174
83,175
Finding Nested value(s) within nested values in jQuery
<p>I have the following code with the intention of locating values from within a targeted div as follows:</p> <pre><code>$('#combineDiv').children().each(function(){ if ($(this + ":first-child").attr('class') == 'combinedColumn') { alert('found ONE!'); } }); </code></pre> <p>I have a hidden input in some of the divs within the children of the div '#combineDiv'... but, I dont know how to combine the 'THIS' keyword with the appropriate selector... :(</p>
jquery
[5]
2,935,686
2,935,687
Counters not decrementing or not being read in Breakout
<p>Okay, I've got this game loop which never terminates --</p> <pre><code>public void run() { setup(); addMouseListeners(); int Turns = NTURNS; int TotalBricks = NBRICKS_PER_ROW * NBRICK_ROWS; while ((Turns&gt;0) &amp;&amp; (TotalBricks&gt;0)) { moveBall(); checkForCollision(); pause(DELAY); } System.exit(0); } </code></pre> <p>-- even though I have this method decrementing the Turns value every time the ball is missed:</p> <pre><code>private void checkForCollision() { GObject collider = getCollidingObject(); if (collider !=null) { if (collider == Paddle) { vy= -vy; } else { vy= -vy; remove(collider); TotalBricks = TotalBricks - 1; } } if((ball.getX()&gt;=(WIDTH-BALL_RADIUS)) || (ball.getX()&lt;=0)) { vx = -vx; } if(ball.getY()&lt;=0) { vy = -vy; } if(ball.getY()&gt;=HEIGHT) { Turns = Turns -1; remove(ball); newBall(); } } </code></pre> <p>plus this</p> <pre><code>private int Turns; </code></pre> <p>at the bottom to ensure that the variable is shared among both methods. No matter how many times the ball is missed, the game never stops. What am I missing? Thx</p>
java
[1]
2,867,829
2,867,830
How to detect screen rotation through 180 degrees from landscape to landscape orientation?
<p>I've seen a few other questions similar to this but no answers.</p> <p>Rotating from portrait to landscape (either direction) and back again, we get the helpful call to onConfigurationChanged().</p> <p>However, when rotating from landscape to landscape (through 180 degrees) onConfigurationChanged() is not called.</p> <p>I've seen mention of using OrientationEventListener but this seems flakey to me because you can rotate quickly around without triggering a display orientation change.</p> <p>I've tried adding a layout change listener, but with no success.</p> <p>So the question is, how to reliably detect such a change in landscape orientation?</p>
android
[4]
2,365,883
2,365,884
Jumping and standing on objects in 2D game
<p>Im making small 2D game and i would like how should, theoretically work jumping and standing on objects.<br> For jumping should there be some kind of gravity?Should i use collision detection?<br> Good example of what i want to undestand is jumping in Mario.</p>
java
[1]
2,032,468
2,032,469
How we insert the data in the database using sqlite database?
<p>Please help me? I'm new with android database.<br> Proper answer would be appreciated.</p>
android
[4]
2,666,557
2,666,558
jquery dynamic adding hidden field
<pre><code>$().ready(function() { $("#add").click(function() { var vals = $("#txtaddfeature").val(); if(vals !='') $('#FeatureLists').prepend('&lt;option value="' + vals + '" selected="selected"&gt;' + vals + '&lt;/option&gt;'); $('#txtaddfeature').val(''); }); }); </code></pre> <p>Ok after adding the value to the select list as above</p> <pre><code>$('#FeatureLists').prepend('&lt;option value="' + vals + '" selected="selected"&gt;' + vals + '&lt;/option&gt;'); </code></pre> <p>I want to create a dynamic hidden field with id=vals defined above and set it value to value entered in the textbox . how can i do that</p>
jquery
[5]
4,077,195
4,077,196
hardware detail using Java
<p>I want to make a java application software which give the current status/information of the running computer. So, for this, is there any inbuilt/extrnal library present or not?</p> <p>Can anyone give a simple code which will just. "What is the current status of laptop battery?" or "Is AC adapter is pluged in or not?" </p> <p>Please help me.</p>
java
[1]
2,959,129
2,959,130
Develop count down timer with unlimited lap options
<p>I want to develop a count down timer in Android which will have unlimited lap options.</p> <p>Can anyone guide me with sample article / source code.</p> <p>Warm Regards,</p> <p>CB</p>
android
[4]
5,215,817
5,215,818
Running PHP script in background
<p>I am testing a php script that has been developed on an OS-X system at Debian and it behaves different there.</p> <p>To reproduce it I wrote two scripts: parent.php and child.php:</p> <p>parent.php:</p> <pre><code>#!/usr/bin/php &lt;?php echo "parent started...\n"; shell_exec(__DIR__ . '/child.php &amp;2&gt;/dev/null &amp;'); echo "parent finished.\n"; </code></pre> <p>child.php:</p> <pre><code>#!/usr/bin/php &lt;?php echo "child started...\n"; sleep(5); echo "child finished.\n"; </code></pre> <p>Running parent.php on OS-X I get back imediately the two output lines (parent started, parent finished). On Debian I get the "parent started..." line, then a delay of 5 seconds an then the "parent finished.". Running "./child.php &amp;2>/dev/null &amp;" in the shell gives me back the prompt imediately as expected. Any ideas how I can fix this?</p>
php
[2]
431,444
431,445
how to take picture from camera using iphone app
<p>I have implemented picture taking while pressing UI Button butwhen ever i pressed the button got app crashed.</p> <p>Here is the source code.</p> <pre><code>.h file @interface Camera : UIViewController &lt;UIImagePickerControllerDelegate&gt; { UIImagePickerController *mPicture; } @property (nonatomic, retain) UIImagePickerController *mPicture; .m file @implementaion Camera @synthesize mPicture; -(void)pictureButtonPushed { UIImagePickerControllerSourceType mType = UIImagePickerControllerSourceTypeCamera; if ([UIImagePickerController isSourceTypeAvailable:mType]) { mPicture.sourceType = mType; [self presentModalViewController:mPicture animated:YES]; } } </code></pre> <p>Thanks in advance</p>
iphone
[8]
4,855,265
4,855,266
Easiest way to save data in savedInstanceState when managing an adapter(viewpager)
<p>I'm working with an adapter(viewpager) and when the app changes orientation it loses its information. Which is the easiest way to conserve this information? I was going to use savedInstanceState inside the adapter but it doesn't recognise it.</p>
android
[4]
66,192
66,193
System.currentTimeMillis() give wrong output android
<p>when i am print <code>System.currentTimeMillis()</code></p> <p>give me : </p> <pre><code>11-03 14:47:05.400: INFO/System.out(7579): date is :: 14475410111 </code></pre> <p>What is the correct procedure to get entire date with time.?</p>
android
[4]
4,530,282
4,530,283
jQuery .delegate(). Events not firing on second click
<p>On a new site I'm designing, I have a top div with a link in it. When that link is clicked, the div animates to the full height of the content. This works but I want a second click on that link to animate the div back to how it was before. This isn't working.</p> <p>I am using jQuery 1.5.2, hence the use of .delegate() rather than .on(). Please don't suggest upgrading my jQuery version!</p> <p><strong>jQuery</strong></p> <pre><code>// top bar &amp; basket functionality var topbarContractedHeight = $('#topbar').height(); // get current height $('#topbar').css('height','auto'); // temp. set height to auto... var topbarExpandedHeight = $('#topbar').height(); // ...and store it $('#topbar').css('height',topbarContractedHeight); // put the height back to how it was $('.topbarcontracted').delegate('#basket_trigger', 'click', function(){ $('#topbar').animate({ height: topbarExpandedHeight }, 500).removeClass('topbarcontracted').addClass('topbarexpanded'); // ...animate the height to the expanded height stored earlier, remove the 'contracted' class and add 'expanded'... return false; // ...and don't process the link }); $('.topbarexpanded').delegate('#basket_trigger', 'click', function(){ $('#topbar').animate({ height: topbarContractedHeight }, 500).removeClass('topbarexpanded').addClass('topbarcontracted'); // ...animate the height to the expanded height stored earlier, remove the 'expanded' class and add 'contracted'... return false; // ...and don't process the link }); </code></pre> <p>How can I get that 2nd .delegate() event to fire?</p> <p>Please test to your heart's content at <a href="http://jsfiddle.net/4KL2z/1/" rel="nofollow">http://jsfiddle.net/4KL2z/1/</a></p>
jquery
[5]
2,344,831
2,344,832
ajax loop over data in jquery
<p>It is possible to loop over all value I get back from jquery ajax call?</p> <p>below is what I'm trying to do...</p> <pre><code>if ($(data.DATA).length == 1) { loop ALL data.DATA { get data.DATA.ID } } </code></pre> <p>Thanks</p>
jquery
[5]
1,132,101
1,132,102
Cross-browser Javascript copy button
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/400212/how-to-copy-to-the-clipboard-in-javascript">How to copy to the clipboard in JavaScript?</a> </p> </blockquote> <p>I am trying to implement a cross-browser Javascript copy button, but am unable to use Flash, unfortunately, so I've come up with a different solution for Chrome/Firefox, etc.</p> <p>The issue I'm having is the syntax for actually calling the function: it seems that IE doesn't like if I have an apostrophe in the argument, and nothing else likes it if I <em>don't</em>. For example, the HTML:</p> <pre><code>&lt;button onclick="copy(el)"/&gt;Copy&lt;/button&gt; </code></pre> <p>Works fine with the IE-only Javascript:</p> <pre><code>textRange = document.body.createTextRange(); textRange.moveToElementText(el); textRange.execCommand("Copy"); </code></pre> <p>But when I try to do the following for Chrome/Firefox, I get a Type Mismatch error in Firebug:</p> <pre><code>document.getElementById(el).innerHTML; </code></pre> <p>If I add apostrophes around the argument in the original function call (onclick="copy('el')"), it works fine in Chrome/Firefox, but IE gives a type mismatch error.</p> <p>How can I resolve this so that I can call the function&mdash;preferably with apostrophes around the arguement&mdash;but it will work in all browsers? Thanks.</p>
javascript
[3]
431,550
431,551
Change text in file with php
<p>How would I go about doing this, preferably without mysql. I just want to display the value inserted on a form on a text file.</p>
php
[2]
4,456,680
4,456,681
stopping android handler loop
<p>i am using a class which extends Handler class to update my activity UI. The code is as follows in side main activity,</p> <pre><code>public class RefreshHandler extends Handler { public void handleMessage(Message msg) { Homeform.this.updateUI(); } public void sleep(long delayMillis) { this.removeMessages(0); sendMessageDelayed(obtainMessage(0), delayMillis); } }; private void updateUI(){ Log.v(""," I am inside Update UUI====================="); refresh(); mRedrawHandler.sleep(5000); } </code></pre> <p>And i had call this method handleMessage() on the object of RefreshHandler as follows</p> <pre><code>mRedrawHandler = new RefreshHandler(); mRedrawHandler.handleMessage(new Message()); </code></pre> <p>But here i am facing one problem that it is running after closing my application also .</p> <p>please solve my problem to stop this handler when close this application.</p> <p>Thank you..</p>
android
[4]
4,267,272
4,267,273
Php putenv() question
<p>I am new to php. Can anyone give a good definition or example when to use putenv() in php? Thanks.</p>
php
[2]
252,323
252,324
Generate no duplicate digits
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/9960908/permutations-in-javascript">permutations in javascript?</a> </p> </blockquote> <p>Now I have 6 numbers, they are from 1 to 6. I want to generate some digits using all of these numbers, for example, 123456, 123465, how could I use JavaScript to solve that?</p> <p>6 * 5 * 4 * 3 * 2 * 1, the program should generate 720 results;</p>
javascript
[3]
5,512,945
5,512,946
How do I control the alignment of formatted text in Java?
<p>I'm knocking my head here using System.out.printf and I really don't understand something that seems that it should be much more simple.</p> <pre><code>public class main{ public static void main(String args[]){ double dog = 3.85; double cat = 333.85; System.out.printf("Hola:%7.1f\n",dog); System.out.printf("Hola:%5.0f", cat); } } </code></pre> <p>I'm trying to understand what the significance is of the numbers after the percentage symbol. In short in the line:</p> <pre><code>System.out.print("Number: %x.y", someNumber); </code></pre> <p>what does the x tell me and what does the y tell me?</p>
java
[1]
5,716,806
5,716,807
why a .net 1.1 code gets compiled in 2.0 and throws an error?
<p>Hi I have web projects build in VS2003/1.1 framework and deployed in a webserver with IIS setting specified to 1.1 framework.lets say project X</p> <p>I also have another web project which is build with VS2008/2.0. IIS setting - ASP version 2.0 is selected and all pages are assigned to run with 2.0* dlls. Lets say project Y</p> <p>Now the problem seem to be when I hit project x, sometimes it throws errors like:</p> <pre><code>error BC30456: 'Initialize Culture' is not a member of ASP </code></pre> <p>During troubleshooting this issue, I browsed through 2.0 Temporary ASP.Net files <code>"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\"</code> and found temp files generated for project X. (HUH?)</p> <p>How/why 1.1 project gets compiled in 2.0 only when it errors out.( or we could put it this way that it errors out every time it gets compiled in 2.0 which it is not supposed to)</p> <p>I'm confused as to why this is happening when project X has nothing to do with .net 2.0.</p> <p>Adding this info:</p> <p>IIS version 6.0</p> <p>I forgot to mention that project X works 95 percent of the time without any errors under 1.1. This error throws randomly which we could not recreate. The time the project error out is at the same time it gets compiled with 2.0</p>
asp.net
[9]
413,313
413,314
adding 48 to string number
<p>I have a string in C# like this:</p> <pre><code>string only_number; </code></pre> <p>I assigned it a value = <code>40</code></p> <p>When I check <code>only_number[0]</code>, I get <code>52</code><br> When I check <code>only_number[1]</code>, I get <code>48</code></p> <p>why it is adding 48 to a character at current position? Please suggest</p>
c#
[0]
1,704,155
1,704,156
how do i set a conditional statement here?
<pre><code>&lt;ul&gt; &lt;li class="artist-website"&gt;&lt;a href="&lt;?php=$artist_website?&gt;" target="_blank"&gt;&lt;/a&gt;&lt;/li&gt; &lt;li class="artist-youtube"&gt;&lt;a href="http://youtube.com/&lt;?php=$artist_youtube?&gt;" target="_blank"&gt;&lt;/a&gt;&lt;/li&gt; &lt;li class="artist-twitter"&gt;&lt;a href="http://twitter.com/&lt;?php=$artist_twitter?&gt;" target="_blank"&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I want to add an if exists statement before each of the 'li' items. For example, if "artist-website" exists, then echo <code>&lt;li class="artist-website"&gt;&lt;a href="&lt;?php=$artist_website?&gt;" target="_blank"&gt;&lt;/a&gt;&lt;/li&gt;</code></p> <p>How can I do make this work?</p>
php
[2]
1,017,566
1,017,567
Trying to write to a file and force download with php
<p>Im using the following code to present a file for download. The file saves on the server correctly with the data, and prompts for download, but the downloaded file is empty. The new file is in the same directory as this script.</p> <pre><code>&lt;?php if(strlen($_POST['name'])&lt;1){ echo "error: you must enter a filename&lt;br&gt;&lt;a href=data.php&gt;back&lt;/a&gt;"; exit(); } $name = $_POST['name']; $data = file_get_contents("temp.php"); $fh = fopen("$name", 'w') or die("can't open file"); fwrite($fh, $data); fclose($fh); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Length: ". filesize("$name").";"); header("Content-Disposition: attachment; filename=$name"); header("Content-Type: application/octet-stream; "); header("Content-Transfer-Encoding: binary"); ?&gt; </code></pre>
php
[2]
2,453,577
2,453,578
Assign valuefield and textfield to listbox
<p>Hi Friends i develop a webpage in that i need to add value field and text field to listbox item i tried the following code , but it's not working , Please help me to solve the issue . Thanks in advance</p> <pre><code> string[] category = new string[100]; char[] delimeter = { '~' }; category = Convert.ToString(dtable.Rows[0].ItemArray[5]).Split(delimeter); for (int h = 0; h &lt; category.Length; h++) { ListItem lstitem = lstCategory.Items.FindByText(category[h]); if (lstitem != null) { lstSelCategory.DataTextField = category[h]; lstSelCategory.DataValueField = lstitem.Value; } } lstSelCategory.DataBind(); } </code></pre>
c#
[0]
1,234,019
1,234,020
increase number of touch points in a Path
<p>I am drawing a <code>path</code> when a user drags his finger across screen. If, however, he does this too fast, I get too few points in <code>path</code>. Is there some way, I can increase the number of points in <code>path</code> <em>after</em> the user has drawn it? I need this because I am comparing each point of <code>path1</code> to all points on <code>path2</code> to see when these two <code>paths</code> are intersecting.</p>
android
[4]
5,480,244
5,480,245
PHP: How do I run a loop during a certain time of the day?
<p>I have a loop which runs in php..</p> <p>I only want the loop to run if the local (sydney, australia) time is between 1pm and 3pm.</p> <p>Can anyone provide an example of how this would function? Thank you!</p>
php
[2]
5,035,654
5,035,655
check all the checkboxes by clicking on the "ALL" checkbox using jquery
<pre><code>&lt;body&gt; &lt;input type="checkbox" id="chkMain" /&gt; &lt;input type="checkbox" id="chkMain1" /&gt; &lt;input type="checkbox" id="chkMain2" /&gt; &lt;br&gt; &lt;P&gt;&lt;input class="child" type="checkbox" id="chk1" disabled="true" /&gt; &lt;input class="child" type="checkbox" id="chk" disabled="true" /&gt; &lt;input class="child" type="checkbox" id="chk" disabled="true" /&gt; &lt;input class="child" type="checkbox" id="chk" disabled="true" /&gt; &lt;input class="child" type="checkbox" id="chk" disabled="true" /&gt; &lt;input class="child" type="checkbox" id="chk" disabled="true" /&gt; &lt;input class="child" type="checkbox" id="chk_all" disabled="true" /&gt;ALL&lt;/p&gt;&lt;/br&gt; $(function(){ $("input[id^=chkMain]").click(function(){ var otherCks = $("input[id^=chkMain]").not(this); if( !$(this).is( ":checked" )) { $(".child").attr("disabled" , true ); otherCks.removeAttr ( "disabled" ); } else { $(".child").removeAttr ( "disabled" ); otherCks.attr("disabled" , true) } }); }); </code></pre>
jquery
[5]
4,307,927
4,307,928
How to read special characters
<p>I am getting a value of column from database like below:</p> <pre> `;;][@+© </pre> <p>When I am reading this in my Python code this is giving below error message:</p> <pre> UnicodeDecodeError: 'utf8' codec can't decode byte 0xa9 in position 7: invalid start byte </pre> <p>Then I tried below code but not working:</p> <pre><code>unicode(' `;;][@+©', 'utf-8') </code></pre> <p>Now how can I solve this problem?</p>
python
[7]
3,147,291
3,147,292
What does the double exclamation !! operator mean?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/784929/what-is-the-operator-in-javascript">What is the !! operator in JavaScript?</a><br> <a href="http://stackoverflow.com/questions/2168406/what-does-double-exclamation-point-mean">What does !! (double exclamation point) mean?</a> </p> </blockquote> <p>I am going through some custom JavaScript code at my workplace and I am not able to understand the following construct. </p> <pre><code>var myThemeKey = (!!$('row') &amp;&amp; $('row').hasClassName('green-theme')) ? 'green' : 'white'; </code></pre> <p>I understand everything on the above line except <code>!!</code> operator. I assume that it is a <code>NOT</code> operator and <code>NOT</code> of <code>NOT</code> is the original value but why would someone do a <code>NOT</code> of <code>NOT</code>? </p> <p>Can someone please help me understand what is happening on the above line of code?</p>
javascript
[3]
2,750,808
2,750,809
How do I develop a large whitelist of pages for a PHP include?
<p>It's clear that for any reasonable-sized website, building it in modules using PHP includes has great advantages, so I chose to dynamically create the page content using includes. I was against the idea of including the header and footer, so I did the inverse like this (index.php):</p> <pre><code> if(isset($_GET['page'])) { $whitelist = array("contact","about","access", etc.); if(in_array($_GET['page'], $whitelist)) { include($_GET['page'].".php"); } } else { include('home.php'); } </code></pre> <p>Some people object to this on security grounds (although they never give an alternative), but I find it to be a neat solution. My question is, what happens when my site has hundreds or even thousands of pages? Do I just keep adding variables to the whitelist array until it becomes huge, or is there a better way?</p>
php
[2]
4,883,110
4,883,111
asp.net dynamic control and jquery
<p>I have some controls being dynamically added to the placeholder control and on the page it has the HTML button (not asp button) that does the validation on the dynamic controls. And the click event handler of the HTML button is in the .js file. </p> <p>Can anyone suggest the best method to do this?</p>
asp.net
[9]
2,766,427
2,766,428
Adding content to variable
<p>sorry I don't know the exact term for this. I'ld like to add content to "mymeta" from the loops and echos. I tried this but it's not working:</p> <pre><code> $mymeta = if (strlen($finalArray['Title']) &gt; 0){ echo $finalArray['Title'] . " | "; } + else if (strlen($finalArray['Name']) &gt; 0){ echo $finalArray['Name'] . " | "; } + else if (strlen($finalArray['Caption']) &gt; 0){ echo $finalArray['Caption'] . " | "; } + echo $finalArray['Date'] . " | " ; </code></pre> <p>Thanks for tips.</p>
php
[2]
1,399,983
1,399,984
Site works on laptop at public and uni wifi but not at home and Unsafe JavaScript attempt to access frame
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/10880177/solutions-to-unsafe-javascript-attempt">Solutions to Unsafe JavaScript attempt?</a> </p> </blockquote> <p>Hi so when my cousin tries to access a game on my laptop we get:</p> <p>4event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future. Unsafe JavaScript attempt to access frame with URL <a href="http://starproject.galaxy-games.com/content/play-star-project" rel="nofollow">http://starproject.galaxy-games.com/content/play-star-project</a> from frame with URL <a href="http://spgame.galaxy-games.com/star_galaxy/File/Game_Main.php" rel="nofollow">http://spgame.galaxy-games.com/star_galaxy/File/Game_Main.php</a>. Domains, protocols and ports must match. swfobject.js:3</p> <p>THing is on the same laptop, the game works at uni or public wifi, but at home wifi it doesn't work at all! Theres obviously nothing wrong with the hardware as i'm using the exact same websites, when at home, i get these codes and errors (has not checked if i get theses at uni)</p>
java
[1]
4,113,605
4,113,606
Is it possible to code images into a python script?
<p>Instead of using directories to reference an image, is it possible to code an image into the program directly? </p>
python
[7]
4,893,316
4,893,317
How to add an option from a drop down menu into a select box?
<p>I have a jquery code below where an option which has been selected from a drop down menu is removed from the drop down menu:</p> <pre><code> var selectedOption = jQuery("#modulesDrop option:selected"); selectedOption.remove(); </code></pre> <p>But before I perform the remove, I want to add the content from the drop down menu into a select box, but the problem is that I don't seem to know how to do this. I tried the code below but all that did was remove the option from the drop down menu as above and did not add the option into the select box:</p> <pre><code> var selectedOption = jQuery("#modulesDrop option:selected"); selectedOption.appendTo("#moduleExistForm"); selectedOption.remove(); </code></pre>
jquery
[5]
4,436,620
4,436,621
iPhone:Problem with String Concatenation
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/510269/how-do-i-concatenate-strings-in-objective-c">How do I concatenate strings in Objective-C?</a> </p> </blockquote> <p>Hello,</p> <p>I am retrieving 10 separate strings from an XML parser. I want to append all the strings together. I checked for string concatenation in Obj-C and tried the below code, but it doesn't work as expected. Every time it overwrites with the new string. </p> <pre><code> NSString *newstring; // Global variable [newstring stringByAppendingString:newStrGotFromXML]; </code></pre> <p>Could someone guide me to resolve this?</p> <p>Thank you!</p>
iphone
[8]
4,984,363
4,984,364
conventional wisdom Jquery: how do I know I have selected etc
<p>Learning jquery right now though I guess this question could be true of any programming language.</p> <p>I'll ask the question by example:</p> <p>Currently reading "jquery fundamentals". In the exercises one of the questions is "Figure out how many elements on the page are hidden (hint: .length)."</p> <p>I've written the code "$('html :hidden').length;"</p> <p>At this stage I did not know the output. To know if I had written the right code I then wrote:</p> <p>"var hidden = $('html :hidden').length;</p> <p>$('h3').html(hidden);"</p> <p>The h3 changed to "8" which told me that there are 8 hidden elements on the page. Changing the h3 element to find out that I had done something correctly seems a bit crude. Is there a conventional way to know if you have either selected an object correctly or to know a value without actually writing on the html doc?</p>
jquery
[5]
2,649,920
2,649,921
python-read file names and build a namelist
<p>I want to make a name list and store all the names in four folders. I build</p> <pre><code>namelist = {1:[], 2:[], 3:[], 4:[]} </code></pre> <p>In the method, I write</p> <pre><code>for file_name in sorted(os.listdir(full_subdir_name)): full_file_name = os.path.join(full_subdir_name,file_name) #namelist[level] += blabla... </code></pre> <p>I want to add the names from the first folder into namelist[1], from the second folder to namelist[2]. I don't know how I can add all the names in different levels to it. Thx!</p>
python
[7]
2,842,805
2,842,806
Changing button background dynamically in thread in Android
<p>I'm developing my first app for Android and its supposed to be a game. Everything is fine but there's one thing I just can't wrap my head around.</p> <p>In my game's "main" activity (not the first activity which starts when the app starts) I want to have a method which starts a thread which changes a buttons background color/image (go with color because I haven't made any images just yet) for one second then turns it back. I wan't the method to also have an integer parameter which makes it perform this n times. I want to be able to call like <code>changeButtons(5);</code> and it turns button x background blue for 1 second then waits 1 second five times.</p> <p>So practically I'm trying to make a "main" thread which runs during the game and inside that thread I'm going to run this method whenever certain conditions are true (a thread which calls a thread).</p> <p>So I have 2 questions. The first one is "Is this possible? " and If so can someone show me how to do it (not all of it of course but help me get started at least)? Especially I want to know if I can change a buttons background color in a thread and if so can someone show me how to write/get me started that thread? </p> <p>The second question is a follow-up, if you can do this, can you have a like a <code>boolean b</code> which turns to true if someone presses a button and the thread can "notice" that change? For example, if the thread is running and Obama presses button x and b turns "true" in the method <code>OnClick(View v)</code> can I, inside my main thead have an <code>if(b == true){Obama.moon();}</code> and Obama will moon? </p>
android
[4]
1,241,875
1,241,876
How can i filter data by checkbox check or uncheck
<p>I have a few checkbox like below. and when one checkbox checked it must load result from mysql and when unchecked again it must load result without page refresh.</p> <p>Almost it is same with <a href="http://www.facebook.com/find-friends/browser/" rel="nofollow">http://www.facebook.com/find-friends/browser/</a></p> <p>How can i do?</p> <pre><code> &lt;div class="tags"&gt; &lt;label&gt;&lt;input type="checkbox" class="arts" /&gt; Arts &lt;/label&gt; &lt;label&gt;&lt;input type="checkbox" class="computers" /&gt; Computers &lt;/label&gt; &lt;label&gt;&lt;input type="checkbox" class="health" /&gt; Health &lt;/label&gt; &lt;label&gt;&lt;input type="checkbox" class="video-games" /&gt; Video Games &lt;/label&gt; &lt;/div&gt; </code></pre>
php
[2]
948,532
948,533
Split() method in Java for multi-dimensional array
<p>I have a two dimensional array. The assignment is to accept row and columns numbers from user and if user wants to enter numeric data row by row (or column by column) he has to do that with comma. Such as, 3x3 will be:</p> <p>1,2,4</p> <p>2,5,3</p> <p>5,3,2 </p> <p>So the the first row elements will be [0,0]=1 [0,1]=2 [0,2]=3, second row [1,0]=2 [1,1]=5 [1,2]=3, etc. I understand I should possibly do that with string, then split it for ", " and then convert it no Integer, but I have no idea how to do split in such case. </p> <p>This is what I have for rows input: </p> <pre><code>for (int row=0; row&lt;board.length; row++){ for (int column=0; column&lt;board[row].length; column++){ //System.out.print("["+board[row]+"]["+board[column]+"]: "); board[row][column] = myInput.nextInt(); //input validation while ((1 &gt; (board[row][column])) || ((board[row][column]) &gt; board.length)) { System.out.println("Please enter number between 1 to "+ board.length +":"); board[row][column] = myInput.nextInt(); } } } </code></pre>
java
[1]
4,551,811
4,551,812
matching multiple file extensions with fnmatch()
<p>In the typical file matching code:</p> <pre><code>while (false !== ($file = readdir($handle))) { if ($file !== "." &amp;&amp; $file !== ".." &amp;&amp; fnmatch($mask, $file)) { $dirList[] = $file; } } </code></pre> <p>I was trying to use a multiple file extension pattern like this:</p> <pre><code>$mask = "*.{jpg,png,gif}"; </code></pre> <p>but it doesn't work. No files match. This is rather strange since the same pattern works just fine in a terminal. It also works perfectly well with glob(), returning the files I want. I know there's nothing wrong with the rest of the code because using "*.jpg" as mask also works with fnmatch. Wasn't fnmatch supposed to support the same patterns that are available in a shell?</p>
php
[2]
346,898
346,899
how to use jquery to remove option from select box
<p>How to use jquery to delete opt1 row ? How about changing opt2 to become selected? Note that the values are random numbers.</p> <pre><code> &lt;select name="ShippingMethod" &gt; &lt;option value="8247(random)"&gt;Opt2&lt;/option&gt; &lt;option value="1939(random)" selected="selected"&gt;Opt1&lt;/option&gt; &lt;/select&gt; </code></pre>
jquery
[5]
5,396,106
5,396,107
DNS query in android source code
<p>Can someone please point out the code in android source code, where a DNS query is being made?</p> <p>I tried to locate the code where the actual DNS query is sent from an application, but i couldn't.</p> <p>Any help would be great.</p> <p>Thanks in advance</p>
android
[4]
3,944,222
3,944,223
Replace text with JavaScript
<p>I need to replace text using Javascript. It's a little different than the other ones I've seen on S.O. because the text that needs to be added in is an incrementing integer.</p> <p>For example: Replace the string: "John Mary Ellen Josh Adam" with "John1 Mary2 Ellen3 Josh4 Adam5"</p>
javascript
[3]
5,046,051
5,046,052
How to Make Web Service Call Without Making the GUI Unresponsive
<p>I have a <code>UISearchBar</code> and <code>UISearchDisplayController</code>. When the user writes text in it inside <code>searchBar:textDidChange:</code> I make a web-service call to filter my TableView. The problem is that the GUI get unresponsive until I get the result from the web-service. I've tried to solve it using <code>[self performSelector:@selector(callWebService:) withObject:searchText];</code>, but it's still unresponsive. </p> <p>EDIT: Following Flink advice, I changed <code>performSelector</code> to <code>performSelectorInBackground</code>, but now the tableView doesn't filter correctly, it only show 'No Results'. even <code>tableView:numberOfRowsInSection:</code> isn't get called.</p> <p>EDIT Again: The reason I got 'No Results' was due to not calling <code>reloadData</code> on the correct tableView. <code>UISearchDisplayController</code> has a property named <code>searchResultsTableView</code>. So in the end what I used was <code>[self.searchDisplayController.searchResultsTableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:false];</code> and now it works fine.</p> <p>It should be noted that although I chose the <code>performSelectorInBackground</code>, I probably should have tried to use <code>sendAsynchronousRequest</code> method on <code>NSURLConnection</code> - See AliSoftware's answer.</p>
iphone
[8]
1,883,643
1,883,644
hightlight a particular td
<p>What I would like to do (and is of course not working) is:</p> <ul> <li>When the user changes the value of the input in a row, that then the unit price and the subtotal tds in THAT row changes the background to orange (the class for that is <code>.basket-table td.hightlight</code>).</li> </ul> <p>It also needs to be highlighted for a specific time and later the bg needs to turn back to light blue.</p> <p>This is the link: <a href="http://jsfiddle.net/Q4T58/" rel="nofollow">http://jsfiddle.net/Q4T58/</a></p> <p>Could you please help me?<br> Many thanks in advance!!</p>
jquery
[5]
702,470
702,471
SymJavaAPI for file scanning through java programme
<p>I need SymJavaAPI.jar for file scanning through java. Where and how to get it?</p> <p>Thanks for any help!</p>
java
[1]
4,936,446
4,936,447
How to animate views?
<p>I'm working on a game that in some ways is similar to Tetris (imagine a 2D array of colored squares that sometimes move around)</p> <p>I am trying to animate the individual squares so they will smoothly slide down from coordinate to the next. Since I wanted to use Android's built-in tweening feature, the animation has to apply to the whole View (rather than parts of it). This doesn't work well for me because I only want some of the colored squares to slide down, and the rest of them to stay still.</p> <p>The (theoretical) solution I came up with to resolve this is to make 2 Views, layered directly on top of each other. The top view is for animating squares when they need to move, and the bottom layer is for the static squares. The animation-layer is transparent until I am ready to animate something. I then simply turn on the colored square in the animation-layer, tween it to the new location, and turn it back off when done. In the same time span, the static-layer just turns squares on and off at the right time to make the whole thing look seamless to the end user.</p> <p>The proposed solution is just a theory, since I haven't been able to make it work correctly yet. Since I have been having trouble, I was wondering if this is even the best way to solve the problem? Perhaps there is a more elegant solution that I am over looking? Anyone know of a better way?</p>
android
[4]
627,459
627,460
Click on link - delay before navigating to a different location
<p>is there any easy way to create a code: if URL changes or clicked on a link show div (like loading gif 3-sec) then show the page? Kinda like blank white page with loading gif spin 3 sec then show the page?</p> <p>Thanks!</p>
jquery
[5]
3,617,710
3,617,711
How to handle null exception in my case
<p>I have defined a function:</p> <pre><code>public MyCar findCar(){ MyCar car = CarManager.findCarById("U983"); //Nullpointer Exception here if no car be found if(car!=null) return car; else return null; } </code></pre> <p>When I invoke the above function in Java, If the above <code>CarManager.findCarById()</code> did not find any car, it returns <code>null</code>, and I try to check in <code>if condition</code> that if it is <code>null</code> return <code>null</code> other wise return the <code>car</code>.</p> <p>But the <code>findCar()</code> function always stop and raise <strong>Nullpointer Exception</strong> when findCarById() did not find any car, without go through my <code>if condition</code>. How to get rid of it?</p> <p><strong>============ findCarById() is a library API I can not modify =================</strong></p>
java
[1]
1,386,967
1,386,968
how to convert some character into numeric in php?
<p>dear i need help for change a character in php. i get some code from web:</p> <pre><code>char dest='a'; int conv=(int)dest; </code></pre> <p>can i use this code for convert character into numeric? or do you have any idea? i'm just want to show result as decimal number:</p> <pre><code>if null == 0 if A == 1 </code></pre>
php
[2]
3,392,153
3,392,154
Directory listing using PHP
<pre><code>&lt;?php function directory_listing($directory_name) { if ($handle = opendir($directory_name)) { while (false !== ($entry = readdir($handle))) { if ($entry != "." &amp;&amp; $entry != "..") { if(is_dir($entry)) { **//program is avoiding this block echo $entry.'--&lt;br/&gt;';** } else { echo $entry.'&lt;br/&gt;'; } } } closedir($handle); } } directory_listing('go'); ?&gt; </code></pre> <p>I would like to have a directory listing with the above code. But the program is avoiding the mentioned <strong>if block</strong>. </p> <p>Thanks</p> <p>Foysal </p>
php
[2]
2,466,061
2,466,062
C# Calculate items in List<int> values vertically
<p>I have a list of int values some thing like below (upper bound and lower bounds are dynamic)</p> <pre><code>1, 2, 3 4, 6, 0 5, 7, 1 </code></pre> <p>I want to calculate the column values in vertical wise like</p> <pre><code>1 + 4 + 5 = 10 2 + 6 + 7 = 15 3 + 0 + 1 = 4 </code></pre> <p>Expected Result = <code>10,15,4</code></p> <p>Any help would be appreciated</p> <p>Thanks</p> <p>Deepu</p>
c#
[0]
1,676,446
1,676,447
Initializing a class using a static constructor?
<p>In what situations do I initialize a class using a <em>static constructor</em>?</p>
c#
[0]
443,962
443,963
How to apply style to a confirm pop-up window
<p>is it possible to give style to a confirm dialog box in javascript?</p> <p>i am using asp.net with c#.</p> <p>Eg:- OnClientClick='javascript:return confirm("Are you sure, Do you really want to delete this item ")'</p> <p>how to give style for this dialog box?</p>
javascript
[3]
5,734,126
5,734,127
Transforming nested list in Python
<p>Assuming I have a structure like this:</p> <pre><code>a = [ ('A', ['D', 'E', 'F', 'G']), ('B', ['H']), ('C', ['I']) ] </code></pre> <p>How can I transform it into:</p> <pre><code>a = [ ('A', 'D'), ('A', 'E'), ('A', 'F'), ('A', 'G'), ('B', 'H'), ('C', 'I'), ] </code></pre> <p>Thanks for your time!</p>
python
[7]
4,432,837
4,432,838
Use line-break as separator for an array input?
<p>I've never actually used arrays before, as I've never had to so far (a simple variable has been enough for me), however now I've created a form with a text-area that is meant to POST multiple urls through to my PHP script.</p> <p>What I want to do is use a line-break in the visitors input to act as a separator for an array input.</p> <p>For example, the visitor inputs 90 lines of text (all url's), the array breaks each one into a list of 90, and creates an array value for each one.</p> <p>Any info, advice or comments would be greatly appreciated :)!</p>
php
[2]
3,489,347
3,489,348
Create iPhone app programmatically, in its entirety
<p>I recently became interested in iPhone app development, so I've been looking at online tutorials, and also reading a book, trying out the examples as I go along.</p> <p>I'm getting better, but one of the things I still find quite annoying about the usual development model is that I really have no idea what the SDK is really doing behind the scenes to make the app "work" because Apple <em>protects</em> me from this. For example, when I make connections on interface builder, this presumably corresponds to code being generated somewhere... Where that code is and what it does and how it works are not obvious (to me).</p> <p>So I'm wondering, is it possible to create an iPhone app entirely programmatically? That is, have execution start in some main method, which will then programmatically create any views, register event listeners, etc. And if yes, what are some good resources for something like this?</p>
iphone
[8]
4,081,666
4,081,667
Most elegant way to achive the some element?
<p>I wrote function onclick of <code>a</code> element</p> <pre><code> &lt;div class="left_collapsed"&gt;Որոնում&lt;/div&gt; &lt;div class="container" style="display: none;"&gt; &lt;ul&gt; &lt;li&gt; &lt;a href="" id="search_refresh" &gt;Թարմացնել համակարգը&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; $("#search_refresh").click(function(u) { how can i achieve to first div element here? (i have many div's with left_collapsed class ) }); </code></pre> <p>i wrote <code>$(this).parent("li").parent("ul").parent("div").before("div").addClass("left_expended");</code></p> <p>but i dislike it:)</p> <p>Thanks much</p>
jquery
[5]
5,334,783
5,334,784
HashSet doesnt guarentee sorting?
<pre><code>import java.util.*; public class DuplicateCheckMain { public static void main(String[] gopal){ Integer[] args = {6,9,2,55,100,1,6,8,9}; Integer[] args1 = {3,6,2,3,5}; Set S = new HashSet(); DuplicateCheck.checkDuplicate(S,args,new String("HashSet")); Set S1 = new HashSet(); DuplicateCheck.checkDuplicate(S1,args1,new String("HashSet")); S = new TreeSet(); DuplicateCheck.checkDuplicate(S,args,new String("TreeSet")); S = new LinkedHashSet(); DuplicateCheck.checkDuplicate(S,args,new String("LinkedHashSet")); } } public class DuplicateCheck { public static void checkDuplicate(Set S, Integer[] args, String setname){ for(int i = 0;i&lt;args.length;i++){ if(!S.add(args[i])){System.out.println("Duplicate element "+args[i]);} } System.out.println(S +" "+ setname); } } </code></pre> <p>Question: for the HashSet with reference S, the HashSet is not sorted. But for the reference S1, the HashSet is sorted. Why so?</p>
java
[1]
5,221,911
5,221,912
how to set get_magic_quotes_gpc to Off
<p>How can I set get_magic_quotes_gpc to Off in php.ini ? I have tried to overwrite value to Off in php.ini. it is showing Off in file but when i echo, it returns 1 means On.</p> <p>any suggesion that can help me..</p> <p>I am using XAMPP server ...</p>
php
[2]
970,979
970,980
how to display file dialog with csv streamed from a server
<p>I am using jQuery.doGet() to get a csv file from the server. I am receiving the contents of the file in the onDataReceived function. How do I display the file dialog for the user to save it?</p> <p>adsafe.util.doGet(url, params, onDataReceived);</p> <p>onDataReceived(data) { // how do i launch the file dialog for the user to save this data as a file. }</p>
javascript
[3]
2,173,431
2,173,432
Show / hide several div
<p>I use this script :</p> <pre><code> &lt;script language="javascript"&gt; function toggle() { var ele = document.getElementById("mydiv"); var text = document.getElementById("displayText"); if(ele.style.display == "block") { ele.style.display = "none"; text.innerHTML = "show"; } else { ele.style.display = "block"; text.innerHTML = "hide"; } } &lt;/script&gt; </code></pre> <p>Called by :</p> <pre><code> echo '&lt;a id="displayText" href="javascript:toggle();"&gt;show&lt;/a&gt;'; </code></pre> <p>i want to show / hide several div (not in a list or a form)</p> <p>i try :</p> <pre><code> var ele = document.getElementById("mydiv", "mydiv2"); </code></pre> <p>but it's showing and hidding only the first div</p>
javascript
[3]
4,017,779
4,017,780
Performing a task every x time
<p>I'm trying to perform a task every 5 minute. The task need to start from: xx:00, xx:05, xx:10, xx:15 and so on so if the time is xx:37 the task will start in xx:40.</p> <p>I'm used the following code to do that:</p> <pre><code> Date d1 = new Date(); d1.setMinutes(d1.getMinutes() + 5 - d1.getMinutes()%5); d1.setSeconds(0); this.timer.schedule(new Send(), d1, TEN_MINUTES/2); </code></pre> <p>Send looks like that:</p> <pre><code>class Send extends TimerTask { public void run() { if(SomeCondition) { Timestamp ts1 = new Timestamp(new java.util.Date().getTime()); SendToDB(ts1); } } } </code></pre> <p>So the result should be records that if you % the minutes the result would be 0. But the records time I have is:</p> <p>*05:35:00 *07:44:40 *07:54:40 *09:05:31 *09:50:00</p> <p>As you can see the first task start perfectly but then something went wrong.</p> <p>My guess is that the task calculateds the 5 minute jump after the previous task is finished so the task run time effects, but it's just a guess.</p>
java
[1]
5,080,812
5,080,813
How to reduce the size of list item in android?
<p>I have gone through the link <a href="http://blog.sptechnolab.com/2011/02/01/android/android-custom-listview-items-and-adapters/" rel="nofollow">http://blog.sptechnolab.com/2011/02/01/android/android-custom-listview-items-and-adapters/</a> and executed the <strong>listview sample</strong> in android. <strong>I found the link very useful.</strong> </p> <p>But I want to reduce the size of the list item...i.e.: each <strong>listitem height became very big so i kept my images size from 60*60 to 32*32. But even then the same problem. How to reduce the height of listitem?</strong></p> <p>Thanks in advance.</p>
android
[4]
3,798,826
3,798,827
how are String objects immutable in this case?
<p>I agree with the fact that the String objects are immutable, means they cannot be modified. Like in the case below</p> <pre><code>String str = "Hi"; String str1 = str.concat("Nilesh"); </code></pre> <p>Here the str object will be returned if the length argument is 0 or a new String object will be created and its reference will be returned. And if i do</p> <pre><code>String str = "Hi"; str="Hello"; </code></pre> <p>How is it getting changed? where does immutable comes into picture? An example please.</p>
java
[1]
1,725,961
1,725,962
Delete an image via snapr page
<p>I'm currently making a 'snapr' page, where I take a screensnap with a program, which then uploads it to my server. When it uploads it shows it on a page that has the width, image name, height and image type (.PNG, .GIF etc)</p> <p>What I'd like to be able to do is have the ability to delete the image by inputting a password via PHP.</p> <p>The images are stored in a directory (/snapr/images/)</p> <p>(Example: <a href="http://snapplr.com/f0rm" rel="nofollow">http://snapplr.com/f0rm</a> this is a picture I uploaded to Snapplr.com, it has the 'DELETE PHOTO' below it)</p> <p>This is my current code for my page: <a href="http://pastebin.atmoner.com/nqa3N4Ma" rel="nofollow">http://pastebin.atmoner.com/nqa3N4Ma</a></p> <p>If anymore information is needed, just ask and Ill give you it.</p> <p>Hopefully this is described well enough.</p> <p>((This is my current snapr page: newfoundfaggot.net/snapr/?img=9cF8ME.png))</p>
php
[2]
3,605,486
3,605,487
How to Generate Random Alphanumeric string?
<p>I want to generate a password using numbers ,punctuation and alphabets(both lowercase and uppercase).how can i randomly generate this?</p>
iphone
[8]