Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
1,658,255
1,658,256
PHP stream multiple videos at once
<p>I want to build a little streaming service, nothing like YouTube (there will be no options for users to upload videos themselves), I calculate with not much more than 100-200 concurrent streams at once. The videos are quite short, around 3-10 minutes in HD-quality and shouldn't be much bigger than 200mb. My question is, if this is possible with PHP and what kind of hardware would be needed, I thought maybe the hard drive read'n'write-rate could be too slow to stream 200 different videos at once...Any suggestions?</p>
php
[2]
4,603,001
4,603,002
How to get Properties file values in android?
<p>I am new to android application development.</p> <p>In my android project I place on properties file in assets folder.</p> <p>My requirement is ,How to get the values from properties file?</p> <p>please help me to go forward..</p>
android
[4]
712,997
712,998
Using an array in a method that has been created in another method
<p>How do I write a method, that has a parameter integer representing the index, and returns the value the array holds at the specified index. But the array being used has been generated by a previous method. So far I have this:</p> <pre><code>public static int get(int var) { int[] result = constructArray(arrayA,array B); return result[var]; } </code></pre> <p>The main method looks like </p> <pre><code> public static void main(final String[] args) { int[]result = constructArray(arrayA,arrayB); System.out.println(Arrays.toString(result)); int variable = get(2); System.out.println(variable); } </code></pre> <p>The method constructArray constructs a different array each time it is called, so when I call the get method I want to use the array that has already been constructed. How can I achieve this?</p>
java
[1]
4,657,217
4,657,218
while loop login
<p>I've completed my login page. My problem now is I can only log in using the first account created. I found out that I have not complete my login page. The missing item is the while..loop code so that the application will check the other existing user instead of only looking for a match for the first user.</p> <pre><code>if(username.equals(c.getString(1))) { if(password.equals(c.getString(2))) { Context context = getApplicationContext(); int duration = Toast.LENGTH_LONG; Toast toast = Toast.makeText(context, "LOGIN SUCCESS", duration); toast.show(); Intent intent=new Intent(Login.this,Test.class); startActivity(intent); } </code></pre> <p>I do know that the code is something like <code>while (c.moveToNext())</code> but I do not know how to apply it on my if..else statement.</p> <p>I hope you can help me out on this simple task. Thank you!</p>
android
[4]
1,725,250
1,725,251
Java Error When attempting to use the return from a method as an item in an if statement
<p>I keep getting the following errors: Cannot find symbol Variable find</p> <p>cannot find symbol method getdata(int)</p> <p>I am sure I am making this way more difficult than it is, but I am not sure how make this work so that the return from searching through the array, can be seen and evaluated by the if statement. </p> <pre><code> //assigns manager identification manID = keyboard.nextInt(); //Fibonacci binary array for passwords int[] passWArray = {00000000,00000001,00000001,00000010,00000011,00000101,00001000,00001101}; //item = find.getdata(manID); if (getdata(manID) != -1) { //Do work here dblPayRate = 10.85; dblGrossPay = (intHours * dblPayRate) + (15.00); dblTaxes = dblGrossPay * 0.19; dblGrossPay -= dblTaxes; //Print information to user System.out.print("\n\n$" + df2.format(dblTaxes) + " was withheld from this paycheck in taxes after working "+ intHours + " hours.\n\n"); System.out.print("The amount \"Employer Here\" owes you is $" + df2.format(dblGrossPay) + "\n"); } else { // Dialog box for incorrect password JOptionPane.showMessageDialog(null, "Invalid Entry! Contact the BOFH!"); //exits program (Note: needed for any JOptionPane programs) System.exit(0); } }// end of long if statement for &gt;50 hours }//end of main method public int find(int[] passWArray, int manID) { //search for manID in passWArray array for (int index = 0; index &lt; passWArray.length; index++) if ( passWArray[index] == manID ) return manID; //-1 indicates the value was not found return -1; }// end of find method </code></pre>
java
[1]
4,005,857
4,005,858
What's a good way to provide additional decoration/metadata for Python function parameters?
<p>We're considering using Python (IronPython, but I don't think that's relevant) to provide a sort of 'macro' support for another application, which controls a piece of equipment.</p> <p>We'd like to write fairly simple functions in Python, which take a few arguments - these would be things like times and temperatures and positions. Different functions would take different arguments, and the main application would contain user interface (something like a property grid) which allows the users to provide values for the Python function arguments.</p> <p>So, for example function1 might take a time and a temperature, and function2 might take a position and a couple of times.</p> <p>We'd like to be able to dynamically build the user interface from the Python code. Things which are easy to do are to find a list of functions in a module, and (using inspect.getargspec) to get a list of arguments to each function.</p> <p>However, just a list of argument names is not really enough - ideally we'd like to be able to include some more information about each argument - for instance, it's 'type' (high-level type - time, temperature, etc, not language-level type), and perhaps a 'friendly name' or description.</p> <p>So, the question is, what are good 'pythonic' ways of adding this sort of information to a function.</p> <p>The two possibilities I have thought of are:</p> <ul> <li><p>Use a strict naming convention for arguments, and then infer stuff about them from their names (fetched using getargspec)</p></li> <li><p>Invent our own docstring meta-language (could be little more than CSV) and use the docstring for our metadata.</p></li> </ul> <p>Because Python seems pretty popular for building scripting into large apps, I imagine this is a solved problem with some common conventions, but I haven't been able to find them.</p>
python
[7]
3,101,998
3,101,999
PHP - Alternate row colours based on a 'grouping' value in an array
<p>There's probably an easy answer to this, but I just haven't been able to get my head around it.</p> <p>I have the following array:</p> <pre><code>Array ( [0] =&gt; Array ( [meeting_grouping] =&gt; 1 [client_first_name] =&gt; Nikolay ) [1] =&gt; Array ( [meeting_grouping] =&gt; 1 [client_first_name] =&gt; Konstantin ) [2] =&gt; Array ( [meeting_grouping] =&gt; 1 [client_first_name] =&gt; Andrey ) [3] =&gt; Array ( [meeting_grouping] =&gt; 4 [client_first_name] =&gt; Eddie ) [4] =&gt; Array ( [meeting_grouping] =&gt; 4 [client_first_name] =&gt; Neil ) [5] =&gt; Array ( [meeting_grouping] =&gt; 6 [client_first_name] =&gt; Ian ) [6] =&gt; Array ( [meeting_grouping] =&gt; 6 [client_first_name] =&gt; Mark ) ) </code></pre> <p>What I would like to do is output this data to an HTML table and colour code the rows. I know how to alternate the row colours, but in this case I need it to be colour coded based on the 'meeting_grouping'. I.e. Nikolay, Konstantin and Andrey (meeting_grouping = 1) would have a grey background, Eddie and Neil (meeting_grouping = 4) would have a white background and Ian and Mark (meeting_grouping = 6) would have a grey background again.</p> <p>If someone could point me in the right direction it would be much appreciated.</p> <p>Thanks in advance!</p>
php
[2]
5,022,656
5,022,657
How to get first character c#
<p>I want to convert following string</p> <p>0-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-10-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1 and so on</p> <p>to</p> <p>0 only</p> <p>how can i do this edit</p> <p><strong>try</strong></p> <pre><code>protected void rblist_SelectedIndexChanged(object sender, EventArgs e) { foreach (RepeaterItem item in Repeater1.Items) { RadioButtonList rblist = (RadioButtonList)item.FindControl("rbList"); Panel p = (Panel)item.FindControl("pnlComment"); string rbValue = rblist.SelectedIndex.ToString(); char firstDigit = rbValue[0]; Response.Write(firstDigit); } } </code></pre> <p></p> <pre><code> &lt;asp:ListItem Text ="Approved" Value="1" /&gt; &lt;asp:ListItem Text ="Approved With Comment" Value="2" /&gt; &lt;asp:ListItem Text ="Reject With Comment" Value="3" /&gt; &lt;/asp:RadioButtonList&gt; </code></pre> <p>getting out put </p> <pre><code> 1----------------------------1---------------------------- </code></pre>
c#
[0]
2,418,276
2,418,277
Creating a file on an Android device
<p>I am new to Android development using eclipse, although not new to software development in general.</p> <p>For my first real project, I am trying to modify the example SoftKeyboard that is supplied with the SDK. I want to modify one of the keys to act as a function key, when followed by a single letter key it will enter a canned string - performing a macro function.</p> <p>So far so good. I have the key and graphics modified, and found where to respond. I would like to put the canned strings in an editable Properties file stored where the keyboard can find them.</p> <p>That is where I'm having trouble. It seems that I can't to create and save a file. I don't know if it's read/write permission problem, whether the keyboard (it runs as a service) is not allowed to create a file, or my code is just plain wrong.</p> <p>Can someone help me out – point me in the right direction?</p> <p>Thank you very much. Barry.</p>
android
[4]
2,292,914
2,292,915
Why my cmd disapears? I use cin.ignore() but it has no effect! C++
<p>I'm testing my roulette classes but visual studio don't let me see the output since <strong>cin.ignore()</strong> does not work, and I have no idea what going on here,</p> <p>can you explain why my cmd line window disapear and why <strong>cin.ignore()</strong> in this code never gets invoked?</p> <p>Thank you so much!</p> <pre><code>#include "Bet.h" #include "Table.h" #include &lt;iostream&gt; using namespace std; using namespace Roulette; int main() { cout &lt;&lt; "Enter numbers for Split bet:" &lt;&lt; endl; short answer; vector&lt;short&gt;* Selection = new vector&lt;short&gt;; for (short i = 0; i &lt; 2; ++i) { cin &gt;&gt; answer; Selection-&gt;push_back(answer); } cout &lt;&lt; "Enter how many chips and chip worth:" &lt;&lt; endl; short chips, worth; cin &gt;&gt; chips &gt;&gt; worth; Bet* MyBet = new Bet(TableLayout::European, BetName::Split, chips, worth, Selection); Bet* Complex = new Bet(TableLayout::European, BetName::VoisinsDeZero, 1, 1); Complex-&gt;PrintProperties(); cin.ignore(); // THIS IS IGNORED!!! WHY??? please... delete Selection; Selection = nullptr; delete Complex; delete MyBet; return 0; } </code></pre> <p>EDIT:</p> <p>I press F5 to run a program and then type in the numbers as follows:</p> <p>1 enter 2 enter 1 enter 1 enter</p> <p>and here cmd goes away, program skips cin.get() ( or cin.ignore() ) whatever it doesn't work.</p>
c++
[6]
2,916,859
2,916,860
Terminal emulator an Android 2.1
<p>I want add new fonts for Android. I found a tutorial that asks me to open a terminal emulator. I can't find this terminal emulator:</p> <blockquote> <p>On your Droid, open up a terminal emulator application -- I used "Android Terminal Emulator" -- and type this exactly (make sure to be case-sensitive and do not type directions I include in parenthesis):</p> </blockquote> <pre> su (wait for the superuser screen, and press "yes") mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system chmod 4755 /system/fonts/DroidSansFallback.ttf dd if=/sdcard/DroidSansFallback.ttf of=/system/fonts/DroidSansFallback.ttf reboot </pre>
android
[4]
5,875,301
5,875,302
e value script program
<p>So I am trying to get the e_values from the file</p>
python
[7]
5,596,343
5,596,344
OnCommand event on ImageButton control
<p>I have problem with OnCommand event. When I give this parametr as argument or display everything is all right, but if I used it as CommandArgument I get InvalidCastException. In code behind method CommandArgument is equal "" (string.Empty)</p> <p>In my aspx file I have this code below:</p> <pre><code>&lt;%# (bool)Eval("IsCandidateFavourite") %&gt; //just display value &lt;asp:ImageButton id="ImageButton1" runat="server" CommandArgument="&lt;%# (bool)Eval("IsCandidateFavourite") %&gt;" OnCommand="imBtnFavorite_Command" ImageUrl='&lt;%# GetIsFavoriteImageUrl((bool)(Eval("IsCandidateFavourite")) ) %&gt;'/&gt; </code></pre> <p>In my code behind file I have this</p> <pre><code>public string GetIsCandidateFavoriteImageUrl(bool isNowFavorite) { if (isNowFavorite) { return @"~/_images/icon_grid_fav.gif"; } return @"~/_images/icon_grid_unfav.gif"; } protected void imBtnFavorite_Command(object sender, CommandEventArgs e) { bool isFavorite =(bool) e.CommandArgument; } </code></pre>
asp.net
[9]
3,205,875
3,205,876
Determine which button was pressed using jQuery
<p>Say that I have three "button" elements in one parent "div". Assuming that these buttons could be labeled 1, 2, 3 or 0, 1, 2, using jQuery, is there an easy way to determine the number of which button is clicked?</p> <p>Here's the HTML:</p> <pre><code>&lt;div class="table-tabs"&gt; &lt;button class="tab1 selected"&gt;Description&lt;/button&gt; &lt;button class="tab2"&gt;Monitoring&lt;/button&gt; &lt;button class="tab3"&gt;Change Logs&lt;/button&gt; &lt;/div&gt; </code></pre> <p>I would like to know the number so that I can activate the appropriate table when a button is pressed.</p>
jquery
[5]
2,331,286
2,331,287
key events with Robot class
<p>hi there is a problem during handling Robot.KeyPress(KeyEvent...) is it neccesarry to specify all the keys every time.... e.g Robot.KeyPress(KeyEvent.VK_A); Robot.KeyPress(KeyEvent.VK_B); Robot.KeyPress(KeyEvent.VK_C); if there is any shortkut for not repeating this everytime...plz tell me.....</p> <p>and the interpretation for keys that are recieved at client side is diff...than that is sent from server side...</p> <p>so please help me...</p>
java
[1]
3,060,760
3,060,761
Select and Deselect the checkboxs using JQuery
<p>I am using JQuery and I have below HTML with checkboxes in it.</p> <pre><code> &lt;div class="selectallitems"&gt; &lt;div class="selectall"&gt; &lt;asp:CheckBox ID="chkSelectAll" CssClass="selectall-txt" runat="server" /&gt; &lt;/div&gt; &lt;div id="divCheckAll"&gt; &lt;div class="selectall"&gt; &lt;asp:CheckBox ID="chkItemLists" CssClass="selectall-txt-1" runat="server" /&gt; &lt;div class="clear"&gt; &lt;/div&gt; &lt;/div&gt; &lt;br /&gt; &lt;div class="selectall"&gt; &lt;asp:CheckBox ID="chkComponentLinks" CssClass="selectall-txt-1" runat="server" /&gt; &lt;div class="clear"&gt; &lt;/div&gt; &lt;/div&gt; &lt;br /&gt; &lt;div class="selectall"&gt; &lt;asp:CheckBox ID="chkResourceKeyData" CssClass="selectall-txt-1" runat="server" /&gt;&lt;/div&gt; &lt;br /&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Now I want whenever user selects "chkSelectAll" then it should select all other checkboxes and whenever user deselect any of them it should deselect the "chkSelectAll".</p> <p>Please suggest!!</p>
jquery
[5]
1,769,488
1,769,489
Can anyone explaint the output?
<p>I know the output is four one three two. Can any one explain how? Since there are five items, but only four are printed.</p> <pre><code>TreeSet map = new TreeSet(); map.add("one"); map.add("two"); map.add("three"); map.add("four"); map.add("one"); Iterator it = map.iterator(); while (it.hasNext() ) { System.out.print( it.next() + " " ); } </code></pre>
java
[1]
4,010,024
4,010,025
Python load list in list from text file
<p>I want to load list in list from text file. I went through many examples but no solution. This is what I want to do I am new bee to python</p> <pre><code>def main() mainlist = [[]] infile = open('listtxt.txt','r') for line in infile: mainlist.append(line) infile.close() print mainlist `[[],['abc','def', 1],['ghi','jkl',2]]` </code></pre> <p>however what I want is something like this</p> <pre><code>[['abc','def',1],['ghi','jkl',2]] </code></pre> <p>my list contains</p> <pre><code>'abc','def',1 'ghi','jkl',2 'mno','pqr',3 </code></pre> <p>what I want is when I access the list <code>print mainlist[0]</code> should return</p> <pre><code>'abc','def',1 </code></pre> <p>any help will be highly appreciated Thanks,</p>
python
[7]
3,220,723
3,220,724
javascript Class Set?
<p>Is there a javascript class/object name set? In a <a href="http://github.com/DmitryBaranovskiy/raphael/raw/master/raphael.js" rel="nofollow">raphael</a> demo i saw this code </p> <pre><code>var targets = r.set(); targets.push(r.circle(300, 100, 20), r.circle(300, 150, 20), ... </code></pre> <p>and i didnt know js can use object that way. So i looked into the source and it looks like i am calling this</p> <pre><code>paperproto.set = function (itemsArray) { arguments[length] &gt; 1 &amp;&amp; (itemsArray = Array[proto].splice.call(arguments, 0, arguments[length])); return new Set(itemsArray); }; </code></pre> <p>But i googled and found nothing about a class called set nor seen anything in code.</p> <p>Where can i find more about Set?</p>
javascript
[3]
6,027,741
6,027,742
how to search a text in UIView?
<p>I am new to iPhone development. I am able to draw a pdf page which contains some text, in a UIView. Now I want to do search a text in my present view and highlight that text as well. Please help me out from this problem. Thank you.</p>
iphone
[8]
570,282
570,283
Why can anonymous functions defined with `var` be called in global scope?
<pre> function setupSomeGlobals() { // Local variable that ends up within closure var num = 666; // Store some references to functions as global variables var gAlertNumber = function() { console.log(num); } } setupSomeGlobals(); gAlertNumber(); //works, WHY?!! console.log(num); //does not work, GOOD </pre> <p>I expected gAlertNumber() to not work outside the setupSomeGlobals() function...</p>
javascript
[3]
2,646,321
2,646,322
Creating tables with jQuery without tbody
<p>How do I create tables in jQuery without tbody being added to my code by jQuery? See <a href="http://jsfiddle.net/r7BFq/" rel="nofollow">http://jsfiddle.net/r7BFq/</a> </p> <pre><code>$('table').html('&lt;tr&gt;&lt;td&gt;A&lt;/td&gt;&lt;td&gt;B&lt;/td&gt;&lt;/tr&gt;'); $('pre').text($('table').html());​ </code></pre> <p>results in</p> <pre><code>&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;A&lt;/td&gt;&lt;td&gt;B&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt; </code></pre> <p>I don't want that. I want:</p> <pre><code>&lt;tr&gt;&lt;td&gt;A&lt;/td&gt;&lt;td&gt;B&lt;/td&gt;&lt;/tr&gt; </code></pre>
jquery
[5]
5,374,026
5,374,027
errors in php class
<p>I built the following php class file, it seems not working at all, I am not sure what is my mistake, so if anybody could point me out, any help will be greatly appreciated!</p> <pre><code>&lt;?php class Arrayfromcsv { public $newrow = array(); public $i=0; public $c=0; public function readCsv($file) { if(($handle = fopen($file, "r")) != FALSE) //open the csv file { while (($data = fgetcsv($handle, 1000, ",")) != FALSE) //loop through each line from csv file and store each line elements into array { $num = count($data); //get the size of each line array for ($this-&gt;c=0; $this-&gt;c &lt; $num; $this-&gt;c++) { } } } fclose($handle); //close file pointer } return this-&gt;newrow; } } ?&gt; do I need to declare every varible I used in the php class in the beginning? </code></pre>
php
[2]
5,186,471
5,186,472
What is the best way to run PHP 4 and PHP 5 side-by-side on the same Apache server?
<p>I have a unique requirement where I want to run PHP 4 and PHP 5 on the same web server. How do I acheive it ?</p>
php
[2]
3,056,397
3,056,398
YouWave doesn't load apps
<p>I added default "android apps" folder but my application windows is empty. Why? I can see "localapps.xml" in that folder.</p> <p><strong>I tried:</strong></p> <ul> <li><p>Uninstall YouWave. Delete all relative things.</p></li> <li><p>Restart. Reinstall. Restart.</p></li> </ul> <p>It still doesn't load apps.</p> <p><img src="http://i.stack.imgur.com/SwYTm.png" alt="enter image description here"></p>
android
[4]
29,325
29,326
How to clear an ImageView in Android?
<p>I am resusing ImageViews for my displays, but at some point I don't have values to put it.</p> <p>So how to clear an ImageView in Android?</p> <p>I've tried:</p> <pre><code>mPhotoView.invalidate(); mPhotoView.setImageBitmap(null); </code></pre> <p>None of them have cleared the view, it still shows previous image.</p>
android
[4]
5,675,295
5,675,296
How to hide or display text and tags with PHP?
<p>I was wondering how would hide the text Location if the city state and country were not present and how would I let it display if any of the variables were present?</p> <pre><code>&lt;p&gt;Location: &lt;?php if (!empty($city)) { echo $city .','; } if (!empty($state)) { echo $state; } if (!empty($country)) { echo ' ' . $country; } ?&gt; &lt;/p&gt; </code></pre>
php
[2]
3,465,848
3,465,849
downcast problem in c++
<pre><code>#include &lt;iostream&gt; using std::cout; using std::endl; class Base { public : void f(); void g(); int mBaseData1; }; class Derived : public Base { public : int mDerivedData1; }; void main() { Base* base = new Base(); Derived* derived = (Derived*)(base); // DownCast derived-&gt;mDerivedData1 = 6; cout&lt;&lt; derived-&gt;mDerivedData1&lt;&lt;endl; // Result = 6; } </code></pre> <p>in this code <code>new base()</code> allocate memory in heap </p> <p>and <code>Derived* derived = (Derived*)(base)</code> cast base to derived </p> <p>how we can use mDerivedData1? i cant find where we allocate memory for mDerivedData1 or when we call constructor of Derived for allocate mDerivedData1 ?</p>
c++
[6]
3,125,967
3,125,968
android is it possible to get notified when a new image,video is inserted,deleted from sd?
<p>is it possible to get notified every time a new image,video is inserted on the sd card of your android device and how? I have looked at the Media Scanner class which indexes files but I can't find how to do get notified from that only how to notify Media Scanner of a new image I have created. </p>
android
[4]
3,586,076
3,586,077
Question about API Demo Remote Service example in android
<p>I am studying RemoteService example in Android's APISample. In the manifest file, it declares the service like this: My question is how can I specify the service to be 'auto-start', i.e. it gets start whenever the phone start?</p> <pre><code> &lt;service android:name=".app.RemoteService" android:process=":remote" &gt; &lt;intent-filter&gt; &lt;!-- These are the interfaces supported by the service, which you can bind to. --&gt; &lt;action </code></pre> <p>android:name="com.example.android.apis.app.IRemoteService" /> </p> <p>Thank you.</p>
android
[4]
1,859,004
1,859,005
name of element mouse is hovering
<p>I'm using a global variable that toggles between true and false on mouse enter of a div and then I'm using the value of this variable elsewhere to show / hide another element depending on the value.</p> <p>Actually, another way to do what I want would be to know if the mouse is hovering a div called MyDiv. <strong>I'm looking to remove the use of the global variable that toggles with the mouseenter/mouseleave events.</strong></p> <p>I tried this:</p> <pre><code> var test = $('#MyDiv').mouseover() ? 1 : 0; </code></pre> <p>but it's not working.</p> <p>Let me know if you have a <strong>1-liner</strong> suggestion for returning the name of the div that's being hovered.</p> <p>Thanks.</p> <p>PS: I already know it can be done with more than 1 line</p>
jquery
[5]
4,501,422
4,501,423
why isn't my error message working?
<p>I've got a simple form for a <code>$_Session</code> and it's not printing my error message when the password is wrong. It works fine other than the error message and in fact the error message worked until I put <code>header("Location: /cms/");</code> in. Is there something I'm doing wrong?</p> <pre><code>&lt;?php session_start(); $error_msg = ""; if($_POST['username']) { $username = $_POST['username']; $password = $_POST['password']; $admin = "a"; $adminpass = "s"; if(($username != $admin) || ($password != $adminpass)) { $error_msg = 'Your login information is wrong dude!'; } else { $_SESSION['admin'] = '$username'; header("Location: /cms/"); exit(); } } if(!isset($_SESSION['admin'])) { header("Location: /cms/login"); exit(); } ?&gt; &lt;html&gt; &lt;body&gt; &lt;form action="/cms/loggedin.php" method="post" target=_self&gt; &lt;label&gt;Username: &lt;input type="text" name="username" id="username"&gt;&lt;/label&gt; &lt;font color="#FF0000"&gt;&lt;?php echo $error_msg; ?&gt;&lt;/font&gt;&lt;br /&gt; &lt;br /&gt; &lt;label&gt;Password: &lt;input type="text" name="password" id="password"&gt;&lt;/label&gt; &lt;br /&gt; &lt;br /&gt; &lt;label&gt;&lt;input type="submit" name="Submit" value="Sign In"&gt;&lt;/label&gt; &lt;/form&gt; </code></pre> <p> </p>
php
[2]
3,963,725
3,963,726
How do I sanitise cin?
<p>Say I have a program that takes in integers. How do I stop the program from falling apart if the user enters an out of range number, or a letter or something?</p>
c++
[6]
201,412
201,413
Detect multiple fingers on screen
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/8681582/how-to-get-double-touch-position-in-android">How to get double touch position in android?</a> </p> </blockquote> <p>I am developing an app witch uses mapview.I want to place pinpoint after one second when the user clicks and holds on the screen (long press).My problem is that the pin is pressed if the user makes a zoom action(if they hold the button on the screen long enogh). How can i detect if the second finger touched the screen while the first one is still pressing?</p>
android
[4]
5,185,261
5,185,262
Jquery - How to check, if child in hidden DIV is visible?
<p>how can i check a div in a hidden div ... if visible or not?</p> <p><strong>HTML</strong></p> <pre><code>&lt;div style="display:none;"&gt; &lt;div id="two_child"&gt;&lt;/div&gt; &lt;div id="three_child" style="display:none"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>JS</strong></p> <pre><code>if($('#two_child').is(':visible')) { alert('true'); } </code></pre> <p>This will not work. </p> <p>Any ideas`?</p> <p>Thanks in advance! Peter</p>
jquery
[5]
4,427,478
4,427,479
How to make csv file password protected in android
<p>I need to create and read password protected csv file in android .</p> <p>Is it possible with android ??</p> <p>IF not then is there any other file formate which is password protected with android ??</p> <p>Is there any solution for ??</p> <p>Thanks in advance.</p>
android
[4]
1,118,536
1,118,537
While importing project in eclipse workspace showing error invalid project description?
<p>I have taken code from server repository in a folder in D drive. while i import project in workspace it shows error invalid project description ?what is solution of it.</p>
android
[4]
3,408,076
3,408,077
Syntax error in php
<p>I am executing following code from this <a href="http://stackoverflow.com/questions/6404023/string-matching">post</a>:</p> <pre><code>preg_match_all("/'(.+)' ((\w+)\(? ?(\d*) ?\)?)/", $sql, $_matches, PREG_SET_ORDER); $matches = array_map(function($v) {return array(trim($v[2]), $v[1]);}, $_matches); </code></pre> <p>But I am getting following error:</p> <pre><code>Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in SqlParser.php on line 29 </code></pre> <p>I have spent some time to solve this but I am unable to find the solution. Can someone tell me that what is wrong here.</p> <p>Thanks</p>
php
[2]
4,807,111
4,807,112
how to add uipickerview with uibutton programmaticaly in iphone
<p>Im new to iPhone development.Now im doing application in that i want to add pickerview with button without using IB.Here i added pickerview and button programmaticaly in iphone.But When i run this application in pickerview I added some names that was not showing.It was showing only empty pickerview and when i click button the pickerview displayed in top of the view not in down.I searched in all sites but there is no data for this pickerview with button.I added pickerview view in uiaction sheet and i declared pickerview.</p> <p>Can any one plz give code for this uipickerview with uibutton programmaticaly in iphone.</p> <p>Thank you in advance.</p>
iphone
[8]
2,337,404
2,337,405
Randomly get a emtpy message in networkstream Read
<p>I am doing a multiple channels chatting project. Everytime a client joined a channel, the server will broadcast the message that someone joined.</p> <p>I have to make sure that the client only receive message belong to the channel that they are currently in. So i did something like clientName$channelName^ clientName$JoinedChannelName^ I used $ and ^ to tell the program which substring is client name and channel name. And of course, the program needs to know how to extract the channelName when the server is broadcast a client join event or a client message sent event, because then it can determine if the message belong to this channel.</p> <p>things are fine but... The broadcasting of client Joined is fine, and after i type some words that are supposed to send to the channel and the channel broadcast it correctly. BUT SOMEHOW, the client gets another empty message on it's networks stream.read. I checked the server and it didn't do any unnecessary broadcast. The empty message isn't a big issue, it can be easily fixed, but i want to know why...Please help if you encounter similar situation before,</p> <p>Here is the trouble part of the code, i cannot give the entire codes since its awfully long...</p> <pre><code> string chan_name = null; serverStream = clientSocket.GetStream(); int buffSize = 0; byte[] inStream = new byte[10025]; buffSize = clientSocket.ReceiveBufferSize; MessageBox.Show("Waiting for client input"); serverStream.Read(inStream, 0, buffSize); MessageBox.Show("got client input"); </code></pre>
c#
[0]
5,158,237
5,158,238
How come my .php fopen() method is not working?
<p>How come my .php fopen() methods are not working. It says that it can't find the file? Any help is greatly appreciated:</p> <pre><code> #!/usr/local/bin/php &lt;?php $strLessonDescription = fopen("c:\\exercise5\\content\\lesson5.txt", "r") or die ("Error - lesson5.txt cannot be opened"); $arrLessonVocabulary = fopen("c:\\lovej2ee\\exercise5\\content\\vocabulary5.txt", "r") or die ("Error - lesson5.txt cannot be opened"); ?&gt; </code></pre>
php
[2]
1,799,039
1,799,040
C sharp code to fetch WMI information
<p>how do you code in c sharp to fetch WMI information like total memory,cpu usage with the use of "performance counter".</p>
c#
[0]
2,894,515
2,894,516
reordering questions in javascript?
<p>I'm developing a survey application. Can you suggest a good way to reorder questions?</p>
javascript
[3]
2,417,966
2,417,967
How to print out N spaces in Javascript?
<p>In Javascript, the method to print out using</p> <pre><code>console.log("this is %s and %s", foo, bar); </code></pre> <p>works, so it follows some C style, but it doesn't follow</p> <pre><code>console.log("%*s this is %s and %s", 12, foo, bar); </code></pre> <p>where the <code>%*s</code> and <code>12</code> is to make it print out 12 spaces, as in this question: <a href="http://stackoverflow.com/questions/10702678/in-objective-c-how-to-print-out-n-spaces-using-stringwithcharacters">In Objective-C, how to print out N spaces? (using stringWithCharacters)</a></p> <p>Is there a short, quick way to make it work simply in Javascript? (say, without using the <code>sprintf</code> open source library or writing a function to do it?)</p> <p><strong>Update:</strong>, in my case, 12 is actually a variable, such as <code>(i * 4)</code>, so that's why it can't be hardcoded spaces inside the string.</p>
javascript
[3]
1,938,830
1,938,831
Text Messaging my business location when someone enters their zip code
<p>When a customer enters their zip code as text message and text it as "my company name", they get the nearest location. how can I do that? Thank you.</p>
php
[2]
5,256,445
5,256,446
any integer return when user read the sms
<p>i want to do some activity on sms after user read it, so how can my background service in android know that particular sms is now read(when my service start work) to react for some task.</p> <p>is there system generate any integer when user read sms. if it generate than how will i get?</p> <p>if anyone have any idea than share it.</p>
android
[4]
516,224
516,225
I cannot $_post value into a <form></form> in chrome but works in IE
<p>I cannot <code>$_post['value_to_be_posted']</code> value into a <code>&lt;form&gt;&lt;input type="hidden" value="&lt;? echo $_post['value_to_be_posted'] ?&gt;"&gt;&lt;/form&gt;</code> in chrome but works in IE and ff.</p> <p>Any ideas</p> <p>Thanks Jean</p>
php
[2]
3,909,387
3,909,388
Installation Locale on iPhone
<p>My iPhone application needs to provide different features in some local markets, so I need to be able to determine where the devices "home" market is or from which store it was downloaded (if applicable).</p> <p>I've tried almost all variations of NSLocale but I always seem to be able to change one or more of the settings.</p> <p>I need to disable one tab if they are not in the US/CA for legal reasons, and I'd prefer to keep just the single binary.</p> <p>Does anyone know how to do this?</p> <p>Thanks</p>
iphone
[8]
3,640,130
3,640,131
Read XML file in flat file in Java
<p>I am reading a file that is in xml format (has elements, attribute,..). However, the contents in the file have no carriage return or space and all the contents are in one line.</p> <p>I am searching for an element and will need to parse the value of the element.</p> <p>I am thinking to use XMLStreamReader to read and parse the value. </p> <p>Does it matter if the contents are in all in one line? Or, is there another way I should look into?</p> <p>Thanks.</p>
java
[1]
4,784,630
4,784,631
Multitouch detection
<p>I am developing a game of race type. I have a image for acceleration of car and other image for changing the track as we have 3 lanes. </p> <p>My problem is that when i am touching the acceleration image and suddenly want to change the track its not detecting the another touch if i am still touching acceleration image. Means multitouch is not getting recognized.</p> <p>I also used multipleTouchEnabled = true for the two images and also for the view also.</p> <p>Will any body knows why this is happening. Please help me in this issue.</p> <p>Thanks in advance.</p> <p>Regards, Vishal.</p>
iphone
[8]
1,243,946
1,243,947
Interchange the display order in a loop
<p>I am trying to interchange the display order in a loop.<br /> For example i have an array <code>$array</code> with values: <code>1,2,3,4,5</code> and want to display the result in the order <code>2,1,3,4,5</code>. I am using the following code for the purpose and which worked for me:</p> <pre><code>&lt;?php $array = array( 1, 2, 3, 4, 5, ); $tempArray = array(); $count = 1; foreach($array as $key =&gt; $value){ $tempArray[$key] = $value; if(in_array($count, array(1, 2))){ if($count == 2){ echo $tempArray[1] . '&lt;br /&gt;'; echo $tempArray[0] . '&lt;br /&gt;'; } }else{ echo $value . '&lt;br /&gt;'; } $count++; } </code></pre> <p>But i would like to know if there is any effective (better) way of doing so?</p> <p><strong>EDIT</strong>:</p> <pre><code>$array = array( 1, 2, 3, 4, 5, ); //Either /*$temp = $array[1]; $array[1] = $array[0]; $array[0] = $temp;*/ //OR list($array[1], $array[0]) = array($array[0], $array[1]); foreach($array as $key =&gt; $value){ echo $value . '&lt;br /&gt;'; } </code></pre> <p>Either way works fine with minimum code. <br /> Thank you guys!</p>
php
[2]
5,551,308
5,551,309
javascript property value dependent of other property
<p>I made an object called Fullscreen, and within the object another object called directions. so my code looks like this:</p> <pre><code>FullScreen = { directions: { prev: -1, next: 1 } } </code></pre> <p>but i want to be able to set FullScreen.directions.prev from outside the object, and change FullScreen.directions.next to the negative value of the prev. any ideas how to do this?</p>
javascript
[3]
2,233,792
2,233,793
Android Emulator Keyboard not displaying
<p>Just installed the android sdk on my macbook pro. I created a virtual device, allotted 50mb worth of memory in android 3.0. I ran the emulator, and Android_ displays on the left, but the keyboard interface does not display on the right. I have hw.keyboard.lid enabled. Not sure if that has anything to do with it.</p>
android
[4]
3,048,945
3,048,946
templates and inheritance issue!
<p>I have a tempated base class check and publically derived class childcheck. the base class also have a partial specializatin but i inherit the childcheck class from the general templated class( not from the partial specialization of the class check). when i call the constructor of the base class from the initialization list of the derived class, compiler gives error, now if i remove the partial specialization of class check then compiler gives no error, so here is the code <br></p> <pre><code>#include&lt;iostream.h&gt; template&lt;class t&gt; class check { t object; public: check(t element); }; template&lt;class t&gt; check&lt;t&gt;::check&lt;t&gt;(t element) { cout&lt;&lt;"base class constructor"&lt;&lt;endl; } //partial specialization template&lt;class t&gt; class check&lt;t*&gt; { int objectsize; t* object; public: check(t*,int); t* getelement()const; ~check(); }; template&lt;typename t&gt; check&lt;t*&gt;::check&lt;t*&gt;(t* ptr,int size) { cout&lt;&lt;"\n partial specialization constructor"; } //derived class template&lt; class t&gt; class childcheck:public check&lt;t&gt; { t chobject; public: childcheck(t); t getobject()const; }; template&lt;class t&gt; childcheck&lt;t&gt;::childcheck(t element):check&lt;t&gt;(element+1) { cout&lt;&lt;"derived class constructro"&lt;&lt;endl; } //and this is the main function main() { int* ptr; int x=2; ptr=&amp;x; childcheck&lt;int*&gt; object(ptr); system("pause"); } </code></pre>
c++
[6]
2,243,650
2,243,651
How to add a Horizontal BarGraph in Android platform?
<p>Any one please help me to build a horizontal bar graph in my android platform</p>
android
[4]
3,409,137
3,409,138
Ping in ASP.NET
<p>I can ping using console app, but I want to ping from ASP.NET, the problem is that, ping object doesn't show ping.send(....). Is it not possible to ping from ASP.NET Web App?</p> <p>for image please visit : <a href="http://coscientech.blogspot.com/2010/09/ping-trouble-aspnet.html" rel="nofollow">http://coscientech.blogspot.com/2010/09/ping-trouble-aspnet.html</a></p> <p>Directives are : <code>using System; using System.Net; using System.Net.NetworkInformation; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text; </code></p>
asp.net
[9]
594,126
594,127
Javascript appendchild not including element in Body/Head
<p>I am using code to add javascript to my page using javascript file..</p> <p>My code is :</p> <pre><code> alert("works"); addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'); addScript('js/pdttrack/jquery.titlealert.js'); addScript('js/pdttrack/jquery.msgbox.min.js'); function addScript(filename) { var tagPosition = document.getElementsByTagName('body'); var scriptElement = document.createElement('script'); scriptElement.setAttribute('type', 'text/javascript'); scriptElement.setAttribute('src', filename); tagPosition.appendChild(scriptElement); alert("added "+ scriptElement); } </code></pre> <p>...but the last alert is not firing.. seems </p> <pre><code>tagPosition.appendChild(scriptElement); </code></pre> <p>is not firing rest all are..</p>
javascript
[3]
3,356,144
3,356,145
what happens when you declare the same object/variable more than once (newbie)
<p>what does something like this do?</p> <pre><code>static int i; // wrapped in a big loop void update_text() { std::stringstream ss; // this gets called again and again ++i; ss &lt;&lt; i; text = new_text(ss.str()); // text and new_text are defined elsewhere show_text(text); // so is this } </code></pre> <p>does is create a new instance of ss in the stack with a new address and everything? would it be smarter to use sprintf with a char array?</p>
c++
[6]
1,940,985
1,940,986
How to use ceaseFire with the Endless Scroll jQuery plugin
<p>scroll jQuery plugin. Everything works fine but I can't understand the ceaseFire option.</p> <p>I'd like to stop making callbacks after 10 times.</p> <pre><code>$(document).endlessScroll({ fireOnce: true, fireDelay: 3000, bottomPixels: 750, insertAfter: "ul#articlePagedList li:last", loader: "&lt;div id='processing'&gt;&lt;img src='${pageContext.request.contextPath}/images/buttons/icon_busy.gif' alt='&lt;spring:message code='commonMessages.loading' /&gt;' /&gt;&lt;/div&gt;", callback: function(i) { getArticlesEndlessScroll('articlePagedList' ,'${articleListUrl}', i); } }); </code></pre> <p>I try'ed adding this but it doens't work... No errors...</p> <pre><code>ceasFire: function(i) { if (i==10) return true; } </code></pre>
jquery
[5]
2,568,159
2,568,160
formatting the date
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2009296/date-formatting-in-php">Date formatting in PHP</a> </p> </blockquote> <p>Inside my print_r function when ran shows $message->date_sent as this 2012-03-05 00:00:00</p> <pre><code>echo '&lt;td&gt;'.date('F d, Y', $message-&gt;date_sent).'&lt;/td&gt;'; </code></pre> <p>Aparrently the date function is not what I'm wanting here because I just want to turn it into March 05, 2012. </p>
php
[2]
3,693,847
3,693,848
PHP strip_tags - splitting tags into an array
<p>I have a big html content entry. I need to split only the plain text into separate entries in an array, so that I can run it through a translation tool and then replace it into the original html.</p> <p>I've managed to clean it out and then split lines into an array, but the text <code>...to do this &lt;a href="#" title="blah"&gt;click here&lt;/a&gt;</code> comes back as <code>...to do this click here</code>. </p> <p>doing a <code>str_replace</code> on that text won't match anymore because of the <code>a</code> tag. </p> <p>So, I need a way to turn the tags that would normally be stripped using <code>strip_tags</code> into an inserted value that i can use to explode the string with. </p> <p>any suggestions?</p>
php
[2]
4,380,034
4,380,035
Why does tempfile.NamedTemporaryFile() truncate my data?
<p>Here is a test I created to recreate a problem I was having when I used tempfile.NamedTemporaryFile(). The problem is that when I use tempfile the data in my CSV is truncated off the end of the file.</p> <p>When you run this test script, temp2.csv will get truncated and temp1.csv will be the same size as the original CSV.</p> <p>I'm using Python 2.7.1.</p> <p>You can download the sample CSV from <a href="http://explore.data.gov/Energy-and-Utilities/Residential-Energy-Consumption-Survey-RECS-Files-A/eypy-jxs2" rel="nofollow">http://explore.data.gov/Energy-and-Utilities/Residential-Energy-Consumption-Survey-RECS-Files-A/eypy-jxs2</a></p> <pre><code>#!/usr/bin/env python import tempfile import shutil def main(): f = open('RECS05alldata.csv') data = f.read() f.close() f = open('temp1.csv', 'w+b') f.write(data) f.close() temp = tempfile.NamedTemporaryFile() temp.write(data) shutil.copy(temp.name, 'temp2.csv') temp.close() if __name__ == '__main__': main() </code></pre>
python
[7]
5,750,724
5,750,725
Issue while rendering the literal text
<p>I have a string like below </p> <pre><code>&lt;meta property="og:title" content="test" /&gt; </code></pre> <p>This is already in the literal control in it's text property. When I see the rendered page. It shows like below.</p> <pre><code>&amp;lt;meta property=&amp;quot;og:title&amp;quot; content=&amp;quot;test&amp;quot; /&amp;gt; </code></pre> <p><strong>EDIT</strong></p> <p>Here is the source providing the final text...</p> <pre><code>public static void RenderName(Literal ltlMetaHolder, string contentName, string content) { var metaTagFromat = "&lt;TagName property=\"{0}\" content=\"{1}\" /&gt;"; ltlMetaHolder.Text = string.Format(metaTagFromat, contentName, content); } </code></pre> <p><strong>Expected result</strong></p> <pre><code>&lt;meta property="og:title" content="test" /&gt; </code></pre> <p><strong>Actual result</strong></p> <pre><code>&amp;lt;meta property=&amp;quot;og:title&amp;quot; content=&amp;quot;test&amp;quot; /&amp;gt; </code></pre>
asp.net
[9]
271,251
271,252
C# basics - Memory Management
<p>I am new to the programming in C#.</p> <p>Can anyone please tell me memory management about C#?</p> <pre><code>Class Student { int Id; String Name; Double Marks; public string getStudentName() { return this.Name; } public double getPersantage() { return this.Marks * 100 / 500; } } </code></pre> <p>I want to know how much memory is allocated for instance of this class?</p> <p>What about methods? Where they are allocated?</p> <p>And if there are static methods, what about their storage?</p> <p>Can anyone please briefly explain this to me?</p>
c#
[0]
4,561,851
4,561,852
Facebook style navigation bar in android application
<p>I tried the following link <a href="https://github.com/StevenRudenko/ActionsContentView" rel="nofollow">https://github.com/StevenRudenko/ActionsContentView</a> At first I was very impress with the application as it was doing as expected. But main thing I notice after a while. That is application is simply calling the different urls on the same web view . That means it is not opening the new activity or screen. I was attempting to open new activity with every button click but this approach is not working as ii I call new activity layout via intent it will shown the new layout on new screen and this screen will go.</p> <p>Please give me some suggestion so that I can open new activities layout with every click. Is is even possible to do like that or not?</p>
android
[4]
585,847
585,848
how to access private variables with out using friend function in c++
<pre><code>#include &lt;iostream&gt; using namespace std; class Point { friend void ChangePrivate( Point &amp; ); public: Point( void ) : m_i(0) {} void PrintPrivate( void ){cout &lt;&lt; m_i &lt;&lt; endl; } private: int m_i; }; void ChangePrivate ( Point &amp;i ) { i.m_i++; } int main() { Point sPoint; sPoint.PrintPrivate(); ChangePrivate(sPoint); sPoint.PrintPrivate(); } </code></pre> <p>here is the example how to access private variables using friend function how to use without using friend funtion?</p>
c++
[6]
746,917
746,918
Detect Shift key is pressed without using events in WinForms?
<p>I need to be able to detect that the shift key is being held, but I don't want to use events or global variables to determine that. Is there an API in C# that lets you ask what keys are currently pressed instead of using the event?</p>
c#
[0]
605,905
605,906
Benefit of Binding a GridView in Page_PreRender vs Page_Load?
<p>Assume I have an asp:GridView with some customer information. On that page I also have a button which allows me to add a new user to the GridView. When I add the click the user, I databind the gridview again in the button click. Correct me if I am wrong, but if the asp.net lifecycle or at least part of it is in the following order:</p> <p>page_load Hookup event handlers such as my button click page_preRender</p> <p>Does this mean that if I put the databinding for the gridview in preRender, that is the only place I need to worry about calling it. I can remove it from the button click. This is what I think, but I am not sure if my thinking is correct, so I would like some more insight as to the benefit of putting code in PreRender as opposed to PageLoad</p>
asp.net
[9]
2,642,446
2,642,447
Conditionally showing an element in jQuery
<p>I want to make a <code>div</code> visible if there is an element on the page. For example:</p> <p>If <code>('#some_div')</code> is on the page, I want to do a <code>('#another_div').show();</code></p> <p>What's the syntax to make this happen?</p>
jquery
[5]
4,335,222
4,335,223
Syntax for executing a returned function
<p>If I return a function from a function as shown below, how do I execute it and set the parameter?</p> <pre><code>var func1 = function(param){ // do stuff }; function returnFunction(){ return func1; } returnFunction() // this will return func1 but I want to execute it with certain param. </code></pre>
javascript
[3]
3,545,337
3,545,338
Javascript clear
<p>Is there a Javascript Clear function for a dropdownlist per se?</p> <p>ddlist.Clear(); or something of that sort?</p>
javascript
[3]
5,274,954
5,274,955
Jquery-Validation check for two text boxes
<pre><code>function validate() { var textbox= $("#inputtextbox").val(); var match = /^([a-zA-Z0-9]{1,})$/; if(!match.test(textbox)) { $("#dataError").text('Min 1 alpha numeric characters and space allowed.').fadeOut(5000); return false; } var textbox= $("#inputtextbox").val(); var match = /^([a-zA-Z0-9]{1,})$/; if(!match.test(textbox)) { $("#dataErr").text('Min 1 alpha numeric characters and space allowed.').fadeOut(5000); return false; } } </code></pre> <p>I've a form and two text boxes.I'm validating two text boxes.Say,when i do not fill both text boxes and click submit button,it is only print the error message for first textbox. When i fill every thing properly in first text box and i do not fill any thing in second text,now if i submit,it is showing error message for second text box,why is it not showing the message,when both not filled.</p> <p>Thanks in advance!</p>
jquery
[5]
5,944,628
5,944,629
PHP embedding text on a image
<p>I'm trying to embed text on a image.I'm using this script <a href="http://www.phpjabbers.com/put-watermark-on-images-using-php-php20.html" rel="nofollow">http://www.phpjabbers.com/put-watermark-on-images-using-php-php20.html</a></p> <p>This works for fine with one text.Say for eg: I want text some thing like this</p> <p>textone<br /> texttwo<br /> textthree</p> <p>I want them one below one.How can this be achieved.i tried to use </p> <pre><code>&lt;p&gt;$handlerData = "textone"; ?&gt;&lt;/p&gt;&lt;p&gt;$handlerData = "texttwo"; ?&gt;&lt;/p&gt;&lt;p&gt;$handlerData = "textthree"; ?&gt;&lt;/p&gt; </code></pre> <p>But this is only embedding first text.</p> <p>Any help would be appreciated!</p>
php
[2]
2,562,731
2,562,732
How do I place a unique ID in my PHP confirmation page?
<p>I have a PHP script that emails me the results from a form that generates a unique ID number. The PHP script executes a confirmation page. I'm trying to place the unique ID on the confirmation page: quote_confirm.php. I already tried this in the conformation page: </p> <blockquote> <pre><code> &lt;?php $prefix = 'LPFQ'; $uniqid = $prefix . uniqid(); $QuoteID = strtoupper($uniqid); </code></pre> </blockquote> <pre><code> ."&lt;tr&gt;&lt;td class=\"label\"&gt;&lt;strong&gt;Quote ID:&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;".$QuoteID."&lt;/td&gt;&lt;/tr&gt;\n" </code></pre>
php
[2]
4,522,587
4,522,588
JQuery each not working as intended
<pre><code> jQuery.get("ajax.php", function(data) { $(data).find("div[id^='feed']").each(function() //Find every div with id starting with feed in AJAX response { $('#' + $(this).attr("id")).remove(); }); $("#newsfeed").prepend(data); }); </code></pre> <p>This works for some divs that fit this description in the ajax response, but not all. Thanks in advance.</p> <p>Just to make it clear, I want to send out an AJAX request for HTML, itterate through all divs in the response. If they share an id with something already in the DOM AND the id starts with 'feed', remove them. Then append the AJAX to the top of newsfeed. Sorry if I didn't properly explain that before.</p>
jquery
[5]
710,909
710,910
How to Match Two Strings?
<p>If I want to match two strings like</p> <pre><code>$string1 = 'hello'; $string2 = 'hell'; </code></pre> <p>OR</p> <pre><code>$string1 = 'hello'; $string2 = 'hellz'; </code></pre> <p>so Result should be like this "4 Character are match".</p>
php
[2]
3,482,909
3,482,910
How do I install xampp on Windows Vista?
<p>I'm a new student of PHP. How can I install xampp on Windows Vista?</p>
php
[2]
1,255,634
1,255,635
Why not working java code?
<pre><code>package mainData; public class Hello{ public void Hello(String sData, int ... nAges){ for(int x : nAges){ System.out.println(sData + " " + x); } } public static void main(String args[]){ Hello ages = new Hello("Age: ", 5, 6, 7, 8); } } </code></pre> <p>When i change the <strong>constructor</strong>(Hello > Hello2) this code running without problem. But why this code not working?</p>
java
[1]
5,259,268
5,259,269
Android: referencing library project in eclipse is not working after ADT update?
<p>I updated my ADT plugin for the first time in a little while, and I regret it. Previously, I was able to reference my library project from another project by doing: propteries->android->add (library)->select library project->press ok. However, now when I do this, nothing happens. The next time I open my Android properties dialog, the list of referenced libraries is empty. Suspiciously, I see the library reference in my default.properties file, but not in my project.properties file.</p> <p>Has anyone run into this and have any idea of a solution?</p>
android
[4]
5,628,508
5,628,509
How to install an apk on my Emulator if I get: Snapshot storage already in use?
<p>This is the error message I have met when I run my app, and my logcat is empty</p> <pre><code> -08-09 11:19:22 - TestCity] ------------------------------ [2011-08-09 11:19:22 - TestCity] Android Launch! [2011-08-09 11:19:22 - TestCity] adb is running normally. [2011-08-09 11:19:22 - TestCity] Performing com.pack.android.TestCityActivity activity launch [2011-08-09 11:19:22 - TestCity] Automatic Target Mode: launching new emulator with compatible AVD 'my_device' [2011-08-09 11:19:22 - TestCity] Launching a new emulator with Virtual Device 'my_device' [2011-08-09 11:19:24 - Emulator] WARNING: Data partition already in use. Changes will not persist! [2011-08-09 11:19:24 - Emulator] ko:Snapshot storage already in use: C:\Documents and Settings\Ram\.android\avd\my_device.avd/snapshots.img </code></pre>
android
[4]
752,474
752,475
using ref to view error
<p>I working now on firm that using ref in every function.<br> The reason, is to catch errors.<br> There example :</p> <pre><code>//return true if the read is success //otherwise writing to the error ,the problem bool ReadFile(ref string error) </code></pre> <p><strong>Question:</strong><br> How do you catching errors?<br> Using ref,exceptions or other way?</p>
c#
[0]
2,163,305
2,163,306
How to get a list of file names in a directory in Python
<p><strong>Problem:</strong></p> <p>In my "D:/collection" folder, I have two types of files, that are "8-digit-number_type.dbf" and "character_type.dbf" as follows: 00093282.dbf, 00345602.dbf, 69209340.dbf, 69806980.dbf, 92406482.dbf, 93609360.dbf,..., aaa.dbf, bbb.dbf,.... </p> <p><strong>Objective:</strong></p> <p>I want to take only the "8-digit-number_type.dbf" files, and exclude the "character_type.dbf" files from my analysis. I don't care about the "character_type.dbf" files. Then, I'd like to split the 8 digits into two 4-digit values. So, a listing file(say,list.txt) with two columns should look like the following:</p> <pre><code>0009 3282 0034 5602 6920 9340 6980 6980 9240 6482 9360 9360 .... </code></pre> <p>And these values should be stored as character type.</p> <p>How can I implement that in Python? Thank you.</p> <p>Sincerely, Bill TP</p>
python
[7]
3,606,649
3,606,650
disable all check boxes
<p>following code work fine but 1 error</p> <pre><code>$(document).ready( function() { $("#myCheckboxes input[type='checkbox']").change(function() { var checked = $("#myCheckboxes input[type='checkbox']:checked").length; if(checked == 4){ $("#myCheckboxes input[type='checkbox']") .attr('disabled',true) .find(':checked') .attr('disabled',false) } else { $("#myCheckboxes input[type='checkbox']").attr('disabled',false); } }); }); </code></pre> <p>after selection become 4 all check box become disable even selected one, but i don't want to disable selected check box's.</p> <p>Thanks</p>
jquery
[5]
2,552,250
2,552,251
Where do i find the Source codes from the Pragmatic programmers-iPhone SDK Development book
<p>I have just started reading the book and i seem to have a problem with the code from the Tab-Bar project. I dont know where i'll get the source code from for free. can ne1 help me out with that? Thanks in Advance.</p>
iphone
[8]
785,401
785,402
how to use thoolika unicode font in my application
<p>Hi friends i am new to android platform,</p> <p>i have developed an application to read toolika unicode font most of the device support this. But some devices like LG-P500 android 2.3.3 device does not support this font Why? How to make this device supporting thoolika font?</p> <p>please help me</p> <p>regards Pranav thanks in advance</p>
android
[4]
1,439,719
1,439,720
How to get attributes of an Object in Java?
<p>I have a function that returns an <code>Object</code></p> <p>The <code>toString()</code> method shows that my object has two <code>BigDecimal</code> attributes. But I don't know how to get them in the code ?</p> <p><img src="http://i.stack.imgur.com/HR4TF.jpg" alt="enter image description here"></p> <p>My function uses hibernate to get results from a query is :</p> <pre><code>public Object executeQuery(final String sql) { final Query query = getSessionFactory().getCurrentSession().createSQLQuery(sql); return query.list().get(0); } </code></pre> <p>Thank you.</p> <p>-- Additional infos:</p> <pre><code>obj.getClass().getDeclaredFields(); // empty array [] obj.getClass().getName(); // [Ljava.lang.Object; final BigDecimal b = (BigDecimal) obj[0]; //Compilation error: The type of the expression must be an array type but it resolved to Object </code></pre>
java
[1]
1,482,145
1,482,146
Dynamic casting in Java
<p>I have two parallel class hierarchies and I would like to convert objects from one to another. I can do it by manually specifying what conversion to do, but I need to specify the conversion twice: first when the actual conversion happens and second when I need to call it. Is there a way to specify it only once?</p> <p>So here is the example, that works, but I would like to simplify. There are two convert functions that allow me to go between input classes (bI, cI) and output classes (bO, cO). This is unavoidable. The instanceof comparisons though bother me. Is there an elegant solution to avoid them?</p> <pre><code>public class ConversionTest { static public class aI {} static public class bI extends aI {} static public class cI extends aI {} static public class aO {} static public class bO extends aO {} static public class cO extends aO {} // Convert from bI to bO. private static aO convert(bI iVar) {return new bO();} // Convert from cI to cO. private static aO convert(cI iVar) {return new cO();} public static void main(String argv []) { // Input variable. final aI iVar = new bI(); // Output variable. final aO temp; // Perform conversion. if(iVar instanceof bI) { temp = convert((bI)iVar); } else if (iVar instanceof cI) { temp = convert((cI)iVar); } } } </code></pre> <p>I would like to do something like that:</p> <pre><code>final a0 temp = convert(iVar.getClass().cast(iVar)); </code></pre> <p>But in this case, compiler complains that it can not find the proper convert function. Maybe I can specify an array of all possible conversions to try?</p> <pre><code>final a0 temp = convertHelp({bI,cI}, iVar); </code></pre> <p>I am not sure how I should implement this <code>convertHelp</code> function. It would iterate through the array and try to find the proper casting. Any suggestions?</p> <p>Thanks.</p>
java
[1]
4,795,642
4,795,643
How to run .exe application with paramenters from java?
<p>I want to run .exe application with two parameters.Its VB .exe application its need two parameters to execute ? I tried with create .cmd file to execute .exe application, its working good.</p> <p>Please see the which code running .cmd file. start <strong><em>xx.exe ./aa.txt,2012</em></strong></p> <p>Same procedure following in java, but giving error... Please find the below small java program.</p> <pre><code>public class Invoke { public static void main(String as[]) Runtime r=Runtime.getRuntime(); Processp=null; try { String s="...complie.exe"; String d="...de.txt"; String l="...foldername"; p=r.exec(s,d,l); } catch(Exception e){ } </code></pre> <p>Please advise...</p>
java
[1]
1,512,875
1,512,876
Multiple tabs same content
<p>There are 6 divs on the page:</p> <p>A B C D E F G</p> <p>I want to reuse those divs to display content based on the tab.</p> <p>For example:</p> <p>Tab1 = A B</p> <p>Tab2 = A C</p> <p>Tab3 = A B C</p> <p>and so on...</p> <p>What would be the best way to do it( jQuery? ) Any examples?</p>
javascript
[3]
1,008,233
1,008,234
Spinner onClick items
<p>i have created a spinner.could i place my spinner items in a table into my java file and call it (maybe from position) in one onClick method?</p> <p>code:</p> <pre><code> Spinner spinner = (Spinner) findViewById(R.id.spinner); ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource( this, R.array.epilogis, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); </code></pre> <p>here i m getting the spinner items from the string.xml..</p>
android
[4]
1,600,050
1,600,051
jQuery validation: .each with form
<p>If I have a form of about 40 questions, how do I apply the same rules to questions 1-20, and 21-40?</p> <p>For example:</p> <pre><code>$("#form_survey").validate({ rules: { a_ +i: {max:12, maxlength:2}, }, messages: { a_ +i:{ max: "That's too much!" } } </code></pre> <p>Where the "+i" is the ideal increment of +1...</p> <p>Should be easy, I'm just stuck on syntax...</p>
jquery
[5]
988,376
988,377
I want to get diff Controls Id through java script?? as any control can be added on form script will return the type of Control and its ID
<p>I want to get diff Controls Id through java script??any control can be added by user on form java script will return the type of Control for ex textbox,label and its ID</p>
javascript
[3]
4,130,190
4,130,191
how to remove java.net.URI syntax exception
<p>I am using the following code to show NSE indices in default browser.</p> <pre><code>String downloadURL = "http://in.finance.yahoo.com/q;_ylt=AkieA" + "_4_rXXRBh2SH7_U3kXyULlG;_ylu=X3oDMTE1Nmc5cjBnBHBvcwMyBHNlY" + "wNmb290ZXIteWZpbmFuY2UEc2xrA25pZnR5NTA-?s=^NSEI"; java.awt.Desktop myNewBrowserDesktop = java.awt.Desktop.getDesktop(); java.net.URI myNewLocation = new java.net.URI(downloadURL); myNewBrowserDesktop.browse(myNewLocation); </code></pre> <p>The URL in mention has been copied from yahoo site itself. However, when i run the code , i get error like:</p> <blockquote> <p>java.net.URISyntaxException: Illegal character in query at index 140: <a href="http://in.finance.yahoo.com/q;_ylt=AkieA_4_rXXRBh2SH7_U3kXyULlG;_ylu=X3oDMTE1Nmc5cjBnBHBvcwMyBHNlYwNmb290ZXIteWZpbmFuY2UEc2xrA25pZnR5NTA-?s=" rel="nofollow">http://in.finance.yahoo.com/q;_ylt=AkieA_4_rXXRBh2SH7_U3kXyULlG;_ylu=X3oDMTE1Nmc5cjBnBHBvcwMyBHNlYwNmb290ZXIteWZpbmFuY2UEc2xrA25pZnR5NTA-?s=</a>^NSEI</p> </blockquote> <p>I dont know what is wrong ; i have done the same with other URLs with success. Please help.</p>
java
[1]
1,182,414
1,182,415
upgrade app on jailbreak device
<p>I have a free app. I also make the version for jailbreak iphones. The problem is that the normal upgrade on iphone is just run updating of appstore app. But for the version works on jailbreak device, I hope I can check whether the new version existes, if sure, it downloads the version from web and installs it on the device automatically.</p> <p>What kind of sdk I need to call for install the ipa file on jailbreak devices?</p> <p>Welcome any comment</p>
iphone
[8]
1,529,268
1,529,269
error compiling java program
<p>when I compile any java code. I get error. Compiling the program using command line</p> <p>c:\Program Files\java\jdk1.7.0_02\bin>javac exampleop.java error: error reading C:\program files\java\jdk1.7.0_02\jre\lib\ext\localedata.jar; error in opening zip file 1 error</p>
java
[1]
3,676,546
3,676,547
How i am getting long keep on in the setTimeout?
<p>How this code works? any one help me to understand ?</p> <pre><code>var myArray = ['one','two','three']; var logAll = function (){ var long = myArray.length; for(i=0;i&lt; long;i++){ console.log(myArray[i]); } setTimeout(logAll,50); } logAll(); </code></pre> <p>According to me, the myArray length is just 3, so, my log has to give me the result as 0,1,2. thats ok. out of my for loop i introduced a setTimeout for logAll function, but how that logAll function keep on calling the for loop instead of 3 times, to ever..? any one help me to understand this?</p> <p>if so, why this is calling only one time ?</p> <pre><code>var myArray = ['one','two','three']; var logAll = function (){ var long = myArray.length; for(i=0;i&lt; long;i++){ console.log(myArray[i]); } } setTimeout(logAll,50); </code></pre>
javascript
[3]
1,897,901
1,897,902
PHP options for extracting data from an array?
<p>Given this two-dimensional array, each element has two indexes – row and column.</p> <pre><code>&lt;?php $shop = array( array("rose", 1.25 , 15), array("daisy", 0.75 , 25), array("orchid", 1.15 , 7) ); ?&gt; </code></pre> <p>Are these my only two options for extracting the data from the array, using row and column indexes?</p> <pre><code>&lt;?php echo "&lt;h1&gt;Manual access to each element&lt;/h1&gt;"; echo $shop[0][0]." costs ".$shop[0][1]." and you get ".$shop[0][2]."&lt;br /&gt;"; echo $shop[1][0]." costs ".$shop[1][1]." and you get ".$shop[1][2]."&lt;br /&gt;"; echo $shop[2][0]." costs ".$shop[2][1]." and you get ".$shop[2][2]."&lt;br /&gt;"; echo "&lt;h1&gt;Using loops to display array elements&lt;/h1&gt;"; echo "&lt;ol&gt;"; for ($row = 0; $row &lt; 3; $row++) { echo "&lt;li&gt;&lt;b&gt;The row number $row&lt;/b&gt;"; echo "&lt;ul&gt;"; for ($col = 0; $col &lt; 3; $col++) { echo "&lt;li&gt;".$shop[$row][$col]."&lt;/li&gt;"; } echo "&lt;/ul&gt;"; echo "&lt;/li&gt;"; } echo "&lt;/ol&gt;"; ?&gt; </code></pre>
php
[2]
1,525,216
1,525,217
Class in c# which gives the information about the machine
<p>I want to get the information about the the machine configuration i.e like ip address of the machine</p>
c#
[0]
1,086,788
1,086,789
move_uploaded_file file not work when it will call two time
<p>i have a function to upload file in php Like:</p> <pre><code>function upload_file($folder,$name) { $dest = "../product/". $folder."/". $name; $src = $_FILES['image']['tmp_name']; if (move_uploaded_file($src, $dest)) { } else { echo "&lt;script&gt; alert('" . $src . "'); window.history.go(-1); &lt;/script&gt;\n"; exit(); } } </code></pre> <p>whene i call function only one time like <code>upload_file('small','abc.jpg')</code> it works fine but i have call two time like:</p> <pre><code>upload_file('small','abc.jpg') upload_file('big','abc.jpg') </code></pre> <p>it not work on second folder 'big'</p> <p>any solution for that ?</p>
php
[2]
2,068,242
2,068,243
php, how to calculate the sum from an while loop?
<p>i have a while loop that returns some values:</p> <pre><code>while ($get_keywords3 = mysql_fetch_array($keywords2)){ ?&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="margin: 0 3px;"&gt;&lt;?php echo $get_keywords3['grand_total'];?&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php } </code></pre> <p>this returns back:</p> <pre><code>123 234 345 456 ... </code></pre> <p>what i want is to add those together: <code>123 + 234 + 345 + ...</code></p> <p>any ideas?</p> <p>thanks</p>
php
[2]