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,303,975
1,303,976
Android Development: Keypress/keyEvent
<p>Im developing an application and got stuck. i have a normal simple Button. What i want to do is that if i click this button it will behave just like you press the SPACE on the soft keyboard.</p> <p>How do i do this. there must be a way because you can develop a softkeyboard.</p> <p>So repeat xP How do i "inject" a keypress or simulate a keypress if i press a button.</p> <p>Thank you! //Me</p>
android
[4]
1,294,931
1,294,932
what is the difference between StringBuilder and Stringbuffer?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/355089/stringbuilder-and-stringbuffer-in-java">StringBuilder and StringBuffer in Java</a> </p> </blockquote> <p>what is the difference between StringBuilder and Stringbuffer?</p>
java
[1]
5,250,971
5,250,972
Missing expected identifier
<p>Getting message <code>expected identifier</code> in red for below these two statements </p> <pre><code>} else if ([playpauseButton.state == UIControlStateSelected]) } else if ([playpauseButton.state == UIControlStateNormal]) </code></pre> <p>I m not getting where i m missing identifier in below play/pause/resumeaction</p> <pre><code>if( playpauseButton.state == UIControlStateNormal ){ [sender setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateSelected]; [audioPlayer play]; self.timer = [NSTimer scheduledTimerWithTimeInterval:11.0 target:self selector:@selector(displayviewsAction:) userInfo:nil repeats:NO]; } else if ([playpauseButton.state == UIControlStateSelected]) { [sender setImage:[UIImage imageNamed:@"Play Icon.png"] forState:UIControlStateNormal]; [audioPlayer pause]; [self pauseTimer]; } else if ([playpauseButton.state == UIControlStateNormal]) { [sender setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateSelected]; [audioPlayer play]; [self resumeTimer];}} </code></pre> <p>I have programmed this way because i want when play is pressed it should play audio file plus start <code>NSTimer</code> to load <code>view controllers</code> one after another. When pause is pressed it should pause audio file plus <code>NSTimer</code> to avoid further loading of <code>view controllers</code> one after another and finally pause is resumed back to play audio file from the same point it should resume timer to start loading <code>view controllers</code> one after the other from that point.</p> <p>If any one can help me to solve this.</p> <p>Appreciate help.</p> <p>Thanks.</p>
iphone
[8]
2,190,475
2,190,476
Is it a good thing create jquery plugins
<p>So let's say i'm building a huge website, something close to facebook size, and i'm using jquery for most of the client side stuff, now obviously there is probably going to be at least 4k lines of code and thousands of ajax request etc..</p> <p>So my question is fairly simple, what is the best way to build my jquery based scripts, should i create plugins for things that im going to use multiple times or should i just use functions and call them whenever i need?</p> <p><strong>EDIT</strong> Well maybe i overdid it with <code>facebook size</code> but it's going to be pretty big anyways..</p>
jquery
[5]
3,134,782
3,134,783
Error in moving file in php
<p>I have following script which is showing me warning on <code>move_uploaded_file</code>.</p> <blockquote> <p>Warning: move_uploaded_file(/home/oxfordmo/public_html/ticket/attachement/1320610829.docx) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/oxfordmo/public_html/ticket/open.php on line 53</p> <p>Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpLHjtMJ' to '/home/oxfordmo/public_html/ticket/attachement/1320610829.docx' in /home/oxfordmo/public_html/ticket/open.php on line 53</p> </blockquote> <pre><code> if ( $file != "" ) { $type = $_FILES["file"]["type"]; $ext = pathinfo( $_FILES["file"]['name'], PATHINFO_EXTENSION ); if ( $ext != "doc" || $ext != "pdf" || $ext != "docx" ) { if ( $_FILES["file"]["size"] &lt;= 1024 * 1024 ) { if ( file_exists( "$root/ticket/attachement/$time.$ext" ) ) { unlink( "$root/ticket/attachement/$time.$ext" ); } elseif ( !move_uploaded_file( $_FILES["file"]['tmp_name'], "$root/ticket/attachement/$time.$ext" ) ) { $errorfile = "Unable to move file to destination folder."; } $file = $time . '.' . $ext; $query = mysql_query( "UPDATE tkt_container SET attachment='" . $file . "' WHERE ticket_id='" . $ticket_id . "'" ) or die( mysql_error() ); } else { $errorfile = "File not saved. Size limit Exceed! "; } } else { $errorfile = "File not saved. Invalid Format!"; } } </code></pre>
php
[2]
1,117,922
1,117,923
How to handle collection of sounds for a game?
<p>We are working on a number of games that have a variety of sound effects as well as spoken phrases and expressions. The current design stores the sound snippets as individual numbered files. A set of #defines maps a human-readable name to the file name. For example:</p> <pre><code>#define SOUND_COOL @"0038" // Cool! #define SOUND_YOU_GOT_IT @"0039" // You got it! #define SOUND_FANTASTIC_1 @"0040" // Fantastic! version 1 #define SOUND_FANTASTIC_2 @"0041" // Fantastic! version 2 </code></pre> <p>One advantage of this approach is that the code becomes very readable. You can see what sound will play just by reading.</p> <p>One of the problems with this is that we have many intonations or versions of some phrases. Whenever appropriate, a hand-coded switch statement randomly chooses from among the available versions. </p> <p>It would be nice to generalize this and have the option to play a random version if more than one is available. One option here could be to abandon the #define approach and create a proper database table with fields that allow for selection of all sound files matching a given criteria. A class and methods would then encapsulate the desired functionality. </p> <p>What are some of the other ideas for organizing/cataloging sound in applications that might have hundreds of sound files?</p>
iphone
[8]
4,733,571
4,733,572
I need to write to a SQL Express db in my ASP.NET web site, is NETWORK SERVICE the account to use?
<p>I need to write to a SQL Express db in my ASP.NET web site, is NETWORK SERVICE the account to use?</p> <p>Thanks</p>
asp.net
[9]
5,019,723
5,019,724
Extracting string between <title> and </title> using PHP
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="http://stackoverflow.com/questions/3054347/php5-extracting-a-title-tag-and-rss-feed-address-from-html-using-php-dom-or-reg">(PHP5) Extracting a title tag and RSS feed address from HTML using PHP DOM or Regex</a><br> <a href="http://stackoverflow.com/questions/5869925/grabbing-title-of-a-website-using-dom">Grabbing title of a website using DOM</a> </p> </blockquote> <p>I am trying to run through a hundred different html files on my server, and extract the titles for use in another php file.</p> <p>For reference:</p> <pre><code> &lt;title&gt;Generic Test Page&lt;/title&gt; </code></pre> <p>What I need is a function that will return the string "Generic Test Page" and stick that into a global variable.</p> <p>What I am doing right now is simply reading the file into an array called $lines. Foreach $lines as $line, I am testing for the string &lt; title> ... but how do I extract only what's between the > and &lt; /title?</p> <p>My trouble is that sometimes the original developer decided to elaborate on the title: &lt; title name=title class=title1>, or he put it on three lines instead of one. What in the world? So I can't just strip the first seven characters and the last eight characters. Which would be so nice...</p> <p>Thank you!!</p>
php
[2]
586,478
586,479
What can cause a java.util.noSuchElementException?
<p>I'm getting a <code>java.util.NoSuchElementException</code> when running the following code, and I can't identify the cause of it:</p> <pre><code>package jBittorrentAPI; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Scanner; public class ThreadTest { static Object[] elements; static ArrayList Users; public static String fileRead(){ System.out.println("inside frs"); //List Users = new ArrayList(); Users = new ArrayList(); System.out.println("after "); try { File file1 = new File("c:\\coms.txt"); System.out.println("try"); Scanner Filereader1 = new Scanner(file1); while (Filereader1.hasNextLine()) { //int i = 0; String Name = Filereader1.next(); System.out.println("aftr string"); Users.add(Name); } //elements = Users.toArray(); // while(Users.iterator() != null){ for (int a =0; a &lt;elements.length; a++) { System.out.println(elements[a]); } } catch (FileNotFoundException e) { System.out.println("error" + e); } return "hi"; } public static void main(String[] args) { System.out.println("inside main"); ThreadRun tr= new ThreadRun(); Thread t= new Thread(tr); String s=fileRead(); System.out.println(s); for(int i=0;i&lt;Users.size();i++) { System.out.println(Users.get(i)); t.start(); //System.out.println("Thread no is "+t.getId()); } } } class ThreadRun implements Runnable { static int loop_break=0; public void run() { System.out.println(loop_break); loop_break++; } } </code></pre> <p>Would someone mind pointing out where I might be going wrong, or perhaps suggest ways to debug this?</p>
java
[1]
1,558,496
1,558,497
Jquery slideshow
<p>Help me to find some jquery plugin like this - <a href="http://fr.grandluxuryhotels.com/hotel/hotel-du-palais/offre-speciale/633-imperial-gourmet/" rel="nofollow">http://fr.grandluxuryhotels.com/hotel/hotel-du-palais/offre-speciale/633-imperial-gourmet/</a> ... Wide photos miving and changing each oother</p>
jquery
[5]
3,324,703
3,324,704
Python USSD via com port
<p>I am new to python. Is there anyway i can use python to send ussd with a phone via at+cusd commands. i can do that using hyperterminal. i want to automate using python. thanks.</p>
python
[7]
5,161,420
5,161,421
Accessing JavaScript objects
<p>Can someone please explain this bit of piece of code? Thanks.</p> <pre><code> alert({foo:"test foo", bar:"test bar"}.bar); // "test bar" </code></pre>
javascript
[3]
1,253,881
1,253,882
user input field
<p>how to create the database where allow user to key in the goal time? Based on the code below, the goal time has been assigned, so i would like to change that code and allow user key in the goal time as input..is it possible to do that? </p> <pre><code>&lt;?php $currenttime = date("H:i:s"); $goaltime = "04:10:00"; echo "Current time:$currenttime&lt;br&gt; Goal time: $goaltime&lt;p&gt;"; echo "&lt;meta http-equiv= 'refresh' content='5'&gt;"; if ($currenttime &gt;= $goaltime) { echo "&lt;b&gt;Goal has been reached!&lt;/b&gt;"; echo "&lt;div align=center&gt;&lt;img src=\"images/1.jpg\" alt=\"bla bla\" &gt;&lt;/div&gt;"; } else { echo "&lt;div align=center&gt;&lt;img src=\"images/red.jpg\" alt=\"bla bla\" &gt;&lt;/div&gt;"; echo "Have a nice day!"; } ?&gt; </code></pre>
php
[2]
4,351,266
4,351,267
In which memory static variables,local variables are presents?
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="http://stackoverflow.com/questions/405364/whats-up-with-static-memory-in-java">Whats up with static memory in java?</a><br> <a href="http://stackoverflow.com/questions/6569557/what-is-the-actual-memory-place-for-static-variables">What is the actual memory place for static variables?</a> </p> </blockquote> <p>In which memory static variables,local variables are presents like object is leave in heap </p>
java
[1]
5,409,624
5,409,625
problem with simple dll in c++
<p>Hello i do not use c++ but i try to make a simple dll in c++ by usin Microsoft visual studio 2008 this my steps 1-new project 2-select win32 and chose win32 project 3- from the win Application Wizard i chose Dll and in Additional Option i celect Empty Project 4-right click "Source Files" and add new item<br> 5- chose c++ file(.cpp) 6- in this file i write this code</p> <pre><code>#include &lt;windows.h&gt; __declspec(dllexport) int ss() { return 5; } </code></pre> <p>7-Build the project >> Build Succeeded</p> <p>but there is no dll file</p> <p>what is the wrong ??</p> <p>Thanks in advance.</p>
c++
[6]
2,520,905
2,520,906
How to get items from feed in iphone?
<p>iam developing RSS Reader, i need to get the items from the given Feed URL.I used Touch XML for this, but this is very slow.Is there any faster way? thanks.</p>
iphone
[8]
1,884,850
1,884,851
Execute multiple jQuery effects on the same element in parallel
<p>I see that this question was asked many times, but none of the solutions worked for me. I have two effects that I want to execute in parallel.</p> <p>I want the box to fade-in and bounce simultaneously: <a href="http://jsfiddle.net/6VVUG/">http://jsfiddle.net/6VVUG/</a></p>
jquery
[5]
1,303,085
1,303,086
unble to replace string
<p>This is my replace method in java but unble to replace for following.</p> <p>It replace only one \</p> <p>Please help. If any body have any different method for replace?</p> <p>I had tried java standard API but that is not working can please try following senario --> System.out.println(replace("this%s is the problem" , "%" , "\%"));</p> <pre><code>public static String replace(String str, String sub, String rep) { int s, p, q; int slen = sub.length(); StringBuffer sb = new StringBuffer(); s = 0; p = str.indexOf(sub); q = p + slen; while (p != -1) { sb.append(str.substring(s, p)); sb.append(rep); s = q; p = str.indexOf(sub, s); if (p != -1) { q = p + slen; } } sb.append(str.substring(s)); return sb.toString(); } </code></pre>
java
[1]
4,794,444
4,794,445
using LARGE_INTEGER gives me back error error C2679: '=' binary no operator found which takes a right-hand operand
<p>i have the following code:</p> <pre><code>QueryPerformanceCounter(&amp;timeStart); winMain::render(); //do stuff QueryPerformanceCounter(&amp;timeEnd); numCounts = ( timeEnd.QuadPart - timeStart.QuadPart); </code></pre> <p>All the 3 variables are declared as LARGE_INTEGER, the code should work since im following a book example, but i get:</p> <p>error C2679: '=' binary no operator found which takes a right-hand operand of type LONGLONG it might be '_LARGE_INTEGER &amp;_LARGE_INTEGER::operator =(const _LARGE_INTEGER &amp;)' 1> durante la ricerca di corrispondenza con l'elenco di argomenti '(LARGE_INTEGER, LONGLONG)'</p>
c++
[6]
3,189,028
3,189,029
Is it possible to animate each line of text with jquery?
<p>Is it possible to reveal text one line at at time in jquery? I know it can be done in flash I have an example here <a href="http://iliketoplay.dk/#/blog/deff" rel="nofollow">http://iliketoplay.dk/#/blog/deff</a>. On the video playing, the mouse clicks a circle which opens a box that contains text but each line of text is displayed one at a time with a really cool looking effect. Can it be recreated?</p>
jquery
[5]
570,977
570,978
Is it possible to Left align the Gallery Images in android?
<p>Images in the gallery view are starting from the center.How to make the images start from the left edge of the Gallery in android?</p>
android
[4]
1,575,457
1,575,458
Extracting data from a window in an application using c#
<p>I have an application which consists of a couple of windows along with the main one. Please help me to extract some data present in one of these windows using c#.. </p>
c#
[0]
429,002
429,003
Android : Writing part of text file to another file
<p>I have a multipart format text file. i am going threw the file looking for start of content and from then on writing the content to another file until i hit end of content.</p> <pre><code>FileInputStream in = new FileInputStream(getContentPath()); InputStreamReader sr = new InputStreamReader(in, "UTF-8"); BufferedReader buffreader = new BufferedReader(sr); String lineStr; while ((lineStr = buffreader.readLine()) != null) { if (lineStr == "") { FileOutputStream fos = new FileOutputStream("", true); OutputStreamWriter writer = new OutputStreamWriter(fos, "UTF-8"); BufferedWriter fbw = new BufferedWriter(writer); fbw.write(lineStr); fbw.newLine(); fbw.flush(); fbw.close(); } } </code></pre> <p>The problem i am getting is the resulting files encoding is all messed up. The input is utf8.</p> <p><a href="http://www.2shared.com/file/w04lFJT3/request_-1311485219e5071873-c2.html" rel="nofollow">Original in multipart format</a></p> <p><a href="http://www.2shared.com/file/w04lFJT3/request_-1311485219e5071873-c2.html" rel="nofollow">Just image file extracted(funny-pictures-bomb-squad-cat-chooses-the-blue-wire.jpg)</a></p>
android
[4]
3,167,186
3,167,187
Unable to delete a developer's certificate
<p>I mistakenly imported someone else's certificate(with his priv key) to my mac, and now I have two developer's certificates shown in my xCode. When I delete the unneeded certificate with its key in "Keychain Access", both the cert and the priv key magically reappear after sometime, how can I get rid of this? Is it automatically imported from somewhere e.g. the iphone developer's site?</p>
iphone
[8]
5,233,137
5,233,138
addProximityAlert and BroadcastReceivers
<p>I am currently working on a map app that has points of interest built into it. These points are supposed to be announced to the user by means of a proximity alert trigger. Here is the addproximityAlert() code that I'm using</p> <pre><code>loc.addProximityAlert(lat, longe, radius, -1, PendingIntent.getActivity( c, 0, new Intent().putExtra(loc_name, loc_name), flag)); </code></pre> <p>The idea is that once the alert fires an alert dialog pops up with a short blurb about the site with the option to either close the alert or get more info(uses WebView).</p> <p>Thus far I have no run-time or compile-time errors but as I approach each site, nothing happens.</p> <p>My theory on why nothing happens is that either;</p> <p>1) I haven't used the PendingIntent correctly, or</p> <p>2) I haven't set up the BroadcastReceiver correctly</p> <p>Here is the XML code for the BroadcastRecevier,</p> <pre><code>&lt;receiver android:name=".ProxyAlertReceiver" &gt; &lt;intent-filter&gt; &lt;action android:name="entering" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; </code></pre> <p>My current plan to fix this issue is to modify the PendingIntent to use a new Intent like this;</p> <pre><code>...new Intent(myContext, ProxyAlertReceiver.class)... </code></pre> <p>and see if I get any results.</p> <p>Opinions and advice on my issue would be greatly appreciated!</p>
android
[4]
1,003,005
1,003,006
C++ Loop: expected primary-expression before ‘;’ token
<p>I have a loop like below, I think the problem is with the inner for loops marked "See here". Whats the problem with that? </p> <pre><code>// measure time to write different sizes of data for (int i = 0; i &lt; sizeof(sizes)/sizeof(int); i++) { lengthMod = sizes[i]/sizeof(int) - 1; start = wall_clock_time(); for (unsigned int j = 0; j &lt; 10; j++) // &lt;&lt; See here!!! tmp = 1; // force any write back cache to flush. read from other data source for (unsigned int j = 0; j &lt; REPS; j++) // &lt;&lt; Or here!!! tmp = j; end = wall_clock_time(); timeTaken = ((float)(end - start))/1000000000; fprintf(stderr, "%d, %1.2f \n", sizes[i]/1024, ((float)(end - start))/1000000000); } </code></pre> <p>You can see the <strong><a href="https://github.com/jiewmeng/cs3210-assign1/blob/master/cache-write.cpp" rel="nofollow">full source on GitHub</a></strong> ~line 32</p> <hr> <pre><code>g++ -O3 cache-write.cpp -o cache-write -lrt cache-write.cpp: In function ‘int main()’: cache-write.cpp:36:27: error: expected primary-expression before ‘;’ token cache-write.cpp:36:27: error: expected ‘)’ before ‘;’ token cache-write.cpp:36:29: error: name lookup of ‘j’ changed for ISO ‘for’ scoping [-fpermissive] cache-write.cpp:36:29: note: (if you use ‘-fpermissive’ G++ will accept your code) cache-write.cpp:36:32: error: expected ‘;’ before ‘)’ token cache-write.cpp:44:11: error: ‘data1’ was not declared in this scope make: *** [cache-write] Error 1 </code></pre>
c++
[6]
898,039
898,040
Modify jQuery function to add onload
<p>I have a page with several drop-down selectors. When an option is selected a matching piece of HTML is found and placed in the immediately following the drop-down. When selection is made a function checks to make sure that not of the previously selected options is selected again...</p> <hr> <p>UPDATE: Sorry, not worth posting here. Solutions is simple with server-side. Please vote to close this question.</p>
jquery
[5]
1,401,479
1,401,480
Use PHP to convert PNG to JPEG
<p>I have a website where users have been uploading a bunch of high quality PNG files. I want to use PHP to convert them to JPEG and re-size them to make them smaller in file size.</p> <p>How can I do this when they upload the file? What is the process for doing this? Is a new image created or is it edited? </p> <p>Thanks</p>
php
[2]
112,834
112,835
setting a variable to each element of an array
<p>i have function:</p> <pre><code>function getFieldNames(arrayOfRecords) { var theStuff; for (var i = 0; i = arrayOfRecords.length - 1; i++){ theStuff = arrayOfRecords[i]; theList = theStuff.split('" '); for (var j = 0; j = theList.length - 1; j++) { var v = theList[j].split('="'); fName1[i][j] = v[0]; } } return fName1; } </code></pre> <p>the argument arrayOfRecords is an array, and i dont know how to setup to the 'theStuff' variable an array element? When I do like it is above, i get something stupid.</p> <p>can anyone help me? :)</p>
javascript
[3]
946,061
946,062
How to append to a JavaScript array dynamically?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2250953/how-do-i-create-javascript-arrayjson-format-dynamically">How do I create Javascript array(JSON format) dynamically?</a> </p> </blockquote> <p>I am attempting to create the following:</p> <pre><code>var employees = {"accounting": [ // accounting is an array in employees. { "firstName" : "John", // First element "lastName" : "Doe", "age" : 23 }, { "firstName" : "Mary", // Second Element "lastName" : "Smith", "age" : 32 } ] // End "accounting" array. } // End Employees </code></pre> <p>I started out with:</p> <pre><code> var employees=new Array(); </code></pre> <p>How do I continue to append to the array dynamically (might change firstName with variable)?</p>
javascript
[3]
3,592,983
3,592,984
How to use external projects in an ASP.NET project
<p>UPDATE : It turned out that the project I was referring to was a console app. Rebuilding it as a class library was the solution.</p> <p>I guess this should be an easy one : </p> <p>I have only just started ASP.NET and for now need it only as a tool for some quick intranet reporting. I have an existing project that supplies the data, but I am not able to refer to it from within my web project. </p> <p>The library is called (for example sake) 'Lib' and I want to test the static method "HelloWorld()" in Utils. I have included the Lib project in the References. The compiler knows it's there cause Intellisense is working and the project dependencies indicate that the webproject is depdendant on Lib.</p> <pre><code>&lt;div&gt; &lt;% Response.Write(Lib.Utils.HelloWorld()); %&gt; &lt;/div&gt; </code></pre> <blockquote> <p>Compiler Error Message: CS0103: The name 'Lib' does not exist in the current context</p> </blockquote> <p>Of course I am very newbee, but in the examples and tutorials for beginners, I haven't fount how to refer to external projects. </p> <p>Thanks!</p>
asp.net
[9]
1,199,268
1,199,269
Custom PHP App with a wordpress site
<p>I have created a new 'page template' and (this is probably not the right way to do this, but this is the way I have got it working), and created a new page using that template. Within the page template (PHP file) I have made, I have put lots of PHP which makes the page function, like it has a simple login an view information from a SQL table.</p> <p>The problem is, I need to be able to send $_GET data to the page. I can send POST fine, but not GET, and I dont know what the URL is.</p> <p>For example, I would like to have clean URLs (that is what I have set wordpress to)</p> <p>i.e.:</p> <p>domain.com/teaching-portal/mygetdata</p> <p>The name of the page template is teaching-portal, and I would like to get <code>mygetdata</code> into PHP. But currently anything passed after teaching-portal results in a 404 page.</p> <p>How can i achieve this?</p>
php
[2]
5,836,944
5,836,945
ECG healthcare monitoring system in android
<p>i just need to do ECG healthcare monitoring system in android.I don't have any idea regarding that. what are the necessary things &amp; how could i do that.?Pls help me.Its urgent.Thanks in advance. Rgds, Sudhir.</p>
android
[4]
834,622
834,623
How can I change the entered key through keyboard outside my application in C#?
<p>I am trying to change the entered key by keyboard.</p> <p>I have managed to restrict key entered by keyboard.</p> <p><strong>Code in C#:</strong></p> <pre><code> using System.Runtime.InteropServices; public partial class Form1 : Form { public Form1() { InitializeComponent(); SetWindowsHookEx(WH_KEYBOARD_LL, hookProc, LoadLibrary("User32"), 0); HookedKeys.Add(Keys.A); HookedKeys.Add(Keys.B); } [DllImport("user32.dll")] static extern IntPtr SetWindowsHookEx(int idHook, keyboardHookProc callback, IntPtr hInstance, uint threadId); [DllImport("kernel32.dll")] static extern IntPtr LoadLibrary(string lpFileName); const int WH_KEYBOARD_LL = 13; const int WM_KEYDOWN = 0x100; public List&lt;Keys&gt; HookedKeys = new List&lt;Keys&gt;(); public delegate int keyboardHookProc(int code, int wParam, ref keyboardHookStruct lParam); public struct keyboardHookStruct { public int vkCode; } public int hookProc(int code, int wParam, ref keyboardHookStruct lParam) { Keys key = (Keys)lParam.vkCode; if (HookedKeys.Contains(key)) return 1; else return 0; } } </code></pre> <p>After debugging check on Notepad or anywhere else in window.... A and B key will not work</p> <p><strong>How can I modify the keys, in place of 'A' some other key?</strong></p>
c#
[0]
205,978
205,979
Make a relativeLayout and it's child im my case an imageview act like one button
<p>Hi im trying to accomplish the following layout.</p> <p>I have two RelativeLayout, each one contains a TextView and an ImageView. </p> <p>the imageView show to the user the choice that he picked!!.These two picture explains more what i want to do:</p> <p><img src="http://i.stack.imgur.com/CVD7N.jpg" alt="normal state of the ui"></p> <p>This Picture show th normal state of the ui, no click events. When user click on the bottom layout th imageview in layout top will be set to invisible and the the image view in layout bottom appear showing to the user that the second choice was picked by the user. I didn't find it difficult to deal with this issue (setting click listener on relative layout and handle the visibility of imageview). </p> <p>the problem that im facing is how to make all the relative layout act like one button " when relative layout is clicked it turns to blue at the same time the imageview turns to white!!</p> <p>In short i would say how can i synchronize the two selector!!</p> <p><img src="http://i.stack.imgur.com/1JViO.jpg" alt="enter image description here"></p>
android
[4]
389,599
389,600
PHP emulator based website
<p>I want to make a website which is containing a mobile and i want to open a website inside this interface like mobile emulator.I tried with Iframe but this is not working properly. Any idea ? thanks</p>
php
[2]
3,399,393
3,399,394
App works on real phones but no longer on emulator
<p>My app works on two different phones, but it no longer works on the emulator. I immediately get the stopped unexpectedly error on the emulator. I have rebooted my computer, and it did not change things. I am at wits end!</p> <p>The debugger shows this:</p> <pre><code>Thread [&lt;1&gt; main] (Suspended (exception RuntimeException)) ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2663 ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2679 ActivityThread.access$2300(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 125 ActivityThread$H.handleMessage(Message) line: 2033 ActivityThread$H(Handler).dispatchMessage(Message) line: 99 Looper.loop() line: 123 ActivityThread.main(String[]) line: 4627 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 521 ZygoteInit$MethodAndArgsCaller.run() line: 868 ZygoteInit.main(String[]) line: 626 NativeStart.main(String[]) line: not available [native method] </code></pre>
android
[4]
370,355
370,356
How can I popup when no connection the default Connection Failed dialog?
<p>Whenever a application needs internet and connection fails, I get a message dialog </p> <p><code>Connection failed<br> This application requires network access. Enable mobile network or Wi-Fi to download data.</code></p> <p>and two buttons, Settings, Cancel.</p> <p>How do I detect there is no internet connection?<br> How do I popup a same dialog in my application?</p>
android
[4]
5,492,112
5,492,113
Invalid view state exception in asp.net. do you know any solution?
<p>this problem make me crazy! i have asp.net website it raise periodically this error (in IE8):</p> <pre><code> System.Web.HttpException: Invalid viewstate. at System.Web.UI.Page.DecryptStringWithIV(String s, IVType ivType) at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler .ProcessRequest(HttpContext context) ,... </code></pre> <p>or (in IE6)</p> <pre><code>System.FormatException: Invalid length for a Base-64 char array. at System.Convert.FromBase64String(String s) at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) </code></pre> <p>or (in IE7)</p> <pre><code>System.FormatException: Invalid character in a Base-64 string. at System.Convert.FromBase64String(String s) at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) </code></pre> <p>i set enableViewStateMac in web.config to false and defined machinekey in my web.config and defined UTF-8 encoding for every page but i received this errors.</p> <p><bR/> do you have any solution? <br/> best regards</p>
asp.net
[9]
648,926
648,927
Parse csv file and generate graphs in HTML file using C#
<p>I want to parse one csv file and generate the charts/graphs in the html file. I have worked with Microsoft Charts for Win Form Apps but dint find a way to extract/export them to HTML file. Can anyone help me with that?</p> <p>thanks in advance.</p>
c#
[0]
2,602,907
2,602,908
reading a file saved by another app in iphone
<p>Is there a way to have an app write a into a file and then have another app read from that file?</p> <p>I mean writting into the file system of the iPhone.</p> <p>I want to do this without using an internet connection. So uploading the file and then downloading from the other app is not what i mean.</p> <p>Thanks!</p>
iphone
[8]
466,083
466,084
Python Scripts for mac, how to run a program and get value back
<p>I am trying to build a script in python to mac OS, I need the script to run two other scripts; the only thing my scripts does is run a website, and return value 1 or 0. </p> <p>I just need to get the values, in windows i am getting then from CMD with "Exit value". </p> <p>But i am new to mac, and in my job i need do it i mac. </p> <p>After i get those values, i need to write a file that says 1 or 0.</p>
python
[7]
81,769
81,770
image enlarge onmouseover
<p>I need a script which will be applied to a set of images around a circle..</p> <p>Now whats required through script is that</p> <p>on mouseover image around the circle should get enlarged and should move to the centre.</p> <p>How to do this using Javascript and CSS.</p> <p>Be specific about the attributes of CSS and functions of Javascript please I am almost novice.</p> <p>Help me out.</p> <p>Thnx in advance.</p>
javascript
[3]
2,889,435
2,889,436
Referencing an observablecollection from the class
<p>I have a class called <code>NewsEntry</code> and news entry is part of an observable collection called <code>NewsItems</code>.</p> <p>What I want to do is create two functions inside <code>NewsEntry</code> called <code>following</code> and <code>previous</code>.</p> <p>in pseudo-c# it needs to do this.</p> <pre><code>public class NewsEntry { public int id { get; set; } public String description { get; set; } public NewsEntry following () { // get the ObservableCollection containing this // find the index of this in the collection // return the next item } public previous ... } public ObservableCollection&lt;NewsEntry&gt; NewsItems { get; set; } </code></pre> <p>can I do this from the Entry class or should I really do this from the outside class and pass a <code>NewsEntry</code> as a parameter (which I think results in ugly code)</p>
c#
[0]
84,697
84,698
Scroll a div with Jquery
<p>I have a click function that slides a contact form down from the top of the page and pushes the rest of the page down. I have an absolute position DIV which stays where it is currently and I need it to scroll down as if it didn't have an absolute position.</p> <pre><code>$("#contact-tab").toggle(function() { $('#contact-form-wrapper').slideToggle(); // scroll #absolute DIV vertically the height of #contact-form-wrapper }, function() { $('#contact-form-wrapper').slideToggle(); // scroll #absolute back to where it was }); #absolute { position: absolute; top: 500px; } #contact-form-wrapper { width:100%; height:370px; top:0; } </code></pre> <p>Example: <a href="http://jsfiddle.net/benners/FV2sp/" rel="nofollow">http://jsfiddle.net/benners/FV2sp/</a></p>
jquery
[5]
2,103,070
2,103,071
Avoid (limit) low memory force close of an activity
<p>I have a problem with an activity force close in android when memory fell down.</p> <p>My activity has a button that calls a particular class, where some tasks are performed in a separate thread (it should take up to 10'). On the emulator I have no problem, but on the phone sometimes the activity went closed for low memory reason. I read about startForeground method for services, may I apply the same logic to my app? How can I do it?</p> <p>Many thanks for any suggestion.</p> <p>Alessandro.</p>
android
[4]
4,824,694
4,824,695
How can I let my function crash?
<p>In certain cases I want my function to simply crash and my app to stop execution:</p> <pre><code>public void foo() { if(lifeIsWorthLiving) { /*code ...*/ } else { /* log the problem, throw an exception and die */ } } </code></pre> <p>Now if I add <code>throw Exception("lifeIsWorthLiving = false !!!");</code> then I need to add <code>throws Exception</code> to function definition and then I have to handle this everywhere I call <code>foo()</code>. I don't want to do that. How can I do this?</p>
java
[1]
1,710,586
1,710,587
wakelock disable slider
<p>Have I completely mis-understood android Wakelock?</p> <p>I want the screen to dim and shut down; but on the wake button being pressed, I don't want the user to then have to do a slide to open the running app - I want that app immediately available in the state it was left in.</p> <p>Is that possible?</p>
android
[4]
4,962,702
4,962,703
Input Method without a view
<p>I have a service that gets Unicode characters over WiFi, which should be entered to a EditText in which the cursor is currently positioned (sort of a remote desktop)</p> <p>I'm trying to figure out what will be the best way to input text to EditText views (and similar view) without showing a keyboard layout on the screen.</p> <p>Is the IME the right direction? or is there a way to inject a keypress (Unicode char) to the system?</p> <p>Thanks!</p>
android
[4]
52,005
52,006
How to pass a click on an image from one activity to another?
<p>In my application i created a button when the button is clicked it will load all images from the sdcard.</p>
android
[4]
950,938
950,939
How do I use jQuery to return the class of each checked checkbox as they are checked?
<p>I am using jQuery for the first time (my js knowledge is poor at best) and attempting to create a Section filter (hides/shows divs depending on class) that is based around checkbox options.</p> <p>To start with I was wanting to retrieve the class of each checkbox that was checked so I have something like this (the div.text is just to test the output). Each checkbox class corresponds to the class of the div (all div's have multiple classes that match various checkboxes)</p> <pre><code>&lt;ul&gt; &lt;li&gt;Size&lt;/li&gt; &lt;li&gt;&lt;input type="checkbox" class="half" /&gt;&amp;frac12;"&lt;/li&gt; &lt;li&gt;&lt;input type="checkbox" class="quart" /&gt;&amp;frac34;"&lt;/li&gt; &lt;/ul&gt; &lt;script&gt; function Checked() { var n = $("input:checked").attr("class"); $("div.text").text(n); } Checked(); $(":checkbox").click(Checked); &lt;/script&gt; </code></pre> <p>This succesfully returns the first checked checkbox class, I toyed around with each() but don't quite understand how to implement it, can someone point me in the right direction please?</p> <p>Ultimately I'm looking for each checked checkbox class to be in an array that I can then call upon to make the corresponding divs the only visible items, but I'm happy to take this a step at a time. I'm sure this is likely to be an easier way to achieve the desired result so am also open to suggestions. Thanks in advance</p>
jquery
[5]
1,451,886
1,451,887
Find out what exception is being thrown in PHP
<p>I'm trying to learn PHP on the fly here, and something is broken, but I am unsure how to figure out what the problem is. An exception is being thrown, and I was able to isolate the line that is throwing the exception by printing debugging messages, but how do I figure out the nature of the error that is being thrown? All that happens is my php code stops executing.</p>
php
[2]
5,227,618
5,227,619
Reverse the contents of Array
<p><strong>This is what I need to do</strong></p> <p>Ability to reverse the contents of a single dimensional array of variable size, without using another temporary array.</p> <p>Given a single dimensional array of integers, numbers, write the Java code to reverse the contents of numbers in-place without using a temporary array to store the reversed contents. For example, if numbers is {12, 34, 50, 67, 88}, provide code that will alter numbers so that its contents now become {88, 67, 50, 34, 12}.</p> <p><strong>This is what I have</strong> it is not working correctly.</p> <pre><code>public static int[] reverseArrayWithoutTempArray(int[] array) { double array [ ]; array = new double [10]; int [ ] num = {12, 34, 50, 67, 88}; int i = 0; int j = a.length - 1; for (i = 0; i &lt; a.length / 2; i++, j—){ int temp = a[i]; a[i] = a[j]; a[j] = temp; } return array; } </code></pre>
java
[1]
4,586,149
4,586,150
Reading a full line of input
<p>I'm trying to store the input that user enters through console. so I need to include the "enter" and any white space.</p> <p>But <code>cin</code> stops giving me input after the first space.</p> <p>Is there a way to read whole lines until CTRL+Z is pressed, or something?</p>
c++
[6]
4,985,603
4,985,604
How to check existence of a JAR file and a specific file inside JAR?
<p>Assume the file name is in this URL:</p> <pre><code>URL file = new URL("jar:file:/path/to/foo.jar!/META-INF/file.txt"); </code></pre> <p>This operation leads to <code>IOException</code> if there is no <code>foo.jar</code> or there is no <code>file.txt</code> inside the existing jar:</p> <pre><code>import org.apache.commons.io.FileUtils; FileUtils.copyURLToFile(file, /* some other file */); </code></pre> <p>Is it possible to validate file existence without exception catching?</p>
java
[1]
1,829,260
1,829,261
Get the "size" (length) of a C++ function?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4156585/how-to-get-the-length-of-a-function-in-bytes">How to get the length of a function in bytes?</a> </p> </blockquote> <p>I'm making a Hooking program that will be used to insert a method into the specified section of memory. </p> <p>I need to get the length of a local C++ function, I've used a cast to get the location of a function, but how would I get the length? </p> <p>would </p> <pre><code>int GetFuncLen() { int i = 0; while((DWORD*)Function+i&lt;max) { if((DWORD*)Function+i==0xC3) { return i; } i++; } } </code></pre> <p>work?</p>
c++
[6]
3,549,664
3,549,665
Trying to place javascript statements in an array
<p>I have the line <code>document.getElementById('slot2').src ="snail.gif";</code> in my code and it works to change the img element to the appropriate gif.</p> <p>However I also have an array called slots of three elements each of which is <code>document.getElementById('slotN')</code> or 1 2 and 3 in place of N.</p> <p>When I use <code>slots[2].src ="snail.gif";</code> in a function it fails to do anything.</p> <p>I know it has to do with converting the string of the statement into a statement but trying to use eval() doesn't seem to work either.</p> <p>Any advice would be appreciated</p>
javascript
[3]
252,658
252,659
Jquery change input text value
<p>this is driving me nuts! I can't find the right selector for:</p> <p></p> <p>I want to change the value to = 000000</p> <p>Shouldnt this work?:</p> <pre><code>$("text.sitebg").val("000000"); </code></pre> <p>Regards Joricam</p> <p>PS: I need the selector to find the "name" not the id of the text input.</p> <p>The presented solution does not work, whats the problem with this?</p> <pre><code>$.getJSON("http://www.mysitehere.org/wp-content/themes/ctr-theme/update_genform.php",function(data) { $("#form1").append(data.sitebg); $('input.sitebg').val('000000'); }); </code></pre> <p>the json data is working correctly, the ideia is to later pass the json values into the form input text values. But is not working :(</p> <p>ps: it works if you use the suggestion bellow</p>
jquery
[5]
5,359,825
5,359,826
UIViewController orientation changes in a UINavigationController stack
<p>I have a UINavigationController with two UIViewControllers on it (A and B). From A, I push B onto the stack. Then the user re-orients the device. I need to move some things around the screen (buttons, etc) to be visible in the new orientation on A.</p> <p>I find that -shouldAutorotateToInterfaceOrientation is getting called on both A and B (and returning YES). But the -will / -didRotateFromInterfaceOrientation are only getting called on the visible ViewController (B). When B gets popped off the stack, A is shown in the new (correct) orientation but without the buttons getting moved as needed.</p> <p>To solve this, I find myself implementing the following pattern:</p> <p>in header file:</p> <pre><code>@interface A : UIViewController { // ... UIInterfaceOrientation layoutOrientation; } // ... - (void)orientationChanged; @end </code></pre> <p>in .m file:</p> <pre><code>- (void)viewDidLoad { // ... layoutOrientation = self.interfaceOrientation; } - (void)viewWillAppear:(BOOL)animated { // ... if (layoutOrientation != self.interfaceOrientation) { [self orientationChanged]; } } - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { [self orientationChanged]; } - (void)orientationChanged { // move my buttons layoutOrientation = self.interfaceOrientation; } </code></pre> <p>Essentially, I'm checking to see if the orientation changed in -viewWillAppear and doing the work to update the UI there if needed. It works just fine, but this seems (a) tedious, and (b) a lot of duplicated code among my various classes like A. I can fix (b) by moving the code to a common superclass, but this still seems like something I shouldn't have to do.</p> <p>Is there a better way of moving my buttons around on views that are not top-most on the navigation stack? My views come from .xibs if there's something in IB I need to check. Should I just be designing my views such that they don't need to move buttons around when the orientation changes?</p> <p>Thanks!</p>
iphone
[8]
5,778,895
5,778,896
alternate method of Mootools addEvent in Jquery
<pre><code>$('test_div').addEvent('click', function() { formElement = $$('.field_search_criteria')[0]; // get it from &lt;form class="field_search_criteria" id="field_search"&gt; // On search formElement.addEvent('submit', function(event) { event.stop(); alert(formElement.toQueryString()) }); }); </code></pre> <p>anybody can help me to convert the above mootools function to Jquery. What is the alternate Jquery of addEvent in Mootools</p> <p>Thanks in advance :) </p>
jquery
[5]
1,614,988
1,614,989
AIDE Won't Build App Stuck on "Running AADT" Stage
<p>I've moved an app to mmy device so that AIDE can build it and so I can install but it is stuck at the AAPT stage. Any suggestions?</p>
android
[4]
2,036,914
2,036,915
How do I work with appended divs?
<p>I'm a massive newbie to jquery so please excuse my lack of knowledge, how do I go about doing anything with the elements i've appended here? for instance I want to have all but the first '.larger' to be hidden when these elements are appended. thanks.</p> <pre><code>function loadXML() { $.ajax({ type: "GET", url: XML_PATH, dataType: "xml", success: function(xml){ $(xml).find('item').each(function(){ var id = $(this).attr('id'); var images = $(this).find('large').text(); var thumbs = $(this).find('thumb').text(); var descs = $(this).find('description').text(); $('&lt;div class="thumber" id="thumb_'+id+'" rel="large_'+id+'" style="background-image: url('+thumbs+')"&gt;&lt;/div&gt;').appendTo('#thumbslide'); $('&lt;div class="larger" id="large_'+id+'" style="background-image: url('+images+')"&gt;&lt;/div&gt;').appendTo('#view'); }); }); </code></pre>
jquery
[5]
5,448,023
5,448,024
Configuring Asp.NET Application in subfolder - Without IIS config
<p>I have a free hosting account, and two ASP.NET project.<br/> <br/> I want to upload both apps in my hosting, like:<br/> <code>www.hosting.com/myaccount/project1/</code><br/> <code>www.hosting.com/myaccount/project2/</code><br/> <br/> But the problem is when I run project1 or project2<br/> Asp.net considers <code>application main path ("~")</code> as root <code>www.hosting.com/myaccount/</code><br/> Si I cant load dll, App_themes, and Other.<br/> What can I do to stop that strange behvior!<br/> <br/> I cant configure IIS because I am using free hosting. I applied this <a href="http://stackoverflow.com/questions/1516041/run-an-asp-net-website-in-a-subfolder/2739203#2739203">answer</a> and no thing happened. <br/><br/> Thank you for hepling.</p>
asp.net
[9]
2,597,412
2,597,413
Suggestions for archive file creation and validating the archive file during iphone uploading process
<p>I am trying to upload an iphone application.I've got my certificates (development and distribution ) the App id is also available in my provisioning profile on the developer section of apple.com and my app is awaiting upload in iTunes connect.</p> <p>I manage to get my app archived but when i try to validate it i get the following error message : “Myapplication” does not contain a single–bundle application or contains multiple products. Please select another archive, or adjust your scheme to create a single–bundle application.</p> <p>My archive file created has no version information(Unspecified) and identifier also blank. I am using Xcode4.3</p> <p>Please give me a solution as soon as possible</p> <p>Thanks in advance</p>
iphone
[8]
3,898,165
3,898,166
How can I play continuous music in the background when my iPhone app is running?
<p>I want to run light music (non-stop) when user is running my application actively. When user exits my application, then the music will be stopped automatically. I tried the following code to execute continuous music play (that is, play the music on a loop). But it doesn't actually loop; it ends the music once said music is completed. </p> <pre><code>- (void) PlayLoopMusic { NSString* path; NSURL* url; path = [[NSBundle mainBundle] pathForResource:@"music" ofType:@"mp3"]; url = [NSURL fileURLWithPath:path]; player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:NULL]; [player prepareToPlay]; [player setVolume: 0.030]; [player setDelegate: self]; // Start playing it while starting the game ... [player play]; } </code></pre> <p>Could someone please suggest methods to achieve looping, continuous music?</p>
iphone
[8]
5,376,915
5,376,916
Suggestions for inbox notifications in android?
<p>i have few activities in android application with inbox Textview in the title.</p> <p>i want to implement something like Inbox(Number of messages) to be shown on each screen</p> <p>any one guide me what is the suitable way to show number of messages in each screen title bar?</p> <p>one of my friend is calling webservice after 10 seconds again and again to achieve this funtionality but i dont think it is a suitable way.</p> <p>any help would be appreciated.</p>
android
[4]
212,577
212,578
How to iterate over two Collections of Objects simultaneously?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1365793/how-to-most-elegantly-iterate-through-parallel-collections">How to most elegantly iterate through parallel collections?</a><br> <a href="http://stackoverflow.com/questions/2118932/is-there-an-accepted-java-equivalent-to-pythons-zip">Is there an accepted Java equivalent to Python&#39;s zip()?</a> </p> </blockquote> <p>I have to iterate simultaneously over two Collections of objects to see if their members are equal. Is there a way of using a counter to access the object or do something similar to the for loop below ?</p> <pre><code>Boolean compareCollection(Collection&lt;Object&gt; c1, Collection&lt;Object&gt; c2) { //something like - for (Object ob1 : c1, Object ob2 : c2){ //check if ob1.val == ob2.val } return true; } </code></pre>
java
[1]
4,151,402
4,151,403
use of HTMLEditor or HTMLEditorExtender in asp.net 2008 .net 3.5 with database storage details
<p>I am making one project of online examination, I am finding problem in maths paper bcz i can't write maths equations in our asp.net textbox, So i need to use HTMLEditor or AJAX Editor Extender. So I need help to use this control in our application or web page.</p> <p>How to use this control, because I tried it with ajax and it gives an error in sanitizer tag and how to store this contents in SQL server 2008 database.</p>
asp.net
[9]
4,199,190
4,199,191
is it possible to intigrate google checkout with iphone?
<p>i want to know...is it possible to integrate googlecheckout with iphone?</p>
iphone
[8]
2,469,885
2,469,886
Android longClickEvent and swipe event together
<p>I have an activity with a ViewFliper. Also it contains GestureListener for swipe events.</p> <p>ViewFlipper contains various views. One of them has multiple elements witch expect longClick. Basicly It looks like that:</p> <pre> FlipperView Container Element1 Element2 Element3 </pre> <p>My problem is that swipe event does not work when view "Container" is displayed. It gets consumed by longClick listener added on each "ElementX" - that is my guess - as when I remove longClickListener - swipe works perfectly.</p> <p>So nothing works as it should: long click does not work as it is not a long click and swipe is not captured because of longClick.</p> <p>What should I do?</p>
android
[4]
2,397,409
2,397,410
Why fadeOut() wait delay() and hide() not?
<p><a href="http://jsfiddle.net/RsVF2/" rel="nofollow">This</a> you will find an example :</p> <pre><code>&lt;div id="first_div"&gt;First Div&lt;div&gt; &lt;div id="second_div"&gt;Second Div&lt;div&gt; $('#first_div').show().delay(2000).fadeOut(300); $('#second_div').show().delay(2000).hide(); </code></pre> <p>as you can see, <code>fadeOut()</code> is called after 2 seconds; <code>hide()</code> is called immediatly. Why? <code>hide()</code> doesnt wait <code>delay()</code> function.</p>
jquery
[5]
2,921,503
2,921,504
Get autocomplete selector after ajax call
<p>I am trying to find the selector of a jquery autocomplete in the "success" after making an ajax call. In the "success" I am looking for $(this) to be $(".itemDescInput") but it is not. How would I find that selector at that point?</p> <pre><code>$(".itemDescInput").autocomplete({ source: "invoices/invoice_items.php", select: function(event, ui) { var $it_desc = ui.item.value; $.ajax({ type: "POST", url: "invoices/invoice_items_prices.php", data: "it_desc="+$it_desc, success: function(result){ if(result != '') { $(this).find("input .itemCostEach").val(result); } } }); } }); </code></pre>
jquery
[5]
588,106
588,107
how to assign variable value to jquery?
<pre><code>var s="attr" var i=$(s) // jQuery(elem).attr(attr,eval("elm"+attr)); jQuery(elem).$(s)(attr,eval("elm"+attr));//i tried this. </code></pre> <p>how to assign a variable name in the above code(in place of s) so that i need to add an attribute to the element "elem".</p>
jquery
[5]
2,706,924
2,706,925
Is this the correct way of using a void* member pointer?
<p>Can I use the method doSomething like this; first having assigned the pointer to the A class to the void* member of b?</p> <pre><code>class A { public: A(int); int m_x; int doSomething(){}; }; class B { public: void* m_y; }; #include "x.h" using namespace std; A::A(int x) { m_x = x; } int main() { //create 2 pointers to A and B B *b; A *a; b = new B(); a = new A(15); b-&gt;m_y = a; ((A*)b-&gt;m_y)-&gt;doSomething(); delete a; delete b; return 0; } </code></pre>
c++
[6]
2,040,592
2,040,593
Only getting DatePickerDialog's value when Done button is being pressed
<p>By referring <code>DateWidgets1.java</code> in API demo, I tend to show date picker widget through the following way.</p> <pre><code>private void initDateTextView() { dateTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { showDialog(DATE_DIALOG_ID); } }); } @Override protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date return new DatePickerDialog(this, datePickerListener, this.year, this.month, this.date); } return null; } @Override protected void onPrepareDialog(int id, Dialog dialog) { switch (id) { case DATE_DIALOG_ID: ((DatePickerDialog)dialog).updateDate(this.year, this.month, this.date); } } private static final int DATE_DIALOG_ID = 0; private final DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // When dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) { Log.i("CHEOK", selectedYear + ", " + selectedMonth + ", " + selectedDay); } }; </code></pre> <hr> <p>However, I realize, onDateSet will always be called, with latest spinner selected date, regardless I am pressing dialog's <strong>Done</strong> button, or pressing the phone's soft back button.</p> <p>I am only interested in getting the selected date, when user pressing <strong>Done</strong> button, but not back button.</p> <p>Is there any way I can achieve so?</p>
android
[4]
4,023,451
4,023,452
retval = false && someFunction(); // Does someFunction() get called?
<p>I'm currently working with the Diab 4.4 C++ compiler. It's a total POS, non ANSI-compliant, and I've found problems with it in the past.</p> <p>I'm wondering if the following problem is an issue with the compiler, or a shortcoming in my knowledge of C++</p> <p>I realize that the form of x = x &amp;&amp; y; will short-circuit the y part if x is false. What the compiler is doing is short-circuiting in the case of x = x &amp;&amp; y(); where y() is a non-const function.</p> <pre><code>class A { int _a; A(int a) { _a = a; } bool someFunction() { _a = 0; return true; } }; main(...) { A obj = A(1); bool retval = false; retval = retval &amp;&amp; A.someFunction(); /* What is the value of A._a here? */ } </code></pre> <p>What seems wrong to me is the fact that the compiler is doing this short-circuiting even though someFunction() is not a const function. If it's not const, is the compiler overstepping its bounds by skipping A.someFunction() when retval is false?</p> <p>Also, I realize this issue can be avoided by writing retval = A.someFunction() &amp;&amp; retval; but I'd really like to know why this is happening.</p>
c++
[6]
915,590
915,591
Linq Query - Selective Fields as DataTable?
<p>I want to create a datatable from linq query. The below code selects all filed, but i need select few fileds like "door_no","street_name","city_name","post_code","date of birth" and need to create it as Datatable.</p> <pre> var Results = from SelRow in MyDtb1.AsEnumerable() where SelRow.Field("door_no") != null select SelRow; DataTable ChkResult = Results.CopyToDataTable(); </pre> <p>Any Better Ideas Thanks &amp; Regards PARAMU</p>
c#
[0]
3,836,158
3,836,159
jquery using data for cross-function variables
<p>Hey all. Basically I have a page full of text input fields with default values in them.</p> <p>When a user focuses on the input, I want the value to be set to nothing, but then if the user focusses out (on blur) and the input is still empty, I want to change its value back to what it was originally.</p> <p>At the moment I have this, but it isn't working:</p> <pre><code>$("#login input").focus(function(){ $(this).val(""); $(this).data({   value: $(this).val()  }); }); $("#login input").focusout(function(){  if($(this).val()=="") {   $(this).val($(this).data("value"));  } }); </code></pre> <p>What I need is some sort of NOT .change() kind of thing? Maybe?</p> <p>Thanks in advance</p>
jquery
[5]
4,804,915
4,804,916
java scanner - how to split a mac address?
<p>The mac address string may be in format:</p> <p>00:aa:bb:cc:dd:ee</p> <p>or </p> <p>00aabbccddee</p> <p>I need a good way to retrieve the 6 parts. </p> <p>Here my code:</p> <pre><code>public class Mac { public static void main(String[] args) { String mac = "00:aa:bb:cc:dd:ee"; /* 00aabbccddee */ Scanner s = new Scanner(mac); s.useDelimiter(":?"); /* zero or one occurrence */ String t = null; while ((t = s.next("[0-9a-f][0-9a-f]")) != null) System.out.println(t); } } </code></pre> <p>It throws a exception:</p> <pre><code>Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Scanner.java:840) at java.util.Scanner.next(Scanner.java:1461) at java.util.Scanner.next(Scanner.java:1394) at Mac.main(Mac.java:11) </code></pre> <p>What's wrong with it?</p>
java
[1]
3,400,073
3,400,074
Login page that resolves direct url copy paste issue
<p>I have to make Login page in asp.net.</p> <p>But this is not happening when I copy and paste the direct URL in browser. How can i achieve that?</p> <p>Example: If I have project.aspx and login.aspx and Project.aspx should not get accessed without Login.aspx even if URL is pasted in browser.</p>
asp.net
[9]
5,667,552
5,667,553
List view customization issue while scrolling
<p>I have the below code which overrides the getView, What i want is always the first row should show some custom view and the item cell below this first will show regular cells. My code works fine without any errors, but when i scroll the first cell get repeat after continuos use of scroll upside down, Please refer the code below, If any one can answer this it be of great help. Thanks </p> <pre><code> @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; int type = getItemViewType(position); holder = new ViewHolder(); System.out.println("getView " + position + " " + convertView + " type = " + type); if (convertView == null &amp;&amp; position !=0) { System.out.println("inside if " + position); //holder = new ViewHolder(); switch (type) { case TYPE_ITEM: convertView = mInflater.inflate(R.layout.item1, null); holder.textView = (TextView)convertView.findViewById(R.id.text); holder.textView.setText(mData.get(position)); break; case TYPE_SEPARATOR: convertView = mInflater.inflate(R.layout.item2, null); holder.textView = (TextView)convertView.findViewById(R.id.textSeparator); holder.textView.setText(mData.get(position)); break; } convertView.setTag(holder); }else if(position == 0){ System.out.println("inside else if " + position); convertView = mInflater.inflate(R.layout.header, null); holder.textView = (TextView)convertView.findViewById(R.id.text); }else { System.out.println("inside else " + position); holder = (ViewHolder)convertView.getTag(); try{ holder.textView.setText(mData.get(position)); }catch(Exception ex){ System.out.println("caught exception is "+ ex.getMessage()); } } return convertView; } </code></pre>
android
[4]
4,060,190
4,060,191
plus and non-plus for id-beginner wonder
<p>I am an Android beginner and I don't understand what exactly the plus (+) before <code>id</code> reference means. The tutorials I found on the web only say it is for <code>new id reference</code> and non-plus definition means it references the defined <code>id</code>. Could you offer an example to clarify my non-understanding of this tiny detail I am cracking my brain to get it right ?</p>
android
[4]
2,348,031
2,348,032
how to get click or tab select a panel?
<p>how to get a click or a tab to select either north, west, or center panel? This is tab code works but don't know how to integrate it with a click-panel code</p> <p><strong>JAVASCRIPT :</strong></p> <pre><code>$(document).ready(function(){ var divs = ["north", "west", "center"]; var startIndex = 0; $(document).keydown(function(e) { if (e.which == 9) { $("div").css("border", ""); $("#" + divs[startIndex]).css("border", "4px solid gray"); if(divs[startIndex] == "north"){ alert("north"); }else if(divs[startIndex] == "west"){ alert("west"); }else{ alert("center"); } startIndex++; if(startIndex === divs.length) { startIndex = 0; } } return false; }); }); </code></pre> <p><strong>HTML :</strong></p> <pre><code>&lt;div id="north"&gt;&lt;textarea&gt;&lt;/textarea&gt;&lt;/div&gt; &lt;div id="west"&gt;&lt;textarea&gt;&lt;/textarea&gt;&lt;/div&gt; &lt;div id="center"&gt;&lt;textarea&gt;&lt;/textarea&gt;&lt;/div&gt; </code></pre>
jquery
[5]
3,880,890
3,880,891
Is there a quasi-standard set of attributes to annotate thread safety, immutability etc.?
<p>Except for a blog post here and there, describing the custom attributes someone created, but that do not seem to get any traction - like one describing how to <a href="http://blogs.msdn.com/b/kevinpilchbisson/archive/2007/11/20/enforcing-immutability-in-code.aspx">enforce immutability</a>, another one on <a href="http://larryparkerdotnet.wordpress.com/2009/08/25/documenting-thread-safety/">Documenting Thread Safety</a>, modeling the attributes after <a href="http://jcip.net/">JCIP annotations</a> - is there any standard emerging? Anything MS might be planning for the future?</p> <p>This is something that should be standard, if there's to be any chance of interoperability between libraries concurrency-wise. Both for documentation purposes, and also to feed static / dynamic test tools.</p> <p>If MS isn't doing anything in that direction, it could be done on CodePlex - but I couldn't find anything there, either.</p> <p>&lt;opinion&gt;Concurrency and thread safety are really hard in imperative and object-languages like C# and Java, we should try to tame it, until we hopefully switch to more appropriate languages.&lt;/opinion&gt;</p>
c#
[0]
4,519,260
4,519,261
Check for binary string length?
<p>Is there a native or inexpensive way to check for the length of a string in bytes in PHP?</p>
php
[2]
5,080,976
5,080,977
Android InAPP Purchase?
<p>I have a Wallpaper APP, with several wallpaper. Some Wallpaper's have a price (0.2 euro).</p> <p>Can I use InApp purchase to buy a wallpaper OR I can only sell my APP with InAPP Purchase?</p> <p>Thanks, Leslie</p>
android
[4]
2,063,018
2,063,019
Detect application foreground event
<p>Does anybody know some event listener for detecting when the application comes back to the foreground from the background? I searched a lot, but I didn't find such a listener. Any other solution is appreciated. Thank you!</p>
android
[4]
4,732,627
4,732,628
check if one value exists in an array
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2440506/how-to-check-if-an-array-value-exists">How to check if an array value exists</a> </p> </blockquote> <p>I have a problem in PHP. So, my problem is that I want to see if a particular value exists in a session (in which session I store an array). And if this value exists to return me a boolean ($check=TRUE). But when I try to stop the script with die (var_dump($check)); in order to check the value, I get always this notice: </p> <blockquote> <p>Undefined variable check...</p> </blockquote> <p>This is my code:</p> <pre><code> $individualitem[] = $_SESSION["books"] ; foreach ($individualitem as $key =&gt; $idividualvalue){ if($individualitem == $card){ $check = TRUE; } } // die (var_dump($check)); </code></pre>
php
[2]
1,707,308
1,707,309
How can I set the Page.User Property in ASP.NET?
<p>This is mostly a theory question, for example if I wanted to create my own alternative to forms authentication.</p>
asp.net
[9]
3,876,613
3,876,614
Getting sms while phone is asleep
<p>I have an app that receives sms (via BroadCastReceiver) and starts an Activity to handle incoming sms (including playing a sound to notify user, updating database and showing a message to user). </p> <p>The problem is that sometimes that app is not running and mobile is asleep, I receive nothing but as soon as I unlock screen, I got 4 or 5 messages together!</p> <p>EDIT: Definition of BroadcastReceiver:</p> <pre><code> &lt;receiver android:name=".util.sms.SmsReceiver" android:enabled="true" &gt; &lt;intent-filter android:priority="999" &gt; &lt;action android:name="android.intent.action.DATA_SMS_RECEIVED" /&gt; &lt;data android:scheme="sms" /&gt; &lt;data android:port="56790" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; </code></pre> <p>Definition of my Activity:</p> <pre><code> &lt;activity android:name=".MyActivity" android:launchMode="singleInstance"&gt; &lt;/activity&gt; </code></pre> <p>Inside Activity:</p> <pre><code>@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // ... handleNewMessage(this.getIntent()); } @Override public void onNewIntent (Intent intent) { super.onNewIntent(intent); handleNewMessage(intent); } </code></pre> <p>Starting MyActivity from BroadcastReceiver:</p> <pre><code>@Override public void onReceive(Context context, Intent intent) { //... if( smsIsMine() ) { Intent intent = new Intent(); intent.putExtra("MESSAGE_BODY", sms.getBody()); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setClass(context, MyActivity.class); context.startActivity(intent); } } </code></pre> <p>Any idea?</p>
android
[4]
2,509,029
2,509,030
how to find email has been delivered in android
<p>how to find email has been delivered in android</p>
android
[4]
2,607,083
2,607,084
assign onclick event to function
<p>I want to call a function onclick and pass the event object to the function:</p> <pre><code> progressBarOuter.onclick = function(e) { var x; if (!e) { x=window.event.clientX; } else { x = e.clientX } yt.clickedOffset = x; yt.progressBarClicked } </code></pre> <p>So i'm assigning clickedOffset to by enclosing object (yt) and then calling progressBarClicked which then uses the clickedOffset var. But what I actually would rather be doing is something like this:</p> <pre><code>progressBarOuter.onclick = yt.progressBarClicked(e); </code></pre> <p>Because it's much more compact. Problem is that even if the user has clicked or not this bit of code is executed... yt.progressBarClicked(e). </p> <p>Is there any way around this?</p>
javascript
[3]
1,340,676
1,340,677
How to check if a date is in a given range of day+month?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/976669/how-to-check-if-a-date-is-in-a-given-range">How to check if a date is in a given range?</a> </p> </blockquote> <p>Having each year divided into periods such as</p> <pre><code>from 11-28 to 01-20 from 01-21 to 02-16 from 02-17 to 03-15 from 03-16 to 05-04 from 05-05 to 07-25 from 07-26 to 10-10 from 10-11 to 11-27 </code></pre> <p>And some days as</p> <pre><code>$date1 = '06-09-1990'; $date2 = '05-03-1867'; $date3 = '02-29-1945'; $date4 = '06-24-2012'; $date5 = '12-25-2015'; $date6 = '07-15-2010'; </code></pre> <p>How to check if a day is in one of these range?</p> <p>P.S. Excuse me for my english</p>
php
[2]
3,473,948
3,473,949
How to assign text size in sp value using java code
<p>If I assign an integer value to change a certain text size of a TextView using java code, the value is interpreted as pixel (px), now does anyone know how to assign in sp?</p>
android
[4]
3,542,367
3,542,368
How do i search the java api?
<p>Since the java api page has no search function, at least not one that I see. How do I find out what methods are in which packages?</p>
java
[1]
15,729
15,730
selected dropdown list value changes after page reload
<p>I have a <code>dropdown</code> list in my application's layout . So in every page it is visible . In the <code>dropdown</code> list I have a list of hotels , when I change a hotel in <code>dropdown</code> , it redirects to the main page , with the changed <code>id</code> , it works fine , but the problem is when reloading the page , <code>selected</code> <code>dropdown</code> value is reset , how can i keep the selected value with out changing? . :(</p>
jquery
[5]
1,264,344
1,264,345
create a string of variable length in python
<p>i need to create a string consisting of spaces, and the length of the string needs to be determined at runtime.</p> <p>here is what i am doing:</p> <pre><code>suffix = "".join([' ' for x in range(0, max)]) </code></pre> <p>There must be a <strong>better</strong> way, a more <strong>clever</strong> way, and an <strong>easier</strong> way. what are the ways?</p> <p><strong>edit:</strong> well this is simpler then i imagined. there is only the 1 way and it all of the above, heh :)</p>
python
[7]
2,938,399
2,938,400
how to find the index based on rowposition and column position
<p>I have an two-dimenstional array..</p> <p>I know the rowposition and column position.</p> <p>How to find the index of the array based on the row position and column position.</p> <pre><code>Ex: if rowPosition =1 and columnPosition = 1, </code></pre> <p>the index should be 2. The Pictorial representation is</p> <pre><code> 0 1 2 3 </code></pre>
javascript
[3]
1,864,367
1,864,368
how to play video in webview by html 5
<p>I have problem, i can't play video in webview by html5 here,my code</p> <pre><code> webView = (WebView) findViewById(R.id.web);//new WebView(this); webView.setBackgroundColor(android.R.color.transparent); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setPluginsEnabled(true); webView.getSettings().setAllowFileAccess(true); webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR); webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS); webView.loadUrl("file:///android_asset/index.html"); </code></pre> <p>and here mycode html</p> <pre><code> &lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;video autoplay="autoplay" controls="controls" style="align:center;" autobuffer onclick="this.play();"&gt; &lt;source src="birtday2527.theora.ogv" type="video/ogg" codecs="theora, vorbis"/&gt; &lt;source src="birtday2527.mp4" type="video/mp4"/&gt; &lt;/video&gt; &lt;/body&gt; </code></pre> <p></p> <p>i have nexus s by test.</p>
android
[4]
5,296,594
5,296,595
rollover images with Jquery
<p>Beginner question here. I'm going to make a Jquery function that is used to change an image when hovering over it. I use the id name as the selector. How do I make it generic so that I don't have to have a copy of the function for every single tag with a rollover image?</p> <pre><code>$("#home img").hover( function(){ blah }, function(){ blah } ); </code></pre>
jquery
[5]