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
4,908,965
4,908,966
Efficient way to convert a list to dictionary
<p>I need help in the most efficient way to convert the following list into a dictionary: </p> <pre><code>l = ['A:1','B:2','C:3','D:4'] </code></pre> <p>At present, I do the following:</p> <pre><code>mydict = {} for e in l: k,v = e.split(':') mydict[k] = v </code></pre> <p>However, I believe there should...
python
[7]
3,103,448
3,103,449
Get height of image inside a hidden div
<p>i want to to get the height/width of an image inside a hidden div-containter, but <code>.height()</code> and <code>.width()</code> both returns 0 (like expected).</p> <pre><code> $('body').append('&lt;div id="init"&gt;&lt;img id="myimg" src="someimage.png" /&gt;&lt;/div&gt;'); $('#init').hide(); $('#myimg').height(...
jquery
[5]
4,240,224
4,240,225
how to get the registration id for C2DM server of google for push notification?
<p>For push notification i'm planning to use C2DM google server but to use it registraion ID is need.I tried alot to get the registration id but unable to get registration id if anyone have succeded to get it then please assist me to get it </p> <p>thank you in advance.</p>
android
[4]
2,318,170
2,318,171
COM library Initilization failed with code 0x80010106 in c#
<p>i was trying to push data manually to NT using c# but i was getting an error as: "Failed to initialize COM library(0x80010106)." I have already added the reference 'Ninjatrader.Client.dll' i am posting my code as below:</p> <pre><code>using System; using System.Runtime.InteropServices; using System.Threading; usin...
c#
[0]
4,156,502
4,156,503
Find next lower item in a sorted list
<p>let's say I have a sorted list of Floats. Now I'd like to get the index of the next lower item of a given value. The usual for-loop aprroach has a complexity of O(n). Since the list is sorted there must be a way to get the index with O(log n).</p> <p>My O(n) approach:</p> <pre><code>index=0 for i,value in enumerat...
python
[7]
2,829,038
2,829,039
Asp.net UrlWriting
<p>can any one tell me why url rewriting not working in iis6?</p>
asp.net
[9]
664,142
664,143
How do I get the module instance for a class in Python?
<p>I am learning Python, and as always, I'm being ambitious with my starter projects. I am working on a plugin system for a community site toolkit for App Engine. My plugin superclass has a method called <code>install_path</code>. I would like to obtain the <code>__path__</code> for the <code>__module__</code> for <...
python
[7]
592,966
592,967
Identifying index position of duplicates in a list and fetching the elements at the identified index of another list in Java
<p>I have two list say 'src' and 'dest'. src contain some duplicates. I need to identify the index of the duplicate elements. After identifying the index, I want to fetch elements from the same index position of the 'dest' list </p>
java
[1]
1,063,174
1,063,175
Jquery conflicts between jquery.js and jquery-1.9.0.js
<p>I have two jquery one for responsive navigation and other for banner. But both are not working same time. I think there is jquery conflicts. when i comment <strong>jquery.js</strong> for banner then banner with <strong>jquery-1.9.0.js</strong> is working well. Will any one please help me to fix this. I am going to ...
jquery
[5]
4,503,260
4,503,261
Learning classes but having an odd issue that I am sure is simple
<p>So I am learning how to use classes and python and I am creating a simple program to perform arithmetic operations with rational numbers. I am creating a class called ArithmeticOperations. In this class I have a main function definition which prompts the user for the numerator and denominator of 2 rational numbers, ...
python
[7]
846,429
846,430
Installing a large size apk application on Android phone
<p>I have an application which is of size 130MB. when i try to install its displaying insufficient memory error. but i have around 170MB left in available space in internal memory. How can i Install this app? The size of the app is large because it contains many media files. In Motorolla droid its getting installed. bu...
android
[4]
5,569,527
5,569,528
How to minimize compilation time in C++
<p>I've coded an script that generates a header file with constants like version, svn tag, build number. Then, I have a class that creates a string with this information.</p> <p>My problem is the following: As the file is created in every compilation, the compiler detects that the header has changed, and forces the re...
c++
[6]
5,377,469
5,377,470
How to change the value of a textView within a widget, from the value of a textEdit in another activity
<p>If I have a widget that has a textView within it, and then a different class with an activity with a editText, is there a way to change the widget textView value, to the same value of the editText?</p>
android
[4]
4,822,401
4,822,402
android how to build a repeat AlarmManager for the day that user select every week?
<p>I want to build an Activity that user could select the days they want</p> <p>such as Sun, Mon, Tue, wed,...,Sat</p> <p>and a method in the Activity is use to set the time user choose </p> <p>'</p> <pre><code> if(action) { //10分鐘該一次 PendingIntent sender = PendingIntent.getBroadcast(MedicationAddRemine...
android
[4]
4,973,540
4,973,541
Should you make private properties?
<pre><code>private string mWhatever; private string Whatever { get { return this.mWhatever; } set { this.mWhatever = value; } } </code></pre> <p>I've seen some people who make properties for every single member, private or not... does this make any sense? I could see it making ...
c#
[0]
4,596,224
4,596,225
Is it possible for a user app to capture a screenshot(anytime) in android?
<p>Is it possible to capture a screenshot of whatever view the user has, in android using a user app - without rooting/adb. So basically i want to create a screenshot app. Hopefully my doubt is clear enough. Not enough info is there whether android allows the user app to do this or not.</p>
android
[4]
2,094,943
2,094,944
how to get the DIV ID from given HTML in JQuery
<p>I have below HTML format:</p> <pre><code>&lt;ul class="whatlike-list"&gt; &lt;li class="first"&gt; &lt;a href="/SessionHandler.aspx" class="button-flight-search"&gt;Search for Flights&lt;/a&gt; &lt;div class="open-block-holder"&gt; &lt;div id="slideFlightSearch" class="open-block" st...
jquery
[5]
4,436,047
4,436,048
Firefox/chrome is not displying uploaded image but IE6 is displaying in php why so
<p>HI Everybody</p> <p>I am uploading an user image while he/she sign up and then in his/her home page i have given a link if he/she want to show his/her uploaded image.There is no problem ..</p> <p>But when i try to see this image through firefox/chrome my image is not displaying only a tiny icon is displaying there...
php
[2]
3,450,046
3,450,047
Function for bigrams matching
<p>I have got a following function:</p> <pre><code>public static ArrayList&lt;String&gt; matchLists(ArrayList&lt;String&gt; ar1, ArrayList&lt;String&gt; ar2, ArrayList&lt;String&gt; ar3) { ArrayList&lt;String&gt; result = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; ar1.size(); i++) { for (int j = 0...
java
[1]
977,926
977,927
Rounding up with pennies in Python?
<p>I am making a change program in python. The user must input a dollar amount and then the program will calculate the change in twenties, tens, fives, ones, quarters, dimes, nickels, and pennies. I was instructed to use the round function for the pennies because If I input an amount of $58.79, the program tells me to...
python
[7]
2,593,295
2,593,296
How to sort array key based on two key values?
<p>Let's say I need to run a for loop through an array where I need to check against to key value. I would like to print the array element that doesn't match BEFORE the element that doesn't match.</p> <p>So using the array from below (extra values added for clarity), I would like it to print as follows. It needs to ma...
php
[2]
3,387,481
3,387,482
How create enum in javascript
<p>I need create named constant.</p> <p>for example:</p> <pre><code>NAME_FIELD: { CAR : "car", COLOR: "color"} </code></pre> <p>using:</p> <pre><code>var temp = NAME_FIELD.CAR // valid var temp2 = NAME_FIELD.CAR2 // throw exception </code></pre> <p>most of all I need to make this enum caus...
javascript
[3]
1,353,077
1,353,078
Storing and retrieving a long array from NSUserDefaults
<p>How can I store a long array into NSUserDefaults and retrieve it?</p> <p>Here is how my long array looks:</p> <p>long *arr;</p> <p>arr = new long [10];</p> <p>for(int i = 0 ; i&lt;10 ; i++) {</p> <p>arr[i] = i;</p> <p>}</p> <p>Now I want to store this arr into UserDefaults and then retrieve it later</p>
iphone
[8]
3,275,204
3,275,205
In C++, how can I create two interfaces for a class?
<p>For example, when creating a class library, I would like to specify an internal API and a public API for each classes, so I can hide some details from the user. The internal API would be used by other classes in the library, and the public API would be used by the library user.</p> <p>Is it possible?</p>
c++
[6]
3,183,141
3,183,142
Android device specific camera path in android
<p>I created a sample app, in my app i capture a photo and save it in a specific folder. The app runs successfully on the emulator with target 2.3.3, but when installing it on a mobile the image gets stored in the default folder in <code>/mnt/sdcard.DCIN/100ANDRO/sample.jpg</code>. Please tell me how can I overcome thi...
android
[4]
57,206
57,207
only sound is being generated not video Why?
<pre><code>public void surfaceCreated(SurfaceHolder holder) { try { mp.setDisplay(holder); mp.setDataSource("/sdcard/family.3gp"); Toast.makeText(this, "Surface created", Toast.LENGTH_LONG).show(); mp.prepare(); mp.setLooping(true); mp.start(); } catch (Illegal...
android
[4]
5,006,709
5,006,710
Difference between int and numbers.Integral in Python
<p>I'm trying to get a deeper understanding in Python's data model and I don't fully understand the following code:</p> <pre><code>&gt;&gt;&gt; x = 1 &gt;&gt;&gt; isinstance(x,int) True &gt;&gt;&gt; isinstance(x,numbers.Integral) True &gt;&gt;&gt; inspect.getmro(int) (&lt;type 'int'&gt;, &lt;type 'object'&gt;) &gt...
python
[7]
5,825,774
5,825,775
Adding a space between two linked labels
<p>This might be the silliest question ever. But how do I get to put a space between the Edit and the Delete labels? </p> <pre><code>echo " &lt;a href=\"update.php?id=" . $id . "\"&gt; Edit &lt;/a&gt;"; echo " &lt;a href=\"confirm.php?id=" . $id . "\"&gt; Delete &lt;/a&gt;"; </code></pre> <p>I tried putting <...
php
[2]
5,874,083
5,874,084
jQuery : reserve key this, and ambiguous cases
<p>I´m littel confused with <code>this</code> reserve key and cases caused errors. Here a sample code where this causes errors.</p> <pre><code>var sample = { init: function() { this.sampleFunction0(); this.sampleFunction1(); }, sampleFunction0 : function(){ var something0, something...
jquery
[5]
1,643,666
1,643,667
gallery item selector in android
<p>I am suffering from a problem regarding gallery item selector. I don't see any selector property of Gallery widget like GridView and ListView. There should be a property like android:listSelector for Gallery also. Though i have forcefully tried the android:listSelector property in Gallery, but it is not working at a...
android
[4]
1,718,152
1,718,153
Storing GUI text as a ResourceBundle (no localization)?
<p>I would like to extract out the labels, error messages, button text etc from out the java code. There is too much discrepancy right now and changing things is a pain.</p> <p>There are too many of these Strings to be implemented as constants in a java file. Ideally I would like it be something like a properties file...
java
[1]
1,313,317
1,313,318
AttributeError: 'datetime.date' object has no attribute 'date'
<p>I have a script like this:</p> <pre><code>import datetime # variable cal_start_of_week_date has type &lt;type 'datetime.date'&gt; # variable period has type &lt;type 'datetime.timedelta'&gt; cal_prev_monday = (cal_start_of_week_date - period).date() </code></pre> <p>When the above statement is executed, I get t...
python
[7]
5,228,457
5,228,458
Connection to ODBC in very restricted environment (sort of challenge)
<p>I usually type too much, so <strong>read bold copy if in a hurry</strong>.</p> <p>I'm trying to develop a little app in a very restrictive environment (at work)... I want to read data from a database, but I cant install stuff on my machine (so my usual choice of using python or visual studio is a no-no). Basically ...
javascript
[3]
3,021,100
3,021,101
limit Google autocomplete list to "belgium, france, germany, thaliand and south africa
<p>limit Google maps of countries in the autocomplete list to "belgium, france, germany, thaliand and south africa</p>
jquery
[5]
2,693,563
2,693,564
Read from internal storage file (Android)
<p>How to read the particular data from the internal storage file. For eg., I have stored 1. Device 2. Time(epoch format) 3. button text</p> <pre><code> CharSequence cs =((Button) v).getText(); t = System.currentTimeMillis()/1000; s = cs.toString(); buf = (t+"\n").getBytes(); ...
android
[4]
1,454,619
1,454,620
select 1 random keyword per line in txt
<pre><code>$kw=explode("\n",file_get_contents("keyword.txt")); shuffle($kw); </code></pre> <p>keyword.txt is just keyword in line, example :</p> <pre><code>keyword1 keyword2 keyword3 keyword4 keyword5 keyword6 keyword7 keyword8 keyword9 </code></pre>
php
[2]
379,293
379,294
How to remember to use return value?
<p>Sometimes I forget to use the return value when I <strong>have</strong> to. For example</p> <pre><code>var s = "foobar"; s.Replace("foo", "notfoo"); // correct: s = s.Replace("foo", "notfoo"); </code></pre> <p>This also applies to my custom value-like classes, for example, where I use fluent x.WithSomething() meth...
c#
[0]
4,609,109
4,609,110
Invoke a non static method from a static method
<p>Can anyone please explain me why it is illegal for static method to invoke a non static method?</p>
java
[1]
348,398
348,399
It is an error to use a se`enter code here`ction registered as allowDefinition='MachineToApplication' beyond application level.
<p>When i m trying to run my asp site it comes this error:</p> <p>Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.</p> <p>Parser Error Mes...
asp.net
[9]
5,888,715
5,888,716
Shuffle Class Instances
<p>My program is a quiz which asks questions for US States I create three instances of a class say State</p> <pre><code>State st1 = new State(); State st2 = new State(); State st3 = new State(); </code></pre> <p>like it asks a question about a state what is capital of st1.name and line below that it gives 3 option </...
android
[4]
3,736,721
3,736,722
jquery inserts in div
<p>i am having problem with jquery inserts i am using bbedit to inserts images links bold italic etc in my message box and jquery inserts the required html in the corresponding form but its not doing correctly. in below code </p> <p>in the below code .bbedit-toolbar and .bbedit-smileybar is getting inserted by jquery ...
jquery
[5]
1,022,431
1,022,432
how to get ontouch event in bitmap inside canvas?
<p>i have a bitmap inside a canvas.the class implements ontouchlistener.i need to hide the image while touch on the image.</p> <pre><code>class Panel extends View implements View.OnTouchListener { Paint linepaint=new Paint(); public Panel(Context context) { super(context); } @Override public void onDraw(Can...
android
[4]
2,148,842
2,148,843
Javascript Weird construction in simple object?
<p><a href="http://jsbin.com/ufihev/3/edit" rel="nofollow">http://jsbin.com/ufihev/3/edit</a></p> <p>Pretty simple code : </p> <pre><code>var t = new function () //line 1 { this.a1 = function () { return function () { alert("1"); }; }(); this.a2 = f...
javascript
[3]
2,795,401
2,795,402
Dynamically Selecting by ID
<p>I have the ID of a selected textarea stored in a variable. Is it possible to use that variable to select the element by ID later on in the code? For example:</p> <pre><code>var currentTextarea = null; function foo() { currentTextarea = 'pageid'; // This will be set dynamically via an event. Example only. } fu...
jquery
[5]
5,882,615
5,882,616
Upload of MediaFiles is always returning NullPointException
<p>I am encountering this weird error when uploading voice recordings from the Android device to an backend.</p> <p>I am getting the following error and nothing is uploaded:</p> <p>java.lang.NullPointerException at java.io.File.fixSlashes (File.java.=:205)</p> <p>The file name consists of the data timestamp, I have ...
android
[4]
3,282,016
3,282,017
Some trouble with jQuery
<p>Is this html </p> <pre><code> &lt;div class='title centered'&gt;SCE&lt;/div&gt; &lt;div class='description'&gt; Magna tristique pulvinar porta montes, scelerisque odio montes porta habitasse, ut, arcu scelerisque vel, pellentesque &lt;/div&gt; </code></pre> <p>I need to fade childer div (description) ...
jquery
[5]
2,846,294
2,846,295
Why does double dispatch not work in C++?
<pre><code>#include&lt;iostream.h&gt; #include&lt;conio.h&gt; using namespace std; class SpaceShip {}; class GiantSpaceShip : public SpaceShip {}; class Asteroid { public: virtual void CollideWith(SpaceShip *) { cout &lt;&lt; "Asteroid hit a SpaceShip" &lt;&lt; endl; } virtual void CollideWith(GiantSpaceSh...
c++
[6]
388,846
388,847
adding all person in form of array in ABRecordRef
<p>how can i add the people from the contacts to 'people'- array then to abrecordref.??? Actually i want all the contacts in tableview and can able to edit individual record. here is my code:</p> <pre><code>-(void)showPersonViewController { // Fetch the address book ABAddressBookRef addressBook = AB...
iphone
[8]
3,580,507
3,580,508
Spin image onclick Javascript
<p>Like the title says, I am trying to rotate an image once a user clicks a button. I am new to javasript so I am still trying to figure out how things work. I have found a good example but the two images they have are always spinning. I want my image to just spin once for 45 degrees.</p> <p>I want the image to spin l...
javascript
[3]
5,249,013
5,249,014
Getting selected value from second dropdownlist depending on first dropdown in grid view
<p>what i m trying is i have two dropdownlists inside the gridview... namely say '<strong>Client</strong>' and '<strong>User</strong>' i have 10 values in drop down list '<strong>Client</strong>' ... now what i want is if the selected value of '<strong>Client</strong>' is "onsite" the value in drop down list '<strong>U...
asp.net
[9]
3,344,361
3,344,362
How can I split text on commas not within double quotes, while keeping the quotes?
<p>So I'm trying to split a string in javacript, something that looks like this:</p> <pre><code>"foo","super,foo" </code></pre> <p>Now, if I use <code>.split(",")</code> it will turn the string into an array containing <code>[0]"foo" [1]"super [2]foo"</code> however, I only want to split a comma that is between quote...
javascript
[3]
5,842,944
5,842,945
Need help deciphering PHP error message
<p>How to overcome from below error:</p> <pre><code>Notice: Use of undefined constant temp_members_db - assumed 'temp_members_db' in /var/www/signup_ac.php on line 10 Cannot send Confirmation link to your e-mail address </code></pre> <p>Below is the Code:</p> <pre><code>&lt;?php ini_set('display_errors',1); error...
php
[2]
5,426,399
5,426,400
How to format numbers using javascript?
<p>I want to format numbers using javascript.</p> <p>For example:</p> <pre><code>10 =&gt; 10.00 100 =&gt; 100.00 1000 =&gt; 1,000.00 10000 =&gt; 10,000.00 100000 =&gt; 1,00,000.00 </code></pre>
javascript
[3]
1,954,901
1,954,902
Execute script only for newly added HTML
<p>i am creating this mini-module framework and what i'm trying to do is to reuse a module definition on a dynamically loaded HTML. it's like using the same weather widget script to power two or more weather widgets on screen, one loaded on page load, and the others loaded later. defining the module uses this format.</...
javascript
[3]
4,075,157
4,075,158
References to incomplete types
<p>According to the C++03 standard, is it valid to have references to incomplete types? I'm not aware of any implementation that implements references as any other than non-null pointers, so such code ought to work. However, I wonder whether it's standard conforming.</p> <p>I would appreciate answers with quotes and r...
c++
[6]
3,446,196
3,446,197
cin.get() not working?
<p>I'm using C++ for the first time from php. I was playing around with some code. To my understanding cin.get() was suppose to stop the page from closing until I press a key, however it doesn't seem to be working because of the code before it, I don't know what the problem is. Here is my code:</p> <pre><code>#include...
c++
[6]
5,364,864
5,364,865
How To Code a Basic Questionnaire
<p>I am new to Android and have the SDK up and running fine. I am looking for some model code to make an app with a 15-item questionnaire (yes/no) and score it. </p> <p>Suggestions?</p> <p>Thanks</p>
android
[4]
3,077,951
3,077,952
multiple file upload using jquery uploadify
<p>I have a form which used file upload. once I Pressed the uploadify button it goes to database and displayed the name it in the form. My question is that dont store it into the database until submit the form..can anyone help me to upload the file by onclick using jquey uploadify settings.</p>
php
[2]
1,109,604
1,109,605
Except statement
<p>In a function <code>check_price()</code> I try to open a .txt file, that does not exist, to read and I wanted to use except statement to catch the IOerror.</p> <p>But after, I created a .txt file and I want to use the same function to read it. However my function doesn't read the file. Can anyone help me?</p> <p>...
python
[7]
49,707
49,708
user input determines count of displays
<p>I have been trying for days to get this to work. I have the basic code but every time I try to get the last requirement added, I break the code. I'm sure I am missing a lot and that's why I can't add the alert box with the count of displays. So it asks the users name, the number of times they want to see and alert b...
javascript
[3]
1,307,946
1,307,947
check for online update when open program in C#
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/555118/suggest-a-method-for-auto-updating-my-c-sharp-program">Suggest a method for auto-updating my C# program</a> </p> </blockquote> <p>I'm sorry if this question has been asked already. i have a problem whit o...
c#
[0]
5,212,680
5,212,681
jQuery Show One Div and Hide the Others
<p><a href="http://jsfiddle.net/yrM3H/2/" rel="nofollow">http://jsfiddle.net/yrM3H/2/</a></p> <p>I have the following code:</p> <pre><code>jQuery(document).ready(function() { jQuery(".toggle").next(".hidden").hide(); jQuery(".toggle").click(function() { $('.active').toggleClass('active').next('.hidden').sl...
jquery
[5]
603,484
603,485
Difference Between Cast, Convert and AS operator?
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="http://stackoverflow.com/questions/3168704/when-to-use-a-cast-or-convert">When to use a Cast or Convert</a><br> <a href="http://stackoverflow.com/questions/702234/what-is-the-difference-between-the-following-casts-in-c">What is the difference betw...
c#
[0]
133,591
133,592
Can I create a server php variable?
<p>I want to have my own variable that would be (most likely an array) storing what my php application is up to right now.</p> <p>The application can trigger few processes that are in background (like downloading files) and I want to have a list what is being currently processed. </p> <p>For example </p> <ul> <li>if...
php
[2]
2,794,133
2,794,134
Writing a latlng to a file on the computer
<p>I made a function that can take a an address from url and return its latlng and show a marker on the address. Is there a javascript function that can write the latlng to clipboard. Thanks.</p>
javascript
[3]
1,891,358
1,891,359
Animated background using jQuery
<p>Is it possible to have a set of small images of various sizes falling continuously (like gentle snowfall) in the body or a background wrapper element using jQuery. I've looked online and found the falling leaves jQuery but it didn't look that smooth. </p>
jquery
[5]
4,536,932
4,536,933
Java voice processing
<p>I now have a demand that is, for a given speech file, like TOEFL listening or celebrities speech English, is it possible to realize the automatic conversion, text, and automatic segmentation, intercept point in time? Is there any readily available API calls?</p>
java
[1]
4,734,799
4,734,800
MVC Framework that is similar to ASP.NET MVC but for Winform
<p>I know there are MVC for Winform (MVC# etc.) but if have to develop on ASP.NET MVC and then on Desktop I don't want to have 2 different frameworks so is there anything close to ASP.NET MVC but for Winform ?</p> <p>What I mean is that the specific part of ASP.NET which is url routing for example should be replaced b...
c#
[0]
2,093,022
2,093,023
Limiting a web page to a single mac address
<p>Does any body know php code to limit the webpage you design to open on a particular pc or mac address?</p>
php
[2]
1,195,973
1,195,974
Help me out with my sloppy HTML/PHP
<p>This might sound like a silly question but how would I make this code seem...neater?</p> <pre><code> echo "&lt;h3&gt;&lt;font face='helvetica'&gt;&lt;font size='4'&gt;&lt;b&gt;&lt;font color='B80000'&gt;$title&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt; &lt;font color='A0A0A0'&gt;$category &amp;nbsp;&lt;/fo...
php
[2]
3,767,160
3,767,161
Simple MultiThread Safe Log Class
<p>What is the best approach to creating a simple multithread safe logging class? Is something like this sufficient? How would I purge the log when it's initially created?</p> <pre><code>public class Logging { public Logging() { } public void WriteToLog(string message) { object locker = ...
c#
[0]
3,032,023
3,032,024
"this" inside of a nested prototype not pointing to instance
<p>Given:</p> <pre><code>var x = function () { }; x.prototype = { y: { z: function () { console.log(this); } } }; var foo = new x(); foo.y.z(); </code></pre> <p>Why is <code>this</code> logged in the <code>console</code> as <code>y</code> instead of <code>x</code> and how is that...
javascript
[3]
3,908,239
3,908,240
Memory free up string builder an d byte[] in c#: Out of memory exception
<p>I am working on c#. I want know how i can free the stringbuilder n byte[]....Because I am getting an out of memory exception while using string builder.... Another thing is String.Replace() is also giving an out of memory exception or else is there any other way to do the same....please tell me how I can overco...
c#
[0]
436,707
436,708
Using && for conditionals in Javascript
<p>I have this:</p> <pre><code>var field = query("form#"+form.id+" input[name='" + error.field + "']"); if(field.length){ if( field[0].id ) { widget = registry.byId( field[0].id ); if(widget){ ... } } </code></pre> <p>I would have thought I could write:</p> <pre><code>var field = query("form#"+form....
javascript
[3]
59,713
59,714
PHP : Can I compile/build my site like .NET?
<p>I am new to PHP, and working on a class based web site. So my question is simple. Can I compile the site like I can in .NET?</p> <p>This would be helpful to me because I changed my IsAAction interface to accept an error callback function as a parameter of the Execute function, and I would like all of my implementat...
php
[2]
4,182,881
4,182,882
How does PHP work - literature
<p>I'm interested in literature (articles on internet, in magazines, books, podcasts - I don't really mind anything) that describes how PHP works internally, about its gotchas and perhaps some advanced functions. Is there anything like this out there? I tried to search on Google, but majority of articles were about sta...
php
[2]
3,515,254
3,515,255
How to change progress bar fore color?
<p>I want to change progress bar default(yellow) color to green color.Please help me</p> <p>Regards Mona</p>
android
[4]
2,029,122
2,029,123
How to get contacts from only Phone device?
<p>This code get contacts both Phone device and Sim Card. Now, How to get contacts only from phone <strong>without Sim card</strong>?</p> <pre><code>String selector = Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'"; mCursor = managedQuery(ContactsContract.Data.CONTENT_URI, null, selector, null, ContactsContr...
android
[4]
4,981,845
4,981,846
What does `array(&$this)` mean?
<p>Please, I would like to know what <code>array(&amp;$this)</code> means.</p>
php
[2]
3,888,237
3,888,238
Create Android App That Acts As A Shortcut To Our Mobile Site
<p>We have a special mobile version of our site that we would like to promote in the android marketplace. The "app" would effectively be a shortcut to the website, but you would be able to download it and have an icon for it, just like any other app.</p> <p>Is this possible? If so, can you link me to instructions? ...
android
[4]
5,724,360
5,724,361
PHP arrays & keys - fetching particular ones
<p>Lets say I have an array with a structure like this:</p> <pre><code>$arr= Array( array( "id"=&gt;"a" "type"&gt;"apple"), array( "id"=&gt;"b"), array( "id"=&gt;"c"), array( "id"=&gt;"c" "type"=&gt;"banana") ); </code></pre> <p>now I want to have a foreach loop which fetche...
php
[2]
964,427
964,428
javascript function not working correctly
<p>I have the following simple javascript function to slide an object up and down.</p> <p>When I first click it should slide down which it should do and alerts with true which it should do. However on the second click I want it to slideup however it detects firstclick to be true again. Any ideas</p> <pre><code>&lt;...
javascript
[3]
4,495,589
4,495,590
A class design of animal food choice question
<pre><code>class Animal { }; class Herbivore:Animal { void eat(); }; class Carnivore:Animal { void eat(); }; class Food { bool bMeat; bool bVegeable; }; </code></pre> <p>I start out this class and all of a sudden I don't know what to do to with the class Food, as I would like to print out the correct...
c++
[6]
5,961,045
5,961,046
jQuery Mobile Page Load Issue
<p>I'm building a mobile web app using jQuery Mobile. I'm facing some very strange issues.</p> <p>Pages are connected with the standard tag. Whenever I click on a link, the location in address bar changes and I do get redirected to the new page but in order for the page to render something I need to explicitly refres...
jquery
[5]
3,065,766
3,065,767
history.go(-1) going back doesnt work in Chrome
<p><code>href="#" onclick="closeOrCancel()</code> and <code>history.go(-1)</code> in that js method doesnt work in Chrome (neither <code>history.back()</code>)</p> <p>It works with <code>href="javascript:closeOrCancel()"</code> , but Opera doesn't allow <code>href="javascript:...</code></p> <p>How to make history go ...
javascript
[3]
3,468,391
3,468,392
Click on Text and Checkbox separately in CheckBoxPreference
<p>I am creating a PreferenceActivity by using the PreferenceScreen xml. I wants to open a new preference screen when click on the label(title) of a CheckBoxPreference and when the user click on check box of this CheckBoxPreference then normal preference functionality will work. So how can I do it?</p> <p><strong>For ...
android
[4]
4,802,448
4,802,449
Animation with pure javascript, no jquery
<p>I was using jquery/jquery-ui's <code>slideDown()</code> animation function for a particular task. It now transpires that I will not be able to use jQuery in this project. I also cant use YUI or any other libraries. So I wondering is there a way to perform a slideDown style animation using pure javascript?</p> <p><s...
javascript
[3]
5,733,635
5,733,636
Java String.indexOf API
<p>I have following situation,</p> <pre><code>String a="&lt;em&gt;crawler&lt;/em&gt; &lt;em&gt; Yeahhhhh &lt;/em&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table"; System.out.println(a.indexOf("&lt;/em&gt;")); </code></pre> <p>It returns the 11 as the result which was the first that it founds.</p> <p>Is there any way to detect th...
java
[1]
4,660,309
4,660,310
Running 2 instances of the Camera at the same time
<p>was wondering if it is possible to have 2 instances of the camera preview in android. what i mean is running 2 instances of the camera at the same time. if it is, How would one go about this, will there be need to implement an instance on a different thread? I have not used the camera api before, so i would appreci...
android
[4]
4,550,974
4,550,975
Change color in part of my message
<p>I need to change my text color for specific word in my text. I have used to generate my text as below.</p> <pre><code>String message=string.empty; String message1=”something”; String message2=”something”; message += “My Message is”+ message1+ “and” + message2; </code></pre> <p>and I send this message as a email b...
c#
[0]
2,040,585
2,040,586
<identifier> expected. java
<p>I have this snippet of java code. I am a noob in java.. </p> <p>Error :</p> <pre><code>&lt;identifier&gt; expected cfg = new Config; </code></pre> <p>Code:</p> <pre><code>import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLEx...
java
[1]
5,322,352
5,322,353
How to find out if a letter's unicode number is odd or even without checking for said unicode number in java?
<p>For example the unicode number for 'A' is 65, and the one for 'B' is 98. </p> <p>Thus a, c, e, g, etc have odd unicode numbers and b, d, f, h, etc have even unicode numbers. </p> <p>How would I go about checking whether a char is odd or even?</p> <p>Keep in mind I'm not an advanced programmer. </p>
java
[1]
95,624
95,625
How to get a reference of the content window of the parent window from an iframe, when the parent is cross domain
<p>I need to so that the iframe can send a postMessage to it.</p>
javascript
[3]
4,517,442
4,517,443
php script that populates photos to a html div
<p>I currently have a picture page with about 250 jpeg. Images and I currently have a web page where I manually assigned a picture to a section on the page, however this is very time consuming and would like to create a script that will run through and assign the images to a div. While this normally would be easy my pr...
php
[2]
1,790,681
1,790,682
How to check string vector for a certain letter or phrase?
<p>I have a string vector in C++ with this [Apples,Orangesandgrapes], Now i would like too search the vector not for the whole string but the part of the string that says "andgrapes" and would like to change it too, "nograpes". All just an example.</p> <p>Answer on <a href="http://stackoverflow.com/questions/3497310/s...
c++
[6]
3,041,284
3,041,285
unresolved externals of creating a static instance in C++
<p>I have produced this C++ code:</p> <pre><code>class TestInstance { public: TestInstance(); ~TestInstance(); static TestInstance&amp; GetInstance(); private: static TestInstance* testInstance; }; </code></pre> <p>But I got this error when compiling:</p> <blockquote> <p>er...
c++
[6]
476,506
476,507
Combining PHP Variables
<p>I've the following code:</p> <pre><code>if ($type == 'unit'){ $item_title = $result["title"]; } elseif ($type == 'message'){ $item_title = $result["description"]; } // all should combine unit and message elseif ($type == 'all'){ $item_title = $result["description"] $item_title .= $result["title"]; } if (st...
php
[2]
2,686,586
2,686,587
jquery checkboxes, how to get all selected checkboxes and add them to array?
<p>Hi I have the following page:</p> <pre><code>&lt;input type="checkbox" name="fruit1" id="1" class="box"&gt;Banana&lt;br /&gt;&lt;br /&gt; &lt;input type="checkbox" name="fruit2" id="2" class="box"&gt;Cherry&lt;br /&gt;&lt;br /&gt; &lt;input type="checkbox" name="fruit3" id="3" class="box"&gt;Strawberry&lt;br ...
jquery
[5]
4,608,069
4,608,070
Insert text to editor, when focus is not in the div editor
<p>I want to insert some text into the editor. But the focus is not inside the editor(div contenteditable="true"). How can i insert text before cursor is shown.</p>
javascript
[3]
2,579,461
2,579,462
asp.net dataset xsd error : variable is used before it has been assigned a value
<p>I am using visual studio vb asp.net, i am trying to use dataset.xsd. but i am getting error. It is showing error , that ABC variable is used before it has been assigned a value a null reference exception could result at the runtime</p> <p>in my program i have loginDataSet.xsd > uloginDS</p> <p>this is the coding<...
asp.net
[9]