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
747,808
747,809
AutoComplete with vectors - android
<p>I've have a Vector like this in my app:</p> <pre><code> Vector&lt;Firm&gt; firmVector= new Vector&lt;Firm&gt;(); </code></pre> <p>As you may see, this is a vector of objects from my own class <code>Firm</code></p> <p>So to my question, is it possible to add a <code>AutoComplete</code> to this `Vector?</p> <p>Like this one, from <a href="http://developer.android.com/resources/tutorials/views/hello-autocomplete.html" rel="nofollow">developer.android.com</a>:</p> <pre><code>@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); AutoCompleteTextView textView = (AutoCompleteTextView)findViewById(R.id.autocomplete_country); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, R.layout.list_item, COUNTRIES); textView.setAdapter(adapter); } </code></pre>
android
[4]
1,331,252
1,331,253
Parse input from string containing ints
<p>I am trying to get input from a string containing ints. So when a user types in the command "getrange(1,12)" I need to read the inital command as a string, and the two numbers inside it as an ints. I was thinking I could do a number of Splits() but I think that might get messy. In addition Split() keeps them as strings I think. </p> <p>My ultimate goal is to write an IF statement like this: </p> <pre><code>if("getrange") { while(1 &lt;= 12) { output.println(MyArray[1]) 1++ } } </code></pre> <p>Any Ideas? I know this is pretty crude, let me know if I need to clarify. Thanks </p>
java
[1]
5,036,620
5,036,621
Average of an array will fail if I have int.MaxValue in the array
<p>I have defined the following method which calculates the average of an array:</p> <pre><code>public int AverageOfArray (params int[] arr) { if (arr.Length &gt; 0) { double avg = Sum(ints) / arr.Length; return (int)avg; } return 0; } </code></pre> <p>My requirement is that the average should be returned as an integer. When I tried to test this method using the int.MaxValue The unit test will fail. How can I make the test class pass?</p> <p>UPDATED::-</p> <pre><code>public int Sum(params int[] arr) { int total = 0; for (int n = 0; n &lt; arr.Length; n++) { total += arr[n]; } return total; } </code></pre>
c#
[0]
2,919,086
2,919,087
What is the difference between an Intent Service and a Service
<p>Can you please help me understand what is the difference between an Intent Service and a Service in android?</p> <p>Thank you.</p>
android
[4]
3,475,515
3,475,516
Flat File Database in C++, Is it possible?
<p>Flat File Database in C++, Is it possible? </p>
c++
[6]
4,747,802
4,747,803
twitter integration using OAuth sign post
<p>I want to integrate twitter in my application.Can anybody suggest how should i proceed using the cosumer key,token,token secret.I got some code but could not understand the use of the cosumer key,token,token secret,callbackurl.can anybody help me giving the complete explanation of each functions,variable used ?</p>
android
[4]
2,383,859
2,383,860
How to get the executable name or process id clicking a window
<p>Is there a way to get the executable name or id of a process clicking a window? I want to do a counter that counts the time a user uses an application (game). It's only for Windows and done in java.</p> <p>Thanks.</p>
java
[1]
3,977,543
3,977,544
Why doesn't my variable return the answer?
<p>So I'm trying to construct a program. Everything works but my math portion of the program. I want the time in mins entered to be converted to hours. This should be a decimal number like 30 mins=.5 hrs. I'll try to omit as much code as I can that I don't think is relevant to make it easier to read.</p> <pre><code>public class StudentReader { private static String studentName= ""; private static int pages; private static int time; StudentReader(String name,int pagenum, int totalTime) { studentName=name; pages=pagenum; time=totalTime; } public double getTotalTimeInHours() { double total=0; total=time / 60; return total; } } </code></pre> <p>This class is being called by another class:</p> <pre><code>System.out.println("What is the total amount of time spent reading?: "); totalTime=scanner.nextInt(); System.out.println(StudentReader.getTotalTime()); </code></pre>
java
[1]
3,429,432
3,429,433
Pausing iPhone game from applicationWillResignActive
<p>I am trying to pause my app when the user hits the home button.</p> <p>Here is how I pause the game in the GameViewController:</p> <pre><code>- (void)pauseGame { if (!gamePaused) { [gameTimer invalidate]; [self pauseLayer:self.view.layer]; gamePaused = TRUE; } } </code></pre> <p>AppDelegate.h</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import "GameViewController" @class GameViewController; @interface AppDelegate : UIResponder &lt;UIApplicationDelegate&gt; { GameViewController *game; } @property (strong, nonatomic) UIWindow *window; </code></pre> <p>AppDelegate.m</p> <pre><code>@interface AppDelegate() @property (readonly) GameViewController *game; @end @implementation AppDelegate @synthesize window = _window; -(GameViewController *)game { if (!game) { game = [[GameViewController alloc] init]; } return game; } - (void)applicationWillResignActive:(UIApplication *)application { [self.game pauseGame]; } </code></pre> <p>This doesn't give me any errors or warnings, but it doesn't work. What am I doing wrong?</p> <p>Thanks in advance!</p>
iphone
[8]
2,109,894
2,109,895
float number is not the expected number after subtraction
<p>I have the following statement:</p> <pre><code>float diff = tempVal - m_constraint.getMinVal(); </code></pre> <p><code>tempVal</code> is declared as a float and the <code>getMinVal()</code> returns a float value.</p> <p>I have the following print out:</p> <p><strong>diff=0.099999905, tempVal=5.1, m_constraint.getMinVal()=5.0</strong></p> <p>I expect the <strong>diff</strong> is <strong>0.1</strong> but not the above number. how to do that?</p>
java
[1]
4,019,198
4,019,199
List boundaries - what is the most Pythonic way?
<p>I have a Python list and I want to check if a given index is out of bounds. Since I'm accepting user input I want to restrict the index to integers greater than or equal to 0. What is the most Pythonic way to do this? Currently, this is my solution:</p> <pre><code>def get_current_setting(self, slot): if slot &lt; 0 or slot &gt; len(self.current_settings) - 1: raise Exception("Error message...") return self.current_settings[slot] </code></pre>
python
[7]
4,162,458
4,162,459
Python - Check If Multiple String Entries Contain Invalid Chars
<p>Using Python v2.x, I have 3 variables that I want to ask the user for, as below:</p> <pre><code>def Main(): Class_A_Input = int(raw_input('Enter Class A tickets sold: ')) Class_B_Input = int(raw_input('Enter Class B tickets sold: ')) Class_C_Input = int(raw_input('Enter Class C tickets sold: ')) </code></pre> <p>How can I check if the user input is a valid input. IE: I want only numerical data entered. I have done this once before using 'chars = set('0123456789') and the 'WHILE' functions, but cannot seem to get it to work for multiple inputs.</p> <p>Thanks for any help.</p>
python
[7]
722,169
722,170
trace keyboard inputs
<p>I hope to create application in c# to trace the keyboard raw inputs and replace that inputs ex: if keydown > crtl+A then output> B or input AB then out put > C</p> <p>this is for support to local language typing.</p>
c#
[0]
4,398,853
4,398,854
Find all views with tag?
<p>I am looking to find all the views in a specified activity that have the tag "balloon" for example then hide them using setVisibility to GONE.</p> <p>Does anyone know how to retrieve a list of views with a given TAG?</p> <p>Thanks, Kevin</p>
android
[4]
3,862,956
3,862,957
differentiate admin and user of android apps
<p>i cant get the idea of it.. How to differentiate admin and user of the android apps if the apps do not provide the login function? how the admin manage the database of the apps? </p>
android
[4]
3,806,842
3,806,843
A connection attempt failed
<p>I have an ASP.NET application that is trying to connect to Twitter. When I try to connect, I receive the following stack trace:</p> <pre> [SocketException (0x274c): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 64.202.165.130:3128] System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +239 System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +35 System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +224 [WebException: Unable to connect to the remote server] System.Net.HttpWebRequest.GetResponse() +5313085 </pre> <p>Everything seems correct on my side. I am trying to determine, is this a problem with Twitter, or my application?</p>
asp.net
[9]
5,460,092
5,460,093
What does [literal] in [array/object] mean?
<p>What does the following syntax mean:</p> <pre><code>1 in [1,2,3,5] </code></pre> <p>I know it doesn't search for 1 in the array. But what does it do? </p> <p>I've seen it used in loops:</p> <pre><code>for (var i in testArray) { } </code></pre> <p>But have also seen this used by itself. Does it mean check if the literal is a valid index in the array or object that is the other operand?</p>
javascript
[3]
5,213,484
5,213,485
How to show a cold pic when its cold and show a warm pic when its hot?
<p>Im using C# and i have to show a cold picture if the F or C is below 50F and a hot pic if the F or C is above 50F. i know i have to use an if statement but cant figure out how to write the if statement to show one pic or the other?</p>
c#
[0]
1,680,725
1,680,726
Last clicked element
<p>I have a list of divs like this:</p> <pre><code>&lt;div class="item"&gt;Click&lt;/div&gt; &lt;div class="content"&gt;Hidden Content&lt;/div&gt; &lt;div class="item"&gt;Click&lt;/div&gt; &lt;div class="content"&gt;Hidden Content&lt;/div&gt; &lt;div class="item"&gt;Click&lt;/div&gt; &lt;div class="content"&gt;Hidden Content&lt;/div&gt; &lt;div class="item"&gt;Click&lt;/div&gt; &lt;div class="content"&gt;Hidden Content&lt;/div&gt; &lt;div class="item"&gt;Click&lt;/div&gt; &lt;div class="content"&gt;Hidden Content&lt;/div&gt; </code></pre> <p>When the page is loaded the first div which has the id content is shown. What i would like to do is when i click on some other div (id="item") to hide the content of the previous clicked item and do some changes to the previous clicked div (id="item"). So far i've tried this:</p> <pre><code>$(document).ready(function(){ $(".item").first().css("border-right","none"); $(".item").click(function(e) { $pressed = $(this); if ($pressed.data("lastclick")){ $pressed.data("lastclick").css("border-right","solid"); $pressed.data("lastclick").css("border-right-width","1px"); $pressed.data("lastclick").find("span").remove(); } $(this).next(".content").slideToggle(\'slow\', function() { if ( $(this).is(":visible")) { $pressed.css("border-right","none"); $pressed.append(\'&lt;span style="float:right;font-weight:bold"&gt;\'+$(this).children().length+\'&lt;/span&gt;\'); $pressed.data("lastclick",$pressed); } });});}); </code></pre>
jquery
[5]
4,327,650
4,327,651
Marker Interfaces in Java
<p>Is there a list of standard marker interfaces in Java? I've read (in some Java book) that marker interfaces do not have any methods to implement , however when I did a google search - there are certain answers which specify that marker interfaces can indeed have methods. If that is the case then I think there is no difference between a regular interface and marker interface - would it be possible to clear my confusion :)</p>
java
[1]
1,309,172
1,309,173
copying pointer to member functions from a structure
<p>I have my code organized as following</p> <pre><code>class MyClass { public: typedef void (MyClass::Ptr2func)(); } struct abc { MyClass::Ptr2func ptr; bool result; } void main() { MyClass myCls; abc var; //here is a lot of decision making code and pointer initializations //I want to copy the pointer to function in another variable MyClass::Ptr2func tempPtr; tempPtr=var.ptr; } </code></pre> <p>When I try to copy the <code>var.ptr</code> into <code>tempPtr</code> it gives me a compilation error that the argument list is missing. Also it gives me compilation error on <code>myCls.*(var.ptr())</code>; Is there a precedence issue? I have tried using parenthesis but nothing works. I hope someone can help me out on this.</p> <p>Thanks and regards, Saba Taseer</p>
c++
[6]
720,473
720,474
.animate() with two complete functions?
<p>I wondered about if it's possible to add two or more <code>complete</code> functions to the <code>.animate()</code> event, like this:</p> <pre><code>.animate(properties [, duration] [, easing] [, complete][, complete][, complete]) </code></pre> <p>because I don't want to have all the things that happened in one function. I want them separated in different <code>complete</code> functions!</p> <p>Is this possible?</p>
jquery
[5]
99,796
99,797
Random permutation of letters
<p>I have cities: A, B, C, D, E</p> <p>How can I generate an initial solution in Java that contains all of these elements once? For example: BCDAE</p> <p>Currently I'm generating a solution in order ABCDE then mixing it up, is there an easier way to do this I'm just not thinking of?</p>
java
[1]
3,424,292
3,424,293
Spinner disable is not working
<p>I tried to disable the spinner control, but its not working. I have given <code>spinnerControl.setEnable(false);</code> this code disable spinner process but, it will not put spinner in gray color(ie) disabled manner.</p>
android
[4]
5,641,775
5,641,776
move UITableCell
<p>I used codes below to move an UITableCell</p> <pre><code>- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { NSMyObj *newObj=[myArray objectAtIndex:[fromIndexPath row]] ;//myArray is the array to store NSMyObj [myArray removeObjectAtIndex:[fromIndexPath row]]; [myArray insertObject:newObj atIndex:[toIndexPath row]];// } </code></pre> <p>but it reported:</p> <p>objc[316]: FREED(id): message retain sent to freed object=0x3d3d330</p> <p>Welcome any comment</p> <p>Thanks</p> <p>interdev</p>
iphone
[8]
4,021,811
4,021,812
I could not able to access a <div> through Javascript,if there is only a <div></div> in a HTML page
<p>I have written below code in a HTML file name as test.html</p> <pre><code>&lt;div id="dd"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; document.getElementById("dd").innerHTML="fdfdfd"; alert(document.getElementById("dd").innerHTML); &lt;/script&gt; </code></pre> <p>The above code is not working. Can someone help me. What is the reason ?</p> <p>If I put a <code>&lt;body&gt;</code> tag or write anything, then it works fine and Its working in Google chrome.</p>
javascript
[3]
5,052,021
5,052,022
Divide single value into an array
<p>Is it possible to divide a number into an array based on its value? </p> <p>For example:</p> <pre><code>$val = 3; // do something here to convert the number 3 into 1's Array ( [0] =&gt; 1 [1] =&gt; 1 [2] =&gt; 1 ) </code></pre>
php
[2]
1,284,648
1,284,649
How to find a function by function name
<p>I need to find a function handler on the page by only using a function name. How can I do it in javascript?</p>
javascript
[3]
5,713,919
5,713,920
onTouchEvent() will not be triggered if setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) is invoked
<p>I call </p> <pre><code>getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) </code></pre> <p>when my app starts to make my app able to display the full screen. </p> <p>I want my app's UI to pop up when screen is touched, but <code>Activity.onTouchEvent()</code> is not triggered until the screen is touched a second time. At first touch, only the Virtual Keys are shown.</p> <p>So, I have to trigger my app's UI to pop up on</p> <pre><code>public void onSystemUiVisibilityChange(int visibility) { if (visibility == View.SYSTEM_UI_FLAG_VISIBLE) { // show my APP UI } } </code></pre> <p>but <code>onSystemUiVisibilityChange</code> with <code>View.SYSTEM_UI_FLAG_VISIBLE</code> will be invoked NOT once per touch (3 times on my Galaxy Nexus) by system, especially if the user touches the screen very fast/often.</p> <p>project lib 4.0 or 4.03. Samsung galaxy(9250) with 4.03.</p>
android
[4]
4,180,427
4,180,428
How to workaround same origin problem
<p>The following JS will fail if the URL in mainFrame from <strong>a.abc.com to b.abc.com</strong>.</p> <p>top.frames["mainFrame"].location.href = "/Users/xuenn.aspx?backUrl=" + top.frames["mainFrame"].location.href.split("?")[0];</p> <p>This is the error message: Permission denied for <a href="http://a.abc.com" rel="nofollow">http://a.abc.com</a> to get property Location.href from <a href="http://b.abc.com" rel="nofollow">http://b.abc.com</a>.</p> <p>Anybody knows how could I workaround this or think of other solutions?</p>
javascript
[3]
2,039,993
2,039,994
php conditional problem
<p>Goal: User only selects <strong>one</strong>, <strong>only one</strong> option at a given time for the <strong>denomination</strong>, either some value of Nickels <strong>only</strong>, some <strong>value of Dimes</strong> <strong>only</strong>, or some <strong>value of Quarters only</strong>.</p> <p><strong>Problems:</strong> Currently the code only <strong>defaults to Nickels only</strong>?</p> <p><strong>Pre-existing condtion:</strong> If I select a different denomination, for example, <strong>Quarters only</strong>, I only get the values for Nickels, the same applies for Dimes?</p> <p>Code Snippet:</p> <pre><code>if($denomination["Nickels"] != NULL) { $value = $denomination["Nickels"]; echo $value . " is the value of selected Nickels"; } else if ($denomination["Dimes"] != NULL) { $value = $denomination["Dimes"]; echo $value . " is the value of selected Dimes"; } else if ($denomination["Quarters"] != NULL) { $value = $denomination["Quarters"]; echo $value . "is the value of selected Quarters"; } </code></pre>
php
[2]
1,017,915
1,017,916
How to check which one of the username or password is incorrect?
<p>I want to check which one of the username or password is incorrect in a single mysql query.</p> <p>Scenario:</p> <p>When a user types a username and password and clicks submit, I want to show an error message which one is incorrect. I need a simple and optimized query for this.</p>
php
[2]
5,126,868
5,126,869
XCode can't find headers in /usr/include for openSSH
<p>I know its Repost but i still dont have proper ans to this question</p> <p>i am including this </p> <pre><code>#include &lt;openssl/x509.h&gt; </code></pre> <p>but it says </p> <pre><code>"Openssl/x509.h: No such file or directory" </code></pre> <p>i did my best , added OpenSSl folder ( both way blue color folder and yellow as well)</p> <p>this is my "HEader Search Path" -> <strong>${SDKROOT}/usr/include/libxml2 and /usr/include</strong></p> <p>my User Header search path is empty</p> #####UPDATES <p>how to fix this issue in <strong>library search path</strong></p> <p>1)"$(SRCROOT)/" -> is fine and takes current project path</p> <p>2)**$inherited -> this is taking some stupid path which i dont know , how to fix this path</p> <p>** <strong>i want to include my openSSL path here so what should i do</strong> </p>
iphone
[8]
3,446,037
3,446,038
Problems running a java program from the command line interface
<p>I created a java program in Eclipse. When I run the program in Eclipse ("run as -> Java Application") the program runs fine and I have the correct output. However, when I try to run the program in the command line interface I got this error:</p> <blockquote> <p>Exception in thread "main" <code>java.lang.NoClassDefFoundError</code>: <code>HelloWorld</code> (wrong name: helloworld/HelloWorld) Could not find the main class: HelloWorld. Program will exit.</p> </blockquote> <p>The class file is in directory bin and I try to run it with the command:</p> <pre><code>java HelloWorld </code></pre>
java
[1]
4,550,751
4,550,752
Jquery - Accordion
<p>How to make an accordion in jquery to select none of the menu while loading</p>
jquery
[5]
2,256,089
2,256,090
android media not working
<p>I create a raw folder within res folder and I past a mp3 song but in eclipse show error R.raw cannot be resolved and in console shows Invalid file name: must contain only [a-z0-9_.] my mp3 file name is MaidwiththeFlaxenHair.mp3 after the build the project the same is come</p> <p>this the code </p> <pre><code>MediaPlayer player = MediaPlayer.create(this, R.raw.MaidwiththeFlaxenHair); player.start(); </code></pre>
android
[4]
2,160,404
2,160,405
Code optimization in PHP
<ol> <li><p>I need 3 temporary variables is there any difference between this codes ? <code>$temp1</code>, <code>$temp2</code>, <code>$temp3</code> vs <code>$temp[0]</code>,<code>$temp[1]</code>,<code>$temp[2]</code>;</p></li> <li><p>If i have a variable name <code>$X</code> in page1.php and in page2.php and then i include page2.php in page1.php, is the variable <code>$X</code> going to be overwritten ? can i stop this ?</p></li> </ol>
php
[2]
3,348,088
3,348,089
Android App only for Tablets
<p>I have designed my app for Android Tablet. But <strong>it should be installed only on Android Tablet</strong>. For this I have tried the following.</p> <ol> <li><a href="http://stackoverflow.com/questions/10540646/designing-an-android-tablet-only-app">supports-screens</a></li> <li><a href="http://stackoverflow.com/questions/14846609/restrict-app-installing-in-tablets">android.hardware.telephony</a></li> <li><a href="http://developer.android.com/guide/practices/screens-distribution.html#FilteringHansetApps" rel="nofollow">compatiblity-screens</a></li> <li><a href="http://stackoverflow.com/questions/10412005/avoid-app-installing-on-tablet-in-android?rq=1">android.permission.CALL_PHONE</a></li> </ol> <p>But <code>all the above scenarios are failed. The android app installed both Google Nexus S 4.1.0 mobile and Acer Iconia A500 tablet</code>. Is there any other way to restrict the android app only for android tablet alone.?</p>
android
[4]
2,204,665
2,204,666
Use class member functions as callbacks?
<p>I would need a member function to be passed into a third party external method:</p> <pre><code>box_self_intersection_d(mycallback); </code></pre> <p>The <code>box_self_intersection_d</code> is a third party external static method, and I cannot modify it. <code>mycallback</code> is a method I want to pass it into the <code>box_self_intersection_d</code>, it is a class function and is accessing some members in this class ( have full control for this class and the <code>mycallback</code>)</p> <p>Is there anyway I can use class member functions as callbacks without declaring them as static functions?</p> <p>Edit: the signature of <code>mycallback</code> is <code>(const box &amp;boxA, const box &amp;boxB)</code>, where <code>box</code> is a special class from the third party provider. </p> <p>And the <a href="http://www.cgal.org/Manual/3.4/doc_html/cgal_manual/Box_intersection_d_ref/Function_box_self_intersection_d.html" rel="nofollow">signature for</a> <code>box_self_intersection_d</code> is</p> <pre><code>void box_self_intersection_d(RandomAccessIterator begin,RandomAccessIterator end,Callback callback) </code></pre>
c++
[6]
2,418,552
2,418,553
How can I read a file that is in use by another process?
<p>I need to read a file that is in use by another process. How can I achieve that in C#?</p> <p>Thanks!</p>
c#
[0]
5,163,837
5,163,838
Application should give a prompt on pressing back button
<p>I am developing an android application. I wish that when I press back button in my application, it should give me a prompt(kind of alert dialog) if I really wish to exit. I dont know where to put this alert dialog and what to write in the Yes button, where user wants to quit the application. Please help me.</p>
android
[4]
3,761,313
3,761,314
iPhone tab bar Item image resolution?
<p>what is the resolution of the image for tab bar item? and also please provide some other usefull information regarding that tab item image.</p> <p>Thanks in advance.</p>
iphone
[8]
1,105,963
1,105,964
Freeze background activity when Progress Bar is running
<p>I am a facing a problem in my app.Actually,there is an activity in which i send an image to server.In xml layout file i use a progress bar view.The progress bar start loading when image is loading to server and dismiss when the work done.Everything working fine.The problem is that when progress bar is in running state the background activity is still active.I want to freeze the background activity while progress bar is in runnung state.The code is as follows. </p> <pre><code>postPic.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v){ mProgressBar.setVisibility(View.VISIBLE); new Thread(){ @Override public void run() { //here the code to post image to server handler.sendEmptyMessage(0); } }.start(); } } private Handler handler = new Handler() { @Override public void handleMessage(Message msg) { try { mProgressBar.setVisibility(View.GONE); } else if(messagePostingItems.equalsIgnoreCase("Success")){ startActivity(new Intent(PostPhoto.this,PostPicDialog.class)); } }; }); </code></pre> <p>Please help me out from this problem.</p>
android
[4]
4,257,447
4,257,448
How can add Tab widget to the botton in android?
<p>I am working on android, i want to add tab widget to the bottom of page. this is the code of my xml file:- </p> <pre><code> &lt;HorizontalScrollView android:id="@+id/ScrollView01" android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:scrollbars="none"&gt; &lt;TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:layout_marginLeft="0dip" android:layout_marginRight="0dip" android:layout_alignParentBottom="true"/&gt; &lt;/HorizontalScrollView&gt; &lt;FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5dp" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p> </p> <p>by this code the tabwidget is adding to the top of the layout as shown in below picture:- <img src="http://i.stack.imgur.com/ZvDNV.png" alt="enter image description here"> please tell what should i so to add these "<strong>Albums</strong>" tabWidget ?</p> <p>Thank you in advance...</p>
android
[4]
5,990,367
5,990,368
intersect function
<p>i am checking intersection of two objects.. and i have a class MBR with data meembers low[2] and high[2].. but i am not getiing intersect..c an you explain this function.. </p> <pre><code>intersects(const MBR* h) const { for (int i = 0; i &lt; 2; i++) { if (low_[i] &gt; h-&gt;high_[i] || high_[i] &lt; h-&gt;low_[i]) return FALSE; } return TRUE; </code></pre>
c++
[6]
1,495,999
1,496,000
Simulate button press
<p>I have this resource for a <code>Button</code></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_pressed="true"&gt; &lt;shape&gt; &lt;solid android:color="@color/CLR_GREEN" /&gt; &lt;corners android:radius="5dp" /&gt; &lt;padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;item&gt; &lt;shape&gt; &lt;solid android:color="@color/CLR_GREEN_DARK" /&gt; &lt;corners android:radius="5dp" /&gt; &lt;padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;/selector&gt; </code></pre> <p>And I refer to this button in code as <code>greenBtn</code></p> <p>How do I simulate its pressure without firing its <code>onClick</code> event? i.e. how do I make it change its background color as if it was pressed, stay in this state for half a second and then be back in its original state?</p>
android
[4]
338,825
338,826
splitting the java string
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3764687/string-split-not-returning-empty-results">String split not returning empty results</a> </p> </blockquote> <p>I am having a string of words separated by comma(,) and I need to tokenize or split the main string into substrings. For e.g, <code>string="file1,param1,file2,param2,file3,"</code> What the string means is, a list of all file names and the parameter passed to it. Like, for file1--> param1, file2-->param2 and file3 nothing parameter exists.</p> <p>So I need to extract the file names and params, if any. If no params I need to get the empty string("").</p> <pre><code>import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class XStringTokenizer { /** * @param args */ public static void main(String[] args) { String str = new String("File1,param1,File2,"); List list = new ArrayList(); System.out.println(str.split(",").length); String[] string = str.split(","); for(int i=0;i&lt;string.length;i++){ list.add(string[i]); } System.out.println(list); } } </code></pre> <p>Current output for the above sample code is [File1,param1,File2] but expected output is [File1,param1,File2,]. Basically I should not miss the end empty string after the 3rd comma in the above <code>str</code> String.</p>
java
[1]
5,735,686
5,735,687
Saving thumbnails images to certain directory
<p>I'm willing to use thumbnails into my website which is mainly like websites directory. I've been thinking to save url thumbnails into certain directory !</p> <p>Example :-</p> <p>I'm going to use free websites thumbnails service that gives me code to show thumbnail image of any URL as follow</p> <pre><code>&lt;img src='http://thumbnails_provider.com/code=MY_ID&amp;url=ANY_SITE.COM'/&gt; </code></pre> <p>This would show the thumbnail of <code>ANY_SITE.COM</code></p> <p>i want to save the generate thumbnail image into certain directory <code>my_site.com/thumbnails</code></p> <p>Why i'm doing this ?</p> <p>in fact my database table is like <code>my_table {id,url,image}</code> where i'm going to give the image thumbnail random name and store its new name into <code>my_table</code> related to its url then i can call it back anytime and i know how to do it but i don't know how to save it into certain directory.</p> <p>any help ~thanks</p>
php
[2]
697,916
697,917
Masonry - Expanded box on document ready
<p>Does anyone know how to set the first box to an expanded state when document is ready in Masonry? </p> <p><a href="http://jsfiddle.net/vDGTC/" rel="nofollow">http://jsfiddle.net/vDGTC/</a></p> <p>Also would be great to know how to animate certain boxes up, as opposed to down which seems to be the default. I need to apply this to the bottom row of boxes so the total dims - or layout container - of all boxes remains constant regardless of what is expanded. </p> <p>Many thanks, this is one hell of a plugin!</p>
jquery
[5]
4,895,877
4,895,878
How can I use http://translate.google.com/ to translate the string in Java program?
<p>I want to use <a href="http://translate.google.com/" rel="nofollow">http://translate.google.com/</a> to translate the string. And now I want to sent a string from a java program in <a href="http://translate.google.com/" rel="nofollow">http://translate.google.com/</a> to translate the string from english to bangla . And I want to get the translated string as a program output . Anyone can tell me how can I do this......??</p>
java
[1]
1,561,328
1,561,329
Can I listen to keyboard and mouse events without activating any window?
<p>I want to track number of keys pressed and mouse clicks in background, i.e., without activating any window.</p> <p>Please, help me to solve my problem?</p> <p>Thank you.</p>
java
[1]
5,345,347
5,345,348
How to divert the iPhone on Voice Mail programmatically?
<p>In my iPhone application I want to divert my phone on voice mail if any callers call me, which I have to do programmatically for my app. </p> <p>Is it possible in iPhone? If so please guide me.</p> <p>Thanks,<br> Panache</p>
iphone
[8]
2,341,154
2,341,155
IDisposable Question
<p>Say I have the following:</p> <pre><code>public abstract class ControlLimitBase : IDisposable { } public abstract class UpperAlarmLimit : ControlLimitBase { } public class CdsUpperAlarmLimit : UpperAlarmLimit { } </code></pre> <p>Two Questions:</p> <p>1. I'm a little confused on when my IDisposable members would actually get called. Would they get called when an instance of CdsUpperAlarmLimit goes out of scope?</p> <p>2. How would I handle disposing of objects created in the CdsUpperAlarmLimit class? Should this also derive from IDisposable?</p>
c#
[0]
4,000,622
4,000,623
Pre-made delegates for operators?
<p>Supposing I want to use the addition operator (<code>+</code>) as a delegate, how would I pass that to a method?</p> <p>Looking for something similar to Python's <a href="http://docs.python.org/release/3.1/library/operator.html#operator.add" rel="nofollow"><code>operator.add</code></a>.</p> <p>e.g., instead of</p> <pre><code>var center = _drawingPoly.Aggregate((a, b) =&gt; a + b)/_drawingPoly.Count; </code></pre> <p>I'd want to write something like:</p> <pre><code>var center = _drawingPoly.Aggregate(operator+)/_drawingPoly.Count; </code></pre> <p>(FYI, <code>+</code> is overloaded here)</p>
c#
[0]
5,141,936
5,141,937
Implementing Non -Renewable subscriptions Using MKstorekit4?
<p>I have Iphone application in which i wanted to use Non_Renewable subscriptions.As per docs MKstorekit supports Non Renewable subscriptions.But everywhere saying about Auto_renewables only.Can anybody knows how to implement Non-renewable subscription with MKstorekit4.I have been googling for the entire day.But with no luck.Can anybody help me ?Was anybody done this kind of in app with mkstorekit?</p>
iphone
[8]
485,400
485,401
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done
<p>Hello I'm still getting this error and I try different solutions but it's not work ! Here are my code </p> <p>I put the connection string in app.config file like this :</p> <pre><code>&lt;connectionStrings&gt; &lt;add name="ComputerManagement" connectionString= "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=.. ; Integrated Security=false"/&gt; </code></pre> <p> </p> <p>and in the button_click in the form I put the following code :</p> <pre><code> try { OleDbConnection conn = new OleDbConnection(GetConnectionString()); OleDbCommand command = new OleDbCommand(); command.CommandType = CommandType.Text; command.CommandText = "INSERT INTO Clients(C_name,C_phone ,C_mob ,C_add , C_email ,C_account) VALUES ('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4 + "','" + textBox5.Text + "','" + textBox6.Text + "')"; command.Connection = conn; conn.Open(); command.ExecuteNonQuery(); conn.Close(); } catch (Exception) { throw; } </code></pre>
c#
[0]
1,192,259
1,192,260
All C# Syntax in a single cs file
<p>I heard about there being a cs file on the internet from a couple different sources that has all of the syntax in C# in a single file, which would be really good for a crash course to get ready for a job I have. Unfortunately no one could point me to the exact file, has anyone heard or seen anything like this?</p>
c#
[0]
1,961,377
1,961,378
is DOMDocument::loadHTMLFile() secure?
<p>Can someone inject some malicious code into my script through this method? and if someone might, what is the best practice? </p> <p>I am trying to create a similar to reddit way of suggesting title.</p>
php
[2]
5,768,625
5,768,626
Passing variable with URL but not able to make decision with Switch statement
<p>On page1.php, i use </p> <pre><code>&lt;a href="page2.php?choice=&lt;?php echo $value?&gt; &amp; item1=&lt;?php echo $abs1?&gt; &amp; item2=&lt;?php echo $abs2?&gt;" title="Link to next page"&gt;Download&lt;/a&gt; </code></pre> <p>On page2.php, i receive these variables correctly as iam able to echo those. But Switch statement doesn't work.</p> <pre><code>echo $_REQUEST["choice"];echo "&lt;br&gt;"; //printing variable to debug echo $_REQUEST['item1'];echo "&lt;br&gt;"; //printing variable to debug echo $_REQUEST['item2'];echo "&lt;br&gt;"; //printing variable to debug switch((string)$_REQUEST["choice"]) { case "Value1": echo "Value 1 selected"; break; case "Value2": echo "Value 2 selected"; break; case "Value3": echo "Value 3 selected"; break; default: echo "No Value selected"; } </code></pre> <p>It always give: <strong>No Value selected</strong> . Please help, Thanks in advance.</p>
php
[2]
2,031,386
2,031,387
Find last value of array in foreach cicle
<p>I've data stored in a array ($rows). For read the array and genarate a dinamic table I use foreach function.</p> <pre><code>&lt;table&gt; foreach ($rows as $row) { echo "&lt;tr&gt;"; echo "&lt;td&gt;" . $row['field1'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['field2'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['filed3'] . "&lt;/td&gt;"; echo "&lt;/tr&gt;"; } &lt;/table&gt; </code></pre> <p>My goal is to find the last value of the array (the end) in order to change the class of TR element for the last line displayed. How could I do this? Thanks</p>
php
[2]
5,675,408
5,675,409
Generate random certificates
<p>I am looking for a utility class that can generate random certificate strings for testing purposes. Any idea if there is one already implemented?</p>
java
[1]
765,515
765,516
Cannot reset OpenFlow
<p>I'm using OpenFlow on IPhone to create a "slideshow" of images. My problem is that I cannot reset the OpenFlow view, when I want to add a new set of images. Can anybody help?</p>
iphone
[8]
5,809,126
5,809,127
What are Class methods in Python for?
<p>I'm teaching myself Python and my most recent lesson was that <a href="http://dirtsimple.org/2004/12/python-is-not-java.html">Python is not Java</a>, and so I've just spent a while turning all my Class methods into functions.</p> <p>I now realise that I don't need to use Class methods for what I would done with <code>static</code> methods in Java, but now I'm not sure when I would use them. All the advice I can find about Python Class methods is along the lines of newbies like me should steer clear of them, and the standard documentation is at its most opaque when discussing them.</p> <p>Does anyone have a good example of using a Class method in Python or at least can someone tell me when Class methods can be sensibly used?</p>
python
[7]
537,340
537,341
Script for downloading weather data, day by day?
<p>Here's my problem: I'm not a programmer or have very little to no experience with scripts, however I've been tasked with downloading a .csv file of every single day of weather information from a university website. I'm guessing the only way from making this a painful experience is to get a script for it, or ask the university for the entire database.</p> <p>Is this a simple task?</p> <p>Here is the website: <a href="http://climate.rutgers.edu/njwxnet/" rel="nofollow">http://climate.rutgers.edu/njwxnet/</a> </p> <p>I need to download "Station Hourly" data from "New Brunswick, NJ" from September 2006 through December 2010 for every day that data is available. Only selecting the date in the calendar and the location of "New Brunswick" is needed before selecting "Get Data".</p> <p>Could anyone help with this?</p>
php
[2]
602,274
602,275
Search results from billboard api
<p>I have to show the lists of songs from Billboard Api like the page </p> <p><a href="http://www.billboard.com/charts/r-b-hip-hop-songs#/charts/hot-r-and-b-hip-hop-airplay" rel="nofollow">http://www.billboard.com/charts/r-b-hip-hop-songs#/charts/hot-r-and-b-hip-hop-airplay</a></p> <p>I try to use many api of Billboard but not be able to get the response as I required.I try for this api also <a href="http://api.billboard.com/apisvc/chart/v1/list/spec?name=hip-hop&amp;api_key=APIKEY" rel="nofollow">http://api.billboard.com/apisvc/chart/v1/list/spec?name=hip-hop&amp;api_key=APIKEY</a> but in this I got a listing only but I want the full details of charts.</p> <p>Please help me how can I found the required results like the given url.</p>
php
[2]
2,132,498
2,132,499
how to check a string for a special character in Java
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1795402/java-check-a-string-if-there-is-a-special-character-in-it">JAVA: check a string if there is a special character in it</a> </p> </blockquote> <p>I'm testing a method that transforms a string into another string except it preservers all special characters (non alpha-numeric). </p> <p>So I'm looking to test the output of this method to ensure it actually preserves these characters.<br> I know this calls for use of <code>Pattern</code> and <code>Matcher</code> classes but not sure how.<br> I think I need to build a format template, compile it with <code>Pattern</code> and then use it with <code>Matcher</code> with the output string of my test method .<br> So I'll build the format template character by character. For digits and characters, I can use IsLetter and IsDigit of Character class and insert <code>"\\d"</code> for digit in my template.<br> Not sure what I should use for letters and special characters.</p> <p>Any Ideas?</p> <p>Thanks.</p>
java
[1]
1,807,296
1,807,297
passing arguments as array of integers
<pre><code>struct G{ G&amp;operator()(const int**a) { v&lt;&lt;a; std::copy(v.begin(),v.end(),std::ostream_iterator&lt;int&gt;(std::cout, " ")); return *this; } friend std::vector&lt;int&gt;&amp;operator&lt;&lt;(std::vector&lt;int&gt;&amp;v,const int** n); std::vector&lt;int&gt;v; }; std::vector&lt;int&gt;&amp;operator&lt;&lt;(std::vector&lt;int&gt;&amp;v,const int** n) { v.insert(v.begin(),*n,*n+sizeof(*n)/sizeof(*n[0])); return v; } /// use it G g; int v[8]={1,2,3,4,5,6,5,4}; g(&amp;v); </code></pre> <p>I have two questions, 1. The above code returns with error <code>cannot convert parameter 1 from 'int (*)[8]' to 'const int **'</code><br> 2. I would like to pass in g as g({1,2,3,4,5,6,5,4}) instead of g(&amp;v). But I don't know how to do that and always wonder if g will accept it.<br> Thank you.</p>
c++
[6]
342,088
342,089
Migrate android code error on eclipse
<p>I have been working on a project and it was running error free. However, when I copied the files to another project, it showed error and as a fix eclipse suggested "Migrate android code". But it didn't work .in the logcat there is no error and on pointing at an error it saya '--- cannot be resolved'. i have been working fine with the project and project was running successfully. But when i copied this to other system also same error happened. Please suggest a fix for this</p>
android
[4]
3,408,617
3,408,618
using jquery's each() to add click events to imgs
<p>I'm using jquery's each() to add click events to a set of imgs , this works fine but i want each img to have a different effect on click it . </p> <pre><code>$('#worksfoot img').each( function() { $(this).click( function() { $('#entrycontainer').animate({ marginLeft: },500); }) }) </code></pre> <p>I would like for the first img to set marginLeft as 0 , then increment it 100 for each of the others .</p>
jquery
[5]
5,503,865
5,503,866
How to make the below code generic?
<p>I have a method as under</p> <pre><code> private int SaveRecord(PartnerViewLog partnerViewLog, PortalConstant.DataSourceType DataSourceType, Func&lt;IDataAccess, PartnerViewLog, int&gt; chooseSelector) { int results = -1; var dataPlugin = DataPlugins.FirstOrDefault(i =&gt; i.Metadata["SQLMetaData"].ToString() == DataSourceType.EnumToString()); if (dataPlugin != null) { results = chooseSelector(dataPlugin.Value, partnerViewLog); } return results; } </code></pre> <p>I am invoking it as under</p> <pre><code>public int SavePartnerViewLog(PartnerViewLog partnerViewLog, PortalConstant.DataSourceType DataSourceType) { return SaveRecord(partnerViewLog, DataSourceType, (i, u) =&gt; i.SavePartnerViewLog(partnerViewLog)); } </code></pre> <p>As can be figured out that PartnerViewLog is a class. Now I want to make the function SaveRecord as generic where the class name can be anything?</p> <p>How to do so?</p>
c#
[0]
939,000
939,001
Test if on a certain page with php?
<p>Using PHP, is there a way to test if the browser is accessing a certain page?</p> <p>For example, I have a header file called header.php which is being pulled into a couple different pages. What I want to do is when I go to a different page, I want to append certain variable to the title.</p> <p>Example.</p> <p>Inside header.php:</p> <pre><code>&lt;?php $titleA = " Online Instruction"; $title B = "Offline"; ?&gt; &lt;h2&gt;Copyright Info: &lt;?php if ('onlineinstruction'.php) echo $titleA; ?&gt; &lt;/h2&gt; </code></pre> <p>edit: also if you believe there is a simpler way to do this, let me know!</p>
php
[2]
2,767,845
2,767,846
Is there a way to exit only the php file being included?
<p>So, I have a sidebar.php that is included in the <code>index.php</code>. Under a certain condition, I want <code>sidebar.php</code> to stop running, so I thought of putting <code>exit</code> in <code>sidebar.php</code>, but that actually exits all the code beneath it meaning everything beneath <code>include('sidebar.php');</code> in <code>index.php</code> all the code would be skipped as well. Is there a way to have <code>exit</code> only skip the code in the <code>sidebar.php</code>? </p>
php
[2]
32,018
32,019
Language split to minimize .apk file
<p>I'm creating an app with 3 different languages. Every language contains a separate audio file (8 mb each). Is it possible to split/export the project to 3 different .apk files prior to release on Market? I really do not want to put everything in one .apk due to the 24+ mb file size.</p>
android
[4]
3,439,959
3,439,960
Code of .Where() and .All()
<p>I'm searching for the code of .Where(), .All or at least one of the other "special" methods in some object. I'd like to learn how to write such, because I find them useful.</p> <p>Also 1 question - Why some objects contain those methods and others do not, how do I inherit them in a class of mine for example?</p>
c#
[0]
845,173
845,174
Do I have to hash twice in C#?
<p>I have code like the following:</p> <pre><code>class MyClass { string Name; int NewInfo; } List&lt;MyClass&gt; newInfo = .... // initialize list with some values Dictionary&lt;string, int&gt; myDict = .... // initialize dictionary with some values foreach(var item in newInfo) { if(myDict.ContainsKey(item.Name)) // 'A' I hash the first time here myDict[item.Name] += item.NewInfo // 'B' I hash the second (and third?) time here else myDict.Add(item.Name, item.NewInfo); } </code></pre> <p>Is there any way to avoid doing two lookups in the Dictionary -- the first time to see if contains an entry, and the second time to update the value? There may even be two hash lookups on line 'B' -- one to get the int value and another to update it.</p>
c#
[0]
1,104,753
1,104,754
Is there any way to make Jquery automatically detect changes in DOM and act accordingly?
<p>I have a lot of dynamically added elements in my html page. And each time Jquery fails to detect them. I tried using live function, but it's functionality seems to be very limited. Can you please suggest me some way of making Jquery go through my DOM everytime I want to execute some work?</p>
jquery
[5]
5,313,608
5,313,609
Problem with each()
<pre><code>&lt;script type="text/javascript"&gt; //&lt;!-- $(document).ready(function() { $('ul.course-nav li a').each(function() { alert(5); if ('#' == $(this).attr('href')) { $(this).addClass('lessOpacity'); } }); }); //--&gt; &lt;/script&gt; </code></pre> <p>HTML of course contains searched elements:</p> <pre><code> &lt;ul class="course-nav"&gt; &lt;li&gt;&lt;a href="navigator.php?kam=zakladnyNahladKurzu&amp;amp;id=1&amp;amp;pos=2" class="next"&gt;&lt;img src="css/images/16_arrow_right.png" alt="next"&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" class="prev"&gt;&lt;img src="css/images/16_arrow_left.png" alt="prev"&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="navigator.php?kam=zakladnyNahladKurzu&amp;amp;id=1" class="start"&gt;&lt;img src="css/images/16_arrow_first.png" alt="start"&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Yet it doesn't work. Not even alerts pop up. Any suggestions?</p>
jquery
[5]
140,043
140,044
Inconsistent page redirections in php
<p>I have set the session on all pages in my admin panel like so:</p> <pre><code>session_start(); if(!isset($_SESSION['username'])) header("Location: login.php?e=please+login+first"); </code></pre> <p>This seemed to be working properly on all my pages, but now when I refresh my page or click on a link, the page automatically redirects to <code>login.php</code>. This seems to happen infrequently. I don't understand what is causing this problem</p> <p>As an example, my menu bar is like:</p> <pre><code>home : doctors: hospitals: feedback </code></pre> <p>If I am on <code>hospitals.php</code>, then after a few mins I click on <code>feedback.php</code> (or any other link) I get redirected to <code>login.php</code>. The next time if I again click on the link I will not get redirected</p> <p>Here is my dologin.php code</p> <pre><code>$qry = "select * from admin where username='$uname' and password='$pwd'"; //echo $qry;exit; $rs = mysql_query($qry,$con); if($rec= mysql_fetch_array($rs)) { $_SESSION['username'] = $rec['username']; header("Location: index.php"); } else if (empty($uname)) { header("Location: login.php?e=Please+enter+username"); } else { header("Location: login.php?e=Invalid+username+or+password"); } </code></pre>
php
[2]
2,305,729
2,305,730
what is the meaning of this php code in facebook style chat script freichat?
<p>This question is about the facebook style chatting script <a href="http://evnix.com/drupal2/" rel="nofollow">freichat</a> . The following line is found in arg.php file. Please notice that arg.php is also used in the argument of str_replace(,,.,,) function.</p> <pre><code> $parameters= unserialize(file_get_contents(str_replace('arg.php','config.dat',__FILE__))); </code></pre> <p>config.dat file content looks like :</p> <pre><code>a:20:{s:9:"show_name";s:5:"guest";s:11:"displayname";s:4:"name";s:11: "show_module";s:7:"visible";s:9:"chatspeed";s:4:"5000";s:5:"fxval";s:4: "true";s:9:"draggable";s:6:"enable";s:8:"conflict";s:4:"true";s:12 </code></pre> <p>What does the quoted line actually do? any step by step explanation?</p>
php
[2]
4,513,725
4,513,726
Need a working example on how to insert text at the cursor position in a html text area using jquery?
<p>Need a working code example on how to insert text at the cursor position in a html text area using jquery? Read somewhere there is a plugin to accomplish but not sure how plugins work.</p>
jquery
[5]
4,271,303
4,271,304
Literal period in Python dict
<p>I'm using this code:</p> <pre><code>import urllib2 submit = urllib.urlencode(dict(sign.username='example')) </code></pre> <p>But i get this error:</p> <p><code>SyntaxError: keyword can't be an expression</code></p> <p><code>sign.username</code> is a parameter in the URL which I am encoding, but Python won't let me use it, how can I fix this?</p>
python
[7]
5,569,905
5,569,906
How to refresh the src of <img /> with jQuery?
<pre><code>&lt;img src="test.php" /&gt; </code></pre> <p>where test.php generates an image with a random number.</p> <p>Itried :</p> <pre><code>$('#verifyimage').click(function() { $(this).attr('src',$(this).attr('src')); }); </code></pre> <p>But it doesn't work.</p>
jquery
[5]
1,807,671
1,807,672
Is it possible to create an associative array which holds instances of a custom class?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2702863/initializing-php-class-property-declarations-with-simple-expressions-yields-synt">Initializing PHP class property declarations with simple expressions yields syntax error</a> </p> </blockquote> <p>Is it possible to create an associative array and parse instances of a custom class as values?</p> <p>Something like:</p> <pre><code> private static $contentTypeList = array( "News" =&gt; new ContentType("News", "news.php", "News"), "Termine" =&gt; new ContentType("Termine", "termine.php", "Termine"), "Zeitplan" =&gt; new ContentType("Zeitplan", "zeitplan.php", "Zeitplan"), "Fotos" =&gt; new ContentType("Fotos", "fotos.php", "Fotos"), "Anfahrt" =&gt; new ContentType("Anfahrt", "anfahrt.php", "Anfahrt"), "Guestbook" =&gt; new ContentType("Guestbook", "guestbook.php", "G&amp;auml;stebuch") ); </code></pre> <p>Trying this I'm getting an error like "unexpected keyword NEW".</p> <p>Do I use the wrong syntax or is it just not possible?</p>
php
[2]
1,296,879
1,296,880
When to only abstract class but not interface
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1221512/when-to-use-abstract-class-or-interface">When to use abstract class or interface?</a> </p> </blockquote> <p>I know about abstract classes and interfaces. But I wish to know a real time scenario in which we need to use only abstract class but not interface and only interface but not an abstract class.. Can any one suggest me some example like that.</p> <p>I guess the second one is used when multiple inheritance need arises i.e. A class is already inheriting some class and so we cant use an abstract class here .. We need to use only interface. In the same way I need an example In which we use only abstract but not interface.</p> <p>EDITED</p> <p>Just to add some more points for interface.</p> <p>Consider the java library collections</p> <pre><code> Collections List Set </code></pre> <p>All 3 are interfaces but the major thing , though they have functions which are common that is add , addAll, contains,containsAll etc. List implements in its own and set implements in another way ( telling about duplication ). Set does not allow duplicates list allows duplicates. </p> <p>So what I am trying to say is when ever there is no common features for sub-interface of super-interface we have to go for interface</p> <p>But if there is some common functionality which both has then keep it as to be abstract class. </p> <p>I need a practical example done in java api. Thanks. Sindhu</p>
java
[1]
4,548,814
4,548,815
Self scanning code to prevent print statments
<p>I have a python project I'm working on whereby instead of print statements I call a function say() so I can print information while in development and log information during production. However, I often forget this and put print statements in the code by mistake. Is there anyway to have the python program read its own source, and exit() if it finds any print statements outside of the function say()?</p>
python
[7]
308,845
308,846
Parsing specific contents in a file
<p>I have a file that looks like this</p> <pre><code> !--------------------------------------------------------------------------DISK [DISK] DIRECTION = 'OK' TYPE = 'normal' !------------------------------------------------------------------------CAPACITY [CAPACITY] code = 0 ID = 110 </code></pre> <p>I want to read sections [DISK] and [CAPACITY].. there will be more sections like these. I want to read the parameters defined under those sections.</p> <p>I wrote a following code: </p> <pre><code>file_open = open(myFile,"r") all_lines = file_open.readlines() count = len(all_lines) file_open.close() my_data = {} section = None data = "" for line in all_lines: line = line.strip() #remove whitespace line = line.replace(" ", "") if len(line) != 0: # remove white spaces between data if line[0] == "[": section = line.strip()[1:] data = "" if line[0] !="[": data += line + "," my_data[section] = [bit for bit in data.split(",") if bit != ""] print my_data key = my_data.keys() print key </code></pre> <p>Unfortunately I am unable to get those sections and the data under that. Any ideas on this would be helpful.</p>
python
[7]
5,317,005
5,317,006
Cannot set boolean values in LocalStorage?
<p>i noticed that i cannot set boolean values in <code>localStorage</code>?</p> <pre><code>localStorage.setItem("item1", true); alert(localStorage.getItem("item1") + " | " + (localStorage.getItem("item1") == true)); </code></pre> <p>always alerts <code>true | false</code> when i try to test <code>localStorage.getItem("item1") == "true"</code> it alerts true ... so no way i can set an item in <code>localStorage</code> to true?</p> <p>even if its a string, i thought only <code>===</code> will check the type? </p> <p>so </p> <pre><code>alert("true" == true); // shld be true? </code></pre>
javascript
[3]
474,474
474,475
what are best practices for showing help information
<p>I would like to put fairly extensive help information within my app - both "how to use" and explanation of what one is seeing.</p> <p>The app (map oriented) has a row of buttons at the bottom, and I was considering adding a help button.</p> <p>Context sensitive help is mostly not appropriate, btw.</p> <p>What are common and best practices for this? </p> <p>Thanks</p>
android
[4]
3,827,695
3,827,696
how to capture internet file download file info in dot net
<p>hello i am developing an dot net application in C# and i want to get the file download information like name,size etc so can any one tell me how i can do this ....Thank you...</p>
c#
[0]
1,580,911
1,580,912
Does a std::vector constructor not call object constructors for each element?
<p>My code resembles something along these lines.</p> <pre><code>class A { public: A(int i) { printf("hello %d\n", i); } ~A() { printf("Goodbye\n"); } } std::vector(10, A(10)); </code></pre> <p>I notice that hello prints out once. It seems to imply that the vector only allocates space for the element but doesn't construct it. How do I make it construct 10 A objects?</p>
c++
[6]
3,110,753
3,110,754
Watermark image on real time on camera view in iphone
<p>Special Thanks in advance...... I m the beggininer in iphone software development. </p> <p>Just looking for how to programmatically add real time a watermark image to camera view using cocoa. Not looking for a step by step ( although that would awesome ), but more or less looking for where I should start looking to learn how. Are there frameworks developed to work for this. Would like something native to objective-C using XCode framework because I would like to eventually give this a go on the iPhone. Any help would be great.</p>
iphone
[8]
4,482,606
4,482,607
How to turn on/off my Android device with an APP
<p>Is there a way to create an Android application to turn on/off the device? The "turn on" part based, for example, on a timer. I would like to know if exists some functions to do this. Thanks for every reply.</p> <p>Matteo </p>
android
[4]
1,442,249
1,442,250
C# Parallelizing CSV Parsing
<p>Please look at the code below.</p> <pre><code>void func() { for(;;) { var item = new Item(); } } </code></pre> <p><code>Item</code> is a class in whose constructor I read several csv files, as follows</p> <pre><code>List&lt;string&gt; data = new List&lt;string&gt;(); Item() { //read from csv into List&lt;string&gt;data } </code></pre> <p>As is visible, the csv files are distinct and are read into unique variables. I would like to be able to parallelize this. All my data is on a network drive. I understand that the limitation in this case is the disk access. Can someone suggest what I can do to parallelize this?</p>
c#
[0]
3,377,553
3,377,554
jQuery: Is it possible to clone a file input?
<p>Is it possible to clone a file input so that I can have multiple copies of it and delete them while the original stays intact?</p>
jquery
[5]
3,906,409
3,906,410
failing to open alert box before redirection.ASP.NET
<p>I'm trying to show an alert box before redirecting,but it's not working.The alert box only works if the redirection is not done.</p> <p>i modified the popular Alert.Show("string") class from Mads Kristensen as below....</p> <pre><code>public static class Alert { /// &lt;summary&gt; /// Shows a client-side JavaScript alert in the browser. /// &lt;/summary&gt; /// &lt;param name="message"&gt;The message to appear in the alert.&lt;/param&gt; public static void Show(string message) { // Cleans the message to allow single quotation marks string cleanMessage = message.Replace("'", "\\'"); //replacing script string with strSCript //string script = "&lt;script type=\"text/javascript\"&gt;alert('" + cleanMessage + "');&lt;/script&gt;"; //added this below string strScript = "&lt;script type=\"text/javascript\" language=\"javascript\"&gt;"; strScript += "alert('" + cleanMessage + "');"; strScript += "window.location.href='http://localhost/Gadgeteer/IncToH/IncToH.zip';"; strScript += "&lt;/script&gt;"; // Gets the executing web page Page page = HttpContext.Current.CurrentHandler as Page; // Checks if the handler is a Page and that the script isn't allready on the Page if (page != null &amp;&amp; !page.ClientScript.IsClientScriptBlockRegistered("alert")) { page.ClientScript.RegisterClientScriptBlock(typeof(Alert), "alert", strScript); } } } //calling from code behind Alert.Show("message"); </code></pre>
asp.net
[9]
3,083,239
3,083,240
Can a function return two values?
<p>Can a function return two values? </p> <p><a href="http://stackoverflow.com/questions/5139072/can-a-function-return-two-values">Can a function return two values?</a> { I came across this in C} Any possibility of something in JavaScript</p>
javascript
[3]
2,869,160
2,869,161
ASP.NET InitComplete event
<p>Can i Consider the responsibility of InitComplete event as follows</p> <p>1) It is the last stage of page initialization</p> <p>2) If ViewState is enabled at page level it will calls Page.TrackViewState() method inorder to make the view state to be ready for persisted across postback.</p> <p>Thanks Babu</p>
asp.net
[9]
5,915,026
5,915,027
PHP : how do i access a request variable outside of a class?
<p>I have a form passing a variable $oid to a php script. the form variable is pulled and needs to be passed into a function called get_name(). The header() function in the class implements an interface called header() in the parent class. </p> <pre><code> require 'pdfclass.php'; $oid = $_REQUEST['oid']; class p extends PDF { function Header() { $this-&gt;setF('Arial',10); $this-&gt;Cell(50,10,get_name($oid),1,0,'c'); } //end Header() } //end class function get_name($oid) {... } $pdf = new P(); $pdf-&gt;setF('Times',12); $pdf-&gt;AddPage(); $pdf-&gt;Output(); </code></pre> <p>When i run this, i get an error on the get_name($oid) call inside the class extension. I wish to avoid using a global variable. Any ideas how to do this? </p> <p>thanks in advance</p>
php
[2]
1,784,397
1,784,398
remove everything after the last occurrence of numerical value
<p>I need to remove everything after the last occurrence of a numerical value some examples below: </p> <p><code>1234D</code> Should be <code>1234</code><br> <code>ABCD1234A_BC</code> Should be <code>ABCD1234</code></p>
c#
[0]
5,219,273
5,219,274
UIActionSheet is taking longer to load
<p>are their any reasons why my UIActionSheet would be taking a while to load. It works fine just after lauch, but as soon as I loop through some actions once or twice, is loads very slow, and you can see the grey backdrop crawl down to finish drawing the sheet.</p> <p>help?</p> <p>Sam</p>
iphone
[8]