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,777,143
2,777,144
Is there a way to do run something from a parent of a parent?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/183702/access-parents-parent-from-javascript-object">Access parent&#39;s parent from javascript object</a> </p> </blockquote> <p>Im a bit confused how to say this but i want what i would expect from the code "this.this.".</p> <p>In the array</p> <pre><code>Foo = { bar : { Tool : function() { return this.this.foofoo; }, }, foofoo : "rawr" } </code></pre> <p>From the function Foo.bar.Tool() how can i get it to access the data foofoo ?</p> <p>Thankyou !</p>
javascript
[3]
329,068
329,069
VNC SERVER source/app for non-jailbroken iPhone?
<p>I have looked and looked and cannot find an answer. I am looking for an open source vnc <strong>server</strong> for the iphone. I would like to deploy it to my device, and not install it via jailbreaking/cydia. [I'm not looking for a tv-out option (I know that exists), nor a VNC client. Also not looking for screen mirroring (http://code.google.com/p/iphoneos-screen-mirroring/).]</p> <p>Alternate approach: If you KNOW one doesn't exist at the moment: I know veency is out there to be downloaded through Cydia, and I could use something like iResign to sign the ipa with my dev certificates but if I have to go this route how would I get the ipa and it's dependencies without jailbreaking? And could the dependency debs even be installed with iResign?</p> <p><strong>I've been pulling my hair out over this, so any help of any kind will be greatly appreciate. Thank you for your time!</strong></p>
iphone
[8]
675,771
675,772
Template variable in ASP.NET
<p>I have to add a Page's variable into a ItemTemplate but dont know how.</p> <p>For example:</p> <pre><code>&lt;rad:RadMenuItem ID="f" runat="server" Text="Products"&gt; &lt;ItemTemplate&gt; &lt;div class="pitem"&gt;&lt;%= MyText %&gt;&lt;/div&gt; &lt;/ItemTemplate&gt; &lt;/rad:RadMenuItem&gt; </code></pre> <p>The MyText variable does exist in the context and has value but the text does not show up</p> <p>Another question: How can I add MyText to the ASP.NET page like the following?</p> <pre><code>&lt;asp:Button Text="&lt;%=MyText%&gt;" .../&gt; </code></pre> <p>I dont want to edit the code like btn.Text=MyText, just want to do that on the .aspx file as required.</p>
asp.net
[9]
4,870,415
4,870,416
PHP - Image uploading not working
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/11785726/image-uploading-via-php-returning-empty-array">Image uploading via PHP returning empty array</a> </p> </blockquote> <p>I am unable to successfully upload an image/file to my server. The php is as follows:</p> <pre><code>//This is the directory where images will be saved $uploadDir = "./"; $uploadFile = $uploadDir . basename( $_FILES['photo']['name']); //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $uploadFile)){ echo "The file has been uploaded successfully."; } else { print_r($_FILES); } </code></pre> <p>I chose the directory at which this script lives, to ensure the functionality before I upload to the final directory. I want to upload photo's, and will check for file extensions later - but for now I at least need the upload functionality to work.</p> <p>The form is as follows:</p> <pre><code>&lt;form id="imageUploadForm" name="imageForm" enctype="multipart/form-data" action="imageController.php" method="post"&gt; &lt;label for="photo" class="blogLabel"&gt;Upload an Image&lt;/label&gt; &lt;input type="file" name="photo" id="imageUpload"&gt; &lt;input type="submit" name="submit" id="imageSubmit" class="btn btn-primary" value="Upload"&gt; &lt;/form&gt; </code></pre> <p><code>print_r($_FILES)</code> returns: <code>Array ( [photo] =&gt; Array ( [name] =&gt; imgres.jpeg [type] =&gt; image/jpeg [tmp_name] =&gt; /tmp/php1rqFUO [error] =&gt; 0 [size] =&gt; 15147 ) )</code></p>
php
[2]
5,367,036
5,367,037
Best resources to learn JavaScript
<p>The question says it all really, I'm looking for book recommendations, video tutorials etc. I've been programming since I was about six so I don't need a book that spends 4 pages on for loops (thought that might be a <a href="http://www.codinghorror.com/blog/archives/000848.html" rel="nofollow">Bad example</a> in terms of javascript).</p> <p>Also I'm learning ASP.net at the moment so anything on interoperability features/issues would be welcome, though I'm guessing I just showed my ignorance with that question.</p>
javascript
[3]
4,678,251
4,678,252
Reference to running Thread is null
<p>I can't get a spawned thread to stop:</p> <p>I'm implementing the vibration-part of the Ringer-class in the regular Android Phone.apk (basically word for word), but after vibrating once (and stopping) correctly, the second time I call <code>startVibration()</code> and subsequently <code>stopVibration()</code>, it <em>doesn't</em> stop the thread (the log prints out that mVibratorThread is null, even though an instance of it is clearly still active, because the phone is vibrating :-)!)...</p> <pre><code>public volatile boolean mContinueVibrating; public VibratorThread mVibratorThread; private static final int VIBRATE_LENGTH = 1000; // ms private static final int PAUSE_LENGTH = 1000; // ms public void startVibration(){ //Start the vibration alarm if (mVibratorThread == null) { mContinueVibrating = true; mVibratorThread = new VibratorThread(); Log.i(TAG, "Starting vibration..."); mVibratorThread.start(); } } public void stopVibration(){ //Stop the vibration alarm Log.i(TAG, "Stopping vibration..."); if (mVibratorThread != null){ mContinueVibrating = false; mVibratorThread = null; Log.i(TAG, "Thread wasn't null, but is now set to null..."); } else { Log.i(TAG, "Thread was null..."); } } private class VibratorThread extends Thread { public void run() { Vibrator mVibrator = (Vibrator) m_context.getSystemService(Context.VIBRATOR_SERVICE); while (mContinueVibrating) { mVibrator.vibrate(VIBRATE_LENGTH); SystemClock.sleep(VIBRATE_LENGTH + PAUSE_LENGTH); Log.i(TAG, "VIBRATING NOW!!" + mContinueVibrating); } } } </code></pre> <p>I've already tried the method described in <a href="http://stackoverflow.com/questions/680180/where-to-stop-destroy-threads-in-android-service-class">Where to stop/destroy threads in Android Service class?</a></p> <p>Thanks for your help,<br> Nick</p>
android
[4]
5,173,506
5,173,507
Writing specific lines of a text file
<p>I write this code:</p> <pre><code>f = open('example.txt','r') lines = f.readlines() for i, line in enumerate(f): if i &lt; 3: lines = ['LC '+line for line in lines] with open('./example.txt', 'w') as f: f.writelines(lines) f.close() elif i &lt; 5: lines = ['LB '+line for line in lines] with open('./example.txt', 'w') as f: f.writelines(lines) f.close() elif i &gt; 6: break f.close() </code></pre> <p>I have a file with 11 lines. I want to write something in the start from every line. The word is different for the 3 first line and different for other 2. Could you help me what am I doing wrong?</p>
python
[7]
3,952,590
3,952,591
<script type="text/javascript">
<p>Is there any difference between </p> <p><code>&lt;script type="text/javascript"&gt;</code> </p> <p>and </p> <p><code>&lt;script&gt;</code> </p> <p>tags ?</p>
javascript
[3]
2,053,520
2,053,521
Execute initially and via function call
<p>What is the best way wrap some code so I can call it with <code>foo();</code> and have it execute when the javascript is loaded ?</p> <p>I want to have foo executed whenever the javascript is loaded and have the ability to call foo with foo();</p>
javascript
[3]
4,998,082
4,998,083
animation in android
<p>I had an activity (say homeActivity) and when I start a new activity(say nextActivity) from my homeactivity i would like to give it an animation effect like appearing it from the bottom. Is it possible in android?</p>
android
[4]
4,347,626
4,347,627
What's wrong with this code in C++?
<pre><code>#include &lt;iostream&gt; using namespace std; int main() { int i; int a[5]; for (i=0; i&lt;5; i++) { cin&gt;&gt;a[i]; } for (int j=0; j&lt;5; j++) { if (a[j] == 42) break; cout&lt;&lt;a[j]; } } </code></pre> <p>Simple program. Read an array of five numbers. Print the same array until the number 42, if it is entered. For some reason the output is all garbled.</p>
c++
[6]
76,925
76,926
Android-Media Player
<p>I am new to android.I am trying to play a video from sdcard.</p> <p>this is the sample code I have used..</p> <pre><code> public class videoa extends Activity { /** Called when the activity is first created. */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.main); VideoView videoView = (VideoView)this.findViewById(R.id.videoView); MediaController mc = new MediaController(this); videoView.setMediaController(mc); // (1) Web //videoView.setVideoURI(Uri.parse( //"http://www.bogotobogo.com/Video/sample.3gp")); //"http://www.bogotobogo.com/Video/sample.mp4")); //"http://www.bogotobogo.com/Video/sample.mov")); /* (2) SD card */ //videoView.setVideoPath("/sdcard/sample.3gp"); videoView.setVideoPath("/sdcard/robot.avi"); //videoView.setVideoPath("/sdcard/sample.mov"); // videoView.setVideoURI(Uri.parse( //"file:///sdcard/sample.mov")); videoView.requestFocus(); videoView.start(); } </code></pre> <p>}</p> <p>I have launched manually And set the target as -sdcard C:/android-sdk-windows/tools/sdcard.img.</p> <p>When i have launched the emulator it shows Video Cannot be Displayed.</p> <p>Please help me out.</p>
android
[4]
1,337,764
1,337,765
receiving an intent when completing a browser download
<p>I'm writing a software update application that (among other stuff) does the following:</p> <p>When I find an image I want to download, I'm passing an <code>ACTION_VIEW</code> intent to the Browser application. The browser starts the download, and when it completes, I see the download complete message in the notification bar.</p> <p>now I am facing the following problem: I would like to receive an intent when the download is complete.</p> <p>Can anyone help?</p>
android
[4]
4,061,521
4,061,522
Runnable jar doesn't work from one machine to another
<p>So when exporting the project as a runnable jar, the jar works fine on the current machine. Moving the jar to another machine, and it cannot find the main class: Used cmd to get the error:</p> <pre><code> Desktop&gt;java -jar RunMe.jar Exception in thread "main" java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa der.java:56) Caused by: java.lang.ArrayIndexOutOfBoundsException: 500 at pnl_user.readFile(pnl_user.java:667) at pnl_user.readTNS(pnl_user.java:432) at pnl_user.&lt;init&gt;(pnl_user.java:412) at main.&lt;clinit&gt;(main.java:9) ... 3 more </code></pre>
java
[1]
2,737,087
2,737,088
Not able to get onClick event of button while using VideoView
<p>I am using VideoView to display video and media controller.</p> <p>I am showing media controller continually by passing value 0. so when i click on HOME button it doesnt directly go back to home but first it hides mediacontroller than again i have to click on HOME button to go back.</p> <p>What i want is : when i click single time on HOME button video should closed automatically and go back to home.</p> <p>if anybody has some solution / similar type of issue please reply.</p> <p>Thanks</p>
android
[4]
3,072,428
3,072,429
C++ Multiple Condition Statements - Merging
<p>I have written a program according to a specification.<br> The Specification has about 3 types and each type gets handled differently on every single point.</p> <p>That means more or less for code readability, I have written it like shown below, now my question is, if you have <strong>200</strong> such <strong>statements</strong>, wouldn't it be worth to merge them all into one "if enum-type x"</p> <p>I would believe there is a program out there which already does it but google didn't help me much for this specific problem. Thanks for help in advance.</p> <pre><code>/* Point 1.15 Filling Customers bdate */ if(current.identifier == APPLE){ output.setValue(1.15, additionalObj.some.color)} if(current.identifier == PLUM){ output.setValue(1.15, otherObj.another.color) } if(current.identifier == GRAPE){ output.setValue(1.15, default::color) } /* Point 1.16 Filling Customers cash*/ if(current.identifier == APPLE){ do whatever} if(current.identifier == PLUM){ do whatever} if(current.identifier == GRAPE){ do whatever} </code></pre> <p>Result to be achieved:</p> <pre><code>if(current.identifier == APPLE){ output.setValue(1.15, additionalObj.some.color) do whatever } </code></pre> <p>And so on so i can merge them into 1 statement automatically while i still have the readable code</p> <p>Edit: I might have misinformed you, its actually not a type its just an Object with a String identifier and SubObjects so i can't use polymorphism. I have adjusted the above so you can see what i would like to achieve.</p>
c++
[6]
3,953,440
3,953,441
Android - Download and save APK files in Phone Storage (Not in SD card)
<p>I was trying to <strong>download one APK file from my server and save it in Phone Storage</strong>. </p> <p>The following is the code that I used:</p> <pre><code> String apkLink = "http://10.1.20.53/files/test.apk"; URL url = new URL(apkLink); HttpURLConnection c = (HttpURLConnection) url.openConnection(); c.setRequestMethod("GET"); c.setDoOutput(true); c.connect(); context.getDir("test.apk", Context.MODE_WORLD_WRITEABLE); FileOutputStream fos = context.openFileOutput("app_test.apk", Context.MODE_WORLD_WRITEABLE); InputStream is = c.getInputStream(); fileSize = c.getContentLength(); byte[] buffer1 = new byte[1024]; int len1 = 0; int total = 0; while ((len1 = is.read(buffer1)) != -1) { total += len1; percentage = (int)(total*100/fileSize); publishProgress(); fos.write(buffer1, 0, len1); } fos.close(); is.close(); </code></pre> <p>The same code is working fine for XML files. (When i'm downloading XML files to phone memory) . </p> <p>Can someone help me with this? </p> <p>Thank you</p> <hr> <p>Actually I figured out the reason, </p> <p>context.getDir("test.apk", Context.MODE_WORLD_WRITEABLE); code line creates a directory called "data/data/package_name/app_test.apk"</p> <p>But FileOutputStream fos = context.openFileOutput("app_test.apk"); creates a directory called data/data/package_name/files/app_test.apk</p> <p>And I was trying to read the file from data/data/package_name/app_test.apk directory.</p> <p>Anyway, Now I am going to execute this file with this code, </p> <pre><code>File f = new File(getFilesDir()+ "/app_test.apk"); intent.setDataAndType(Uri.fromFile(f) , "application/vnd.android.package-archive"); startActivity(intent); </code></pre> <p>But it gives me a parse error message . </p> <p>Any one can think of a solution? </p> <p>Thank you. </p>
android
[4]
2,605,952
2,605,953
javascript toggle for selected odd and even columns in a table
<p>The Script below is working for either odd or even table columns only. Anybody pl correct/modify to work for both odd and even table columns selected.</p> <pre><code>var toggle = function (action) { var trs = document.getElementById('bar').getElementsByTagName('tr'), trs_count = trs.length, needed = [], total = 0, pattern = /\bfoo\b/g, initial= 'show'; for (i=0; i&lt;trs_count; i++) { var tds = trs[i].getElementsByTagName('td'), tds_count = tds.length; for (j=0; j&lt;tds_count; j++) { if (pattern.exec(tds[j].className)) { needed.push(tds[j]); total++; } } } toggle = function (action) { if (this.display == null) { this.display = initial; } if (action == null) { this.display = (this.display == 'hide') ? 'show' : 'hide'; } else { this.display = action; } for (i=0; i&lt;total; i++) { if (this.display == 'show') { needed[i].style.visibility = 'hidden';//changed from display = 'block'; } else { needed[i].style.visibility = 'visible';//changed from display = 'none'; } } return true; } return toggle(); } </code></pre> <p>Used the following css</p> <pre><code>.foo{visibility:hidden}; </code></pre>
javascript
[3]
4,692,185
4,692,186
How Does the toString(), ==, equals() object methods work differently or similarly on reference and primitive types?
<p>How Does the toString(), ==, equals() object methods work differently or similarly on reference and primitive types?</p>
java
[1]
1,438,127
1,438,128
Is there an Object Initializers in Java
<p>Like this one? <a href="http://weblogs.asp.net/dwahlin/archive/2007/09/09/c-3-0-features-object-initializers.aspx" rel="nofollow">http://weblogs.asp.net/dwahlin/archive/2007/09/09/c-3-0-features-object-initializers.aspx</a></p> <pre><code>Person p = new Person() { FirstName = "John", LastName = "Doe", Address = new Address() { Street = "1234 St.", City = "Phoenix" } }; </code></pre>
java
[1]
147,058
147,059
C# String.Empty
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/151472/what-is-the-difference-between-string-empty-and">What is the difference between String.Empty and &ldquo;&rdquo;</a> </p> </blockquote> <p>Hello</p> <p>Simple Question;</p> <p>Why</p> <pre><code>Textbox1.Text = String.Empty; </code></pre> <p>is better than </p> <pre><code>Textbox1.Text = ""; </code></pre> <p>?</p>
c#
[0]
5,347,496
5,347,497
jQuery .fadeIn() not working as expected
<p>I have the code below for showing a submenu. I want the submenu to fade in on mouse-over, but it doesn't fade in - it just immediately shows the submenu:</p> <pre><code>jQuery("ul li").mouseover(function() { jQuery(this).fadeIn(1000, function () { jQuery(this).find('ul').css('right','0px').css('top','24px'); }); }).mouseout(function(){ jQuery(this).find('ul').css('right','-1000px'); }); </code></pre> <p>thanks</p>
jquery
[5]
703,854
703,855
Trying to read this file in parts. read some part and skip some
<p>I am trying to read a file, I want to read some part of the file and skip some part untill I get to the end of the file. This is what I have but I am not getting my desired result. The idea is to read through all the lines and check if it starts with either "CH" or "CL" if not move to the next line until the end of file and store all those that match the criteria</p> <pre><code> new BufferedReader (new FileReader ("c:\\demo5.properties\\")); while(( br.readLine()) != null ){ if (br.readLine().startsWith("CH") || br.readLine().startsWith("CL")) { buf = new StringBuffer(); buf.append( br.readLine()); while (br.readLine()!= null &amp;&amp; !br.readLine().startsWith("#") &amp;&amp; !br.readLine().contains("claimID")){ buf.append( br.readLine()).append( "\n" ); } z = buf.toString(); System.out.println(z); s3+= z; } br.readLine(); </code></pre> <p><strong>FILE FORMAT</strong></p> <pre><code> CH.field CH.field CH.field CH.field CH.field #CH.field #CH.field #CH.field #CH.field ********* ** ********* CL1.field CL1.field CL1.field CL1.field CL1.field ***************** #Result.CL1.field #Result.CL1.field #Result.CL1.field Result.CL1.field ********* CL4.field CL4.field CL4.field #CL4.field #CL4.field #CL4.field *********** #Result.CL4 #Result.CL4 #Result.CL4 #Result.CL Result.CL4 CL5.field CL5.field CL5.field #CL5.field #CL5.field </code></pre> <p>OUTPUT</p> <pre><code>CH.fieldCH.field CL1.field#Result.CL1.field CL4.field CL4.field </code></pre> <p>#CL4.field</p> <pre><code>CL5.fieldCL5.field </code></pre>
java
[1]
3,731,835
3,731,836
Referencing static fields of the subclass of an abstract class in the abstract class's method body
<p>Given the folowing, in pseudocode</p> <pre><code>abstract public class Bug { private static int BREEDTIME; public void breed() { if (this.age % this.BREEDTIME) { world.setAt(new this.class(newX, newY, this.world); } } } public class Ant extends Bug { private static int BREEDTIME = 3; } public class Doodlebug extends Bug { private static int BREEDTIME = 8; } </code></pre> <p>Is there a way to define the breed() method such that it depends on the BREEDTIME of whatever subclass is calling it? Each subclass of <code>bug</code> is guaranteed to have BREEDTIME initialized.</p> <p>Also, Ants should breed other Ants, so the constructor called inside breed() has to be the constructor of the type of the subclass that is calling breed().</p> <p>Am I barking up the wrong tree here?</p>
java
[1]
4,450,094
4,450,095
How to re-select something in a <select> element using jQuery?
<p>Using jQuery, what is the most simple and elegant way to re-select an item in a <code>&lt;select&gt;</code> dropdown list when given chosen_value=111?</p> <p>What if it is checkboxes instead of <code>&lt;select&gt;</code>, having <code>id[]=11&amp;id[]=12</code>... (the [] are actually in %5B%5D)</p>
jquery
[5]
3,370,958
3,370,959
Unable to find control id 'ID of your Meter' referenced by the 'ControlToValidate' property of 'IDofyourMeterRequird'
<p>I have this error when I run the <code>register.aspx</code> in Visual Studio after I added some fields. The fields are <code>id</code>, <code>meter</code>, and <code>address</code>.</p> <p>This is the code:</p> <pre><code>&lt;tr&gt; &lt;td align="right"&gt; &lt;asp:Label ID="Label1" runat="server" AssociatedControlID="ID of your Meter"&gt;ID of your Meter:&lt;/asp:Label&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ID of your Meter" ErrorMessage="ID is required." ToolTip="ID is required." ValidationGroup="RegisterUser"&gt;*&lt;/asp:RequiredFieldValidator&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre>
asp.net
[9]
5,435,742
5,435,743
Apply styles to dynamically created textViews
<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;style name="detaileventTitle"&gt; &lt;item name="android:layout_width"&gt;fill_parent&lt;/item&gt; &lt;item name="android:layout_height"&gt;wrap_content&lt;/item&gt; &lt;item name="android:textColor"&gt;#000000&lt;/item&gt; &lt;item name="android:textSize"&gt;14dp&lt;/item&gt; &lt;item name="android:textStyle"&gt;bold&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>I have the style above which I usually apply by adding style="@style/detaileventTitle" to my textview xml. However, my textviews are created dynamically. How do I apply this style to the textviews?</p>
android
[4]
850,653
850,654
textarea save wont save with breakline
<p>I have a textarea and then I want to present it. I want the text will be saved with the same break lines or \n.</p> <p>but it wouldnt.</p> <p>heres my code :</p> <pre><code>string content = Request.Form["content"]; content = System.Web.HttpUtility.HtmlEncode(content); UpdateContent(content, id); public void UpdateContent(string content, string id) { sql = "Update TBL_ZAC_SQUARES SET lotstext =@lotstext where id = " + id; connection = new SqlConnection(conn); connection.Open(); cmd = new SqlCommand(sql, connection); cmd.Parameters.AddWithValue("@lotstext", content); cmd.ExecuteNonQuery(); connection.Close(); } </code></pre> <p>then I present it like that :</p> <pre><code>&lt;td align="right" style="padding: 12px; font-family: Arial; font-size: 12pt; color: #000000"&gt; &lt;div &gt; &lt;%=dt_details.Rows[0][9].ToString() %&gt;&lt;/div&gt; &lt;/td&gt; </code></pre>
asp.net
[9]
2,511,857
2,511,858
How to find and modify a TextBox in some word document using Microsoft.Office.Interop.Word
<p>I have to access and change text of some text boxes of some word document by the TextBox id. for example suppose that i have some object named txtDate in a word document and I want to change its content to now's date, so how can i get this object by its id?</p> <p>thanks.</p>
c#
[0]
5,786,440
5,786,441
Make PHP die if there is a warning
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/10520390/stop-script-execution-upon-notice-warning">Stop script execution upon notice/warning</a> </p> </blockquote> <p>Is there a way to make PHP immediately stop script execution if a warning or other error is generated?</p>
php
[2]
2,129,690
2,129,691
Can this be done in PHP? Simple abc "game"
<p>I need to build the following... 3 main function...</p> <p>1- page with 26 boxes. Each box has a picture of an animal.</p> <p>2-When a animal is clicked, load a new page that shows the animal. there are also 3 letters on the screen. User must choose the correct first letter of animal.</p> <p>3- Return to the first page, but show letter in place of animal photo.</p> <p>I am not asking anyone to code this, just need a general idea if this can be done. Also, what type of functions I can look up.</p> <p>thank you, Harry</p>
php
[2]
192,622
192,623
How to create a shortcut button to jump to a DialogPreference
<p>I would like to make a button on the front page of the app that jumps to a specific DialogPreference. </p> <p>The purpose of the button is to be a shortcut to that preference, bypassing having to browse the list of all preferences, since I'm going to be resetting that preference a lot.</p> <hr> <p>If it's not possible to make this button, can someone give me the source for DialogPreference (I don't have enough space to download the source tree).</p>
android
[4]
1,444,201
1,444,202
Android:Contacts related questions
<p>As I am new to android,please do help me to give some brief idea to make this application</p> <p>User should be able to choose a contact from the contact list and assign a photo to it from the gallery so that the photo would be visible when called or calling and the mobile should not dim down the light or turn off when the application is running whatever be the settings of the display.</p>
android
[4]
4,157,694
4,157,695
Add a canvas - Android
<p>I dynamically create a canvas with:</p> <pre><code>Canvas canvas = new Canvas(); </code></pre> <p>But how can I add it to my LinearLayout?</p> <pre><code>LinearLayout ll = new LinearLayout(this); </code></pre>
android
[4]
58,907
58,908
Sessions in asp.net? Maintain the session?
<p>In web application, i have admin module and it contain login page also, i am maintaining the sessions throught the admin if session is null it is redirecting to login page of admin, but when i write the page name in url [which is a page of admin module], it is displaying the page, instead of redirect to login page. I am checking session in every page. This is my code.</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { if(Session["Uid"] != "") { } else { Response.Redirect(" login.aspx"); } </code></pre> <p>even though it is not working when open new tab in browser and copy paste the url , it is displaying the page instead of redirecting to login page. can you help me.</p>
asp.net
[9]
383,668
383,669
iPhone sdk 3.2.3 upgrade Problem
<p>I just upgraded my Mac to Snow Leopard, and installed Xcode 3.2.3.</p> <p>The app I am working on ran perfectly before the upgrade.</p> <p>Now, the default image appears briefly, then the screen goes black except for the status bar. Same behavior on my iPhone 4 and in the simulator, whether I target iOS 3.2 or 4.</p> <p>The app is still running and I an see from traces and in the debugger that the app is running normally, and my root view controller has been loaded, but nothing but blackness on screen</p> <p>Anyone seen this before?</p> <p>Thanks</p> <p>JK</p>
iphone
[8]
4,018,278
4,018,279
Location javascript in Android webview
<p>I have a web page in which location is getting detected in android web browser successfully. And based on location my results are filtered out. I am running same website url in a webview of android app. But in android app that location detection javascript is not working. Any suggestions what to do here? Javascript get location it self.</p> <p>Thanks in advance</p>
android
[4]
3,086,015
3,086,016
Video stegnography in Java with LSB method
<p>I want to hide a secret message inside a video file with Java, using a least significant bits modification algorithm. Can you help me?</p>
java
[1]
3,251,542
3,251,543
Handler.postdelayed
<p>I am using handler.postDelayed method to create some delay for some animation stuff. </p> <p>With that i am playing some song as well using Mediaplayer. User can exit this action class by clicking next. But on next screen the same song is continuing even though i called stop method in the next button's onclicklistener. </p> <p>Is it due to the timedelay that is added which gets executed after the next activity is loaded. Any idea?</p> <pre><code>handler.postDelayed(new Runnable() { public void run() { mp = MediaPlayer.create(getApplicationContext(), R.raw.num2); mp.start(); imageView1.setImageResource(R.drawable.countcat2); } }, 2000); </code></pre>
android
[4]
4,832,026
4,832,027
How to show the route in the map without driving directions?
<p>I am using the Intent(Android SDK) to show the route between two locations by using the code mentioned below:</p> <p>Uri uri = Uri.parse("http://maps.google.com/maps?f=d&amp;hl=en&amp;saddr=Surat&amp;daddr=Kolkata"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); </p> <p>The map is visible with the routes showing with the precise driving direction but what if I don't want the driving direction and need only the route between the two provided locations??</p> <p>Is this is possible with the default Google Map app provided with the Android SDK?</p> <p>Thanks in advance, Aagrah Mandloi</p>
android
[4]
784,947
784,948
Confused with format( ) in python doc
<p>I'm not sure about python doc:</p> <p><a href="http://docs.python.org/py3k/library/functions.html#format" rel="nofollow"><strong>format(value[, format_spec])</strong></a></p> <pre><code>A call to format(value, format_spec) is translated to type(value).__format__(format_spec) which bypasses the instance dictionary when searching for the value’s __format__() method. </code></pre> <p>Is it a typo? I think it should be translated to:</p> <pre><code>type(value).__format__(value, format_spec) </code></pre>
python
[7]
1,725,583
1,725,584
Can someone explain this line of code please? (Logic & Assignment operators)
<p>I've seen the following lines of code and I know what they do, but I don't know how the second line works (and hence how to apply it to another situation).</p> <pre><code>$user = User::model()-&gt;findByPk(123); empty($user-&gt;profile) and $user-&gt;profile = new Profile(); </code></pre> <p>The code tries to look up the User from the database, and if there isn't a profile, creates a new for use later on.</p> <p>I have also seen code before that goes something like the following:</p> <pre><code>$variable1 = $variable2 = $variable3; </code></pre> <p>It did something a bit more complex than simple assigning three things to be the same, but I'm finding it impossible to search for this type of thing to find out any information about it, let alone find the original code that I came across. I think it originally had an 'and' in there somewhere. Does anyone know how to search for code that has more than one equals sign in it that wasn't just an if statement?</p> <p>Sorry for the two questions in one (and vague at that) and the terrible title (I'll fix it up when I know what the names are, if it's anything like a tenary statement)).</p>
php
[2]
3,221,089
3,221,090
What is serialization in Java?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/447898/what-is-object-serialization">What is object serialization?</a> </p> </blockquote> <p>I've made a small RSS Reader app using Swing and Eclipse keeps telling me "The serializable class MochaRSSView does not declare a static final serialVersionUID field of type long"</p> <p>What is serialization and what benefits would it have?</p>
java
[1]
5,931,090
5,931,091
How does c# remove the memory allocated in loop?
<p>imagine this code:</p> <pre><code>int i=9999999; while ( i &gt; 1 ) { string UnusedMemory="this is a string that eats some ram" + i.ToString(); i--; } </code></pre> <p>if unreferenced objects were removed only sometimes when <code>GC.Collect()</code> is run, this code should allocate lot of ram until collect happen. But it doesn't allocate huge memory at all, why? Is there some kind of "delete" implemented on IL level? Or is <code>GC.Collect()</code> called automatically faster? I know this is a trivial example, but if it was more complicated and string was accessed in that block of code, it wouldn't eat lot of ram anyway.</p> <p>EDIT: I changed the example so that string is always unique, so that it can't be "cached"</p>
c#
[0]
5,439,252
5,439,253
TypeError: $(...).tablesorter is not a function
<p>I am using jquery.tmpl to create tables through ajax call. Table row is coming from database .</p> <p>And i included all the tablesorter plugins that is ,tablesorte,js,latest.js and css</p> <p>But it is giving error as tablesorter is not a function...</p> <pre><code>$.ajax({ ..... success:function(){ $("#mytable").addClass("tablesorter"); $("#mytable:has(tbody tr)").tablesorter(); } }); </code></pre>
jquery
[5]
545,502
545,503
Utility activities?
<p>I'm a little confused about the naming conventions used here... but AFAIK it is possible to build an activity(?) that performs some small function than many different programs could use. For example a date-picker tool for use in a calendar or alarm program.</p> <p>Fist of all I wish to know what these things are called. Where can I see a list of common ones that people expect on their phones pre-installed. And finally is it possible to make and distribute your own?</p> <p>I had initially thought these things may be called widgets, but having had a look at a few of them, they appear to be complete programs in their own right - so I'm assuming that widget is not the word I'm looking for.</p>
android
[4]
5,048,069
5,048,070
C# Bestpractice: Writing a method that returns a value in depdency of the method parameter that is a part of the class itself
<p>At first sorry for my really bad title! If you have a better title just change it or make a comment =)</p> <p>I have this class:</p> <pre><code>public class Config { public Provider1 Provider1 { get; set; } public Provider2 Provider2 { get; set; } public Provider3 Provider3 { get; set; } public Provider4 Provider4 { get; set; } public Provider5 Provider5 { get; set; } public int GetNumber(string provider) { ... } } </code></pre> <p>Each provider has a Number property:</p> <pre><code>public interface IProvider { int Number{ get; set; } } </code></pre> <p>In dependency of the provider I want to return the Number of the provider.</p> <p>How would you do that?</p> <p>I do not want to use a big switch block. </p>
c#
[0]
1,845,927
1,845,928
Return list of directories containing specified extension
<p>I'd like to get a list of directories below the current directory containing mp3's. </p> <p>I can get the a list of the files easily enough using <code>os.walk</code>. I can get the full path easily enough using <code>os.path.join(os.path.abspath(root), file)</code>, but I just want a list with of the matching directories. I've tried using <code>os.path.dirname</code> and <code>os.path.pardir</code>, but all I get with them is <code>'..'</code>. </p> <pre><code>import os l = [] for root, dirs, files in os.walk('.'): for file in files: if file.endswith('.mp3'): l.append(os.path.dirname(file)) </code></pre> <p>I'm probably missing something obvious?</p> <p>Cheers.</p>
python
[7]
3,372,354
3,372,355
how to put local website in local browser?
<p>In Win Server 2003, I would like to set the default IE homepage to a local website. How do I accomplish this?</p>
asp.net
[9]
1,495,838
1,495,839
how to create list and sublist -android?
<p>I am new to android.Can any one help me .how to create a list. example: List1 by selecting list1 I should get list1 items in sublist list1.1,list1.2.... List2 by selecting list2 sublist items as list2.1 list2.2</p> <p>Please help me.</p>
android
[4]
5,814,431
5,814,432
How do i get facebbok id from mobile phone
<p>Is it possible to take facebook id from other mobile application ?</p>
android
[4]
562,423
562,424
values in queue Java
<p>If I have a queue with strings as values How would I print all the values I was using:</p> <pre><code>System.out.println(queue.elements().toString().); </code></pre> <p>But it prints java objects...?</p> <p>Do I have to use a loop to print values of queue?</p>
java
[1]
4,036,861
4,036,862
ASP.NET requested page in Global.asax
<p>I want to be able to globally grab a reference to the <code>Page</code> object that is currently being requested, so I've added a Global.asax file.</p> <p>Is there any way to do this? I assume it has something to do with the <code>Application_BeginRequest</code> event.</p>
asp.net
[9]
5,004,340
5,004,341
Click element and change the text inside (with jquery)
<p>I use this function to load the div '.slide'. I want to change the text inside open to close when clicking the div. I want to arrange this by Jquery. How is this done?</p> <pre><code>$("#slideopen").click(function () { var slide = $(".slide"); if (!slide.data("loaded")) { slide.load("/v3/ajax/timeline.php?id=&lt;?php echo $cam_id; ?&gt;"); slide.data("loaded", true); } slide.slideToggle("slow"); }); </code></pre>
jquery
[5]
5,252,493
5,252,494
How to add a SplitViewController to another ViewController in iPhone?
<p>I'm trying to add a splitviewcontroller as a subview in another viewcontroller. </p> <p>To make it easier, I want the splitviewcontroller to be static which means I want to see both master (tableview) and detail controllers in all orientations with no popoverview controller</p> <p>Is that possible and how?? Any help or direction will be appreciated.</p> <p>Thanks,</p>
iphone
[8]
4,030,925
4,030,926
C# Nullable Types and the Value property
<p>I'm a little unclear on when/if the Value property on nullable types must be used when getting the value contained in a nullable type. Consider the following example:</p> <pre><code>int? x = 10; Console.WriteLine("The value of 'x' is " + x.Value); Console.WriteLine("The value of 'x' is " + x); </code></pre> <p>Both of these return the same value (10).</p> <p>However, if I initially set x to null, the first Console.WriteLine throws an exception and the second one does not.</p> <p>So, my question is this. What is the point of using the .Value property? It doesn't appear to be needed to get the actual value (even if it's null) and will throw an exception if the value is indeed null.</p>
c#
[0]
4,738,651
4,738,652
call the methods from one activite to other( java.lang.IllegalStateException: System services not available to Activities before onCreate())
<p>I'm struck with some problem will calling the method from one activity to other......</p> <p>I have a activity called Transaction2 in this activity,I have a method like getProposal().I need to call this method in to the other activity called PaymentDetails. I called the method like this : I import the activity(import com.Transaction2;) in to the paymentDetails and i create an object as </p> <pre><code>Transaction2 ts2 = new Transaction2(); </code></pre> <p>and i call the method as <code>ts2.getProposal();</code></p> <p>when i called like this I am getting the exception like </p> <pre><code>java.lang.IllegalStateException: System services not available to Activities before onCreate() </code></pre> <p>Can anyone help me ?</p>
android
[4]
1,544,390
1,544,391
Image Editor Tool + C# web application
<p>Can anyone tell me which is the nicest tool for image editing in C#</p>
c#
[0]
4,065,885
4,065,886
Beginner Python Advice
<p>I recently started using python I'm not bad but I think some of my basics may be a bit weak </p> <p>My question is does anyone know any good tutorials that they learned from or maybe a couple of challenges for me that I could do like I said I can do most basics but I want to have them as solid as I can </p> <p>help is very appreciated!</p>
python
[7]
1,658,090
1,658,091
How to refresh particular part of my web page?
<p>I want to refresh only a single part of my page not the whole. How ?</p>
asp.net
[9]
6,007,189
6,007,190
Retrieving account features in ICS
<p>The <code>AccountManagerFuture&lt;Account[]&gt;</code> retrieved from <code>AccountManager</code>'s <code>getAccountsByTypeAndFeatures()</code> method sometimes takes forever to yield a result. </p> <p>Documentation says :</p> <blockquote> <p>Account features are authenticator-specific string tokens identifying boolean account properties (see hasFeatures(Account, String[], AccountManagerCallback , Handler)). Unlike getAccountsByType(String), this method calls the authenticator, which may contact the server or do other work to check account features, so the method returns an AccountManagerFuture.</p> </blockquote> <p>Testing an old app on ICS, <code>AccountManagerFuture</code> just hangs on <code>getResult()</code>. This happens when a google account is present.</p> <p>Can someone confirm this behaviour ?</p>
android
[4]
1,691,918
1,691,919
RequestFocus on Edittext shows up after being removed/deleted from xml code
<p>I had defined a <code>&lt;requestfocus /&gt;</code> tag in xml for my edittext widget for my android 2.2 app. Later on, I removed the <code>&lt;requestfocus /&gt;</code> tag, but the activity in which the edittext is defined is still showing up the soft android keyboard. I have re-designed the code similar to another activity where the <code>&lt;requestfocus /&gt;</code> never shows up, but this edittext activity still throws up the soft android keyboard.</p> <p>Any suggestions on how to stop this behavior?</p>
android
[4]
3,386,023
3,386,024
Return true, return false when using switch
<p>I'm trying to get a switch to return true or false, but I seem to be failing somewhere. I keep getting false. I'm totally lost. This should have worked actually. How do I get this right?</p> <pre><code>if (validNum(1)) {echo 'Ok';}else{echo 'Fail';} function validNum($x) { switch ($x) { case 1: echo "Number 1"; break; return true; case 2: echo "Number 2"; break; return true; case 3: echo "Number 3"; break; return true; default: echo "No number between 1 and 3"; return false; } } </code></pre>
php
[2]
5,053,476
5,053,477
Do database update notifications only happen within the same Activity/Fragment context?
<p>I've got a FragmentActivity that shows a list of items and clicking on one starts a new Activity which allows the user to edit that item. This is all using the new <code>CursorLoader</code> support from the v4 compat library. Everything is working (finally!) but when I return from the Edit, the changes are not showing up in the list.</p> <p>I suspect this is due to the cursor just being reloaded upon resuming the "List" activity and perhaps since it is a separate activity it does not receive any "update" notification from the edit Activity? All the database updates are doing notification as:</p> <pre><code>getContext().getContentResolver().notifyChange(uri, null); </code></pre> <p>Is this working as it's supposed to (i.e. notifications only happen within one context) and I need to force a <code>restartLoader</code> operation when returning from the edit?</p> <p>Or (as usual) is something else going on?</p>
android
[4]
2,955,599
2,955,600
iPhone-SDK:How to set background color for View and not for the Table?
<p>I have downloaded TableView sample code '4_TableViewCellSubviews' from internet. I am trying to run this program in my way. I am trying to set my own background view color as 'lightgraycolor'. I just wanted to see the background view as lightgraycolor in this application. I don't want to make any color for TableView. i.e i want to give gray color only for the background view, not for the background of table. When i provide the code for that as '[self.view setBackgroundColor:[UIColor lightGrayColor]];' , it is changing the color for the entire table as well. But i am trying to set Color only for the view which besides on the Table. How to set background color only for the background view and not for the TableView. I know that the code which i provide to set the color background view is perfect. But., Could someone who came across with this problem, provide me suggestions what are the possibilities that we would get to occur with this issue and solution for this?</p> <p>I have kept the sreenshot at the following location:</p> <p><a href="http://www.quickfiles.net/894107" rel="nofollow">http://www.quickfiles.net/894107</a></p> <p>NEED URGENT HELP..WAITING FOR THE SOLUTION BY GIVING YOUR PRECIOUS SUGGESTIONS...</p> <p>I think most you all have misunderstood my problem. I want to have color on the space when we scroll DOWN the Table we see a empty space on the top in the background of tableview. For example, download a free news application called, "BusinessWeek". You can launch this app in your iPhone device. You can see the home screen and scroll DOWN the table there. You can see the background color as Gray color of the Table. I want to do the same way, please let me know what should i do for that?</p> <p>Clave/</p>
iphone
[8]
1,353,391
1,353,392
How can I find hard disk speed
<p>How can I find hard disk speed ? I can not use System.IO.File.Copy and use timer to get hard disk speed , because after caching file , the speed will be really higher than real time .</p> <p>what can I do ?</p>
c#
[0]
1,800,177
1,800,178
How to check if PHP script is running by shell
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1991346/in-php-how-to-detect-the-execution-is-from-cli-mode-or-through-browser">In php, how to detect the execution is from CLI mode or through browser?</a> </p> </blockquote> <p>How can I check if a PHP script is running by Shell (command line) or by a server?</p>
php
[2]
2,034,338
2,034,339
Jquery .on event with selector for dynamically loaded elements with selectors
<p>I am modifying the jquery.unobtrusive-ajax.js that is packaged with asp.net mvc 3 to allow dynamically loaded forms to work.</p> <p>Old:</p> <pre><code>$("form[data-ajax=true]").live("submit", function (evt) { /*code here */ }); </code></pre> <p>My code:</p> <pre><code>$("body").on("submit","form[data-ajax=true]", function (evt) { /*code here */ }); </code></pre> <p>For mine, the event is never fired at all. Is it that the second parameter (selector) has to be directly under <code>body</code>? I am not sure what exactly to do to get the same functionality to work with dynamically loaded forms.</p>
jquery
[5]
401,835
401,836
javascript doesnt continue even though it should - mysterious
<p>I have written a simple script which goes through a textarea and transports !hash tags! and @person names@ into two separate inputs. </p> <p>However, unless the first of two regex conditions is met (word starts with '!' and ends with '!' symbol), it does not work for the next condition.</p> <p>For example code on line 42 console.log(persons_parsed); doesnt execute at all, unless !hash tag! typed into the textarea.</p> <p>How to make it work, so I could only enter @person name@ and it would fill it in the input#persons_jquery ?</p> <p>Code in jsfiddle: <a href="http://jsfiddle.net/Yz2jw/1/" rel="nofollow">http://jsfiddle.net/Yz2jw/1/</a></p> <p>The problematic part</p> <pre><code>if (tags_parsed.length &gt; 0) { var vysledek_tags = null; for (i = 0; i &lt; tags_parsed.length; i++) { if (vysledek_tags) { var vysledek_tags = vysledek_tags + ', ' + tags_parsed[i].replace(/[!]/g, ''); } else { var vysledek_tags = tags_parsed[i].replace(/[!]/g, ''); } } $('#tags_jquery').val(vysledek_tags); } console.log(persons_parsed); // THIS DOESNT RETURN ANY VALUE!!! if (persons_parsed.length &gt; 0) { var vysledek = null; for (i = 0; i &lt; persons_parsed.length; i++) { if (vysledek) { var vysledek = vysledek + ', ' + persons_parsed[i].replace(/[@]/g, ''); } else { var vysledek = persons_parsed[i].replace(/[@]/g, ''); } } $('#persons_jquery').val(vysledek); </code></pre> <p>Thank you, Jakub</p>
javascript
[3]
3,857,988
3,857,989
How to set the selected value for a drop down list based on another drop down list?
<p>If I select x value in the first drop down list, then Y value would be selected on the second drop down list.</p>
javascript
[3]
1,991,112
1,991,113
Test if string exists in file with Python
<p>I'd like to add only servers currently doesn't exist at file</p> <p>My current code :</p> <pre><code> f = open(filename,'a') for server in cmo.getServers() : print &gt;&gt;f, server.getListenAddress() </code></pre> <p>Thanks in advance</p>
python
[7]
646,107
646,108
Need help login validation using java script
<p>I have problem with login validation using javascript. When the user doesn't provide any username or password the pop up message is showing please enter the username and password. I want that when user doesn't provide username the pop up message will come please enter the username, then if i press OK button cursor should go in txtusername textbox. In case of password also same thing should happen, cursor should go in txtpassword textbox. But in my programming the pop up message is coming but after pressing ok button cursor is not placing in expected position, please somebody modify my code. Here is my code.</p> <pre><code>&lt;script type="text/javascript"&gt; //Function to check valid login function validLogin() { if (document.getElementById("TxtName").value == "") { alert("Please enter your UserName"); return false; } if (document.getElementById("Txtpassword").value == "") { alert("Please enter your Password"); return false; } return true; } </code></pre> <p></p> <pre><code>&lt;asp:Button ID="BtnLogin" runat="server" Text="Login" onclick="BtnLogin_Click" OnClientClick="validLogin()"/&gt; </code></pre>
javascript
[3]
2,628,428
2,628,429
How to use JQuery 'on()' with class selector filter?
<p>Trying to update some old code from <code>live()</code> to use <code>on()</code> and something is failing miserably.</p> <pre><code>$('#accordion').on('click','.EditModeDetails', function(event){ alert('yay'); }); </code></pre> <p>where <code>.EditModeDetails</code> is a class on injected HTML like so:</p> <pre><code>&lt;li class="instructionText"&gt; &lt;input value="EditModeDetails" class="EditModeDetails" name="EditModeDetails" type="checkbox"&gt; &lt;label for="EditModeDetails"&gt;Edited text replaces existing text. To add new text, check this box &lt;/label&gt; &lt;/li&gt; </code></pre> <p>...and <code>#accordion</code> is an accordion control that is loaded at page load.</p> <p>If I remove the filter, thus:</p> <pre><code>$('#accordion').on('click', function(event){ alert('yay'); }); </code></pre> <p>....I get alerts all over the place.</p> <p>Have looked all over for a sample that uses a class instead of an element selector and having no luck.</p> <p>EDIT: Many thanks for the suggestions, guys, but nothing is working thus far The version of JQuery that is loaded is ver--1.7.1. Here is the link to the actual development:</p> <p><a href="http://esc.toypizza.com/sysalert" rel="nofollow">http://esc.toypizza.com/sysalert</a></p> <p>To see the problem, in the datatable click on <img src="http://esc.toypizza.com/_img/details_open.png"> followed by clicking on the <img src="http://esc.toypizza.com/_img/up_arrow.png"> that appears. Next, click on the accordion section "Details" (above the "Current Issues" section that opens as the default). You will see the offending checkbox to the right of the "Clear" button.</p>
jquery
[5]
3,055,533
3,055,534
How to do a correct size check?
<p>Having four vars:</p> <pre><code>short mantissa, exponent, base; long double factor; </code></pre> <p>How shall I check each of those three components to ensure that result will fit into factor? Or maybe leave it as a user responsibility to make sure that data provided make sense?</p>
c++
[6]
5,822,011
5,822,012
How to check if a remote server supports PHP?
<p>I often have clients who do not know if their server supports PHP (their website is HTML web site). At the moment, I send them hello.php file, they upload it and then I check it remotely if their server supports PHP. As you see this takes day or two and it's just a waste of time. </p> <p>Can I myself any how check if their server supports PHP (via web browser or console tool)? If the domain is for example www.my-client.com, what would be the syntax? </p> <p>Thanks</p> <p>PS. I have an access to Linux console so I could use it as well</p>
php
[2]
2,351,518
2,351,519
Eclipse does not recognize some coda-parts
<p>Sorry for the unspecific title, but I do not know how to formulate it. </p> <p>I have the following problem:</p> <p>I Have installed Android SDK on my laptop and on another PC. I have to work on both PC. When transport a Project form my Laptop, I sometimes get the problem, that on the PC, parts of the code get the XXX cannot be resolved to a type.</p> <p>Example: The Code is not so interesting, the problem is in the line, "AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);"</p> <pre><code>package com.example.alertdialog; import android.app.Activity; import android.content.DialogInterface; import android.os.Bundle; public class AlertDialog extends Activity { /** Called when the activity is first created. */ public static final int DIALOG_DELETE_YES_NO_MESSAGE = 1; public static final int DIALOG_DELETE_ALL_MESSAGE = 2; public class ExampleApp extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); AlertDialog.Builder alt_bld = new AlertDialog.Builder(this); alt_bld.setMessage("Do you want to close this window ?") .setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // Action for 'Yes' Button } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // Action for 'NO' Button dialog.cancel(); } }); AlertDialog alert = alt_bld.create(); // Title for AlertDialog alert.setTitle("Title"); // Icon for AlertDialog alert.setIcon(R.drawable.icon); alert.show(); } } </code></pre> <p>}</p> <p>In another case, extend a class from a BaseAdapter. On the Laptop, I can overwrite functions like "getVIew", on the PC, there is an Error if I use "@Override".</p> <p>This is the error I get: "Multiple markers at this line - implements android.widget.Adapter.getView - The method getView(int, View, ViewGroup) of type ImageAdapter must override a superclass method"</p> <p>Any ideas as to what the problem is?</p>
android
[4]
1,684,580
1,684,581
Python String Formatting Question
<pre><code>def createSVGStyleTransformationMatrix(self, transformMatrix): return "matrix(%f %f %f %f %f %f)"%(transformMatrix[0],transformMatrix[1],transformMatrix[2],transformMatrix[3],transformMatrix[4],transformMatrix[5]) </code></pre> <p>As all the substitutions are from the same list and in sequence I was hoping there was a neater way to do this. Anybody got any ideas?</p>
python
[7]
4,080,225
4,080,226
Android: simple export/import of sqlite database
<p>I am trying to implement a simple sqlite export/import for backup purposes. Export is just a matter of storing a copy of the raw current.db file. What I want to do for import is to just delete the old current.db file and rename the imported.db file to current.db. Is this doable? When I try this, I get</p> <p>06-30 13:33:38.831: ERROR/SQLiteOpenHelper(23570): android.database.sqlite.SQLiteDatabaseCorruptException: error code 11: database disk image is malformed</p> <p>However if I look at the raw database file in a sqlite browser it seems fine.</p>
android
[4]
5,354,093
5,354,094
Replace First Character PHP
<p>this is a simple question so I wanted a simple answer. I want to check user input in the textbox.. if the first character is a 0 (zero), it will be replaced with +63. But it should not replace all the zeroes in the "string". I had search through sites but most are about replacing all of the occurrences. I am hoping for an answer that is short. Thanks a lot!</p>
php
[2]
3,060,295
3,060,296
web.config forms authentication, cookiename
<p>I have a web.config with the following: </p> <pre><code> &lt;system.web&gt; &lt;customErrors mode="Off"/&gt; &lt;authentication mode="Forms"&gt; &lt;forms loginUrl="Login.aspx" name="SIPE_ASPXAUTH"&gt; &lt;credentials passwordFormat="Clear"&gt; &lt;user name="user1" password="123456"/&gt; &lt;user name="user2" password="123456"/&gt; &lt;user name="user3" password="123456"/&gt; &lt;/credentials&gt; &lt;/forms&gt; &lt;/authentication&gt; &lt;authorization&gt; &lt;deny users="?"/&gt; &lt;/authorization&gt; &lt;compilation debug="true"/&gt; </code></pre> <p></p> <p>This web.config always redirects me to the following url</p> <pre><code>http://localhost:53077/Login.aspx?ReturnUrl=%2fDefault.aspx </code></pre> <p>My start page is a Login.aspx and even after entering the correct credentails, it redirects me to the above url.</p> <p>So here's what I did. I took out the name property in the </p> <pre><code> &lt;forms loginUrl="Login.aspx"&gt; </code></pre> <p>and left everything else untouched. It works perfectly.</p> <p>Can anyone pls explain why. I understand that this is a cookiename and the default is ASPXAUTH. This cookie is used to authenticate a user. Also it is stored in tools..options... </p> <p>What is the use of setting this cookiename. Is it to allow cross browser functinality.n How would I make this to work by having the name property in the <code>&lt;forms loginUrl="Login.aspx"&gt;</code></p> <p>Thank u</p>
asp.net
[9]
2,299,201
2,299,202
signature widget (painter) does it exists in android?
<p>I want an widget that one can sign on it on the tocuh screen its ambivalent to painter so is there a way using the painter in my application?... thanx</p> <p>i want it too fit the 2.1 version does it exist ?</p>
android
[4]
5,624,563
5,624,564
how to retrieve the name of checkbox if using dynamic name like this<input type="checkbox" name="<%=i%>" /> in servlet?
<p>if provide the dynamic name to the check box and i want to retrieve name of it in servlet for using its value.. </p>
java
[1]
1,635,155
1,635,156
Should hardcoded data in a function be static?
<p>When I have hardcoded data in a function I could just initialize the variable normally:</p> <pre><code>function check_country() { $countries = array( 'aa', 'ab', 'ae', ... ); } </code></pre> <p>Will PHP just make <code>$countries</code> <em>point</em> to the literal data in memory or will it <em>copy over</em> all the initialization data to a new ZVAL or whatever?</p> <p>If it does the latter that would be basically equivalent to this, wouldn't it?</p> <pre><code>function check_country() { $countries = array(); $countries[] = 'aa'; $countries[] = 'ab'; $countries[] = 'ae'; } </code></pre> <p>An alternative would be to make the variable static and initialize it like this:</p> <pre><code>function check_country() { static $countries; if (!isset($countries)) { $countries = array( 'aa', 'ab', 'ae', ... ); } } </code></pre> <p>Is this technique a) faster and does it b) require twice the memory?</p>
php
[2]
5,461,499
5,461,500
what's the best way to remove element(s) i inserted with after()
<p>when I click a button, i appended (inserted) after it a div with new div, and i donot want to give id to the new div, because i want this function could be use by other button/anchor/etc.</p> <pre><code>$("#buttonA").click(function(){ $("#div1").after("&lt;div&gt;bla bla bla&lt;/div&gt;"); }); </code></pre> <p>and then by an event i want to remove the inserted div. what's the best way to remove inserted div? ... i still cant make it generic, i must apply ID on the new inserted div, and then to remove it i use </p> <pre><code>$("#newid").remove() </code></pre>
jquery
[5]
3,701,601
3,701,602
Delay ajax call on key input in jQuery
<p>I am building an auto-complete like script for text inputs. In order to avoid multiple unnecessary ajax calls, I would like to initiate ajax calls only after the user stopped typing text for 1 second. That way I will save some overhead calls for every key pressed. How can I achieve this using jQuery?</p> <p>Thanks,</p> <p>Joel</p>
jquery
[5]
5,189,781
5,189,782
PHP filter() function - why?
<p>Why would I want to use PHP's <a href="http://www.php.net/filter" rel="nofollow">filter</a> library? Why wouldn't I?</p> <p>It seems to try and do a bit of clean-up (it's awful when you have to work with regular expressions), but on the other hand function naming and parameter constants seem to be a disaster, if you ask me. It must have been included in PHP for a reason, but I just don't seem to like it. What am I missing?</p> <p><i>Later edit:</i><br /> Regarding GaryF's answer, I wish to explain a bit why I don't like this function. This isn't about using it in "my case" if it fits. This is about using it wherever it fits. There's a high chance of needing a filter that won't fit PHP's functions, so I'll have to create my own filter. In that case, the application will use two completely different kinds of functions for data filtering. I consider that to be a much worse practice than just inventing a better wheel.</p>
php
[2]
449,910
449,911
How to implement a singleton per element?
<p><strong>Overview</strong></p> <p>Here is my Message Object. I only want one object allowed per element. The element noted in the comments. </p> <p>As the user sees it, there should be only one message per element. If the user keeps clicking a button for example I don't want to re-instantiate more messages. Only one is needed. </p> <p>One thing I could have done is disabled buttons until the message is finished being displayed...but that is just not the way I want to go.</p> <p>The Effects.fade() function fades out the message after about 4 seconds.</p> <p><strong>Question?</strong></p> <p>How do I modify this so it only allows one instance of itself per element?</p> <p><strong>The Object</strong></p> <pre><code>/** * Message */ var Message = function( element ) { // need only single instance per element..so a singleton pattern per element this.element = element; // This is element where the message is sent }; Message.prototype.messages = { name: 'Please enter a valid name', email: 'Please enter a valid email', pass: 'Please enter passoword, 6-40 characters', url: 'Please enter a valid url', title: 'Please enter a valid title', tweet: 'Please enter a valid tweet', empty: 'Please complete all fields', same: 'Please make emails equal', taken: 'Sorry, that email is taken', validate: 'Please contact &lt;a class="d" href="mailto:me@host.com"&gt;support&lt;/a&gt; to reset your password', }; Message.prototype.display = function( type ) { Control.send( this.element, this.messages[ type ] ); var EffectsObject = new Effects( this.element ); EffectsObject.fade( 'down', 4000); }; </code></pre> <p><strong>Use of Object</strong></p> <pre><code>this.message_object = new Message( this.response_element ); this.message_object.display( 'empty' ); </code></pre>
javascript
[3]
5,629,613
5,629,614
Creating command line switches in python
<p>For example, sqlmap uses <code>python sqlmap.py -h</code>.</p> <p>This command above lists all available switches in sqlmap, and <code>-h</code> is a switch itself.</p> <p>When you are creating a python tool for use in terminal, what is the basic method to create a switch?</p> <p>A hello world example would be most appreciative!</p>
python
[7]
1,246,536
1,246,537
I wanted to delete the open?
<p>I did some sample articles, and are added to my case, and then want to delete. The delete does not work! Does anyone know why this happens?</p> <p><a href="http://jsfiddle.net/8YP94/1/" rel="nofollow">http://jsfiddle.net/8YP94/1/</a></p>
javascript
[3]
5,054,004
5,054,005
How to record audio or video in a browser and store it in my server's database?
<p>I need to record audio from a user and store it in my local server's database. I tried this, but it didn't work.</p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;?php if(isset($_POST[submit1])) { echo exec("ffmpeg -f alsa -ac 2 -i pulse -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 -y ./Desktop/myVOICE1.wav"); } ?&gt; &lt;form name="form1" method="POST" action="sample.php"&gt; &lt;input type="Text" name="username"&gt; &lt;input type="submit" name="submit1" value="go"&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>May i know wats wrong wit my code and why doesnt it work?</p> <p>What should I do?</p>
php
[2]
3,004,781
3,004,782
Can somebody tell me where is the size coming from。
<p>I'm a beginner of C++. Now I got a little puzzled with the code below. I know there should be a delete operator with which I'm not concerned in somewhere. I just wondering , wow , it worked. Where is the argument "size" coming from?</p> <pre><code>#include&lt;iostream&gt; #include&lt;string&gt; class Base { public: Base() { } void *operator new( unsigned int size, std::string str ) { std::cout &lt;&lt; "Logging an allocation of "; std::cout &lt;&lt; size; std::cout &lt;&lt; " bytes for new object '"; std::cout &lt;&lt; str; std::cout &lt;&lt; "'"; std::cout &lt;&lt; std::endl; return malloc( size ); } private: int var1; double var2; }; int main(int argc, char** argv){ Base* b = new ("Base instance 1") Base; } </code></pre> <p>Here is the result:</p> <p>Logging an allocation of 16 bytes for new object 'Base instance 1'</p>
c++
[6]
1,786,568
1,786,569
Difference between making a button implementation in class or a final inside the onCreate()?
<p>So usually in guides when making a holder for a View let's say Button, I usually see it on the onCreate method like this:</p> <pre><code>public class className extends Activiy{ public void onCreate(){ final Button button = (Button) findViewById(r.something.something); } } </code></pre> <p>Well I was wondering if there's any difference and if ever there is, which is a better in approach from that one to this one:</p> <pre><code>public class className extends Activiy{ Button button; public void onCreate(){ button= (Button) findViewById(); } } </code></pre>
android
[4]
5,420,682
5,420,683
How does java program access operating System functions?
<p>How does java program access operating System functions? Is that using JNI ?</p>
java
[1]
4,373,069
4,373,070
Store plus and minus in a variable PHP
<p>How can I solve this problem:</p> <pre><code>if ($variable == 1) { $math = "-"; } else { $math = "+"; } $numberOne = 10; $numberTwo = 10; $result = $numberOne $math $numberTwo; </code></pre> <p>This doesn´t work, is there any way to solve this?</p>
php
[2]
4,261,013
4,261,014
How to convert HEX data into BINARY data?
<p>I am trying to send Binary data using python raw socket. For that i will do following.</p> <pre><code>s = '\x01\x00\x12\x59' # some binary data sock.send(s) # assuming "sock" is a valid, open socket object </code></pre> <p>i have created a DATAGRAM in HEX in by sniffing a network traffic with wireshark.Which i want to send over the network.This hand made datagram is like </p> <p>"04 f8 00 50 4f 30 fb 47 28 62 a7 6d 50 02 02 00 d2 7f 00 00"</p> <p>So i wanna convert this above mentioned HEX datagram into the binary format like "\x01\x00\x12\x59". How can i do that?</p>
python
[7]
3,639,001
3,639,002
variable scope in asynchronous function
<p>I've built the function to return some variable. But my function uses another function asynchronously.</p> <pre><code>function getVariable() { var myVariable; asyncronousFunction(function(...){ myVariable = ... }); return myVariable; } </code></pre> <p>The problem is that <code>myVariable</code> outside of and inside in <code>asyncronousFunction</code> are different variables. So I can't assign value to <code>myVariable</code> from asynchronous function.</p> <p>How to resolve this scope problem? Thanks.</p>
javascript
[3]
5,050,532
5,050,533
How to unbox an array of string?
<p>Suppose I have an array of string boxed to an object:</p> <pre><code>string[] files = Directory.GetFiles(path); object obj = files; </code></pre> <p>How can I unboxed the <code>files</code> into array of string again?</p>
c#
[0]
4,366,283
4,366,284
How to reboot android device?
<p>I am facing a problem. I just want to reboot the device just after the installation package has installed on the device. How can i do this? Is there any way to do this?</p> <p>please help me.</p> <p>BR, gsmaker</p>
android
[4]
3,932,176
3,932,177
Function getResourceAsStream returns null while getResource returns a URL
<p>I encountered very strange problem, I hope you will be able to help me: I run the following line:</p> <pre><code>InputStream stream = this.getClass().getClassLoader().getResourceAsStream(SOME_PATH); </code></pre> <p>And it works. Then, I create a new class loader that points to the same file, and then </p> <pre><code>this.getClass().getClassLoader().getResourceAsStream(SOME_PATH) </code></pre> <p>returns null.</p> <p>When I debug it, I saw that</p> <pre><code>this.getClass().getClassLoader().getResource(SOME_PATH) </code></pre> <p>returns a valid URL object.</p> <p>So, I debug the getResourceAsStream, and saw that it calls to getResource, and when it tries to open the steam - it fails on FileNotFoundException.</p> <p>I have no idea how to solve it. The stream is properly closed.</p> <p>Anyone?</p>
java
[1]
3,496,737
3,496,738
Can you offer prizes, cash and/or products, to say the person w/highest score on an iphone game app?
<p>Does apple allow that? I remember a $30K contest that a team from MIT ended up winning. I think it had to do with locating red balloons on a GPS that were scattered all over the world. Something like that.</p>
iphone
[8]