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
2,537,724
2,537,725
How do I set display:inline-block on my addClass()
<p>How do I set my span will be <code>display:inline-block</code></p> <pre><code>$("#checking").fadeTo(200, 0.1, function () { $(this).html('Username is not available').addClass('cross').fadeTo(900, 1); }); </code></pre> <p>Current output</p> <pre><code>&lt;span style="display: inline; opacity: 1;" id="checking" class="cross"&gt;Username is not available&lt;/span&gt; </code></pre> <p>In CSS I have set the cross class is <code>inline-block</code>.</p> <p>Let me know how to make the <code>style="display: inline; opacity: 1;"</code> will be <code>style="inline-display: inline; opacity: 1;"</code></p>
jquery
[5]
4,709,524
4,709,525
need Asp.net 2.0 chart control
<p>I want to know which chart is compatible with asp.net 2.0.</p> <p>I need some sample code on how to implement those chart controls ?</p>
asp.net
[9]
2,522,646
2,522,647
How to build software that mimics topcoder, codingbat etc.?
<p>I want to build a downloadable desktop software which shows the user a GUI with a sample problem.</p> <p><img src="http://i.stack.imgur.com/mxbww.png" alt="enter image description here"></p> <p>The user then proceeds to code a solution and pastes it to a blank screen.</p> <p>The program evaluates it and gives points to the user. The user progresses to the next level.</p> <p>My question is, how do these sites evaluate a program for correctness? I don't mean to measure performance. </p> <p>Do they write their own compiler or parse the text and feed it to javac and extract the output as well as search for some required keywords in the code.</p>
java
[1]
1,951,462
1,951,463
Android: how to draw TextView as focused?
<p>I have a series of Views in a tablelayout. Some are EditTexts, some are TextViews. I would like the TextViews to be focusable in the same way as the EditTexts; meaning, I would like them to be highlighted by the "up" and "down" arrows. <code>TextView.setFocusable(true)</code> allows them to gain focus from arrow keys, but they do not draw an orange border to indicate their focus like the EditTexts do. Is there an easy way to draw them as focused?</p>
android
[4]
3,320,677
3,320,678
Getting The ID Of URL
<p>Let say we have set of URLs like this</p> <pre><code>yoursite.com/39827-key1-key2-key3 yoursite.com/132-key1-key2-key3 yoursite.com/9223455-key1-key2-key3 </code></pre> <p>and so on and let say with the help of .htaccess we can point all this urls to file say info.php with the code </p> <pre><code>&lt;?=id?&gt; </code></pre> <p>it should gives the following ids (with respect to each url)</p> <pre><code>39827-key1-key2-key3 132-key1-key2-key3 9223455-key1-key2-key3 </code></pre> <p>My question now is there any way that we only get the number before first (-) let say</p> <pre><code>$id = 39827-key1-key2-key3 </code></pre> <p>we need to make it</p> <pre><code>$realid = 39827 </code></pre> <p>so i wonder if there any preg_replace or any any idea that can remove first (-) and all after it. </p> <p>example</p> <pre><code>For $id = 39827-key1-key2-key3 $realid = (something),$id Then finally $realid = 39827 </code></pre> <p>it will helps me to create easy understandable url and retrieve its data from database.</p> <p>Thanks you and sorry for poor english.</p>
php
[2]
1,881,267
1,881,268
Difference between SHA256CryptoServiceProvider and SHA256Managed
<p>The .Net SHA256Managed class is supported in all framework versions while the SHA256CryptoServiceProvider class is only supported from framework 3.5 and above.</p> <p>Why is the SHA256CryptoServiceProvider introduced ? It seems to do the same as the SHA256Managed class, but the latter performs better. </p> <p>What am I missing and why should I use the SHA256CryptoServiceProvider ?</p>
c#
[0]
3,122,154
3,122,155
Enabling music while the iPhones goes hold during a call
<p>I need to create an app which enables the caller in the other end to hear music while I press hold on my iPhone. This music will be selected from my library. Is there any API or anything which can help me with this?</p>
iphone
[8]
4,180,129
4,180,130
I am making software in java. Tell me how to convert .java file to .jar file that can be runnable
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2023506/selecting-main-class-in-a-runnable-jar-at-runtime">Selecting main class in a runnable jar at runtime</a> </p> </blockquote> <p>Help me to convert .java file to .jar</p>
java
[1]
3,303,569
3,303,570
UIModalPresentationFullScreen gives error in UniversalApplication
<p>i am created Universal application, in that i used UIModalPresentationFull, for displaying MFMailComposerSheet in iPad, which helps me to show the full screen of a MailComposer view in landscape view of ipad. When i run the application in ipad simulator i works well. If i set it to iPhone simulator 3.0 or 3.1.3 it shows the error like "<strong>error: 'UIModalPresentationFullScreen' undeclared (first use in this function)</strong>" when i comment it and run in iPhone simulator it works what would be the solution for this error or, else is that any method replaces "UIModalPresentationFull" works in both ipad and iphone?</p> <p>Thanks and regards Venkat</p>
iphone
[8]
770,085
770,086
What does this error message in python mean?
<p>I am making a hangman game on python and when i try to run it this error message appears. If anyone could tell me what this means i would be grateful.</p> <pre><code>Traceback (most recent call last): File "D:\Computing\Unit 3\Hangman\hangmanv2.py", line 200, in &lt;module&gt; hangmangame() File "D:\Computing\Unit 3\Hangman\hangmanv2.py", line 195, in hangmangame newwords() File "D:\Computing\Unit 3\Hangman\hangmanv2.py", line 187, in newwords hangmangame() File "D:\Computing\Unit 3\Hangman\hangmanv2.py", line 158, in hangmangame guessletter() File "D:\Computing\Unit 3\Hangman\hangmanv2.py", line 136, in guessletter print(hangmanpics[0]) IndexError: list index out of range </code></pre>
python
[7]
1,941,496
1,941,497
How to install an unremovable application on android device
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/8178982/is-it-possible-to-prevent-user-from-uninstalling-application-in-android">Is it possible to prevent user from uninstalling application in Android?</a> </p> </blockquote> <p>Thanks in advance for paying attention on this problem...!!</p> <p>Is this possible to install an <code>application</code> that no one can <code>uninstall</code> it. I just mean that by going</p> <pre><code>setting --&gt; Apps --&gt; Manage Applications --&gt; by selecting an app and click on UnInstall. </code></pre> <p>I want that If I install an <code>application</code> in a device, then no one can <code>uninstall</code> it.</p>
android
[4]
1,316,833
1,316,834
cout (standard output) in C++
<pre><code>// my first program in C++ #include &lt;iostream&gt; using namespace std; int main () { cout &lt;&lt; "Hello World!"; return 0; } </code></pre> <p>Is <code>cout</code> an object? If so, where is it instantiated? (I don't see something like "<code>new ....</code>")</p>
c++
[6]
4,206,901
4,206,902
Add "Everyone" privilege to folder using C#.NET
<p>I have used the code below to allow Everyone access to a folder:</p> <pre><code>System.Security.AccessControl.DirectorySecurity sec = System.IO.Directory.GetAccessControl(directory, AccessControlSections.All); FileSystemAccessRule accRule = new FileSystemAccessRule("Everyone", FileSystemRights.Modify, AccessControlType.Allow); sec.AddAccessRule(accRule); // setACL sec.ResetAccessRule(accRule); </code></pre> <p>Now, the Everyone user is added to the folder, but not with any rights assigned. All the read, write, execute etc. checkboxes are not checked.</p>
c#
[0]
3,373,870
3,373,871
implementing multiple string replace() using lambda function
<p>I've found tons of solutions doing exactly what I'm trying to do WITHOUT lambda...but I'm learning lambda today... </p> <p>I have a string <code>stri</code> and I'm trying to replace some characters in <code>stri</code> that are all stored in a dictionary.</p> <p><code>bad_chars={"\newline":" ","\n": " ", "\b":" ", "\f":" ", "\r":" ", "\t":" ", "\v":" ", "\0x00":" "}</code> and then I want to print <code>stri</code> out all pretty and empty of all of these ugly characters. My current code print's <code>stri</code> many many times. </p> <p><code>format_ugly = lambda stri: [ stri.replace(i,j) for i,j in bad_chars.iteritems()]</code></p> <p>Is there a way to make it print once, and with only 1 lambda function?</p>
python
[7]
1,618,999
1,619,000
List column logic
<p>I have a bunch of list items and I want to arrange them into 3 columns, alphabetically from top to bottom, left to right. This is easy enough to do by dividing the total amount of items by 3 and spitting them out. The other thing I need to do though is to keep the amount of items in each column even, starting at 4 per column.</p> <p>Example:</p> <pre><code>A E I B F J C G K D H L </code></pre> <p>So if there were &lt;= 4 items, it would just be 1 column</p> <pre><code>A B C D </code></pre> <p>The 5th item would start column 2 and the 9th would start column 3.</p> <p>If there are > 12 items, it always adds it to the end of the rightmost column, starting a new row if the other columns have equal amounts of rows. Still maintaining alpha sort order.</p> <p>So for 14:</p> <pre><code>A F K B G L C H M D I N E J </code></pre> <p>And 16:</p> <pre><code>A G L B H M C I N D J O E K P F </code></pre> <p>I'm doing this on the server side and loading up 3 arrays (one for each column) so for 16 items it would be:</p> <pre><code>$left_col = array('A', 'B', 'C', 'D', 'E', 'F'); $mid_col = array('G', 'H', 'I', 'J', 'K'); $right_col = array('L', 'M', 'N', 'O', 'P'); </code></pre> <p>I want to keep this logic on the server side (PHP) rather than handle it with Javascript.</p>
php
[2]
810,833
810,834
how to link header files in c++
<p>Hi iam new to write programs in c++ by using header files and including them.</p> <pre><code>//a.h #ifndef a_H #define a_H namespace hello { class A { int a; public: void setA(int x); int getA(); }; } #endif //a.cpp #include "a.h" namespace hello { A::setA(int x) { a=x; } int A::getA() { return a; } } //ex2.cpp #include "a.h" #include&lt;iostream&gt; using namespace std; namespace hello { A* a1; } using namespace hello; int main() { a1=new A(); a1-&gt;setA(10); cout&lt;&lt;a1-&gt;getA(); return 1; } </code></pre> <p>when i try to compile using g++ ex2.cpp iam getting the following error</p> <pre><code>In function `main': ex2.cpp:(.text+0x33): undefined reference to `hello::A::setA(int)' ex2.cpp:(.text+0x40): undefined reference to `hello::A::getA()' collect2: ld returned 1 exit status </code></pre> <p>is there any other way to compile this please any one help me</p>
c++
[6]
239,373
239,374
error when adding a default page to web.config
<p>I have 1 webpage with a SQL connection. When I run on localhost on Windows 7, this error occurs. </p> <blockquote> <p>HTTP Error 500.19 - Internal Server Error</p> <p>The requested page cannot be accessed because the related configuration data for the page is invalid.</p> <p>Config Error Cannot add duplicate collection entry of type 'add' with unique key attribute 'value' set to 'default.aspx' </p> <p>Config File \?\D:\SIPLWEB\WebSite\web.config </p> </blockquote> <pre><code> 120: &lt;files&gt; 121: &lt;add value="default.aspx" /&gt; 122: &lt;/files&gt; </code></pre>
asp.net
[9]
2,879,997
2,879,998
Impersonation file upload impact
<p>i have a admin system, currently allow login user to upload a file, but i found that it can not overwrite the file with same file name, it return access denied error</p> <p>im wondering if i set impersonation = true in web.config, what impact will have? (i know there is another way to solve my upload overwrite issue, but just want to ask the impact of impersonation)</p> <p>Thanks</p>
asp.net
[9]
2,148,345
2,148,346
Initialize a string variable in Python: "" or None?
<p>Suppose I have a class with a <strong>string</strong> instance attribute. Should I initialize this attribute with <strong>""</strong> value or <strong>None</strong>? Is either okay?</p> <pre><code>def __init__(self, mystr="") self.mystr = mystr </code></pre> <p>or</p> <pre><code>def __init__(self, mystr=None) self.mystr = mystr </code></pre> <p><strong>Edit</strong>: What I thought is that if I use <strong>""</strong> as an initial value, I "<em>declare</em>" a variable to be of <strong>string</strong> type. And then I won't be able to assign any other type to it later. Am I right?</p> <p><strong>Edit</strong>: I think it's important to note here, that my suggestion was WRONG. And there is no problem to assign another type to a variable. I liked a comment of <strong>S.Lott</strong>: "<em>Since nothing in Python is "declared", you're not thinking about this the right way.</em>"</p>
python
[7]
5,927,189
5,927,190
python: reading in a table and converting each column to the right data type
<p>Suppose I have a text file like with rows like below:</p> <pre><code>3, 4.32, hi 7, 3.23, hello </code></pre> <p>When I read in this file, all entries are treated as strings. Is there a way for them to be automatically converted (in my example) to int, float, and string?</p>
python
[7]
1,315,746
1,315,747
I got the error on sample project "Hello Word" on android - cocos2d
<p>I have eclipse 3.7, cocos2d-1.0.1-x-0.9.2, android-ndk-r7.</p> <p>When I have create sample project but, it will get error "FORCE CLOSE"...</p> <p>So is there any other thing i want to include on the project ?</p>
android
[4]
5,003,045
5,003,046
custom list view with custom dialog set adapter in android.
<p>In My <code>listview</code> when i click on change <code>button</code> open a custom dialog box . Enter name of item.</p> <p><em>I am writing update list view code on OK button in custom dialog</em> .</p> <p>gives me following error :</p> <pre><code>01-21 12:33:30.069: E/AndroidRuntime(1789): java.lang.IllegalStateException: System services not available to Activities before onCreate() </code></pre> <p><img src="http://i.stack.imgur.com/f3DoA.png" alt="enter image description here"></p>
android
[4]
2,244,786
2,244,787
how to run android project on phone?
<p>How do we run out android project on a phone? If we use Eclipse, we will set emulator to run it, but how about if we want to test it in real so we can see the output? Thanks.</p>
android
[4]
2,598,307
2,598,308
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: -1163179553, Size: 0
<p>I am new to java environment, i m developing code for playing cards in java application.I am adding 52 elements in the arraylist for different suit.When adding items in the list i m getting index bound exception,but item is able to add in the list.</p> <pre><code>while (totalcards &lt; 4) { for (int i = 1; i &lt;= 13; i++) { switch(i) { case 1: b.add(new Cards(0,'F','A',suits[totalcards])); System.out.println(i); break; case 11: b.add(new Cards(0,'F','K',suits[totalcards])); System.out.println(i); break; case 12: b.add(new Cards(0,'F','Q',suits[totalcards])); System.out.println(i); break; case 13: b.add(new Cards(0,'F','J',suits[totalcards])); System.out.println(i); break; default: b.add(new Cards(i,'F','J',suits[totalcards])); System.out.println(i); break; } } totalcards++; } </code></pre> <p>Output:</p> <pre><code>1 2 3 4 5 6 7 8 9 10 Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: -1163179553, Size: 0 11 12 13 1 2 3 4 5 6 7 8 9 10 at java.util.ArrayList.rangeCheckForAdd(ArrayList.java:612) 11 at java.util.ArrayList.add(ArrayList.java:426) at gambler.Gambler.main(Gambler.java:92) 12 13 1 2 3 4 5 6 7 8 9 10 11 12 13 1 2 3 4 5 6 7 8 9 10 11 12 13 </code></pre> <p>tried a lot but i didnt get any breakthrough..I would be glad if someone suggest me actual problem</p>
java
[1]
586,651
586,652
Individual classes on PHP rows
<p>I have the following thats within a loop...</p> <pre><code> echo "&lt;span class='srch-val'&gt;".apply_filters(" $value\n", $value)."&lt;/span&gt;"; </code></pre> <p>I want to somehow add a number or something after the class 'srch-val-1' without using jQuery, is this possible using PHP? If so where can I find out how to do this? thanks </p> <p>Its currently within a foreach() loop...</p> <pre><code> foreach ( (array) $keys as $key ) { //Stuff } </code></pre>
php
[2]
2,360,732
2,360,733
How to redirect in php with customized url
<p>I need to write a php page that opens an existing url with customized query strings (essentially redirect).</p> <pre><code>"http://existingurl?test=pass&amp;newparam=".$_REQUEST['u']; </code></pre> <p>How to do that?</p>
php
[2]
1,117,715
1,117,716
How to filter a Combo box matching string pattern c#
<p>my Combo box contains values like DBaaaaa, DBbbbbb, Dbccccc, FBaaaaa, FBcccc which is coming from database. i want when user select a value from the combo box it should match the Prefix("DB","FB") and length of the selected value. and it must filter the combo box according to the matching pattern.</p> <pre><code>Regex filter = new Regex("^[a-zA-z][a-zA-z][a-zA-Z0-9]*"); </code></pre> <p>for example if user selected DBaaaaa. now combo box should contain all values starting From "DB" and its matching length. where like DBbbbbb, Dbccccc.</p> <p>if i simply say its kind of filtering data if there are thousands of records in Database.</p>
c#
[0]
4,409,820
4,409,821
Accessing objects within objects
<pre><code>var data = { row: row, row2: row2 }; var tableData = [data.row,data.row2]; </code></pre> <p>row objects contains lot of children objects too... now how would i placed my tableData to access each single objects. so it goes like this... </p> <pre><code>var tableData = [data.row[1],data.row[2],data.row[3],,data.row2]; </code></pre> <p><strong>Updated Question</strong></p> <pre><code>var data = [row, row2]; </code></pre> <p>In this case how would i access my row children objects.</p>
javascript
[3]
2,416,650
2,416,651
Accessing internal expando id for an element
<p>I've been having issues with on/off removing event handlers that I don't want to, and would like to namespace the event binding with the html element's expando id. </p> <pre><code>function SomeWidget(el) { $(document).on('handler.MY_EXPANDO_ID', this.handler.bind(this)); }; var widget = new SomeWidget($(sometargetelement)); </code></pre> <p>The problem with not having a unique identifier, is that currently I have namespaces the same, which screws up when I have two widgets of the same time, and one removed, it removed the handler for both objects.</p> <p>Question 1) How do I access an elements' internal expando id? Question 2) Is there a better way to do this? Function.bind !== Function, which makes removing based on the actual method pointer not possible</p> <p>I'm using jQuery 1.8.3</p>
jquery
[5]
3,079,064
3,079,065
how to start and stop the scheduledexecutorservice multiple times
<p>I am using ScheduledExecutorService, and after I call it's cancel method on scheduleFuture, I can't schedule a Runnable on it. Calling <code>scheduleAtFixedRate(runnable, INITIAL_DELAY, INTERVAL, TimeUnit.SECONDS)</code> after <code>cancel()</code>, nothing happens. Is there any way to restart the <code>ScheduledExecutorService</code> after <code>cancel()</code> method is called?</p>
java
[1]
2,348,002
2,348,003
Turning a tuple of tuples into a dictionary
<p>So I've got tuples inside of tuples, and I would like to turn them into a key: value pair.</p> <pre><code>((1L, 'I.T.'), (2L, 'Project Management'), (3L, 'Creative'), (4L, 'Programming'), (5L, 'Sales'), (6L, 'Administration'), (7L, 'AV'), (8L, 'Human Resources'), (9L, 'Conference Rooms'), (10L, 'Testing'), (11L, 'none')) </code></pre> <p>How would I go about doing this?</p>
python
[7]
4,840,936
4,840,937
equivalent shorthand
<p>What is the shorthand equivalent to the following snippent of code?</p> <pre><code>if (strValue == ""){ throw new Exception("Mandatory 'strValue' parameter empty"); } </code></pre>
c#
[0]
5,181,000
5,181,001
Extract base url from full url
<p>Any quick way to extract base url from full url? for e.g., if i have <a href="http://test.example.com/abcd/test.html" rel="nofollow">http://test.example.com/abcd/test.html</a> - i want only <a href="http://test.example.com" rel="nofollow">http://test.example.com</a>. </p> <p>I can always do string parsing - but wanted to know if there is something in Uri where I can get it directly. </p>
android
[4]
3,129,032
3,129,033
how to retrieve selected contacts and display from phone book in android
<p>I want to read selected contacts from android phonebook and display those contacts ...please any one help me</p>
android
[4]
3,125,595
3,125,596
find current directory level with PHP
<p>I need to require_once a file that is located in my sites root directory. The problem I have is that I won't always know how many levels up the root directory is from where my current script is running. So I need to figure out how many directory levels I need to go up to require_once my file.</p> <p>Some times it could be:</p> <pre><code>require_once '../../file.php'; </code></pre> <p>And some times it could be:</p> <pre><code>require_once '../file.php'; </code></pre> <p>Or any other number of directory levels up.</p> <p>How can I calculate how many "../" I need to get to the root directory from any location in a sub directory?</p>
php
[2]
5,569,424
5,569,425
How to protect the .php file with JSON object when accessed through url in the browser
<p>I hope that this is not too difficult, so here is a story, I have created a simple process which is being sent as JSON object when requested, but for security reasons, would really like to protect (403) the content of the file if it is accessed by placing a full URL to it in the browser. </p> <p>Here is a script inside my ajax.php</p> <pre><code>&lt;?php $image = array( "/trial/images/1.png", "/trial/images/2.png", "/trial/images/3.png", "/trial/images/4.png" ); $msg = array( 'status' =&gt; 1, 'message' =&gt; 'Remember to +1', 'html' =&gt; '&lt;p&gt;Thank you for downloading our software &lt;img src="'. $image[array_rand($image)] .'" width="80" height="80" alt="Thank You"&gt;&lt;/p&gt;' ); echo json_encode($msg); ?&gt; </code></pre> <p>and here is a script of the function that I am using to POST with ajax into that file to obtain JSON object out.</p> <pre><code>function custom_reminder(aElem){ theLink=$(aElem).attr("href"); $.ajax({ type:"POST", url:"/includes/ajax.php", data:"action=reminder&amp;thepath="+theLink, dataType:"json", error:function(){window.location=theLink;}, success:function(msg){ if(msg.status == 1) { display_reminder(msg.html,theLink); }else{ custom_message(msg.message,"error"); } } }); } </code></pre> <p>Please help</p>
php
[2]
2,861,777
2,861,778
How to filter a single character and delete it using JavaScript?
<p>I end up deleting the element containing the character every time I try.</p> <p>What I'm trying to delete is the comma for each <code>.date</code>:</p> <pre><code>&lt;div class='date'&gt;Nov 1, 2011&lt;/div&gt; &lt;div class='date'&gt;Dec 22, 2011&lt;/div&gt; </code></pre>
javascript
[3]
5,562,244
5,562,245
PHP: exif_imagetype explanation
<p><a href="http://lv.php.net/manual/en/function.exif-imagetype.php" rel="nofollow">http://lv.php.net/manual/en/function.exif-imagetype.php</a></p> <p>Can anyone give some more information about the rest extension types.</p> <p>About these:</p> <pre><code>IMAGETYPE_TIFF_II (intel byte order) IMAGETYPE_TIFF_MM (motorola byte order) IMAGETYPE_JPC IMAGETYPE_JP2 IMAGETYPE_JPX IMAGETYPE_JB2 IMAGETYPE_IFF IMAGETYPE_WBMP IMAGETYPE_XBM </code></pre> <p>From where do they all go?</p> <p>It would be very good to know some numbers about % usage from overall uploaded images on some website if anyone knows as well.</p> <p>Because currently i'm only using 1,2,3,6 exif numbers inside my uploader script. I can't figure out now if someone was trying to upload different extension. :S</p> <p>Thanks ;)</p>
php
[2]
1,263,591
1,263,592
How to make a view which covers whe whole screen, including the status bar?
<p>I want to make an overlay which is partially transparent, and covers the entire screen including the status bar. I've seen that the folks at tapbots do exactly that. So it must be possible somehow. Status bar should still be visible!</p>
iphone
[8]
5,458,167
5,458,168
How to show all rows from database
<p>In the code below, I'm getting only the last row in my database, i.e. first name and last name of the last row in my DB. My question is: how do I change this code in order to get all the results printed?</p> <pre><code>package samples.directory; import android.app.Activity; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.webkit.WebView; import android.widget.ArrayAdapter; import android.widget.TextView; public class clanguage extends Activity { protected Cursor c; protected SQLiteDatabase db; protected TextView employeeName; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.webdesign); WebView engine = (WebView) findViewById(R.id.web_engine); db = (new DatabaseHelper(this)).getWritableDatabase(); Cursor c = db.rawQuery("SELECT firstName, lastName FROM employee", null); if (c != null ) { if (c.moveToFirst()) { do { String firstName= c.getString(c.getColumnIndex("firstName")); String lastName = c.getString(c.getColumnIndex("lastName ")); String data = "&lt;html&gt;" + "&lt;body&gt;&lt;table border=2&gt; &lt;tr&gt; &lt;td&gt;"+firstName+"&lt;/td&gt;+ &lt;td&gt;"+lastName+"&lt;/td&gt;&lt;/tr&gt;&lt;/body&gt;&lt;/html&gt;"; engine.loadData(data, "text/html", "UTF-8"); }while (c.moveToNext()); } } } </code></pre>
android
[4]
4,568,516
4,568,517
Consolidate 3 functions
<p>Hi all wonder if someone can help me Consolidate the below code. i should be able to have less lines of code but not sure how to achive this.</p> <pre><code>$(document).ready(function () { $(".question1").hover(function () { $(this).append('&lt;div class="tooltip"&gt;&lt;p&gt;1This is a tooltip. It is typically used to explain something to a user without taking up space on the page.&lt;/p&gt;&lt;/div&gt;'); }, function () { $("div.tooltip").remove(); }); $(".question2").hover(function () { $(this).append('&lt;div class="tooltip"&gt;&lt;p&gt;2This is a tooltip. It is typically used to explain something to a user without taking up space on the page.&lt;/p&gt;&lt;/div&gt;'); }, function () { $("div.tooltip").remove(); }); $(".question3").hover(function () { $(this).append('&lt;div class="tooltip"&gt;&lt;p&gt;3This is a tooltip. It is typically used to explain something to a user without taking up space on the page.&lt;/p&gt;&lt;/div&gt;'); }, function () { $("div.tooltip").remove(); }); }); </code></pre>
jquery
[5]
1,763,508
1,763,509
getting incorrect fileextension and content type
<p>I have an asp.net application where the users can upload files to our database. sometimes when they upload the files, the content-type is set as "application/octet-stream" which is a binary file. When I ask the user, they say that they uploaded the "tif" file but somehow the upload control sets it as "application/octet-stream". when I upload the same tif file from my computer it uploads with the correct content type (application/octet-stream). </p> <p>Also, I am using the following code to get the fileextension</p> <pre><code>fileExtension = filUpload.PostedFile.FileName.Substring(filUpload.PostedFile.FileName.LastIndexOf(".") + 1) </code></pre> <p>sometimes it returns the file extension as "c:\documen" or "j:\testing" etc. I know that windows doesn't allow special characters in the filename.</p>
asp.net
[9]
2,352,165
2,352,166
about argument to member function
<p>Will adding an argument to member function gonna change the behavior of the function?</p> <p>Need help about this concept.</p>
c++
[6]
2,946,852
2,946,853
STRING palindrome
<p>hi I need a detail code in java to check string palindrome without using API'S</p>
java
[1]
3,530,364
3,530,365
Properties in Python
<p>whats the reason to use the variable the self._age? A similar name that doesn't link to the already used self.age?</p> <pre><code>class newprops(object): def getage(self): return 40 def setage(self, value): self._age = value age = property(getage, setage, None, None) </code></pre>
python
[7]
3,940,444
3,940,445
Replace links to images with img elements w/ jQuery
<p>Using jQuery, I'm trying to replace all links to images (.jpg, .png, .tiff, .gif) within a certain div with <strong>img</strong> elements to show the image instead of linking to it.</p> <p>Eg. it would change</p> <pre><code>&lt;a href="http://domain.com/image.jpg"&gt;Any Text Here&lt;/a&gt; </code></pre> <p>to</p> <pre><code>&lt;img src="http://domain.com/image.jpg"/&gt; </code></pre> <p>Thank you so much in advance :)</p>
jquery
[5]
2,241,812
2,241,813
Replace a DIV with multiple class with a new class on click
<p>My HTML is as follow. </p> <pre><code>&lt;div class="box w-25 h-25"&gt; &lt;p&gt;test&lt;/p&gt; &lt;/div&gt; &lt;div class="box w-30 h-30"&gt; &lt;p&gt;test&lt;/p&gt; &lt;/div&gt; &lt;div class="box w-30 h-30"&gt; &lt;p&gt;test&lt;/p&gt; &lt;/div&gt; </code></pre> <p>and my css</p> <pre><code>.test { width:100% height:100% z-index: 999 } .box { .... } .w-25{ width: 25%; } .w-30{ width: 30%; } .w-40{ width: 40%; } .h-25{ height: 25%; } .h-30{ height: 30%; } .h-40{ height: 40%; } </code></pre> <p>Is it possible to replace the original class with .test when I click on them individually with jQuery as to create an overlay effect?</p>
jquery
[5]
652,084
652,085
How do I Install .apk files in the android emulator?
<p>I want to install my .apk file in android emulator.But I have multiple emulators opened(5554,5556) and i don't want to close any one of the emulator how to install a .apk file in an emulator when there is multiple emulators are opened?</p>
android
[4]
4,407,710
4,407,711
jQuery has detected parents incorrectly
<p>I have html structure like below:</p> <pre><code>&lt;div id="banner-menu-holder"&gt; &lt;div&gt; &lt;div class="avalible"&gt; &lt;div class="items-holder"&gt; &lt;div&gt; &lt;div class="img-holder"&gt; &lt;div&gt; &lt;input id="set_banner_29" type="checkbox" onclick="mod.setBanner(29);"&gt; ... &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; ... &lt;/div&gt; &lt;/div&gt; &lt;div class="ready"&gt; &lt;div class="items-holder"&gt; &lt;div&gt; &lt;div class="img-holder"&gt; &lt;div&gt; &lt;input id="rem_banner_1_8_32" class="remove_banner" type="checkbox" checked="checked"&gt; ... &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; ... &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>and js code:</p> <pre><code>$(document).click(function(ev) { if ($(ev.target).parents().index($('#banner-menu-holder')) == -1) { $('#banner-menu-holder').css('display', 'none'); } }) </code></pre> <p>When I clicked checkbox into first div (class avalible) then function has been successfull executed - this chekbox is child of main div (#banner-menu-holder).</p> <p>When I clicked second div's checkboxes and the function had not worked. jQuery didn't detected that these checkboxes are children of main div.</p> <p>Is that problem into jQuery or otherwise?</p>
jquery
[5]
436,989
436,990
how to convert compare two lowercase strings in php
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6813111/how-to-compare-case-insensitive-two-strings-in-php">how to compare case insensitive two strings in php</a> </p> </blockquote> <p>I need to compare two string here is my code</p> <pre><code>if( (strtolower($UgenderSeek)=="both") ? (strtolower($gender)=='male' || strtolower($gender)=='female') : strtolower($UgenderSeek)==strtolower($gender) ) </code></pre> <p>but it's working for any one me help me</p>
php
[2]
2,209,560
2,209,561
Does Java have all the PHP features?
<p>To make my question clearer, I figured out that Java doesn't have a JSON class. Are there many PHP functions that doesn't exist in Java?</p>
java
[1]
799,019
799,020
Why current location of android phone don't change when i change location?
<p>I get location of android phone as:</p> <pre><code>android.location.Location locationA; LocationManager locationManager; Criteria cri = new Criteria(); locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); String tower = locationManager.getBestProvider(cri, false); locationA = locationManager.getLastKnownLocation(tower); if (locationA != null) { // lat = (double) (locationA.getLatitude() * 1E6); // longi = (double) (locationA.getLongitude() * 1E6); double lat = locationA.getLatitude(); double longi = locationA.getLongitude(); TextView txt = (TextView) findViewById(R.id.textView1); String td = String.valueOf(lat) + "," + String.valueOf(longi); txt.setText(td); } </code></pre> <p>Why current location of android phone don't change when i change location and get again current location?</p>
android
[4]
2,797,154
2,797,155
jQuery addClass to element based on attribute value
<p>I am stuck with this and need some help. I know the logical solution for this, but not sure how to translate it to jQuery code (newbie here :)). Any suggestions or help greatly appreciated!</p> <p>I need to add a css class (active class), to an element that has a title attribute equal to the value of a variable. So, let's say my variable currentElement = 'great day'. There is also an a tag element on the page that has the title attribute of 'great day', such as <code>&lt;a title='great day' href='#'&gt;</code>.</p> <p>With jQuery I want to: Find a tag in the DOM where currentElement == a tag title and add css class. So, ideally it should find that a tag and add the css class to it.</p> <p>I came up with something like this but not working:</p> <pre><code>/* set currentElement var to the src attribute value of an a tag on the page this works */ var currentElement = $('#greatLink'] img[src*=' + test + ']').attr('src'); /* now find an a tag on the page that has the same title attribute as var currentElement this does not work */ $("a[title ='+currentElement+']").addClass('selectedThumb'); </code></pre>
jquery
[5]
804,366
804,367
what is java script for the following data?
<p>I want a script which does the below, Here "xxxx xxxx xxxx" is a keyword</p> <p>All my ad visitors will come to my site via bing/yahoo search</p> <ol> <li><p>Visitors type "xxxx xxxx xxxx' in bing/yahoo and see my ad</p></li> <li><p>Once they click on my ad, they are directed to my site</p></li> <li><p>In my site i want to display my normal content with "xxxx xxxx xxxx" as my heading (whichever they typed)</p></li> </ol> <p>This "xxxx xxxx xxxx" is the keyword what visitor type in search engines, so script should be intelligent enough to take the keywords from the search engine.</p>
javascript
[3]
2,635,591
2,635,592
not giving sum of the row
<p>I am getting undefined as the resulting sum of the row.</p> <pre><code>var myArray = new Array(3); for (var i = 0; i &lt; 3; i++) { myArray[i] = new Array(3); for (var j = 0; j &lt; 3; j++) { myArray[i][j]=prompt("element"," "); } } for(i=0;i&lt;4;i++) { sum=0; for(j=0;j&lt;4;j++) { document.write(myArray[i][j]); sum+=myArray[i][j]; } document.write("sum of"+ i+ "row"+sum); } </code></pre>
javascript
[3]
1,220,803
1,220,804
How to read XML file from solution location and bind the xml file with dll?
<p>I am creating a class library, and i have created a folder called config in the solution directory. and i placed one xml in the folder.</p> <p>How to load the xml file in my class functions?</p> <p>I tried like below, its not loading</p> <pre><code> XmlDocument contentxml = new XmlDocument(); String configxmlfile = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "Config\\instruction.xml"; contentxml.Load(configxmlfile); </code></pre> <p>And I want to bind the xml file with the dll, becuase i am going to upload the dll in another application and i will call my classes from the dll, and my class will look for the xml file information there.</p>
c#
[0]
599,520
599,521
Is it safe to downgrade an iphone app to a previous SDK?
<p>I have released an app with the 2.2.1 SDK, to realize that I'm pointlessly losing a big percentage of customers still on firmware 2.2 (See this article: <a href="http://arstechnica.com/apple/news/2009/03/app-store-lessons-firmware-followup.ars" rel="nofollow">http://arstechnica.com/apple/news/2009/03/app-store-lessons-firmware-followup.ars</a>) So I'm thinking of updating the app to the previous SDK, 2.2.</p> <p>I was wondering if anyone has run into any problem doing this? Is this safe for customers who have already installed the previous version, to install my "downgrading" update?</p>
iphone
[8]
653,516
653,517
Print defined content using Javascript
<p>I used <a href="http://stackoverflow.com/questions/3210317/how-to-print-a-div-using-a-javascript">the solution from this question</a> but it also shows the URL on the document. <img src="http://i.stack.imgur.com/u7oIb.png" alt="enter image description here"></p>
javascript
[3]
2,099,958
2,099,959
searching in linked list
<p>Here is my code for searching in a linked list, but it doesn't give me the correct result. Please help me, i'm very worried about it.</p> <pre><code>search() { char ser[20]; cout &lt;&lt; "enter data to be searched" &lt;&lt; endl; gets(ser); for ( start=head; start-&gt;ptr!=NULL; start=start-&gt;ptr ) { if ( start-&gt;info == ser ) { cout &lt;&lt; "ok" &lt;&lt; endl; break; } } cout &lt;&lt; "not found" &lt;&lt; endl; } </code></pre> <p>Thanks, Saima Kanwal Bhutta</p>
c++
[6]
3,814,256
3,814,257
Remove element with JQuery
<p>I'm currently using the following code to append a X link to each element on rollover. </p> <pre><code>$(".item").hover(function() { var id = $(this).attr("id"); var roll = $('&lt;a class="close" href="#"&gt;X&lt;/a&gt;').hide(); roll.prependTo($(this)).fadeIn(0); }, function() { $(this).find("a:first").fadeOut(0, function() { $(this).remove() }); }); </code></pre> <p>What I am unable to code up is the ability for when this X link is pressed, it removes the parent div it is currently in.</p> <p>Would love help on this :)</p>
jquery
[5]
3,926,711
3,926,712
Conditional JQuery dropdown for search function
<p>I'm building a search function in jQuery. I have 3 dropdowns that are loaded from a MySQLdatabase. When a user selects 1 of the dropdowns it has to affect the other dropdown values.</p> <p>I made it working for the seperate values but I'm stuck when they select 2 or 3 dropdowns. I worked with the &amp;&amp; operator but this doesn't work. Can someone please take a look what im doing wrong?</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { if( $(("#IndID").change) &amp;&amp; $(("#CatID").change)) { $("#ProdName").load("scriptp.php?c3=" + $("#IndID").val() + $("#CatID").val()); } if( $(("#IndID").change) &amp;&amp; $(("#ProdName").change)) { $("#CatID").load("scriptc.php?c=" + $("#IndID").val() + $("#ProdName").val()); } $("#IndID").change(function() { $("#CatID").load("scripti.php?c=" + $("#IndID").val()); }); $("#CatID").change(function() { $("#ProdName").load("script.php?cc=" + $("#CatID").val()); }); }); &lt;/script&gt; </code></pre>
jquery
[5]
3,604,495
3,604,496
jquery validation plugin minLength override in invalidHandler
<p>Is it possible to override the default minlength error message in the callback invalidHandler ?</p> <p>Say by default the error message for minlength would be <em>Please enter at least {0} characters</em>. Can this be overriden with the inclusion of the form element say <strong>{element} - Please enter at least {0} characters</strong>. validator.numberOfInvalids() is able to capture this error but am not able to figure out how to override the error message of the corresponding error.</p> <p>Any help in this context is really appreciated, Thanks.</p>
jquery
[5]
4,436,888
4,436,889
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 the the element "elem".</p>
jquery
[5]
2,872,432
2,872,433
window.open makes page scroll up
<p>i'm using a windows.open popup and when i click it the page automatically goes up, how do i prevent this? i tried 'top:auto' it doesnt work here is my code</p> <blockquote> <pre><code> function openPopup() { var divText = document.getElementById("pass").outerHTML; var myWindow = window.open('', '', 'width=500,height=200,top=100'); var doc = myWindow.document; doc.open(); doc.write(divText); doc.close(); } </code></pre> </blockquote> <pre><code> &lt;a href="#" onclick="openPopup()"&gt;Read More&lt;/a&gt; </code></pre>
javascript
[3]
5,326,886
5,326,887
Cannot retrieve global variable's value inside function?
<p>I keep getting "undefined" as result from returning the variable inside a function.</p> <p>This is the code:</p> <pre><code>var nloads = 1; function something(loc) { console.log(nloads); // returns 1 } function changeSection(loc) { console.log(nloads); // Returns undefined nloads = nloads + 1; temp = nloads; } </code></pre> <p>What's wrong with it?/What may be causing the problem?</p>
javascript
[3]
4,495,732
4,495,733
jquery serialize not sorted?
<p>I have a javascript function that reads an entire form into a serialized</p> <pre><code> $.ajax({ type: 'POST', url: '/cart/update.js', dataType: 'json', data: $("#add-to-cart").serialize() + '&amp;id=' + $("select[name=id]").val(), success: goToCart, error: goToCart }); </code></pre> <p>However it seems to be not organizing the data. It should be <code>pattern, line 1, line 2, line 3, line 4, line 5, line 6</code>, however it seems to be going <code>line 1, line 2, line 3, line 4, pattern, line 5, line 6</code>.</p> <p>Is there a way to sort the serialized data somehow?</p> <p>html is in proper order, pattern is first then lines 1-6.</p> <p>Any help?</p>
jquery
[5]
4,743,887
4,743,888
Expand only one row in javascript code
<p>hey guys having trouble figuring out how to make it so that i can make it only open one table at once, once you open another the other should close any help here? </p> <pre><code>function showRow(cctab){ if (document.getElementById(cctab)) { document.getElementById(cctab).style.display = ''; } } function hideRow(row1){ if (document.getElementById(cctab)) { document.getElementById(cctab).style.display = 'none'; } } function toggleRow(cctab){ if (document.getElementById(cctab)) { if (document.getElementById(cctab).style.display == 'none') { showRow(cctab) } else { hideRow(cctab) } } } </code></pre> <p>Now I want to make it so that only one table "cctab" opens after I suggest the onClick="javascript:toggleRow(cctab);" anyhelp?</p>
javascript
[3]
3,684,932
3,684,933
Press any Key to Continue..Android
<p>I want to create an activity with message " Press any key to continue..." and by clicking any key on the keypad...another activity must be started.</p> <p>Can any one give an idea how can I implement this?</p>
android
[4]
3,205,058
3,205,059
Refresh UIView for drawRect?
<p>Is there a way to refresh a UIView which will subsequently call drawRect?</p> <p>EDIT:</p> <p>I am doing <code>[view setNeedsDisplay]</code> however it doesn't appear to be working! Or at least my NSLog in drawRect isn't displaying.</p> <p>EDIT2:</p> <p>Please see comments of selected answer for the gory details! Number one tip: Make sure it's <em>property</em> linked!</p>
iphone
[8]
3,532,551
3,532,552
In JS, which is faster: Object's "in" operator or Array's indexof?
<p>I want to keep a list of strings that I will only ever check for the presence of, eg:</p> <pre><code>corporatePlan = [ 'canDeAuthorize', 'hasGmailSupport', 'canShareReports', 'canSummonKraken', 'etc' ] </code></pre> <p>So, when the user tries to summon the kraken, I'll do <code>corporatePlan.indexof('canSummonKraken') != -1</code> to see if he can.</p> <p>A coworker suggests that it would be faster to store it as an object:</p> <pre><code>"Corporate Plan" = { 'canDeAuthorize' : null, 'hasGmailSupport' : null, 'canShareReports' : null, 'canSummonKraken' : null, 'etc' : null } </code></pre> <p>And just do something like <code>'canSummonKraken' in corporatePlan</code> to check if the plan contains that key. This makes sense in a classic CS sense, since of course 'contains' is constant time on a map and linear on an array. Does this check out against how arrays and objects are implemented under the hood in JS, though?</p> <p>In our particular case, with less than 100 elements, the speed doesn't matter much. But for a larger array, which way would be faster on access?</p>
javascript
[3]
5,145,794
5,145,795
Conflict with jscrollPane and animate
<p>I am using jscollPane on a div that is displayed via the jquery animate function.</p> <p>The animate function seems to be causing a conflict with the jscrollpane script and thus the scrollbars do not show. </p> <p>Here is an example page to demonstrate: <a href="http://mikesewell.net/dev/scrollpane/" rel="nofollow">http://mikesewell.net/dev/scrollpane/</a></p> <p>The div #text is hidden using display: none; it is shown using this function:</p> <pre><code>$(".bio-button").hover(function() { $(this).next("#text").animate({opacity: "show"}, "slow"); } </code></pre> <p>If I dont' hide #text jscrollPane works fine, but if using this function to animate stops the scrollbars from showing.</p> <p>Any suggestions would be greatly, greatly appreciated. Thanks!!</p>
jquery
[5]
40,857
40,858
How to parse time durations from Strings and add them?
<p>I need to parse two Strings in <code>HH:MM</code> format in Java:</p> <pre><code>String time1="10:45"; String time2="02:30"; </code></pre>
java
[1]
3,448,069
3,448,070
public static HashSet<string> thread safe?
<p>Basically i have an app calling 3 different threads that each that a new HashSet and I want to know is this thread safe? or do I need a [ThreadStatic] added to each hashset?</p>
c#
[0]
2,025,654
2,025,655
java - how to open a program and detect when the program is closed
<p>My main method opens an app and sets <code>running</code> to false after it has finished executing, the only problem is that I want to to set <code>running</code> to false only once the opened app has been closed. Is there any easy way to do this?</p> <p>This is my code:</p> <pre><code>Runtime runtime = Runtime.getRuntime(); boolean running = true; try { Process p = runtime.exec("open test.app"); p.waitFor(); } catch (InterruptedException e) {} running = false; </code></pre> <p>EDIT: What happens at the moment is it opens <code>test.app</code>, then it sets <code>running</code> to false even though the app is still running.</p>
java
[1]
4,340,236
4,340,237
Access modifier for php class properties
<p>Why doesn't php have default access modifier for Class properties (like functions - functions do have a default : <a href="http://stackoverflow.com/questions/2224380/default-visibility-of-class-methods-in-php">Default visibility of class methods in PHP</a>) ? It always forces you to use one of the access modifiers(private,public or protected) or var. Would it make more sense to have a default access modifier like 'public' if none is specified ? What was the logic of not providing one ? Am no php expert so please excuse if i am missing anything obvious.</p>
php
[2]
419,628
419,629
Asign click handler to newly appended elements
<p>How does one go about adding a click handler in the following example? I need to assign it to the newly appended anchor element.</p> <pre><code>$.each(regions1, function(key, value) { var coords = regions1[key].rel.split('-'); $("#map").append("&lt;a href='javascript:void(0)' id='"+ regions1[key].id +"' class='bullet' style='left: "+ addpx(Number(coords[0]) - rempx(settings.bulletWidthOffset)) +"; top: "+ addpx(Number(coords[1]) - rempx(settings.bulletHeightOffset)) +"'&gt;&amp;nbsp;&lt;/a&gt; ") //.click(function(){showPopup(regions1[key].id);}) }); </code></pre> <p>Cheers</p>
jquery
[5]
4,197,404
4,197,405
newbie questions about overloading contructors
<p>While I have done OOP before, I am just learning Java.</p> <p>I have a 3 questions on overloaded constructors:</p> <p>1.On the line marked line 1, I am calling an overloaded constructor but the compiler doesn't resolve the call,<br> is there something else I need to do?</p> <ol> <li><p>On the line marked with a 2, The compiler complains that the "this()" needs to be the first statement in the method, when it is. What's with that?</p></li> <li><p>If I am writing an overloaded constructor, and I haven't overridden the default constructor do I need an explicit "this();" in the overloaded constructor, if i want to execute the behavior of the default constructor, or is it included in all constructors for "free"?</p></li> </ol> <p>.</p> <pre><code>class JavaSnippet { public static void main(String[] args) { String MenuItemName="Coffee"; double MenuItemPrice=1.0; Item MenuItem; //1-&gt; MenuItem=new Item(MenuItemName,MenuItemPrice);// Get "cannot find symbol" } } class Item { String name; double price; public void Item(String InName, double InPrice) { // 2-&gt; this();// get "call to this must be first statement in constructor" name=InName; price=InPrice; } } </code></pre>
java
[1]
4,623,618
4,623,619
Can I use Apple Passcode for my App
<p>I want to make one passcode for my app, can I use apple passcode for the same. I want to use Apple embedded Passcode for my app instead of passcode programming in my project, is it possible? </p>
iphone
[8]
1,717,649
1,717,650
$.post not working in IE
<p>I have the following code and it doesn't work in IE8. Even though I see the form data on the client. Nothing makes to the server. Has anybody seen this ?</p> <pre><code>var data2 = $j('#form2').serialize() alert(data2) $j.post(urlBase + 'tabulae/userInvitation/ajaxValidateInviteeDomain', data2, function(data) { if (data[0] == true) { e.target.form.action = e.target.value; e.target.form.submit(); } else { $j('#dialog-invalidEmail').dialog({ modal: true, buttons: { OK: function() { $j(this).dialog("close"); } } }); } }, 'json') </code></pre>
jquery
[5]
2,894,149
2,894,150
How can we track a video file duration in PHP
<p>Hi I need to save video file duration. when it is uploaded. How can I do that in PHP.</p>
php
[2]
3,612,467
3,612,468
difficulty referencing functions, using prototype
<p>I am working on HTML 5 Canvas game, with a gameloop. </p> <p>Here is my code so far. It doesn't do anything and that is fine, but I am getting an error</p> <p>TypeError: Object [object DOMWindow] has no method 'Update' [http://localhost:2516/scripts/lib/Game.js:47] </p> <p>Edit: This code works, it no longer reflects the problem, it reflects the solution</p> <pre><code> var game; var Game = function () { } Game.prototype.Update = function () { } Game.prototype.Draw = function () { } function GameLoop () { game.Update(); //this is line 47 //context.save(); game.Draw(); // context.restore(); setTimeout(GameLoop, 10); } function Start() { game = new Game(); GameLoop(); } </code></pre> <p>Edit: I think the "this" is looking at the document instead of the Game object, which I don't understand why or how to fix it</p>
javascript
[3]
2,970,539
2,970,540
Jquery hover repetition
<p>I want to move an image when I mouse over and put it back to the previous position when mouseOut. This script works fine, but if I move my mouse over few times, it keeps on going up and doing. How can I fix it?</p> <pre><code>$(document).ready(function () { $(".HomeClaimWrapper .img").hover(function () { $(".HomeClaimWrapper .img").animate({ top: "-15px" }, 500); }); $(".HomeClaimWrapper .img").mouseout(function () { $(".HomeClaimWrapper .img").animate({ top: "0px" }, 500); }); }); </code></pre>
jquery
[5]
4,820,178
4,820,179
Javascript : To text string contains only alpha numaric,$ and _
<p>give an example To text string contains only alpha numaric,$ and _ using javascript</p>
javascript
[3]
3,007,986
3,007,987
Error with a href click
<p>I have a problem to share with you guys..In my page I have different tabs that was created by some method, before moving onto another tab i need to do some validations, but the problem is when i click next tab the page is submitted before going to my validation check even though they check the validation script is executed but because of the page is submitted first it's moving to the next tab.How can i prevent moving to next tab if validation is false.</p> <p>Code for a href click: </p> <pre><code>&lt;a onclick="adc.FormHandler.goto('user_edit', 0); return false;" href="#"&gt; &lt;i data="1" class="icon-tab-num"&gt;&lt;/i&gt; General Info &lt;/a&gt; </code></pre> <p>code for actual click function</p> <pre><code>if (null !== document.forms[formName]) { document.forms[formName].elements['__goto'].value = gotoIndex; document.forms[formName].submit(); return false; } </code></pre> <p>I can't modify these scripts because this is a general script and created by some other team memeber.I am using jquery for validation.</p> <p>Thanks Alex</p>
javascript
[3]
1,450,308
1,450,309
Context Menu for ListView
<p>I have a <code>ListView</code> with a customized adapter in my application. I want to add a <code>ContextMenu</code> for deleting items in this <code>ListView</code> </p> <p>in my <code>onCreate</code> method I register the <code>Context Menu</code>:</p> <pre><code>registerForContextMenu(lastCases); </code></pre> <p>where the parameter is my ListView</p> <p>This should call this method: </p> <pre><code>@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); Log.i("onCreateContextMenu: ", "Inside"); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.stock_file_menu, menu); } </code></pre> <p>As you can see I use the Logger to log info whenever this method is called. But it doesn't outputs anything to <code>LogCat</code>, which indicates that this method is never fired off.</p> <p>Also I should mention that my <code>ListView</code> is filled with information from this method: </p> <pre><code>private void RefreshCaseList() { lastTenCases = db.getAllCases(10); if (lastTenCases.size() &gt; 0) error.setText(""); lastCases.setAdapter(new CustomAdapter(myClass.this, lastTenCases)); } </code></pre> <p>This method grabs some objects from a database, and fills the <code>ListView</code> with these objects, but this method is called before I register the <code>context menu</code> in <code>OnCreate</code>. </p> <p>No errors does occure so I doesn't have any more information that can help me. Anybody how knows how to make a <code>Context Menu</code> for a <code>ListView</code> with a customized adapter? </p> <p>Thanks in advance!</p>
android
[4]
4,183,505
4,183,506
How to detect idle state on the browser which use webkit in jQuery
<p>I found a solution worked around with detecting idle state of user on browser on <a href="http://www.nczonline.net/blog/2009/06/02/detecting-if-the-user-is-idle-with-javascript-and-yui-3/" rel="nofollow">Detecting if the user is idle with JavaScript and YUI 3</a>.</p> <p>It worked fine on FireFox, but sometimes it did not do not in Chrome, Safari. The mousemove event was called all of time with those browser.</p> <p>Any one has other solution for it instead?</p>
jquery
[5]
4,643,873
4,643,874
CuteWebUI.UploadModule,CuteWebUI.AjaxUploader does not implement IHttpModule
<p>I'm getting an error with an IHttpModule. Not quite sure what the issue is.</p> <p>This is the web.config entry.</p> <pre><code>&lt;httpModules&gt; &lt;add name="CuteWebUI.UploadModule" type="CuteWebUI.UploadModule,CuteWebUI.AjaxUploader"/&gt; &lt;/httpModules&gt; </code></pre> <p>This is the error message, a yellow screen of death</p> <p><em>"CuteWebUI.UploadModule,CuteWebUI.AjaxUploader does not implement IHttpModule."</em></p>
asp.net
[9]
3,518,355
3,518,356
How to prevent double addtobackstack while on PreferencesFragment in android
<p><strong>Background:</strong></p> <p>I'm using PreferencesFragment to manage preferences in my android app and i use options menu to access those preferences.</p> <p><em>MainActivity class overriden methods:</em></p> <pre><code>@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()){ case R.id.menu_prefs: PrefsFragment prefs = new PrefsFragment(); getFragmentManager() .beginTransaction() .replace(R.id.main_container, prefs) .addToBackStack(null) .commit(); break; } return true; } </code></pre> <p><em>res/menu/menu.xml:</em></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;item android:id="@+id/menu_prefs" android:icon="@android:drawable/ic_menu_preferences" android:title="@string/menu_prefs_title" android:showAsAction="ifRoom|withText"&gt; &lt;/item&gt; &lt;/menu&gt; </code></pre> <p><strong>Problem:</strong></p> <ul> <li>While on main screen, I click preferences icon in action bar, PrefsFragment starts.</li> <li>While on PrefsFragment, I click preferences icon in action bar PrefsFragment starts <strong>again</strong> (this is where problem arise).</li> <li>I hit the back button and it reverts fragment transaction and goes back to <strong>PrefsFragment</strong>. (it should go back to main screen).</li> </ul> <p><strong>Question:</strong> Is there any smart way to disable double showing PrefsFragment?</p> <p><strong>Desired outcome:</strong> Clicking prefs icon in action bar if on main screen shows PrefsFragement, clicking prefs icon in action bar while PrefsFragemnt is visible does nothing, clicking back button while on PrefsFragment always goes back to main screen.</p>
android
[4]
4,274,667
4,274,668
How can I make text into links using jQuery?
<p>I'm trying to make a reply system for the comments on my blog. When someone clicks on "Reply" it will take the comment id and put two brackets infront of it in comment textbox.</p> <p>Basically it will look like this <strong>>>123456789</strong>, it's not a link or anything it's just plain text. Once it's been posted the brackets are converted to <code>&amp;gt;</code> so it'll look like this in the final source code: <strong><code>&amp;gt;&amp;gt;123456789</code></strong> (every id has 9 numbers)</p> <p>I need to make that text into a link.</p> <p>Here's what's supposed to happen: <a href="http://jsfiddle.net/KFXFd/" rel="nofollow">http://jsfiddle.net/KFXFd/</a><br> Here's what happens when I try to change the class: <a href="http://jsfiddle.net/qWYCQ/" rel="nofollow">http://jsfiddle.net/qWYCQ/</a></p> <p>Note that the class has to be <strong>.commenttext</strong> instead of <strong>body</strong>, but for some reason I can't get it working (I'm terrible at js).</p>
jquery
[5]
1,637,872
1,637,873
Find an element in List of List, c#
<p>I have a list of lists as below:</p> <p><code>List&lt;List &lt;T&gt; &gt; userList</code> </p> <p><code>Class T { string uniqueidentifier, string param2, int param2}</code></p> <p>I have a uniqueidentifier and i need to find the element T in the list that has the same 'uniqueidentifier' value.</p> <p>I can do it using two 'foreach' loops. This does not seem to be nice way doing things. I guess there should be some inbuilt method like 'Find' that does the same thing and is highly optimized. </p>
c#
[0]
3,613,951
3,613,952
unable to call self invoking function
<p>i am trying to call self invoking function but it doesn't seem to work, as you can see code below i am able to alert (test) but not when it is called upon another function. Please advise - Thank you </p> <pre><code>var test = (function(a,b){ return a*b; })(4,5); function myFunc() {}; alert(test); // working alert(test.call(myFunc, 10,5)); // not working </code></pre>
javascript
[3]
3,690,918
3,690,919
getInstalledApplications vs getInstalledPackages
<p>May I know what the differences between getInstalledApplications and getInstalledPackages? The documentation doesn't say much.</p> <p>Thanks.</p>
android
[4]
4,280,484
4,280,485
Beginner C# applications
<p>I just started learning C#, and I want to start making some small applications that are easy, but powerful. </p> <p>Does anyone have any projects ideas? I'm interested to hear what you have in mind. Most of my experience is with HTML, CSS, JS, PHP.</p> <p>Thanks </p>
c#
[0]
1,132,910
1,132,911
C++: String and unions
<p>I'm having a (design) problem: I'm building an interpreter and I need some storage for variables. There are basically two types of content a variable here can have: <code>string</code> or <code>int</code>.</p> <p>I'm using a simple class for the variables, all variables are then stored in a vector.</p> <p>However, as a variable can hold a number or a string, I don't want C++ to allocate both and consume memory for no reason.</p> <p>That's why I wanted to use unions:</p> <pre><code>union { string StringValue; int IntValue; } </code></pre> <p>However, strings don't work with unions.</p> <ul> <li>Is there any workaround so no memory gets eaten for no reason?</li> </ul>
c++
[6]
4,355,318
4,355,319
help with $(this).val() toUpperCase()
<p>Given:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { var str = 'Test'; //alert(str.toUpperCase()); $('#stringFinder').keyup(function (e) { alert($(this).val()==str.toUpperCase()); }); }); &lt;/script&gt; </code></pre> <p>How do I make $(this).val() all upper case to get a like comparison using contains?</p> <p>Thanks, rodchar</p>
jquery
[5]
274,627
274,628
Making my own data type
<p>I'm new to programming and Java. I'm trying to write my own data type/collection class but I'm not quite sure how to go about it. </p> <p>I want a class that contains a string, and an array-list of strings.</p> <p>Usually I would go about making a data type like this:</p> <pre><code>public class Collection { private int id; private String word; private int howMany; private char firstChar; public Collection (int i, String w, int h, char f){ id = i; word = w; howMany = h; firstChar = f; } //Getters and Setters } </code></pre> <p>Not sure how I can do this with an ArrayList field. </p> <p>My goal behind this is to have a class of unique words in the string field read in from .txt files and in the arraylist field have all the .txt file names that contain that word. </p> <p>Edit: Building on Tom Anderson's Response and what I initially thought to do:</p> <pre><code>public class Collection { private int id; private String word; private int howMany; private char firstChar; private List&lt;String&gt; filenames; public Collection (int i, String w, int h, char f, List&lt;String&gt; filenames){ id = i; word = w; howMany = h; firstChar = f; this.filenames = filenames; } } </code></pre> <p>I'm still not sure how to use this since I can not simply add a string to the ArrayList parameter when creating a new instance of the my Collection Class. Such as this:</p> <pre><code>ArrayList&lt;Collection&gt; collection = new ArrayList&lt;Collection&gt;(); Collection newTest= new Collection("test","test"); collection.add(newTest); </code></pre>
java
[1]
2,930,114
2,930,115
Android: Data from Broadcast from AsyncTask not getting data through
<p>I am using an Intent to Broadcast data from a AsyncTask thread back to a the main Activity. The Broadcast is received my the Activity with no problem, but I am not seeing the Uri data or CharSequence data. They are both null.</p> <p>On Service side in AsyncTask:</p> <pre><code> public static final String LOCATION_UPDATE = "com.locationTest.lct.LOCATION_UPDATE"; char[] buffer = new char[10]; buffer[0] = 't'; buffer[1] = 'e'; buffer[2] = 's'; buffer[3] = 't'; Intent intent = new Intent(LOCATION_UPDATE); intent.putExtra("location",buffer); sendBroadcast(intent); </code></pre> <p>On activity side in main Activity class:</p> <pre><code>public static final String LOCATION_UPDATE = "com.locationTest.lct.LOCATION_UPDATE"; public class LocationBroadcastReceiver extends BroadcastReceiver { public void onReceive(Context context,Intent intent) { Uri data = intent.getData(); CharSequence location = intent.getCharSequenceExtra("location"); } } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); iService = startService(new Intent(this,InputService2.class)); IntentFilter filter = new IntentFilter(LOCATION_UPDATE); LocationBroadcastReceiver r = new LocationBroadcastReceiver(); registerReceiver(r,filter); </code></pre>
android
[4]
504,718
504,719
MapView works with Eclipse install but not adb install
<p>When I run my application on a physical phone from within Eclipse, my Google MapView works perfectly. If export the app to an apk file and install it to the same phone from the command line with adb then the MapView comes up but shows only the Google logo and grid - no map tiles appear. I'm using a debug application key and a GMaps API key generated with that debug key. I've verified that this happens on both the Droid and N1 phones. The logcat looks identical in both the working and non-working cases - no obvious error messages.</p> <p>Any ideas what might be wrong?</p>
android
[4]
2,505,582
2,505,583
Honeycomb is not passing the app_data bundle to my search results activity
<p>This code which works fine in previous versions of Android is not working on 3.0:</p> <pre> public boolean onSearchRequested() { Bundle currentData = new Bundle(); currentData.putLong(Folder.FOLDER_LUID, folderId); startSearch (lastSearchText, false, currentData, false); return true; } </pre> <p>The app_data bundle is NOT in the intent passed to my search results activity. Is there perhaps some new configuration that must be done to get this data passed in the intent?</p>
android
[4]
4,140,126
4,140,127
Another typedef error with C++
<pre><code>#ifndef C_H #define C_H #include &lt;memory&gt; class C { public: C(){}; ~C() {}; }; typedef auto_ptr&lt;C&gt; CPtr; #endif </code></pre> <p>The above codes seem fine for me, but when I compile them with VC10, I got the following errors: "error C2143: syntax error : missing ';' before '&lt;'". Any ideas about it will be appreciated. </p>
c++
[6]