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
3,853,581
3,853,582
Magic 8 ball - text verification if almost the same?
<p>I'm building a fun kind of 8 ball website in <strong>PHP</strong> where people ask questions and get a yes or no answer.</p> <p>I'm looking to avoid the obvious mistakes like repeated questions... but I was hoping there was also a way of doing it to check if it almost the same. For example, if someone typed the following questions one after the other into the program, it should be able to give the same answer:</p> <pre><code>Will I be rich this year? Will I be rich? Will I be rich </code></pre> <p>Is this possible? I fault of the Eigen... thing, but not too familiar and these seem more complex than the usual.</p> <p>Any help much appreciated.</p>
php
[2]
4,414,762
4,414,763
Launch popup window from service
<p>I need to launch a popup window from a service to do something specific inside my application. I do not seem to find a good way to do it. Inside onCreate() I create the popup window but when I launch it with showAtLocation I get this error:</p> <pre><code>10-06 13:39:49.573: ERROR/AndroidRuntime(5966): Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running? </code></pre> <p>Can someone please help? Thanks,</p> <p>-em</p>
android
[4]
768,604
768,605
Does checking against null for 'success' count as "Double use of variables"?
<p>I have read that a variable should never do more than one thing. Overloading a variable to do more than one thing is bad. </p> <p>Because of that I end up writing code like this: (With the <code>customerFound</code> variable)</p> <pre><code>bool customerFound = false; Customer foundCustomer = null; if (currentCustomer.IsLoaded) { if (customerIDToFind = currentCustomer.ID) { foundCustomer = currentCustomer; customerFound = true; } } else { foreach (Customer customer in allCustomers) { if (customerIDToFind = customer.ID) { foundCustomer = customer; customerFound = true; } } } if (customerFound) { // Do something } </code></pre> <p>But deep down inside, I sometimes want to write my code like this: (Without the <code>customerFound</code> variable)</p> <pre><code>Customer foundCustomer = null; if (currentCustomer.IsLoaded) { if (customerIDToFind = currentCustomer.ID) { foundCustomer = currentCustomer; } } else { foreach (Customer customer in allCustomers) { if (customerIDToFind = customer.ID) { foundCustomer = customer; } } } if (foundCustomer != null) { // Do something } </code></pre> <p>Does this secret desires make me an evil programmer?</p> <p>(i.e. is the second case really bad coding practice?)</p>
c#
[0]
911,372
911,373
Opening / Using / Editing word docs or Excel sheets in a web browser
<p>Good Day, i am fairly new to using forums, so help would be appreciated. </p> <p>I need to open word and excel type documents with a webrowser and save them through different versions</p> <p>For example like a school homework system.</p> <p>Version 1: Teacher will send a excel sheet full of math problems to complete. Version 2: Pupil will add his/her answers Version 3: Teacher needs an easy to use "marking tool"</p> <p>Any help with what suggested editors and marking tools are available??</p> <p>Thanks in advance</p>
asp.net
[9]
1,143,373
1,143,374
java.net.SocketException: Too many open files
<p>I have an application using AppFuse and mysql database</p> <p>The problem is sometime the following exception is thrown :</p> <pre><code>Jan 27, 2011 4:54:56 AM org.apache.tomcat.util.net.PoolTcpEndpoint acceptSocket SEVERE: Endpoint ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=8080] ignored exception: java.net.SocketException: Too many open files java.net.SocketException: Too many open files at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384) at java.net.ServerSocket.implAccept(ServerSocket.java:453) at java.net.ServerSocket.accept(ServerSocket.java:421) at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:60) at org.apache.tomcat.util.net.PoolTcpEndpoint.acceptSocket(PoolTcpEndpoint.java:368) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:549) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:619) </code></pre> <p>Jan 27, 2011 4:54:56 AM org.apache.tomcat.util.net.PoolTcpEndpoint acceptSocket.</p> <p>Please could any one tell me the main reason for that exception? And if that exception can lead tomcat to be shutdown ?</p> <p>Thanks in Advance</p>
java
[1]
2,617,108
2,617,109
Android Popups: How To
<p>How can I make a popup window in Android with simple yes / no buttons?</p>
android
[4]
1,820,819
1,820,820
clearing the link id
<p>if we have</p> <pre><code>$id = 39827-key1-key2-key3 </code></pre> <p>and we want to show only the number or anything before (-) then by using</p> <pre><code>$realid = array_shift(explode("-", $id)); </code></pre> <p>we will get <code>echo $realid; // 39827</code></p> <p><em>Now my problem is as following !</em></p> <p>if we have <code>$id = key1/key2</code> and i want any way that remove the whole part <code>key1/</code> and gives me only <code>key2</code></p> <p>how can i do it?</p>
php
[2]
3,697,742
3,697,743
Scrape Data in C# from images
<p>Scrape Data in C# from images</p> <p><img src="http://i.stack.imgur.com/qerP3.png" alt="enter image description here"></p>
c#
[0]
1,975,050
1,975,051
Can't insert text into my SQLite database
<p>I'm trying to insert text into my SQLite database, but for some reason it doesn't work. It never executes..</p> <p>Code below (this is my function that I'm calling):</p> <pre><code>public void setInfo(final String tableName, final int id, final String title, final String time, final String content) { final String sql = "INSERT INTO " + tableName + "("+DB_COLUMN_ID+", "+DB_COLUMN_TITLE+", "+DB_COLUMN_TIME+","+DB_COLUMN_CONTENT+")" + " VALUES ('"+id+"', '"+title+"', '"+time+"','"+content+""; final SQLiteStatement stmt = mDatabase.compileStatement(sql); stmt.execute(); } </code></pre> <p>Thanks in advance!</p>
android
[4]
4,302,772
4,302,773
Decimal zero padding
<p>I need to output decimal numbers in a price format,</p> <p>i.e.</p> <p>10 = 10.00 11.1 = 11.10</p> <p>How can I achieve this using decimal.Decimal class ?</p> <pre><code>pad_zero(Decimal('10.0')) &gt;&gt;&gt;Decimal('10.00') </code></pre> <p>*<em>EDIT:</em>*format method does not fit my need because I need to pass it on as decimal, I understand though, that i can convert it back to afterwards, but such to-and-fro seems somewhat unpythonic.</p>
python
[7]
4,607,332
4,607,333
Get a file from a Database and put it in an ftp
<p>Hello I have an aspx page that gets a list of documents available in a database through a DataGridview and I want that when the users clicks on the link of the document he want's to sent it as an ftp or http document, like if it was on a drive on the server. </p> <p>The problema I have is that I know that when the file is on a drive it is easy but if it is on the database I do not know how to serve it to the web page user. </p> <p>I thougth maybe that when de user clicks on the link to save the file to a temp directory, and then redirect the page to that page with the name of the file, but I do not know if it is to much of a touble and there is a better way. Of course if I do this I will have to delete the file from the drive after it has been downloaded.</p> <p>Thanks for any comments.</p>
asp.net
[9]
3,777,483
3,777,484
MySQL's LIKE in JQuery
<p>I'd like to filter several SPANs with the text they contain:</p> <pre><code>$('spanFilter').filter(function(){ var html = $(this).html(); return //comparison html LIKE %asdf% }); </code></pre> <p>In the comparison, I'm trying to do something like MySQL's LIKE:</p> <pre><code>field LIKE %asdf% </code></pre> <p>How can I achieve that?</p>
jquery
[5]
1,672,725
1,672,726
Clarification about the order of variables used in a function
<p>I've been fighting with this PHP-snippet for some hours and I can't figure it out...<br> How does PHP determines the order when to pass the variables in this snippet:</p> <pre><code>function myfunction ($left, $right) { echo $left; echo '&lt;br&gt;'; echo $right; } $a = array ('one', 'two', 'three', 'four'); usort($a, 'myfunction'); </code></pre> <p>In this case, the variables are passed like this:</p> <pre><code>$left = 'two' - $right = 'one'; $left = 'four' - $right = 'two'; $left = 'three' - $right = 'two'; $left = 'four' - $right = 'three'; </code></pre> <p>But how is this sequence determined?!? I've been cracking my head and couldn't find any logic... </p>
php
[2]
5,906,566
5,906,567
how to get the most common character in an array?
<p>Suppose I have an integer array like this: {5,3,5,4,2}</p> <p>and I have a method which returns the most common character </p> <pre><code>public int highestnumber(String[] num) { int current_number = Integer.parseInt(num[0]); int counter = 0; for (int i = 1; i &lt; num.length; ++i) { if (current_number == Integer.parseInt(num[i])) { ++counter; } else if (counter == 0) { current_number = Integer.parseInt(num[i]); ++counter; } else { --counter; } } return current_number; } </code></pre> <p>but if I have multiple common character then i need to get the number which is closest to one(1), like if i have an array like this: {5,5,4,4,2};</p> <p>then the method should return 4, what should I do for this?</p>
java
[1]
197,569
197,570
directly print with php
<p>I try to print directly with php library php_printer.dll, my problem is that my printer print strange words instead of PDF file. </p> <p>Here is my code:</p> <pre><code> &lt;?php $printer = ("Epson Printer"); if($ph = printer_open($printer)) { $file = file_get_contents('receipt.pdf', FILE_USE_INCLUDE_PATH); printer_write($ph, $file); printer_close($ph); } else "Couldn't connect..."; ?&gt; </code></pre> <p><strong>UPDATE</strong><br> Now i try with this code on Windows 7, but print not start:</p> <pre><code>shell_exec( 'print /d:EPSON MFC-J265W c:\file.txt'); </code></pre>
php
[2]
596,080
596,081
PHP script with sleep() does not exit on connection close
<p>I have a PHP script that does this:</p> <pre><code>$sec = 1; $id = 1; while ($sec&lt;20) { sleep(1); mysql_query("update test set sec = $sec where id = $id"); $sec++; } </code></pre> <p>Whenever I load the script in my browser, it will keep on going even if I closed the browser window after 5 seconds. How can I change this so when the browser window is closed, the script will exit?</p>
php
[2]
5,969,073
5,969,074
JavaScript tree / treegrid libraries
<p>I'm looking for a good JavaScript tree / treegrid package. Now -- before you answer:</p> <p>It needs to be able to perform well with <em>lots</em> of nodes. Perhaps 1,000 sibling nodes. It needs to be able to draw to a usable state within 2 or 3 seconds with 1,000 nodes. It doesn't necessarily need to draw all 1,000 nodes at once -- if it supports some sort of "smart rendering" or fake scrolling.</p> <p>Beyond that, column resizing, drag and drop, inline editing would all be nice, although I could probably add that functionality myself. </p> <p>I've already tried dojo's tree and yahoo's YUI treeview. Both are too slow.</p>
javascript
[3]
5,368,954
5,368,955
Vector option in Java
<p>I am using vector of object. My issue is the removal from vector is expensive operation( O(n^2)). What would be the replacement of vector in Java. In my uses addition and removal is extensively happens. </p> <p>i am C++ person don't know much Java</p>
java
[1]
2,213,645
2,213,646
Android Wheel concept
<p>I am developing an application in android. I have an Activity where I have a couple of buttons. Among them when I click on one button, I want to get dropdown like iPhone default picker.</p> <p>To achieve that, I am using Android wheel concept. I have implemented like this, when I click on the button, it is calling another activity where my required custom layout is shown. Problem is custom layout should come from bottom of the screen in the same activity where the button I am clicking exists.</p> <p>I have attached a screenshot. I want to achieve as shown in the screenshot (missing).</p> <p>Please help me providing the required solution. Pardon me if there any mistakes in my question. This is the first time to ask a question.</p>
android
[4]
1,120,845
1,120,846
Php 5.4 closures
<pre><code>$that = $this; $closure = function (...) use ($that) { ... }; </code></pre> <p>Found on: <a href="http://css.dzone.com/polls/what-new-feature-php-54" rel="nofollow">http://css.dzone.com/polls/what-new-feature-php-54</a></p> <p>Could someone please explain what it does? Preferably with an example.</p>
php
[2]
4,310,643
4,310,644
Bufferedimage resize
<p>I am trying to resized a bufferedimage. I am able to store it and show up on a jframe no problems but I can't seem to resize it. Any tips on how I can change this to make it work and show the image as a 200*200 file would be great </p> <pre><code> private void profPic(){ String path = factory.getString("bottle"); BufferedImage img = ImageIO.read(new File(path)); } public static BufferedImage resize(BufferedImage img, int newW, int newH) { int w = img.getWidth(); int h = img.getHeight(); BufferedImage dimg = dimg = new BufferedImage(newW, newH, img.getType()); Graphics2D g = dimg.createGraphics(); g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g.drawImage(img, 0, 0, newW, newH, 0, 0, w, h, null); g.dispose(); return dimg; } </code></pre>
java
[1]
4,426,172
4,426,173
Creating a new ArrayList in Java
<p>Assuming that I have a class named <code>Class</code>,</p> <p>And I would like to make a new ArrayList that it's values will be of type <code>Class</code>.</p> <p>My question is that: How do I do that?</p> <p>I can't understand from Java Api.</p> <p>I tried this:</p> <pre><code>ArrayList&lt;Class&gt; myArray= new ArrayList ArrayList&lt;Class&gt;; </code></pre>
java
[1]
2,035,018
2,035,019
Java class with 2 generic parameters
<p>I'm trying to crate my own thread safe event handling but I get <code>E cannot be resolved to a type</code> error on class decleration line below. How can I fix this?</p> <p><strong>Observers.java</strong></p> <pre><code>public final class Observers&lt;T extends EventHandler&lt;E&gt;&gt; { private CopyOnWriteArrayList&lt;T&gt; mListeners = new CopyOnWriteArrayList&lt;T&gt;(); public interface EventHandler&lt;E&gt; { public void HandleEvent(Object sender, E e); } /*...*/ public void dispatchEvent(Object sender, E args) { /*...*/ } } </code></pre> <p><strong>EventHandler.java</strong> </p> <pre><code>public interface EventHandler&lt;E extends EventArgs&gt; { /* ... */ } </code></pre>
java
[1]
5,223,300
5,223,301
Javascript - Function Variable to use in another variable
<p>I want to use a function's variable value to build a variable in the function.</p> <p>Here's what I got so far:</p> <pre><code>function foo(1a, 1b) { var money = document.myform.1b; } </code></pre> <p>So basically, if I pass in <code>foo(aaa, bbb)</code>, I would like the variable money to be:</p> <blockquote> <p>var money = document.myform.bbb;</p> </blockquote>
javascript
[3]
3,104,726
3,104,727
Checking whether the service is down
<pre><code>var Model = function() { function checkStatus(){ JsonClient.onload = function() { }; JsonClient.onerror = function(e) { }; } } </code></pre> <p>I know the error handler would be called when my request parameter is wrong or may be even if the service is down too. </p> <p>But is there any way i can check my service is down at first place before sending the data.</p>
javascript
[3]
2,300,657
2,300,658
What is context in android?
<p>Why we really need to pass context in some elements and what is the difference between <code>getApplicationContext()</code>, <code>getBaseContext()</code>, <code>MainActivity.this</code> ?</p>
android
[4]
1,166,244
1,166,245
How to show marker in Maps launched by geo uri Intent?
<p>I have a application where I want to show different locations (one at the time, picked by user input) by launching Google Maps with their specific geo-coords.</p> <p>I'm currently using this: (with real lat. and long. values of course)</p> <pre><code>Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:&lt;lat&gt;,&lt;long&gt;?z=17")); startActivity(intent); </code></pre> <p>It's quite exactly what I want, except that it doesn't show any indicator or marker for the specified point. It only centers at it's location.</p> <p>Is there some way to get the marker or something else included without using a MapView?</p>
android
[4]
1,081,413
1,081,414
toshow data in table
<p>i have create database having some data.i want to show those data in tableview.how can i add that data in table view.</p>
android
[4]
5,082,087
5,082,088
jquery detect nunber of item inside a div and add a class
<p>Hey hi there, I would like to add a style to a div if number of items within this div is >2</p> <p>If number of <code>&lt;ie:menuitem&gt;</code> is superior to 2 div with id s4-ribbonrow = display:block;</p> <pre><code>&lt;div class="s4-pr" id="s4-ribbonrow" style="height: 135px; display: none;"&gt; &lt;ie:menuitem menugroupid="100"&gt;&lt;/ie:menuitem&gt; &lt;ie:menuitem menugroupid="100"&gt;&lt;/ie:menuitem&gt; &lt;ie:menuitem menugroupid="100"&gt;&lt;/ie:menuitem&gt; &lt;ie:menuitem menugroupid="100"&gt;&lt;/ie:menuitem&gt; &lt;/div&gt; </code></pre> <p>How would i do that in Jquery?</p>
jquery
[5]
4,324,821
4,324,822
multiline string literals and tests
<pre><code>var multiply = function (a, b) { //An internal comment return a * b; }; var stupid = "function (a, b) { return a * b; }" expect(multiply.toString()).toBe(stupid); </code></pre> <p>The test passes, but firefox gives me this: </p> <pre><code>unterminated string literal [Break On This Error] var stupid = "function (a, b) { </code></pre> <p>Changing the code to use the <code>\</code> line terminator stops the test from passing.</p> <pre><code>Expected 'function (a, b) { return a * b; }' to be 'function (a, b) {return a * b;}'. </code></pre> <p>The test fails if you escape the multiline string literal.</p> <p>With newlines, the test still does not pass:</p> <pre><code>var stupid = "function (a, b) {\n return a * b;\n }" expect(multiply.toString()).toBe(stupid); </code></pre>
javascript
[3]
3,755,844
3,755,845
Login form is not working
<p>It gives the wrong result. I use Dreamweaver and i just started to learn PHP i find it very hard to debug.</p> <pre><code>&lt;/html&gt; &lt;head&gt; &lt;title&gt;Login Form&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;fieldset&gt;&lt;legend&gt;Login&lt;/legend&gt; &lt;form action="login.php" method="post" /&gt;&lt;br/&gt; Username&lt;input type="text" name="User" /&gt;&lt;br/&gt; Password&lt;input type="password" name="Pass" /&gt;&lt;br/&gt; &lt;input type="submit" value="submit" /&gt; &lt;input type="reset" value="clear"/&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; &lt;?php $_user=$_POST["user"]; $_pass=$_POST["pass"]; if(($user=="hamza")&amp;&amp;($pass=="2")) echo "Access Granted"; else echo "access denied"; ?&gt; </code></pre>
php
[2]
1,299,414
1,299,415
How to convert Unicode Indian language (Malayalam) to Image using PHP
<p>Here is my php code for creating an image with text inside, I used Malayalam language text but PHP generating an image like this "?????" </p> <pre><code>&lt;?php mb_language('uni'); mb_internal_encoding('UTF-8'); header('Content-type: image/gif'); $text = 'മലയാളം '; $font = 'mlkarthika.ttf'; $im = imagecreatetruecolor(160, 160); $white = imagecolorallocate($im, 255, 255, 255); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 159, 159, $white); imagettftext($im, 12, 0, 20, 20, $black, $font, $text); imagegif($im); imagedestroy($im); ?&gt; </code></pre> <p>the font ML_ttkarthika is avalable in unicode font website, please help me</p>
php
[2]
3,733,794
3,733,795
How to check if two numbers in a list are the same
<p>I was curious on how I would check if 2 numbers inside of a list are identical. For instance,</p> <pre><code>myList=[1,7,9,3,1,2,8] </code></pre> <p><strong>In this case, "1" is repeated in 'myList'.</strong></p> <p>How would I make a program that checks to see if two numbers inside of a list are the same(repeated). Try to use loops so I can understand because I haven't yet learned complex functions.</p>
python
[7]
4,503,204
4,503,205
open link in new tab for the imagebutton in asp.net
<p>how to get the open link in new tab for the image button in the asp.net please give me the solution</p>
asp.net
[9]
2,286,021
2,286,022
Display input title only "onclick" event
<p>I'm having trouble in displaying my title input only "onclick" event. When we mouseouver the input box, it will display the title, but i just want this to happen when I click on the input box.</p> <p>My idea is displaying a title saying "value copied", cause I have a function on "onclick" event that copy the input (read only) value to the clipboard, and when it's done I want to let the user know that this happen displaying that information. Is that even possible? (this is for a windows gadget)</p> <p>Thank you to everyone.</p>
javascript
[3]
4,399,426
4,399,427
String as calculation in php
<p>I've got field in my database which contain strings like <code>21;48;33;22;31</code>. Then I'd like to convert it to mathematical calculation <code>21+48+33+22+31</code>.</p> <pre><code>$points = "21;48;33;22;31"; $points = str_replace(";","+",$points ); $points = preg_replace('/[^0-9\+\-\*\/\s]+/', '', $points); echo $points; </code></pre> <p>But that simply does not work. I've got the same string "21+48+33+22+31" instead of the sum.</p>
php
[2]
1,706,711
1,706,712
Want android app to wait until user presses a button before continuing
<p>I have a game for android, and when the user wins, it shows a dialog asking if they want to play again. If they say "no", the application exits, and if they say "yes", it starts another game. The problem is that a new game starts as the dialog is displayed, instead of waiting for the user to press a button. The code is like this:</p> <pre><code>if (won) { showDialog(DIALOG_WON_ID); imageAdapter.initializemThumbIds(); // this starts a new game } </code></pre> <p>I don't want the start-new-game line to execute until the dialog is dismissed.</p>
android
[4]
1,260,140
1,260,141
redirect page to difference server in php
<p>Does anyone know the code used for redirect page to difference server in PHP?</p> <p>For example: I have 3 server here called server_1, server_2, server_3. and I would like to redirect a page abc.php to server_2. How should the code look like in php?</p>
php
[2]
6,002,416
6,002,417
Heirarchical Sub-Menu - ios?
<p>how can I populate an array of product and category on table in ios using xcode4.5 storyboard. I am using a singleView project can you please tell me the steps. i found some codes but they used .xib file and i don't know how to add a .xib file in my project.Does It requires the .xib file or can be done without .xib file?</p> <p>example: </p> <p>icecreame</p> <pre><code> strawbwry 10 vanila 29 </code></pre> <p>cake</p> <pre><code> strawbwry-cake 10 vanila -cake 29 pineApple -cake 29 pineApple -cake 29 </code></pre> <p>cake-2</p> <pre><code> strawbwry-cake 10 vanila -cake 29 pineApple -cake 29 pineApple -cake 29 </code></pre>
iphone
[8]
3,833,972
3,833,973
Php dynamic class construction
<p>I'm trying to avoid the use of <code>eval</code>. I can dynamically instantiate a class like this:</p> <pre><code>class myclass {} $my_class_name = 'myclass'; $obj = new $myclass(); </code></pre> <p>If the constructor is like follows:</p> <pre><code>class myclass { public function __construct( $argument1, $argument2 ) {} } </code></pre> <p>and i have the values of the arguments in an array, how can i dynamically instantiate the class <strong>and</strong> pass it dynamic arguments? Mind that I have no way to modify the class, so I have to work on the way of using it.</p> <p>Thanks</p>
php
[2]
4,035,172
4,035,173
Intent to open Gallery Only without File Explorer
<p>Hello i have the below code to open the gallery so that user picks an image. </p> <pre><code>Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select file to upload "), 1); </code></pre> <p>I get the gallery and file explorer to choose from. How can I get only the android built in gallery. I need this because I dont want the user to choose something other than images. Thanks</p>
android
[4]
526,244
526,245
Is there an equivalent in PHP to .NET's datasets?
<p>ASP.NET has the concept of a dataset to capture the data and build relationships with the data, and maintain good performance without having persistent SQL connections.</p> <p>Is there something similar in PHP that I can use?</p>
php
[2]
5,436,002
5,436,003
Scripting an input element of an HTML form?
<p>By design I need an input element typed text but I do not need an input element typed submit. I want to submit what's written in the input element once the enter key pressed. How would I do that in JavaScript? Do I need tags and other stuff or could I do it without them (just using )?</p>
javascript
[3]
2,365,384
2,365,385
Fileupload Control in asp.net
<p>I want to get full path which user selected in file upload control. how can we do it. </p>
asp.net
[9]
3,117,285
3,117,286
Dynamically loaded dropdownlist control doesn't fire SelectedIndexChanged event
<p>I have the control <code>dropdownlist</code> which has been loaded inside the template column of <code>RadGrid</code>.<br> While loading I have set <code>AutoPostBack='True'</code> for <code>dropdownlist</code> and also created the event <code>SelectedIndexChanged</code>.</p> <pre><code> DropDownList ddlConditions = new DropDownList(); ddlConditions.ID = "ddl" + name; ddlConditions.AutoPostBack = true; ddlConditions.SelectedIndexChanged += new EventHandler(ddlConditions_SelectedIndexChanged); </code></pre> <p>My question is while i change the selected index of <code>dropdownlist</code> the event <code>SelectedIndexChanged</code> is not getting triggered.<br> Can anyone help me to solve this problem?<br> Thanks in advance.</p>
asp.net
[9]
4,346,533
4,346,534
UIActivity Indicator with mediaplayer framework
<p>i am playing video from URL, i need to display the activity indicator while my movie is loading and if also was buffering at any time.</p>
iphone
[8]
3,476,024
3,476,025
How to print PHP equation to analyze it?
<p>I've got a simple script with a lot of formulas like so:</p> <pre><code>$formula = 12 *( $C + ($D * $A) + $H ) + $B * ((($F+$J)*$M/$L)+(($G+$K)*$N/$L)+$E); </code></pre> <p>Is there any easy way to output the values to debug the equation? Like:</p> <pre><code>12 * ( 15 (44 * 11) + 33) + 3 * [...] </code></pre> <p>Or I have to to do it the usual way:</p> <pre><code>echo "12" . '* ('. $C .' + ' [...] </code></pre> <p>I've got lot of these formulas, so I'm looking for some shortcut to debug them.</p>
php
[2]
737,584
737,585
Android: Sherlock ActionBar
<p>I have faced with one small cosmetic problem when use ActionBar + Tabs. Thing is that when you are in portrait mode you see actionbar(logo + 3 menu buttons where two first of them have showAction equal Always beside last one which has ifRoom) separate from tabs(3 tabs). When you rotate it in landscape mode you see all in one action bar - logo + tabs(but tabs become <a href="http://stackoverflow.com/questions/12680599/custom-tab-indicator-view">as List</a> but I need that they will be as usual) + 3 menu buttons. There is possible to do that if tabs go to action bar they will display as usual removing the last one menu button(<a href="http://www.google.ru/imgres?q=android%20navigation_list%20tabs&amp;um=1&amp;hl=ru&amp;newwindow=1&amp;tbo=d&amp;biw=1644&amp;bih=990&amp;tbm=isch&amp;tbnid=8uXqLcoXYsaxGM%3a&amp;imgrefurl=http://www.androiduipatterns.com/2011/06/tablet-ui-patterns-action-bar.html&amp;docid=1-amslZmJPYCxM&amp;imgurl=http://1.bp.blogspot.com/-xc-qmrYeRKs/TgTATRukEcI/AAAAAAAABsI/lfPJ1nkttoI/s1600/navs.png&amp;w=1280&amp;h=270&amp;ei=JLXBUICaLozP4QT-9YCADw&amp;zoom=1&amp;iact=rc&amp;dur=533&amp;sig=101727624342211377278&amp;page=1&amp;tbnh=55&amp;tbnw=262&amp;start=0&amp;ndsp=52&amp;ved=1t:429,r:32,s:0,i:182&amp;tx=122&amp;ty=23" rel="nofollow">like this</a>) from action bar to bottom common menu section or replacing whole menu style as List?</p>
android
[4]
3,368,687
3,368,688
Buttons for iPhone App. How?
<p>We are building an flashcard iPhone App with a developer. Here are the screens: <a href="http://cobocards.com/blog/2009/09/iphone-app-geplant/lang/en/" rel="nofollow">http://cobocards.com/blog/2009/09/iphone-app-geplant/lang/en/</a></p> <p>Which images do I need to give the developer for buidling the app? - A Button in two states? - The Navigation Bar just in 1px for the background? - The immage for the button with the text or without the text in it?</p> <p>What would help me is a sample package of an App with all the images, so I can have a look wha is needed</p>
iphone
[8]
4,892,562
4,892,563
php conditional isn't working
<p>I have a strange problem. My conditional isn't working:</p> <pre><code>$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://maps.googleapis.com/maps/api/geocode/json? address='.urlencode($address).'&amp;sensor=true'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec ($ch); curl_close ($ch); if($result !== null) { $result = @json_decode($result, true); $result = @$result['results'][0]['address_components']; foreach($result as $key =&gt; $value) { if($value['types'][0] == 'administrative_area_level_2') return $value['long_name']; } } else { throw new Exception('unable to look up the county'); } </code></pre> <p>I tried </p> <pre><code>if($result) if($result != null) if($result != '') if(!empty($result)) if(isset($result)) </code></pre> <p>neither one worked, script always goes inside the block, but the value of $result is null, I can see it through xdebug. Why is this happening?</p> <p>edit: here's a screenshot <img src="http://i.stack.imgur.com/X0hQv.jpg" alt="screenshot"></p> <p>here's what var_dump shows:</p> <blockquote> <p>string '{ "results" : [], "status" : "ZERO_RESULTS" } ' (length=52)</p> </blockquote> <p>This fixed it:</p> <pre><code> $result = @json_decode($result, true); if(!empty($result['results'])) { </code></pre>
php
[2]
5,649,920
5,649,921
Access local variable in function from module
<p>I have a function in my main program that attempts to retrieve information from an imported module, which is a different script I wrote. This module spits out a variable which I access from the main program by making it a global.</p> <p>However, since I'm threading the function that requests the information, the global variable gets polluted by adding the information from separate requests into one var. What I'm looking for is a way to access a local variable in a function in a module.</p> <p>Main program:</p> <pre><code>import module def threaded_function(): module.function(var1, var2) print module.output </code></pre> <p>Module:</p> <pre><code>def function(var1, var2): global output output = [] DoThingsWithVars(var1, var2) output.append(result) </code></pre> <p>Since the threading causes it to get accessed multiple times I figured I'd not use global variables and get the local variables for each request. Any idea how I can get at those?</p>
python
[7]
4,209,820
4,209,821
How to add external API in corona SDk, but no need to require network connectivity?
<p>I am new to corona. I want to add dictionary for word meaning but I don't want to add network connectivity so that user can get the meaning without internet connectivity. SO can you please tell me how to add that external API or any other method so that I can add this feature?</p> <p>Thanks,</p>
iphone
[8]
3,885,875
3,885,876
How to read numbers in python conveniently?
<pre><code>x1, y1, a1, b1, x2, y2 = int(input()), int(input()), int(input()), int(input()), int(input()), int(input()) </code></pre> <p>My problem is to read 6 numbers each given on a new line. How to do that more laconically than my code above?</p>
python
[7]
5,881,275
5,881,276
passing data from list view to another activity
<p>HI All, i want to create an activity, in which, i would like to have a listview, there can be about 20-30 items in a list view,on tapping any particular value in listview, it should move to another activity, with the data of list view.</p> <p>Just wanna pass data from listview to another activity. Suggestion plz Regards</p>
android
[4]
5,970,986
5,970,987
I want to Install android on my Sony Ericsson G900
<p>I have a Sony ericsson G900 mobile phone with 2 GB SD card, for experimenting only i wish to install android on my phone device..</p> <p>It is a touch screen device, is it possible to install android on my device..</p> <p>also advice tips on how to install android on my device.??</p> <p>Thanks in advance..</p>
android
[4]
3,377,862
3,377,863
How do I use JS to fill up availiable space?
<p>I've been searching the www for a solution dealing with the question: How can I use screen.availWidth or something like it in the second inner div of <a href="http://jsfiddle.net/6fLDS/56/" rel="nofollow">this fiddle</a> to fill up the availiable space? Is it possible?</p> <p>Thank you.</p>
javascript
[3]
1,888,219
1,888,220
php scope of Global variables in a loop
<p>This code connects to a first database, loops and picks up a field called 'id' and use the id as a connection[database name] to another database in a function. All seemed to work except that in the function, the value of id does not change so cannot connect to db, even though it changes in the local variable. I suspect i need to unsett and set. Any help? Thanks</p> <pre><code>&lt;? $dbhost = "***"; $dbname = "users"; $dbuser = "****"; $dbpass = "***"; function myRecordHandler($record) { global $dbhost; global $dbuser; global $dbpass; global $id; global $conn2; $db = mysql_select_db($id,$conn2) ; $quantity = $record["QUANTITY"]; $price = $record["PRICE"]; $mytotal ="INSERT into `mytotal`(`quantity`,`price`) VALUES ($quantity,$price)"; mysql_query($mytotal,$conn2); } $conn1 = mysql_connect($dbhost, $dbuser, $dbpass, TRUE) or die("MySQL Error: " .mysql_error()); $conn2 = mysql_connect($dbhost, $dbuser, $dbpass, TRUE) or die("MySQL Error: " . mysql_error()); mysql_select_db($dbname,$conn1) or die("MySQL Error: " . mysql_error()); $query = "SELECT id,url FROM table userdata"; $result = mysql_query($query,$conn1); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $id =$row['id']; $url=$row['url']; MagicParser_parse($url,"myRecordHandler","xml|PRODUCTS/PRODUCT/"); } ?&gt; </code></pre>
php
[2]
2,194,128
2,194,129
how to get all the div in javascript?
<pre><code>&lt;div class="web_index"&gt; &lt;div style="display:block" &gt;content 1&lt;/div&gt; &lt;div style="display:none"&gt;content 2&lt;/div&gt; &lt;div style="display:none"&gt;content 3&lt;/div&gt; &lt;/div&gt; </code></pre> <p>i used</p> <pre><code> var div =document.getElementsByClass("web_index").getElementsByTagName("div"); </code></pre> <p>it tips me there <code>TypeError: document.getElementsByClass is not a function</code>.why, and how to get all the <code>div</code> in the <code>web_index</code> div?</p>
javascript
[3]
2,305,895
2,305,896
@Override problems
<p>In my project, I'm having hundreds of errors because of the keyword <code>@Override</code> because I updated my Eclipse, JDK and all the components. This problem is because my team is using older versions. So is there any way I can ignore this error messages? If there is, how? Second option would be to revert back to older version of my jdk. I need some advice. Thanks.</p>
android
[4]
4,918,600
4,918,601
change uitableviewcell highlight does not work
<p>I used the codes below to change the highlight color of uitabelviewcell</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface KUITableViewCell : UITableViewCell -(void)setSelected:(BOOL)selected animated:(BOOL)animated; -(void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated; @end #import "KUITableViewCell.h" @implementation KUITableViewCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // Initialization code } return self; } - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated { [super setHighlighted:highlighted animated:animated]; if (highlighted) { self.backgroundColor = [UIColor grayColor]; } else self.backgroundColor = [UIColor clearColor]; } } @end </code></pre> <p>setHighlighted was triggered, but does not change the hight color of the UITableviewCell</p> <p>Welcome any comment</p>
iphone
[8]
942,757
942,758
creating a class library in asp.net
<p>how to create a class library file and how to implement in web forms?</p>
asp.net
[9]
1,983,733
1,983,734
how to add 'show/hide content' option in a webpage in html?
<p>though there are many codes available, but i want the simplest and shortest code for an option for show/hide content.( it would be good if the text 'show/hide' can be replaced by an image for the same or by a button)</p>
javascript
[3]
2,695,120
2,695,121
In Python, how can I open a file and read it on one line, and still be able to close the file afterwards?
<p>While working through this exercise I ran into a problem.</p> <pre><code>from sys import argv from os.path import exists script, from_file, to_file = argv print "Copying from %s to %s" % (from_file, to_file) # we could do these two on one line too, how? input = open(from_file) indata = input.read() print "The input file is %d bytes long" % len(indata) print "Does the output file exist? %r" % exists(to_file) print "Ready, hit RETURN to continue, CTRL-C to abort." raw_input() output = open(to_file, 'w') output.write(indata) print "Alright, all done." output.close() input.close() </code></pre> <p>The line <code># we could do these two on one line too, how?</code> is what’s confusing me. The only answer I could come up with was:</p> <pre><code>indata = open(from_file).read() </code></pre> <p>This performed the way I wanted to, but it requires me to remove:</p> <pre><code>input.close() </code></pre> <p>as the input variable no longer exists. How then, can I perform this close operation?</p> <p>How would you solve this?</p>
python
[7]
5,184,134
5,184,135
C# Windows Form with Attached Windows Service
<p>I know how I can create a Windows Service in C# but I have a series of variables that the user currently feeds into a text file and I wanted to control this process. So can I attach a Windows service to a Windows form application to control such things as installing the service, uninstalling the service, start and restart. Or is it better to have them completely separate and just use the form app to run system commands for install/uninstall and use the serviceController to start/restart?</p> <p>Thanks</p>
c#
[0]
4,317,135
4,317,136
What is the best way to distribute C++ class
<p>I have created a big C++ class. I need to give it to another person. I dont want him to see the function implementations but he should be able to use it as a class. (for example: he can inherit this class, use its full functionality in his code but can not see or change function implementations etc)</p> <p>How can i do this. thanking you..</p>
c++
[6]
5,670,572
5,670,573
Windows Command Line Python Change Version
<p>New to Python and programming in general. I want to "install" a module from the command line for v 2.6, but it looks like my default Python is 2.5. (python --version returns 2.5.4) </p> <p>How can I run my python setup.py build/install on 2.6 instead?</p> <p>Many thanks in advance,</p> <p>Brock</p>
python
[7]
1,190,080
1,190,081
How do I define the trigger events 'beforesend' in this plugin?
<p>Probably a simple question, but I cannot figure this out. </p> <p>In this plugin: <a href="https://github.com/brianmario/jquery-infinite-scroll" rel="nofollow">https://github.com/brianmario/jquery-infinite-scroll</a></p> <p>The readme says it fires 'infinitescroll.beforesend', but how do I assign my own function to this without modifying the plugin?</p> <p>Matt</p>
jquery
[5]
5,601,692
5,601,693
app crash when click on back
<p>When i navigate on click row i push the poinofinterestview but when i click back app crash. but if i comment [nextControllerp release]; it works or 5 or 6 time then it crashes</p> <pre><code>(void)tableView:(UITableView *)TableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [TableView deselectRowAtIndexPath:indexPath animated:YES]; PointOfInterest *nextControllerp=[[PointOfInterest alloc] initWithNibName:@"PointOfInterest" bundle:nil]; if([LocationList count]!=0 &amp;&amp; [LocationListId count]!=0) { nextControllerp.locName=[LocationList objectAtIndex:indexPath.row]; nextControllerp.LocationId=[LocationListId objectAtIndex:indexPath.row]; [self.navigationController pushViewController:nextControllerp animated:YES]; } [nextControllerp release]; UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil]; self.navigationItem.backBarButtonItem=backButton; [backButton release]; } </code></pre>
iphone
[8]
851,746
851,747
update span tag value with javascript issue
<p>I am trying to simply update a span tag usign the following method...</p> <pre><code>&lt;script type="text/javascript"&gt; document.getElementById("myspan").innerHTML="newtext"; &lt;/script&gt; &lt;span id="myspan"&gt; hereismytext &lt;/span&gt; </code></pre> <p>But i am getting the following error:</p> <p><strong>document.getElementById("myspan") is null</strong></p> <p>Any ideas as to what is causing this?</p> <p>Cheers</p> <p>Rich</p>
javascript
[3]
2,134,893
2,134,894
How to set class names dynamically?
<p>I have a function that creates classes derived from it's arguments:</p> <pre><code>def factory(BaseClass) : class NewClass(BaseClass) : pass return NewClass </code></pre> <p>Now when I use it to create new classes, the classes are all named the same, and the instances look like they have the same type:</p> <pre><code>NewA = factory(ClassA) NewB = factory(ClassB) print type(NewA()) # &lt;class __main__.NewClass&gt; print type(NewB()) # &lt;class __main__.NewClass&gt; </code></pre> <p>Is the proper fix to manually set the <code>__name__</code> attribute?</p> <pre><code>NewA.__name__ = 'NewA' print type(NewA()) # &lt;class __main__.NewA&gt; </code></pre> <p>Are there any other things I should be setting while I'm at it?</p> <p>Thanks in advance.</p>
python
[7]
4,606,401
4,606,402
C# byte[] back to List<int>
<p>I have a List that I'm converting to a byte[] like so:</p> <pre><code>List&lt;int&gt; integerList = new List&lt;int&gt;(); integerList.Add(1); integerList.Add(2); integerList.Add(3); byte[] bytes = integerList.SelectMany(BitConverter.GetBytes).ToArray(); </code></pre> <p>How do I convert this back to a List?</p>
c#
[0]
288,837
288,838
jquery how to load different scripts when i click on different links?
<p>i have a list:</p> <pre><code>&lt;select name="test" id="test"&gt; &lt;option value="1"&gt;about&lt;/option&gt; &lt;option value="2"&gt;portfolio&lt;/option&gt; &lt;/select&gt; </code></pre> <p>what i am trying to do is to load a different script inside a div <code>#content</code> depending on what option i choose. The script will load some rss content:</p> <pre><code>&lt;div id="content"&gt; &lt;script id="1" type="text/javascript" src="http://rss.bloople.net/?url=http%3A%2F%2Fwww.exploretalent.com%2Frss_cj.php%3Fpid%3D3087968%26file_xml%3Dcastings_new.xml&amp;showtitle=false&amp;type=js&amp;id=1307038796890991"&gt;&lt;/script&gt; &lt;script id="2" type="text/javascript" src="http://rss.bloople.net/?url=http%3A%2F%2Fwww.exploretalent.com%2Frss_cj.php%3Fpid%3D3087968%26file_xml%3Dcastings_new.xml&amp;showtitle=false&amp;type=js&amp;id=1307038796890991"&gt;&lt;/script&gt; &lt;/div&gt; </code></pre> <p>lets say if i select option <code>1</code> then a script with id <code>1</code> will load into page, if i select option <code>2</code> than the script with id <code>1</code> will unload and <code>2</code> will load</p> <p>any ideas? thanks</p>
jquery
[5]
2,794,459
2,794,460
How to access a password protected url with special character(backslash) in Java?
<p>I'm trying to access a file on a server which is password protected which I've tried setting up a Password Authenticator to handle. However the username has a '\' character right in the middle of it. "foo\bar" which gives an error. I just can't figure out how to encode the username. I've tried the following: "foo\bar", "foo%5cbar", and "foo%92bar"</p> <p>I'm hoping the problem is that I haven't encoded the name correctly, but it might be aproblem with my code. Any help is appreciated.</p>
java
[1]
5,537,423
5,537,424
Can I get the Original Install Date of the Windows using C#?
<p>So my question is simple: how can I get the Original Install Date of the Windows using C#?</p>
c#
[0]
3,720,003
3,720,004
Using same XIB for new/edit action
<p>I am making an app which among other things has the oppertunity to add new items or edit(show) existing ones by tapping a row in the tableview. The "detailed" view will be the exactly the same on both actions however with the edit(show) view will ofcourse be in the state of whatever the user has chosen. So my question is, is it bad to use the same XIB for these two viewcontrollers? Or should I make the same view twice?</p>
iphone
[8]
5,081,907
5,081,908
how to post status on LinkedIn from android app?
<p>i am making a app in which there is this edit box and a share button when i click on the share button it posts my status on my LinkedIn account i tried social lib but its of no use kindly help me out how to post a status.</p>
android
[4]
4,099,726
4,099,727
Illegal forward Reference java issue
<p>Could anyone explain what is wrong with this code:</p> <pre><code> public class Base { static { i = 1; System.out.println("[Base]after static init block i=" + i);// LINE 1 System.out.println("*************************************"); System.out.println(); } static int i; public static void main(String[] args) { System.out.println(Base.i); } } </code></pre> <p>If I comment LINE 1 - everything is OK and Base.main method prints "1". If LINE 1 - is not commented, got compile time error: "illegal forward reference". So, as i understand in static init block I can set value for i, but not read. Could anyone explain why?</p>
java
[1]
1,050,142
1,050,143
weird symbol getting appended at the end
<p>I am trying to read characters from a file and writing them to another. The problem is, though everything is being written, a weird symbol is getting appended in the next line of write file. My code is:</p> <pre><code>#include&lt;iostream&gt; #include&lt;stdlib.h&gt; #include&lt;string.h&gt; #include&lt;stdio.h&gt; using namespace std; int main(){ FILE *f, *g; int ch; f = fopen("readfile", "r"); g = fopen("writefile", "w"); while(ch != EOF){ ch = getc(f); putc(ch, g); } fclose(f); fclose(g); return 0; } </code></pre> <p>What may be the reason for that? </p>
c++
[6]
2,782,351
2,782,352
Some problems for Android SDK tool revision 7
<p>Updated Android SDK tools 7 (for Eclipse, windows 7 32 bits). But I got some problems:</p> <ol> <li>Android looks changed some package name, For example, the "android.intent…"was changed to “android.content.intent…”; the “android.permission…” was changed to “android.Manifest.permission…”. If I change the old package name to the new one, the emulator will not work for the application.</li> <li>The tools 7 replaceed some drop-down list selection to Browser selection, for example, the IntentFilter Attributes selection and permission attributes selection no longer have drop-down list selection instead of a “Browser”.</li> </ol> <p>Did I make anything wrong? Please help me!</p>
android
[4]
3,742,848
3,742,849
Python2.6 IF Using AND OR
<p>I can't compare one variable with multiple values.</p> <p>For example I need that variable called <code>_query</code> must be different from <code>Sleep</code> and <code>Binlog</code>.</p> <pre><code>if (query != "Sleep") or (query != "Binlog Dump"): print query[4] </code></pre> <p>With the above code my script is not working. Could you help me?</p> <p>Thanks.</p>
python
[7]
887,286
887,287
Why is observablecollection initialized to null?
<p>I used this constructor to initialize this object</p> <pre><code> ObservableCollection&lt;MyHomeworkModel&gt; allTabs = new ObservableCollection&lt;MyHomeworkModel&gt;(); </code></pre> <p>It turned out that allTabs was null after initialization. I couldn't add MyHomeworkModel objects to it because of that.</p> <p>Please help me and thanks in advance.</p> <pre><code>using System.Windows.Input; using System.Collections.ObjectModel; using MyHomework; namespace MyHomework__MVVM_ { class MyHomeworkViewModel { private ObservableCollection&lt;MyHomeworkModel&gt; allTabs; private MyHomeworkModel selectedTab; public MyHomeworkViewModel() { ObservableCollection&lt;MyHomeworkModel&gt; allTabs = new ObservableCollection&lt;MyHomeworkModel&gt;(); selectedTab = new MyHomeworkModel(); AddCourseCommand = new AddCourseCommand(this); } public ObservableCollection&lt;MyHomeworkModel&gt; AllTabs { get { return allTabs; } set { allTabs = value; } } public MyHomeworkModel SelectedTab { get { return selectedTab; } set { selectedTab = value; } } public ICommand AddCourseCommand { get; private set; } public void AddNewTab() { NewCourseName ncn = new NewCourseName(); ncn.ShowDialog(); if (ncn.courseName != null) { MyHomeworkModel newTab = new MyHomeworkModel(); newTab.Header = ncn.courseName; AllTabs.Add(newTab); } } } } </code></pre>
c#
[0]
4,600,285
4,600,286
Adding Animation in Activity Change in android
<p>I have two Activities A and B . When i swithc between activity A to B the Activity b comes with 3d transition animation.when i press a back button in Activity B the Activity B exits with Animation.</p> <p>Please Answer.</p> <p>Hope Your Quick Response.</p>
android
[4]
3,564,987
3,564,988
How to upload a file on server in c# in fast way
<pre><code>HttpWebRequest request = (HttpWebRequest)WebRequest.Create("request_uri_string"); FileStream fileStream = new FileStream("path_to_my_file", FileMode.Open, FileAccess.Read); Stream requestStream = request.GetRequestStream(); byte[] buffer = new Byte[checked((uint)Math.Min(4096, (int)fileStream.Length))]; int bytesRead = 1; while (bytesRead != 0) { bytesRead = fileStream.Read(buffer, 0, buffer.Length); if (bytesRead &gt; 0) { requestStream.Write(buffer, 0, bytesRead); } } request.Close(); fileStream .Close(); </code></pre> <p>Currently I am using above code. </p> <p>Is there any other approach better (means FAST) than this?</p>
c#
[0]
4,993,288
4,993,289
How to convert List<string> to List<int>?
<p>My question is part of this problem: </p> <p>I recieve a collection of id's from a form. I need to get the keys, convert them to integers and select the matching records from the DB. </p> <pre><code>[HttpPost] public ActionResult Report(FormCollection collection) { var listofIDs = collection.AllKeys.ToList(); // List&lt;string&gt; to List&lt;int&gt; List&lt;Dinner&gt; dinners = new List&lt;Dinner&gt;(); dinners= repository.GetDinners(listofIDs); return View(dinners); } </code></pre>
c#
[0]
4,140,115
4,140,116
Permission denied error calling fopen
<p>I use XAMPP on Leopard. I'm trying to create cache files using fopen but I get </p> <pre>Warning: fopen(/Applications/xampp/xamppfiles/htdocs/mysite/cache/index.php.cache) [function.fopen]: failed to open stream: Permission denied in /Applications/xampp/xamppfiles/htdocs/mysite/functions.php on line 26</pre> <p>I tried to change folder permissions using CMD+I in finder and setting read/write access for everyone, but did not work.</p> <p>Got any ideas?</p> <p>Thanks!</p>
php
[2]
2,904,917
2,904,918
Game Randomly Freezes Up and Won't Repaint
<p>I am working on a game at the moment. Whenever I go into Level 1, exactly 1500 milliseconds into the level, it freezes and I can't close out of it (I have to kill the process). I have a loop which repeatedly calls <code>repaint()</code> and a <code>System.out.println("Repainting")</code> line above it. I also have a <code>System.out.println("Paint component called")</code> line in the <code>paintComponent()</code> method. When it freezes, it keeps printing "Repainting" but won't print "Paint component called".</p> <p>An SSCCE is located <a href="http://www.mediafire.com/?bq09v83bfdpdi58" rel="nofollow">here</a>, and my source code is <a href="http://www.mediafire.com/?41l6lp8p4fikfpf" rel="nofollow">here</a>.</p> <p>Thanks in advance!</p> <p><strong>Edit: relvant code <a href="http://paste.ubuntu.com/1097474/" rel="nofollow">here</a>.</strong></p>
java
[1]
2,405,589
2,405,590
Differences between .text() and .html() with escaped < and > characters
<p>Given the following HTML fragment:</p> <pre><code>&lt;p id="para"&gt;hello &amp;lt;world&amp;gt;&lt;/p&gt; </code></pre> <p>The jQuery <a href="http://api.jquery.com/text/" rel="nofollow"><code>.text()</code></a> and <a href="http://api.jquery.com/html/" rel="nofollow"><code>.html()</code></a> methods will return different values...</p> <pre><code>var text = $('#para').text(); // gives 'hello &lt;world&gt;' var html = $('#para').html(); // gives 'hello &amp;lt;world&amp;gt;' </code></pre> <p>The jQuery documentation states</p> <blockquote> <p>The result of the <code>.text()</code> method is a string containing the combined text of all matched elements.</p> </blockquote> <p>and...</p> <blockquote> <p>In an HTML document, we can use <code>.html()</code> to get the contents of any element. If the selector expression matches more than one element, only the first one's HTML content is returned.</p> </blockquote> <p>But this specific difference with <code>&amp;lt;</code> and <code>&amp;gt;</code> doesn't seem to be documented anywhere.</p> <p>Can anyone comment on the rationale for this difference?</p> <h2>Edit</h2> <p>A little more investigation suggests that the values <code>.text()</code> and <code>.html()</code> match those from the native JavaScript <code>innerText</code> and <code>innerHTML</code> calls respectively (when the jQuery selector has returned a single element, at least). Again, this is not reflected in the jQuery documentation so I am not 100% sure if this observation holds true in all scenarios. Reading through the <a href="http://code.jquery.com/jquery-1.4.4.js" rel="nofollow">jQuery source</a> reveals that this isn't what's actually going on under the hood.</p>
jquery
[5]
1,876,376
1,876,377
PHP document root in includes
<p>At the moment I have this on every page of my site so I can use the same site code on a dev site on the same server but it seems maybe their is a better way than this?</p> <pre><code>define("DOC_ROOT", $_SERVER["DOCUMENT_ROOT"]); $folder=explode("/",DOC_ROOT); include("/home/".$folder[2]."/header.php"); </code></pre>
php
[2]
1,669,235
1,669,236
Mechanism in Java compiler to substitute method name as literal string
<p>Is there a keyword (or equivalent) in Java that the compiler substitues with the name of the method (and/or class, etc) that the keyword appears in? This would be similar to the</p> <pre><code>__FUNCTION__ </code></pre> <p>macro is C/C++.</p> <p>I know Java "doesn't support macros", but I'm not asking for user #define'able macros, just a small set of keywords that are replaced with literal strings that the compiler knows.</p> <p>I know there are methods to get the method a piece of code appears in (<a href="http://www.rgagnon.com/javadetails/java-0420.html" rel="nofollow">http://www.rgagnon.com/javadetails/java-0420.html</a>) but I'm assuming these are not cost-free. Not surprisingly, if this functionality exists I'd like to use it in tracing, so it really does need to have zero cost or very close to it.</p> <p>I guess this would be up to the compiler implementation, so maybe my question is whether the usual Java compilers (whatever comes with the JDK) support this.</p> <p>If not, I fail to understand why this isn't available since it seems useful and I assume it would be trivial for the compiler to provide since surely it knows the method name of the code it's compiling.</p>
java
[1]
3,907,289
3,907,290
JavaScript Load New Page Question
<p>What I am looking to do is if a user complete a form it will provide access to a new location.</p> <pre><code>&lt;script language="JavaScript" type="text/javascript"&gt; &lt;!-- function validateForm(theForm) { var firstname = theForm.firstname.value; var lastname = theForm.lastname.value; var email = theForm.email.value; if (firstname == "") { alert("Please fill in your First Name."); theForm.firstname.focus(); return false; } if (lastname == "") { alert("Please fill in your Last Name."); theForm.lastname.focus(); return false; } if (email == "") { alert("Please fill in your email address."); theForm.email.focus(); return false; } return true; } </code></pre> <p>I know this part is wrong but I have no idea how to go about doing it. any help would be nice.. </p> <pre><code> if lastname="" if firstname="" if email="" load('www.google.com'); </code></pre>
javascript
[3]
5,969,695
5,969,696
`string.replace` weird behavior when using dollar sign ($) as replacement
<p>I found a bug in my JavaScript code that I have isolated to a string replace that is acting in a way I didn't expect. Here is an example of the code:</p> <pre><code>var text="as"; text = text.replace(text,"$\'"); console.log(text); </code></pre> <p>This prints an empty string to the console. I was expecting it to print $' to the console. Can anyone explain this? </p>
javascript
[3]
1,174,174
1,174,175
Android billing - where can I check the transactions that went through?
<p>I just made a transaction go through but not sure where there is a place for developers to monitor the financial earnings.</p> <p>Is there such a spot I can navigate to in my Android store admin area?</p> <p>Thanks!</p>
android
[4]
2,891,400
2,891,401
Fade in divs by passing two id's in query
<p>I'm trying to create a row of divs with hidden images inside, when moused over the middot will fade out, image will fade in, then fade out when the mouse leaves that div. I know I need to do something with the .hover function in jquery.</p> <p>For example</p> <pre><code>&lt;div id='1_1'&gt; &amp;midddot; &lt;img src='image1_1.jpg' style='display:none'&gt; &lt;/div&gt; &lt;div id='1_2'&gt; &amp;midddot; &lt;img src='image1_2.jpg' style='display:none'&gt; &lt;/div&gt; &lt;div id='1_3&gt; &amp;midddot; &lt;img src='image1_3.jpg' style='display:none'&gt; &lt;/div&gt; </code></pre> <p>Each div will represent a page of an article. So where id='1_3', that'd be a row 1, page 3, or id='1_1' would be row 1, page 1. </p> <p>Just not sure how to structure the jquery to get this done. </p> <p>FYI, I'm using php/mysql to output the info. So the above code would be one loop in that "while" statement. Subsequent loops would increase the row number (id="2_1", "2_2", etc.). </p> <p>Thanks for any advice.</p>
jquery
[5]
1,157,927
1,157,928
How get value from local variable and object with jquery
<p>I have this:</p> <pre><code>form = $('#&lt;%= params[:board_id] %&gt;'); var $parent = form.closest(".biscuit").eq(0); </code></pre> <p>I want get values for <code>form</code> and <code>$parent</code></p> <p>If I write:</p> <p><code>alert($parent).value();</code> or <code>alert(form).value();</code> I get in the alert <code>[object Object]</code>.</p> <p>How can I get the values for <code>form</code> and <code>$parent</code>?</p>
jquery
[5]
5,940,150
5,940,151
Check string to see what's being added in Java
<p>I have a chemistry compound ex 'H' and I want to add either 'H', 'C', 'O' or 'N' to it. How can I check in code which one I am adding to the current compound?</p> <p>Second when I am adding to my current compound it might be H2. So if I added H it would become H2H but I want it to be H3, how can I fix this?</p> <p>I am not really sure what to do coding wise but</p> <pre><code>String Compound = "H2"; String a="H"; String b="C"; String c="O"; string d="N"; if (I am adding "H" to Compound){ //do something } if(I am adding "C" to Compound) { //do something else } </code></pre>
java
[1]
5,077,450
5,077,451
function overloading and overriding in php
<p>In php what do you mean by function overloading and function overriding. and what is the difference between both of them? couldn't figure out what is the difference between them.</p> <p>Thanks in advance for any help</p>
php
[2]
4,251,905
4,251,906
How can we serialize the properties defined with private field?
<pre><code>public class NetworkCredentialHolder { public NetworkCredentialHolder() { _networkCred = new NetworkCredential(); } public string UserName { get { return _networkCred.UserName; } set { _networkCred.UserName = value; } } public string Domain { get { return _networkCred.Domain; } set { _networkCred.Domain = value; } } } public class SPS2003NetworkConfiguration { public SPS2003NetworkConfiguration() { _targetCredentials = new NetworkCredentialHolder(); } private NetworkCredentialHolder _targetCredentials; } class Program { static void Main(string[] args) { var netConfiguration = new SPS2003NetworkConfiguration(); netConfiguration.SetGlobalCredentials("sanz", "pass@word1TestPassed"); var sb = new StringBuilder(); var writer = new StringWriter(sb); XmlSerializer serializer = new XmlSerializer(typeof(SPS2003NetworkConfiguration)); serializer.Serialize(writer, netConfiguration); XmlDocument doc = new XmlDocument(); doc.LoadXml(sb.ToString()); XmlNodeReader reader = new XmlNodeReader(doc.DocumentElement); XmlSerializer serializer = new XmlSerializer(typeof(SPS2003NetworkConfiguration)); object obj = serializer.Deserialize(reader); var netConfiguration = (SPS2003NetworkConfiguration)obj; var encryptedPwd = netConfiguration.TargetCredentials.SecurePassword; } } </code></pre> <p>Hi, Here I have created </p> <pre><code>private NetworkCredentialHolder _targetCredentials; </code></pre> <p>when I created <code>_targetCredntials</code> as private, the properties defined under <code>NetworkCrendtialHolder</code> like <code>UserName</code>, <code>Domain</code> are not serialized unless <code>_targetCredentials</code> is defined as public. Is there any way I can serialize <code>UserName</code>, <code>Domain</code> while keeping <code>_targetCredential</code> as private ?? </p>
c#
[0]
4,394,242
4,394,243
Problem with Master pages event order
<p>I have a simple setup with the master page housing some controls used by all child pages.</p> <p>I found when moving to new pages the master page page loads event fires as a non post back and read the solution was to store it's current values somewhere for retrieval. Ok all done.</p> <p>The child page uses these values to run a report. When I switch to a new report, all is well. If I change the values in the master page the master page and the sub page load events fire. </p> <p>The load event for the sub page fires first, picks up the values from the master page which are still the old values and then finally the master page events fire and all the new values are stored. The report hasn't changed as it still ran from the old values.</p> <p>I can't really see a way around this. All you ever hear is that master pages are a saving grace but I swear i've never jumped through so many hoops to get a page to load correctly.</p> <p>And now this!</p> <p>Anyone see a plan to resolve it?</p>
asp.net
[9]
5,328,086
5,328,087
Android: Taking complete control of phone, is it possible? How?
<p>We have a program that we install on the phones and borrow the phones to users for a certain period. We would like the phones to be used solely for running our application(no phone calls, no games, no nothing). We will root the phones, no problem with that. </p> <p>So the things we need:</p> <ul> <li>Run in full screen, nothing else will be visible </li> <li>Home button and other device buttons won't work</li> <li>Our app will run automatically on startup</li> </ul> <p>It doesn't have to be "hacker proof", but should be sufficient to prevent average user messing with the device.</p> <p>Is this possible? I have done similar things on Symbian &amp; Windows Mobile but I don't have much experience with this stuff on Android. Can you please point me in the right direction? </p> <p>Thanks.</p>
android
[4]
1,639,506
1,639,507
how we can remove a file from the assets folder at runtime in android?
<p>how we can remove a file from the assets folder at runtime? Is it even possible?</p>
android
[4]