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,719,104
1,719,105
Pass variable to subprocess call in python
<p>I am trying to pass my variables from raw_input to my subprocess command. I am new to python. Any help would he appreciated. </p> <pre><code>#!/usr/bin/python import subprocess """THIS SCRIPT WILL ALLOW YOU TO INTERACTIVELY ADD USERS ON A LINUX SERVER ONLY""" """REV 0.1A""" print "\nWhat user name" username = s...
python
[7]
251,458
251,459
How to display large amounts of text on Android
<p>I want to display about one or two full screens worth of text in an Android application (like a welcome screen or help screen), and I'm trying to figure out the best way of storing that text in the app. The text does not need formatting, but line breaks and empty lines must be preserved.</p> <p>So far I have come u...
android
[4]
1,967,907
1,967,908
jQuery 1.7 "unifying bind/live/delegate"
<p>The jQuery 1.7 release will "unify bind/live/delegate". What does this mean in term of the jQuery source? What are the consequences for my jQuery code?</p>
jquery
[5]
3,841,854
3,841,855
Issues with setfill in a member function
<p>I am trying to create a program over multiple files that reads out the time, but I am having trouble displaying the time in the desired format. More specifically, <code>setfill</code> appears to be causing me problems. </p> <p>Here is the beginning of a very long error messages I recieve when compiling:</p> <pre><...
c++
[6]
2,643,715
2,643,716
Use Javascript to match elements with a class pattern
<p>Hi I have a number of elements:</p> <pre><code>&lt;div data-stage-1="hello"&gt;Hello&lt;/div&gt; &lt;div data-stage-2="hello"&gt;Hello&lt;/div&gt; &lt;div data-stage-3="hello"&gt;Hello&lt;/div&gt; </code></pre> <p>Using Javascript how would i pull these elements into an array by matching their similar data attribu...
javascript
[3]
3,973,209
3,973,210
What does ordering mean in list/tree set in java
<p>Java docs says that a "TreeSet keeps its elements ordered internally". </p> <p>Here what does ordering mean? Does it mean sorted? If so, then what is the difference between sorting and ordering?</p>
java
[1]
5,677,752
5,677,753
Android Built-In Animations on Emulator with 4.0
<p>My app has been working on a 4.0 emulator when targeted for V11 and built with the support library Fragment classes to work from V7 and up. But now that I am targeting V14 (also min SDK), I am getting the following fatal error on fragment transition animations:</p> <pre><code>E/AndroidRuntime(1098): FATAL EXCEPTION...
android
[4]
4,111,191
4,111,192
drawBitmap where one pixel equals one pixel
<p>If I draw a bitmap on a view canvas using drawBitmap(), the images will be resampled so that 1 pixel in the image will be 1 dip on the screen. On a device I have with high pixel density, that means each image pixel is spread across 1.5 screen pixels, degrading the image. Handy in general, but in some cases I want t...
android
[4]
2,133,013
2,133,014
Activity not showing in list of recent apps when launched from a widget
<p>I have created an app widget which, when clicked, launches an Activity in my application.</p> <p>The activity it launches is <strong>NOT</strong> the main launcher activity (as set in the application manifest).</p> <pre><code>&lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; ...
android
[4]
4,630,395
4,630,396
checking post on page
<p>I have the page and several buttons on it. One of them should post the data on this page, another one has event that also reload page but doesn't post data. The question: how can I check in event Page Load was the data posted or not?</p>
asp.net
[9]
4,389,745
4,389,746
difference with ArrayList and List
<p>Hi Here i am trying to sublist the items from list and print them 5 for each iteration. here in the following code it is printing same items every time</p> <pre><code>for(int i=0;i&lt;4;i++) { List&lt;Card&gt; l=a.subList(a.size()-5, a.size()); System.out.println(l); } </code></pre> <p>But here it is...
java
[1]
1,922,275
1,922,276
Javascript adding js
<p>Lets imagine that we have a web page. We don't have direct access to this page so we couldn't change the source code but we need to add a js to it contents. Is there any way? I mean for example external javascript or any other way.</p>
javascript
[3]
4,512,333
4,512,334
How to handle required default constructor
<p>In writing a copy constructor for one of my classes ( which holds a few objects of other UDTs ), I am required to create a default constructor for those UDTs, even though they were never really meant to have one.</p> <p>Is it fine to just implement a blank default constructor and be done with it? The only time the ...
c++
[6]
1,871,960
1,871,961
How to generate zip file in asp.net
<p>I am using .Net framework 2.0. I need to create zip file from the folder path"D:\Nagaraj\New Project Read Document\TCBILPOS\TCBILPOS\TCBILPOS\FileBuild\HOST" ...within that host folder has 7 txt file. so,Now I want to create zip file "HOST.zip" in this same folder path "D:\Nagaraj\New Project Read Document\TCBILPOS\...
asp.net
[9]
4,318,667
4,318,668
C# class and readonly members
<p>When writing a class in C#, is it a good idea to mark all of you private member variables as private readonly if they are only assigned to in the constructor and aren't subject to change elsewhere in your class? Or is this overkill?</p>
c#
[0]
3,134,592
3,134,593
Detecting whether a PHP variable is a reference / referenced
<p>Is there a way in PHP to determine whether a given variable is a reference to another variable and / or referenced by another variable? I appreciate that it might not be possible to separate detecting "reference to" and "reference from" given the <a href="http://www.php.net/manual/en/language.references.whatdo.php"...
php
[2]
4,110,602
4,110,603
What does this PHP error mean? Call to undefined function addSlashesIfNeeded()
<p>Getting this error:</p> <p>Fatal error: Call to undefined function addSlashesIfNeeded() in <em>*</em>* on line 0</p> <p>can someone tell me what this error means? and possibly a solution?</p> <p>thank you.</p>
php
[2]
57,848
57,849
Turn off backlight of the buttons
<p>I'm developing an Android application that might be used at night. Therefor, I need to turn off the buttons' backlight. How can I do this? On my own phone the backlight turns off after a while, but on the Motorola Droid I don't think this happens. </p> <p>I'm using a wakelock to keep the screen on. Should I use an...
android
[4]
857,651
857,652
Reading separated columns in a CSV file in C++ using getLine
<p>I have a program that can successfully read a CSV file. The said CSV file is a list separated by 3 columns. And each column has a comma in between each line. For instance</p> <p>line 1 --- artist, genre, song line 2 --- Michael jackson, Pop, thriller</p> <p>and so on. What I want my program to do is read the first...
c++
[6]
5,260,799
5,260,800
Simple map<> instantiation, I can't compile, please help
<p>Why I can't compile this code?</p> <pre><code>#include &lt;map&gt; using namespace std; class MyTest { template&lt;typename T&gt; void test() const; }; template&lt;typename T&gt; void MyTest::test() const { map&lt;string, T*&gt; m; map&lt;string, T*&gt;::const_iterator i = m.begin(); } </code></pre> <p...
c++
[6]
4,459,093
4,459,094
Speed of the Internet connection
<p>How to measure the speed of the Internet connection by using JavaScript? Maybe there are examples of code? </p>
javascript
[3]
3,391,929
3,391,930
my thumbnail creation using ffmpeg is not working on linux server
<p>I am using ffmpeg in linux server...the video conversion is working fine,but thumbnail creation not working...</p> <p>here is my code</p> <blockquote> <p>exec($_SERVER['DOCUMENT_ROOT']."/esebd2/ffmpeg/ffmpeg -y -i ".$_SERVER['DOCUMENT_ROOT']."/esebd2/".$target_path." -vframes 1 -ss 00:00:10 -an -vcodec png -f ra...
php
[2]
3,196,498
3,196,499
Android Services, Activities and Handlers?
<p>Im developping an Android Service in Android that needs to pop-up a new dialog box for confirmation.</p> <p>I can popup a new activity using Intent and Context</p> <pre><code>Intent myIntent = new Intent(context, ConfirmationActivity.class); </code></pre> <p>But then I need to handle the option selected in the di...
android
[4]
5,731,184
5,731,185
tab separation problem
<p>I usually used this to create tab separated files for excel:</p> <pre><code>sb.AppendLine(String.Format(@"{0}\t{1}" ... </code></pre> <p>Strangely it does not work anymore. Any ideas?</p> <p>C</p>
c#
[0]
1,169,130
1,169,131
JDK compiler version issue
<p>I'm using Ant to compile Java.The project has to be compiled using JDK 1.5 , however some part of the code references a package compiled with JDK 1.6 version. I set the JAVA_HOME to 1.5 , error is thrown at this reference as</p> <p>[javac] class file has wrong version 50.0, should be 49.0</p> <p>What is the way ou...
java
[1]
2,072,464
2,072,465
GWT. Create primitive (no- referencable) Integer variable
<p>In my class, I have field <code>int count</code>. I want to create a new variable according to value of <code>count</code> variable, like this: <code>int a = new Integer(count)</code>. But when I update count variable: <code>count++</code>, then variable <code>a</code> also gets updated. So how to create non-referen...
java
[1]
4,706,411
4,706,412
Parsing a fancy URL to variables in PHP (/class/method/x/1/y/1/z/1/)
<p>I am sure someone has this done already, and was hoping someone could share some code.</p> <p>We have the following .htaccess file in place:</p> <pre><code>RewriteEngine on RewriteBase / RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ index.php </code></pre> <p>This is the same one Zend uses. We are trying to emula...
php
[2]
5,918,935
5,918,936
What is a good way to order methods in a python class?
<p>I want to order my methods in my python class but I don't know what is the correct order.</p> <p>When I extract methods in Eclipse with pydev then Eclipse puts the extracted method on top of the modified method. But this puts the lower level details before the higher level details. According to Uncle Bob I should d...
python
[7]
1,115,201
1,115,202
What is the best way to pass server side variables to JavaScript on the client side?
<p>Our application uses a lot of configuration options. Those options need to be reflected on the client side in the form of User preferences, site wide preferences, etc.</p> <p>Currently, we pass server side settings down to the client side in the form of JSON that is stored in custom attributes in the markup for a s...
javascript
[3]
1,003,936
1,003,937
Downloading large files using ksoap2 in android from asp.net server
<p>I am developing an app in which the user needs to download videos, pdf, and images from our server. The server response is base64binary data. I am able to download small videos but getting out of memory exception while handling large video or pdf files. I saw the post <a href="http://stackoverflow.com/questions/3238...
android
[4]
192,877
192,878
How can I pass a variable into jQuery timeout
<p>I'm seriously struggling today. </p> <p>I need to pass a variable, or even better an object, into a timeOut as such (example) : </p> <pre><code>$('.x').each(function() { setTimeout(function() { alert ($(this).attr('id')) },10000); }); </code></pre> <p>Obviously what happens is that the timeOut doesn't ...
jquery
[5]
4,840,238
4,840,239
Basic rendering - onDraw() method question
<p>I am declaring a class that extends activity and an inner class that extends view and contains the onDraw() method, which also contains the invalidate() method. In my overriden onCreate() method I instantiate the outer class. My question is how the onDraw() method is called, since I never call it manually.</p> <p>P...
android
[4]
456,919
456,920
android: how to know which process owns a directory?
<p>I have Galaxy S3 and it keeps pop up an advertisement on the bottom of the screen, I want to find out which process is doing this and kill it.</p> <p>Now I have found the directory that stores all the pictures of the advertisement, but how can I find the process which owns the directory? The directory is: /sdcard/a...
android
[4]
3,055,913
3,055,914
why should we widen the accessibility of overridden methods?
<p>why should we widen the accessibility of overridden methods ? If the super class has a protected method and subclass has same method with public. Why should happen?</p>
java
[1]
3,013,703
3,013,704
How to set different images alternately in listView's row?
<p>I have a listview, in which I am fetching data from Twitter, I also show it in listView, but I want to show different images in different rows of listView.</p> <p>I used <code>convert-view.setBackGroundResource(R.drawable.strip1);</code>, it repeats this image in all rows, but I want to set it alternatively. How is...
android
[4]
3,924,028
3,924,029
I need a Pop up with description when i click an image
<p>i need a pop up with description of an image when i click that image. How can this be done? Is there any plugin in wordpress that can do this?</p>
jquery
[5]
1,458,098
1,458,099
Export csv file in php without tag
<p>I have create one csv file but that file contain html tag also.. Problem: generated csv file have html tag and other useless information also print. I have required only no,emailid only. i have try following code:</p> <pre><code>&lt;?php mysql_connect("localhost","root",""); mysql_select_db("XXXXXXX"); $query = "SE...
php
[2]
4,696,316
4,696,317
Retry a connection on timeout in Java
<p>I have a method (below) that pulls down and returns the source of a webpage as a String. It all works fine and dandy, but when the connection times out, the program throws an exception and exits. Is there a better method to do this that would allow it to try again on timeout, or is there a way to do it within this m...
java
[1]
4,902,570
4,902,571
Compare Validator in asp.net?
<p>In web application, i am try to validate the date by using compare validator. but it is throwing error, This is my code </p> <pre><code>&lt;asp:CompareValidator ID="CompareValidator1" runat="server" Text="*" Display="None" ValidationGro...
asp.net
[9]
1,908,890
1,908,891
Comparing values of arrays in C#
<p>I have a bool array that looks like this </p> <pre><code>bool[] responses = new bool[] {true, false, true}; </code></pre> <p>And two classes that look like this:</p> <pre><code>public class Person { public IList&lt;PersonDetail&gt; PersonDetails } public class PersonDetail { public bool Correct { get; set;...
c#
[0]
1,126,417
1,126,418
Covariant return type in Java
<p>The following code uses the concept of method overriding in Java.</p> <pre><code>package pkg; import java.util.ArrayList; import java.util.List; abstract class SuperClass { abstract public List&lt;String&gt;getList(); } final class SubClass extends SuperClass { private List&lt;String&gt;list=null; @...
java
[1]
5,655,291
5,655,292
Make all <li>s, when clicked, scroll to a single anchor?
<p>I have around 30 <code>li</code> nodes. When each one is clicked, I would like the browser to gently scroll to the div <code>sliderbox</code>. (I don't wnt to use anchor tags)</p> <p>So, something like this:</p> <pre><code>$("#boxcont li").click(function(event){ // (Make stuff happen here) )}; </code></pre> <p...
jquery
[5]
1,580,353
1,580,354
Is there a way to do simple "class-like" inheritance using objects in javascript?
<p>I've run into a javascript question that I don't know how to resolve. I'm grouping a bunch of variables and methods into a DocManager object. Everything related to managing "documents" in my application lives here. Basically, the DocManager acts like a class with a single instance. </p> <p>Ex:</p> <pre><code>v...
javascript
[3]
3,773,390
3,773,391
MysqlDump Return a Empty database backup file
<p>I use this code for download a backup of MySql database but it download a empty file. Please also guide for restore this backup.</p> <pre><code>&lt;?php //connect to database include'connect.php'; $backupFile = $dbname . date("Y-m-d-H-i-s") . '.sql'; $command = "mysqldump -h$hostname -u$username -p$password $dbname...
php
[2]
2,365,785
2,365,786
File is used by another process: How to solve this Error?
<p>I am trying to open a file, but I received:</p> <p>The process cannot access the file because it is being used by another process. The File is an XML-Document. Can anyone help?</p> <pre><code> string activeDirectory = @"X:\SubGraph\"; string[] files = Directory.GetFiles(activeDirectory); foreach (string fileN...
c#
[0]
2,239,819
2,239,820
general method to clearform in asp.net?
<p>I am using master page with content pages. I want to write a genral method to clear textboxes and for dropdownlist set index to 0. Please guide on this.</p>
asp.net
[9]
5,927,460
5,927,461
Service, activity and notifications
<p>I have program that starts Service. </p> <p>Service periodically checks server for updates. If there are new updates on server service creates notification. It creates notificatins even if my application is foreground. But I want it to create notification only if my application is background or stopped.</p> <p>Can...
android
[4]
4,038,681
4,038,682
how to extract web page textual content in java?
<p>i am looking for a method to extract text from web page (initially html) using jdk or another library . please help</p> <p>thanks</p>
java
[1]
1,328,281
1,328,282
Bind asp.net control's value to code behind function
<p>I have a hidden field that i want to bind to either a function on the page's code behind. I don't quite recall the exact syntax and i can't find the answer via Google. Is the code below correct? Thank.</p> <pre><code>print("&lt;asp:HiddenField ID="dummy" Value='&lt;%#Getdummy() %&gt;' runat="server" /&gt;"); </code...
asp.net
[9]
5,284,819
5,284,820
How can you attach a C# console application to a running windows service?
<p>I have a windows service that generates logs as it does some execution. I also do <code>console.writeline</code> call for every log message I write into the log file. But since its a windows service the console.write line is not visible.</p> <p>I want to write a C# console application program that can attach to my ...
c#
[0]
1,133,483
1,133,484
Is there a way to change a file name dynamically?
<p>I have a site where only about five people can log into it. When a user logs in I want to have one of the access-protected pages file name to change and have a random file name each time they login. I want this so when the user logs in they cannot type the page in the URL and go straight there by skipping the pages ...
php
[2]
5,677,641
5,677,642
Form disposing difference when closing from parent and from child control
<p>I noticed a difference in the behaviour of my application when closing a form.</p> <p>At some point on my application, a new form is created and showed with the ShowDialog() method.</p> <p>Then, if I force the dialog to close in another thread, calling the Close() method from the parent form, the form is closed AN...
c#
[0]
212,893
212,894
Need to Find and Count given variable in Javascript Array
<p>Hello I would be grateful if anyone could provide solution for the following problem that I have:<br> I need to find if given variable exists in Array; </p> <pre><code>var arr = new Array(4, 1, 4, 1, 4) var number = 4; var number_two = 1; </code></pre> <p><strong>is there a way to count how many times "var nu...
javascript
[3]
4,170,119
4,170,120
C# Passing arguments by default is ByRef instead of ByVal
<p>I know the default is ByVal in C#. I used same variable names in many places and then I noticed passed values change and come back. I think I knew scope mechanism of C# wrong. Here public <strong>license</strong> overrides the local <strong>license</strong> values. I know I can easily rename the variable names in co...
c#
[0]
3,312,339
3,312,340
settimeout in opener window doese not work after showing an alert message on child window
<p>I found the bug in safari on iPad after iOS5 that makes settimeout running on opener window stop when child window shows alert message(or confirm and beforeunload). is it possible to continue settimeout when opener window get focused again?</p> <p>Thanks!</p> <pre><code>&gt;&gt;opener page&lt;&lt; &lt;HEAD&gt; &...
javascript
[3]
1,375,305
1,375,306
how to create an Alert Dialogu in Android without onCliclkListener
<p>I wanted to display an Alert Dialogue inside thread or alternatively such a way that AlertDialogue opens up directly after finding some records in database negative, w/o clicking on any button.. Alert dialogue may contain Few lines and 2-3 buttons..</p> <p>referred following link and tried on my own but not getting...
android
[4]
5,253,513
5,253,514
Which Point, Coodinate structures in C#
<p>I'm using mapping in my application. So I have 2D point structures of int and double, which I need to manipulate. I have currently separated my solution into 2 projects/ assemblies. One has the core functionality. The other is for user interface. I'm currently using a WPF user interface. However I've tried to maximi...
c#
[0]
1,926,481
1,926,482
Android How to restrict user from copying data from Application Folder..?
<p>I'm new to Android and in my Project I got the requirement that the user should not be given a chance to copy images and videos in the application folder to the PC so that they cannot be reproduced. </p> <p>Only the App should have the chance to access the images and videos stored in the App folder.</p>
android
[4]
2,062,257
2,062,258
Why does the amount of used heap decrease when the heap size increases?
<p>I'm reading a large text file into an ArrayDeque,</p> <pre><code> BufferedReader br = new BufferedReader(new FileReader(fname)); String line=null; //allocate an ArrayDeque with enough room for 50M lines. ArrayDeque&lt;String[]&gt; inMemory = new ArrayDeque&lt;String[]&gt;(50000000); while((line=b...
java
[1]
1,838,805
1,838,806
is removeAllAnimations then adding animations the way to go?
<p>Some consultants built some code for us. I'm looking at a method they wrote for UIView subclass. It basically goes like this:</p> <pre><code>- (void)startAnimation { [self.circle removeAllAnimations]; // then some animation code for the circle. The circle is a CAShapeLayer. [self.circle addAnimation:gr...
iphone
[8]
5,613,699
5,613,700
How to show a hidden div using jQuery if 3 input text fields in another div are not empty?
<p>I have a div that is hidden when the DOM is loaded, using hide().</p> <pre><code> &lt;div class="disappear"&gt; Some text appears here &lt;/div&gt; </code></pre> <p>How do I make the above div (<strong>.disappear</strong>) show when the input fields with class <strong>.master</strong> (one to three) are...
jquery
[5]
5,907,056
5,907,057
Sort items in a table view in iphone
<p>I am developing an application in which i am displaying the result of web service in table view, now i want to display according to the selection. for example. there are certain items such as price, description, title. now if i want to display all the result according to price how should i display. I have used XML p...
iphone
[8]
5,297,202
5,297,203
Why does C++ has an additional class name declaration?
<p>why do we have to declarer a class name in <code>C++</code> like:</p> <pre><code>class MDT_DECL Transfer{ // declaration goes here }; </code></pre> <p>? What's the reason for the <code>&lt;DIRNAME&gt;_DECL</code>? I see it's especially used when the code needs to be compiled in <code>Windows</code> </p>
c++
[6]
5,572,129
5,572,130
Wiping data on an actual phone
<p>Ok, usually I use the emulator so I have just to check the "wipe-data" entry and that's it. If I'm using a phone how could I do that? Is there a way to have a "developer profile" on my phone so I don't lose my personal data?</p> <p>I'm using my personal phone so....</p>
android
[4]
4,554,146
4,554,147
check to see if two ID's are hidden in a conditional
<p>So i have two divs and i want to see if both are currently hidden..Im sure this is really easy but im lost for some reason</p> <p>I have this </p> <pre><code> $j('.btn').click(function(){ //check to see if the divs are currently hidden and if they are show either one of the two }); </code></pre>
jquery
[5]
5,839,138
5,839,139
Open URL in Android App?
<p>I use the following to open a url from my app:</p> <pre><code>String url = "http://www.example.com"; Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); </code></pre> <p>But when I test it in the simulator, it goes back to eclipse and states source not found.</p> <p>Whats going...
android
[4]
365,926
365,927
cannot find symbol - constructor Car()
<p>I'm trying to use a method from another class called Car but referring to it in a class called Bike. I've tried to create an instance variable by using the following code </p> <pre><code>Car b = new Car(); b.higherLease </code></pre> <p>It just keeps coming up with error: cannot find symbol - constructor Car() The...
java
[1]
3,936,971
3,936,972
URL content dimensions
<p>Is there a way, in ASP.NET (in code behind), to get page dimensions (width and height) using just the URL. Maybe download the URL content and then get width and height? Thanks.</p>
asp.net
[9]
4,408,213
4,408,214
Generating a certificate for AuthenticateAsServer
<p>I am trying to fix <a href="http://code.google.com/p/flowlib/" rel="nofollow">FlowLib</a> which seems to have been abandoned in 2009.</p> <p>One of the class, TcpConnections.cs (FlowLib.Connections.TcpConnection) is giving me problems. It is trying to setup a SslStream, but the AuthenticateAsServer method doesn't s...
c#
[0]
2,318,445
2,318,446
How do you implement Coroutines in C++
<p>I doubt it can be done portably, but are there any solutions out there? I think it could be done by creating an alternate stack and reseting SP,BP, and IP on function entry, and having yield save IP and restore SP+BP. Destructors and exception safety seem tricky but solvable.</p> <p>Has it been done? Is it impos...
c++
[6]
3,623,392
3,623,393
What is 'Object...' parameter type in java?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4618930/what-does-mean-in-java">What does &ldquo;&hellip;&rdquo; mean in Java?</a> </p> </blockquote> <p>I'm going through sample code of Spring data and MongoDB and seen a method declaration as follows.</p> <p...
java
[1]
2,906,722
2,906,723
Offline version of java api reference docs
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1521823/download-java-api-documentation">Download Java API Documentation?</a> </p> </blockquote> <p>Are there any offline version of this :</p> <p><a href="http://download.oracle.com/javase/7/docs/api/" rel="no...
java
[1]
551,617
551,618
An expression that's equivalent to the return keyword
<pre><code>void Foo() { var xMaybeNull = GetX(); if (xMabyeNull == null) return; // Some way to get rid of this extra // sentence without loosing the check // do stuff } </code></pre> <p>The easy way would be this, but the compiler expects an expression.</p> <pre><code>...
c#
[0]
2,351,634
2,351,635
Merge audio file with some other File in android?
<p>I am merging a song with another file this file can be an image or a text file.I referred to number of links to get some help: <a href="http://stackoverflow.com/questions/11375291/android-merge-two-audio-files-into-one-file">Merging audio files</a> <a href="http://stackoverflow.com/questions/11452464/merging-two-o...
android
[4]
5,834,450
5,834,451
Case insensitive dictionary
<p>I'd like my dictionary to be case insensitive.</p> <p>I have this example code:</p> <pre><code>text = "practice changing the color" words = {'color': 'colour', 'practice': 'practise'} def replace(words,text): keys = words.keys() for i in keys: text= text.replace(i ,words[i]) return ...
python
[7]
5,545,454
5,545,455
Dynamic instance creation without generics
<p>I would like to understand why the following doesn't work:</p> <pre><code>public class HelloClass { private class MyClass { public MyClass() { System.out.println ("Oh heck this is me!"); } } public Object newInstance (Object o) { try { ...
java
[1]
2,773,444
2,773,445
website not upload using webview
<p>ihave write the following code but it does nothing in consloe it shows Unknown scheme, doing nothing</p> <pre><code>[webview setDeleagte self]; [webView loadRequest:[[NSURLRequest alloc] initWithURL:[[NSURL alloc] initWithString:sourcelinkStr]]]; </code></pre>
iphone
[8]
1,010
1,011
javascript call a privileged method
<p>If I call the killSwitch() outside the onkeypress, I'll cause an error. But inside the onkeypress function, I worked just fine. Why?</p> <p><code></p> <pre><code>// this works fine var ClassA = function() { var doc = document; // killSwitch(); doc.onkeypress = function(e){ killSwitch(); } this.k...
javascript
[3]
2,131,526
2,131,527
Determining duplicate letter counts between an array of strings
<p>I have an array of strings of random letters, and I need to know which letters are consistent between the array members. The count of the letters are important.</p> <p>My method right now is loop through the array, doing a split, then looping through the spitted string to count the occurrences of each letter, then ...
php
[2]
432,626
432,627
Dll and exe in asp.net?
<p>i have a doubt when we run the application (dot net application) dll or exe will be created yes. so my question is when we get dll when we get dll and when we get exe</p>
asp.net
[9]
173,789
173,790
Using "".charCodeAt() and String.fromCharCode to obtain some characters (code value > 55349) with JS
<p>I have a problem with unicode character and JS. I have a bookmarklet to help me typing strange unicode character.</p> <p>I use <code>"".charCodeAt(pos)</code> to obtain the unicode code to reproduce same strange character, and <code>String.FromChardCode</code> for the reverse. But, for characters that have a unico...
javascript
[3]
2,097,485
2,097,486
How can I parse a string into different strings in C#?
<p>I just started work on a C# application. I need to break down a string into different parts. Is there an easy way to do this using C# patterns? I think I can do it with substrings but it might get messy and I want to do something that's easy to understand. Here's an example of the input:</p> <pre><code>AB-CDE-GHI-1...
c#
[0]
67,863
67,864
How to I add gradient color or image to Text in iPhone dev
<p>I want to add a gradient color to my UILabel or any text on my iPhone screen. I want to know the ways to do it. Both Using interface and programatically.</p> <p>tnx</p>
iphone
[8]
1,650,714
1,650,715
Access the class type when constructing a class attribute in python?
<p>I'd like to do this:</p> <pre><code>class MyThing(object): def __init__(self,owning_cls): self.owning_cls = owning_cls class MyClass(object): thing = MyThing(self.__class__) print MyClass.thing.owning_cls </code></pre> <p>This doesn't work - as there isn't a self to refer to in the class construc...
python
[7]
2,485,610
2,485,611
i need to know maximum pool size in ThreadPoolExecutor in java
<p>Howmany Threads Can We create in ThreadaPoolexecutor without affecting the system performance</p>
java
[1]
3,848,017
3,848,018
iPhone code browser?
<p>I want to be able to read code on my iPhone in the bus every day. Ideally, I'd like to be able to download a package, extract it to a folder, put it on the iPhone, and be able to just browse through the code (folders &amp; files and all). Don't need to be able to edit, just read.</p> <p>Is there a good solution for...
iphone
[8]
5,945,196
5,945,197
Why some projects choose the extension for source files .cc in c++?
<p>Any reason for that, what is <code>.cc</code> for?</p>
c++
[6]
5,771,255
5,771,256
return a value from python to php(shell and sys.exit)
<p>I have the next problem : there is a python script which is called in php like this :</p> <pre><code>exec($hwnumbercmd,$output,$return_value); </code></pre> <p>I use <code>sys.exit(0)</code> and <code>sys.exit(2)</code> in python.</p> <p>As I know <code>$return_value</code> should contain '0' or '2',depending on ...
python
[7]
3,787,227
3,787,228
Selecting related hidden value based on selected check boxes
<p>I am wondering if anyone can help me. I want to produce a string of user id's based on checkboxes being selected from a list.</p> <p>My current code is:</p> <pre><code>&lt;fieldset id="engineers" data-role="controlgroup"&gt; @foreach (var item in Model.Maintenance_Team_List) { &lt;label&gt;&lt;input type="checkbox...
jquery
[5]
4,377,797
4,377,798
jQuery - Combining elements
<p>I'm trying to combine the location of my WordPress theme folder to a jQuery element. I haven't used jQuery much before and I've done a little research but haven't found anything of value.</p> <p>Here's my JavaScript variable</p> <pre><code>&lt;script type="text/javascript"&gt;var templateDir = "&lt;?php bloginfo('...
jquery
[5]
2,819,247
2,819,248
how to set start page on hosting server after uploading the asp.net site
<p>i have uploaded my site on hosting server with name www.selectionfurnishing.com but when i try to open any page i got an error that the site does not exits when i try www.selectionfurnishing.com/default.aspx then it gives error that the page does not exits (404) </p> <p>please tell me how can i solve this .... Tha...
asp.net
[9]
1,885,526
1,885,527
Multiplexing the Future<> in Java
<p>I find myself about to write a class that <code>implements Future&lt;T&gt;</code> and stores, inside of itself, a <code>Collection&lt;Future&lt;T&gt;&gt;</code>, acting as an aggregate future for all of its contents.</p> <p>I wonder: has anyone already done this in some open source library? A bit of googling didn't...
java
[1]
2,616,779
2,616,780
How do I change where PHP looks for user defined includes?
<p>I'm about to go and change all my includes to use get current working directory to specify where to look.</p> <pre><code>getcwd() </code></pre> <p>because PHP does not look in the current directory as I thought it would.</p> <p>Is there a way to change this behavior so my code is not littered with <code>getcwd()<...
php
[2]
1,712,139
1,712,140
Python object initialisation performance
<p>I was just doing some quick performance tests, and I noticed that initialising a list generically is about four to six times slower than explicitly (those are probably the wrong terms, I'm not sure on the lingo here). For example:</p> <pre><code>&gt;&gt;&gt; import timeit &gt;&gt;&gt; print timeit.timeit('l = list(...
python
[7]
5,060,753
5,060,754
javascript delay function is not working
<p>I am using javascript-based modal dialog. The dialog is fading in and fading out fine, but if I want the fadeout to be delayed by some seconds using delay(3000), it is not working. It simply never fades out. What could I be doing wrong? It's an MVC app.</p> <pre><code>function testingh(button) { a...
javascript
[3]
42,181
42,182
How to replace a set of characters in a string with a random set?
<p>Let's say I have a basic string of characters:</p> <pre><code>$string = "abcdeffedcbaabcdef"; </code></pre> <p>What I want to do is search for a, c, and f, and then replace them with <em>any one</em> of these characters:</p> <pre><code>$replaceChars = array("1", "2", "3"); </code></pre> <p>So as I search the str...
php
[2]
5,961,760
5,961,761
template struct as template class type
<pre><code> template&lt;class T,class TV&gt; struct CONJUGATE_GRADIENTS_HELPER{ DEFORMABLE_OBJECT&lt;T,TV&gt;* deformable_object; int partition_id; T time,dt; T alpha,beta; ARRAY&lt;TV&gt;* dX_full; ARRAY&lt;double&gt; *S_dot_Q_partial,*rho_new_partial,*supnorm_partial; }; type...
c++
[6]
5,475,916
5,475,917
Conditional behaviour with $(window).width
<p>I'd like a certain mouseenter and mouseleave behavior when the window is above 1278 pixels. For widths below 1278, I want to disable this toggle behavior and just set the 2 elements to 1 state (visible &amp; active). I also have to reset the state back to default (hidden &amp; inactive) if the browser is made wider ...
jquery
[5]
5,011,786
5,011,787
Android Not Allow some symbols in Textview
<p>I am retrieving text from web server in that text &amp; symbol is there when i try to display that data &amp; after text is not displaying like (Android &amp; Java) "Android" text is displaying "&amp; Java" text is not displaying so what should i do to display all data in my text view.</p> <p>Thanks, Murali.</p>
android
[4]
5,085,416
5,085,417
image issue on android
<p>I have downloaded the image from given url,and displayed in the imageview,which works fine in the emulator .but not works in real device... whats the problem?</p> <p>Here my code</p> <pre><code>final String url = urlStr; InputStream inputStream = null; try { inputStream = h...
android
[4]