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,342,340
1,342,341
Show children onmouseover but on mouseoff hide the children
<p>I trying to make a menu compatible with IE... :( </p> <p>I did a menu using css that has this structure:</p> <pre><code>&lt;div id="menu"&gt; &lt;ul id="menuu"&gt; &lt;li&gt;&lt;a href="#" class="parent"&gt;Parent&lt;/a&gt; &lt;ul class="children"&gt; &lt;li&gt;&lt;a href="/#"&gt;name&lt;/a&gt;&lt;/li&gt; &lt;li&g...
jquery
[5]
1,364,588
1,364,589
Controlling Activities
<p>I'd like the activity stack for my app to contain multiple instances of the same activity, each working on different data. So I'd have activity A working with data a, b, c and d in my activity stack ad I'd have 4 instances of activity A that I'd call A(a), A(b), A(c) &amp; A(d). I'd also like to arrange it so that...
android
[4]
5,029,542
5,029,543
how to assign a char value to string variable in c#
<p>i have a string strText with certain value on it,i need to assign '\0' or charactor at the specified position of strText. ie strText[5]='\0'.how is it possible in c#.</p>
c#
[0]
1,942,864
1,942,865
How does jQuery achieve making $ an alias for the jQuery function?
<p>I’m having a little trouble wrapping my head around the $ sign being an alias for the jQuery function, particularly in a plugin. Can you explain how jQuery achieves this aliasing: how does it define '$' to be an alias for the jQuery function? That's the first question.</p> <p>Secondly, can you explain how/why the f...
jquery
[5]
3,966,782
3,966,783
how to deal with asynchronous function?
<p>I have two asynchronous objects fn1 and fn2 and sometimes I want to run them synchronously.</p> <p>For simplicity I wrote the code in this way:</p> <pre><code>var fn1 = function () { setTimeout(function () { console.log("fn1"); },200); }; var fn2 = function () { setTimeout(function () { ...
javascript
[3]
4,075,492
4,075,493
dissecting a generic type
<p>Suppose <code>t</code> is variable of type <code>System.Type</code> with the value</p> <pre><code>System.Collections.Generic.Dictionary`2[System.String,System.Int32] </code></pre> <p>Is there a method I can call on <code>t</code> such that it will return:</p> <pre><code>System.Collections.Generic.Dictionary </cod...
c#
[0]
1,421,910
1,421,911
using jQuery delegate in a JQuery plugin
<p>If I am writing a jQuery plugin as </p> <pre><code>$.fn.newWin = function(docTypes) { $(this).live("click",function(){ alert("I am done"); }); }; </code></pre> <p>This plugin can be invoked as </p> <pre><code>$("#content a...
jquery
[5]
1,938,281
1,938,282
Python 2.7 or Python 3 (for speed)?
<p>I've looked around for answers and much seems to be old or outdated. Has Python 3 been updated yet so that it's decently faster than Python 2.7 or am I still better off sticking with my workable code?</p>
python
[7]
4,755,583
4,755,584
Why the second time I run "readlines" in Python in the same file nothing is returned?
<pre><code>&gt;&gt;&gt; f = open('/tmp/version.txt', 'r') &gt;&gt;&gt; f &lt;open file '/tmp/version.txt', mode 'r' at 0xb788e2e0&gt; &gt;&gt;&gt; f.readlines() ['2.3.4\n'] &gt;&gt;&gt; f.readlines() [] &gt;&gt;&gt; </code></pre> <p>I've tried this in Python's interpreter. Why does this happen?</p>
python
[7]
4,281,411
4,281,412
How to filter specific applications for (share) Email intent?
<p>I am using Action Send and createChooser APIs in my app to share some text message through various Email apps.But I dont want all the apps that i have installed in my device.I want specifically facebook,Gmail and Twitter to be in the that chooser List.How to filter like this?Thanks</p> <pre><code>String TEXT = "I s...
android
[4]
2,711,501
2,711,502
Textarea inside div, getting changed value
<p>i have textarea and lot of other HTML elements inside one div, like this:</p> <pre><code> &lt;div id="holder"&gt; &lt;textarea id="txt"&gt;Some text&lt;/textarea&gt; &lt;img src="/someurl/test.png" /&gt; &lt;div class="test"&gt;Blah&lt;/div&gt; &lt;/div&gt; </code></pre> <p>When i try to get all html inside "h...
jquery
[5]
49,158
49,159
ASP.NET OracleMembershipProvider
<p>I use the OracleMembershipProvider on an asp.net application.</p> <p>I want to force users to change their password on first login but how?</p>
asp.net
[9]
689,252
689,253
Error when making class protected
<p>I am getting the error "Remove invalid modifier" when I use the <code>protected</code> keyword on class Zoo. </p> <pre><code>protected class Zoo { int x=5; String coolMethod() { return "Wow baby"; } static Test t=new Test(); } public class Test { public static void main(String args[]) { Test zoo=new Te...
java
[1]
4,575,553
4,575,554
How to get rid of NameError in Python?
<p>Hi I just executed the following code :</p> <pre><code>from Tkinter import * class LabelDemo( Frame ): def __init__( self ): Frame.__init__( self ) self.pack( expand = YES, fill = BOTH ) self.master.title( "Labels" ) self.Label3 = Label( self, bitmap = "warning" ) self.Label3....
python
[7]
4,995,517
4,995,518
Starting alarm service in android
<p>In my application i want to use alarm service for specific period of time.I'm taking start time and end time values from user and saving it in database,Now i want to start a alarm service at start time and alarm should go off at end time specified by user.I'm new to this topic and not able to understand how to imple...
android
[4]
1,735,428
1,735,429
Is there a C# "Library Of Objects" website?
<p>If I need a regular expression, I can go to regexlib.com and with a bit of luck, find a regular expression for my requirement.</p> <p>If I need a class for, say "Employee", is there a centralised resource out there where I can just grab the code for a sample Employee object? I say Employee here as a simple example;...
c#
[0]
3,973,503
3,973,504
Explode function in PHP
<p>I have the following notepad file;</p> <pre><code>dbName: tableName: numberOfFields: </code></pre> <p>I am trying to write a php app which assigns the value of dbName to $dbName, tableName to $tableName and numberOfFields to $numFields.</p> <p>My code is:</p> <pre><code>$handle = @fopen("c...
php
[2]
2,023,955
2,023,956
Youtube bot in Javascript
<p>OK, so I have some Javascript code, but the thing is, I don't know if it works or not. The Javascript code is supposed to :</p> <ul> <li>remove the ".mp4" extension from every title</li> <li>change my video category</li> <li>put the same description in all of the videos</li> <li>put the same keywords in all of the ...
javascript
[3]
3,516,767
3,516,768
Issue in running app in 1024 x 600 resolution device
<p>In my res folder i have layout-hdpi, layout-mdpi, layout-xhdpi and layout-ldpi folder. Now my problem is that tablets with resolution 1024 x 600 takes layout from layout-mdpi folder. Due to which its difficult for me to manage layout for other devices also. Because HVGA device with resolution 320 x 480, also takes l...
android
[4]
2,782,060
2,782,061
Android Tablet: working with external trackpad and touchpad(drawing)
<p>i want to attach external trackpad with my android tablet, i want to do some drawing type stuff. can you pls help me how to do that?</p> <p>Thanks</p>
android
[4]
5,828,262
5,828,263
Error using ArrayList in Java
<p>I was solving a problem before including it in my code and using List to get strings then work around with them. I got the error: "type List does not take parameters List words = new ArrayList();" after compilation. I searched but the syntax i use is correct, please whats wrong with the code? </p> <pre><code>impor...
java
[1]
4,698,996
4,698,997
Ignore attributed and compare collections
<p>I want to compare 2 Collections using <code>CollectionUtils.isEqualCollection</code>. Before this, I need to remove or ignore one attribute of one object collection, this attribute needs to be ignored or deleted, because it is filled in only one collection.</p> <p>Anyone can help me?</p>
java
[1]
3,796,940
3,796,941
How to "import" a static class in C#?
<p>I have created a public static class utils.cs I want to use it in other classes without prefixing method with utils, what's the syntax to do this ?</p>
c#
[0]
1,846,188
1,846,189
Null pointer errors with Static methods
<p>I have getting a number of error reports from an application of mine that don't seem to make any sense. I have a static class that has a number of public static methods that are called from other parts of my code. Most of these methods create an element on an XML document.</p> <p>The first line in most of these met...
c#
[0]
2,173,797
2,173,798
Problems with undersanding the code
<p>i have found this code for the course on edx.com. Can someone tell me why do i have to use the remainder in the for loop? How does it affect the dict?</p> <pre><code>def buildCoder(shift): """ Returns a dict that can apply a Caesar cipher to a letter. The cipher is defined by the shift value. Ignores no...
python
[7]
3,666,162
3,666,163
Two layouts for a single activity
<p>Can i give two layouts for a single activity?? If yes, then how can i join them?? First layout should contain heading and the other one will be used in list adapter and repeated for every item in the list..</p> <p>Thanks</p>
android
[4]
5,434,897
5,434,898
Dealing with jQuery statement with lots of AJAX calls
<p>What is the best way to deal with an jQuery statement that has many AJAX calls?</p> <p>The code below seems slightly inefficient.</p> <pre><code>$("#search_building").on("change blur", function () { var building = $("#search_building").val(); var room = $("#search_room").val(); var dept = $("#dept").va...
jquery
[5]
5,104,657
5,104,658
How to pass an object to an Activity in a library?
<p>I have a library and application that uses it. I need to change this code so that a user of library could pass its own implementation of IDialog to LibActivity (not modifying a source code of a library). What is the best way to pass an object to an activity in library ?</p> <p>library:</p> <pre class="lang-java ...
android
[4]
3,581,656
3,581,657
Can I use cURL to write to a file locally without using fopen in PHP?
<p>A web hosting service I'm trying to use does not allow PHP fopen. Can i write text to a file locally using cURL but without using fopen?</p>
php
[2]
4,166,966
4,166,967
why is javascript incrementing my number?
<pre><code>&lt;span id="9460116557269599" onclick="getdata(6557269599,9460116557269599)"&gt; More...&lt;/span&gt; function getdata(tn,x){ alert(x); } </code></pre> <p>Why is 9460116557269600 received as x.</p> <p>It should be 9460116557269599.</p>
javascript
[3]
2,715,344
2,715,345
Android read/write a few string
<p>i want to read/write a few string into android file</p> <p>So i write information from tree EditTexts</p> <pre><code>public void save(Person p) { try { FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE); fos.write(p.getName().getBytes()); fos.write(p.getSurname().get...
android
[4]
3,284,326
3,284,327
How to get the margin of layout in android?
<p>How to get the distance between the top of child layout and Main Screen in Android?</p> <p>I set up the Relative layout at somewhere of Main Screen. Now, I wanna know that the top and left margin of layout.</p>
android
[4]
1,509,309
1,509,310
Function design decisions
<p>I am developing a library of some utility functions in C++. I have a doubt regarding the function signatures in that library. If a function takes some parameters and returns a value, should the variable into which the result of that function is stored also be passed as a parameter to that function? How should I hand...
c++
[6]
5,814,616
5,814,617
Help with Singleton - Setting Auto Properties?
<p>I'm trying to set my Auto Properties but they are non-static and so I get the error "Cannot access non-static property in static context" when trying to set the properties Credentials, Certificate, and UrlEndPoint.</p> <pre><code>public class PayPalProfile { #region Fields static PayPalProfile _instance; ...
c#
[0]
1,704,858
1,704,859
How to show search result using user control window in windows application?
<p>My project is standalone application. I want to show my search result using user control window. so I added user control to my project. and I wrote code for it attached to form. It attached properly. But I want show my search result using that user control window's text box so how can i do this. Please help me in fo...
c#
[0]
3,411,007
3,411,008
Extracting data from a window in an application using c#
<p>I have an application which consists of a couple of windows along with the main one. Please help me to extract some data present in one of these windows using c#.. </p>
c#
[0]
2,225,245
2,225,246
Converting list item to custom list item with image
<p>I am doing one project, where I have one list with simple list items now I have to put images with the list items.. Here is my coed</p> <pre><code> ArrayList&lt;HashMap&lt;String, String&gt;&gt; mylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); String xml = XMLfunctions.getXML(); Document ...
android
[4]
2,907,893
2,907,894
Is PHP capable of caching count call inside loop?
<p>I know the more efficient way to have a loop over array is a foreach, or to store count in a variable to avoid to call it multiple times. But I am curious if PHP have some kind of "caching" stuff like:</p> <pre><code>for ($i=0; $i&lt;count($myarray); $i++) { /* ... */ } </code></pre> <p>Does it have something simi...
php
[2]
4,929,603
4,929,604
Remove All Characters After First Character
<p>Say I have the string:</p> <pre><code>fame = "John" lname = "Doe" </code></pre> <p>What I want to do is make it so I can take the lname and make it so that everything after the first character is deleted, so I can abbreviate the last name. The output would be:</p> <pre><code>fullname = "John D." </code></pre> <p...
python
[7]
2,589,377
2,589,378
SpeechKit ASR issue for Android4.0
<p>I have met with an issue in SpeechKit ASR for Android4.0. while integrating with 4.0, speechkit dialog box repeatedly asking for recording the sound. But the same code works for the lower end OS. Does SpeechKit has support for Android4.0?</p>
android
[4]
4,815,225
4,815,226
Android: Injecting Javascript into a Webview outside the onPageFinished Event
<p>Hey experts, actually it's a pretty simple question...just don't know about the answer.</p> <p>I have an Android app, running a WebView that loads a certain page, also part of the app.</p> <p>At a given moment, i want to call a javascript function inside the WebView page, but i wanna do this outside the onPageFini...
android
[4]
1,346,514
1,346,515
javascript: adding function to function inside .prototype = {
<p>If I add a function in the "constructor", I can extend it with an other function like so:</p> <pre><code>var MyClass = function() { this.time = function() { return 4.5; } this.time.formatted = function() { return format(this.time(), "HH:mm"); } } </code></pre> <p>I can't figure out a nice way to do this if...
javascript
[3]
2,552,744
2,552,745
What is the result of i + ++i?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/949433/could-anyone-explain-these-undefined-behaviors-i-i-i-i-i-etc">Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc&hellip;)</a> </p> </blockquote> <p>Why this code is generating 8 ...
c++
[6]
1,759,908
1,759,909
java.lang.OutOfMemoryError: bitmap size exceeds VM budget?
<p>friends,</p> <p>i am using following code to display bitmap on screen and having next and previous buttons to change images.</p> <p>and getting out of memory error</p> <p><strong>New Code</strong></p> <pre><code>HttpGet httpRequest = null; try { ...
android
[4]
315,486
315,487
Must default function parameters be constant in C++?
<pre><code>void some_func(int param = get_default_param_value()); </code></pre>
c++
[6]
4,074,275
4,074,276
JQuery button Problems & onclick highlight input text?
<p><strong>JSFiddle:</strong> <a href="http://jsfiddle.net/j7Nuc/" rel="nofollow">http://jsfiddle.net/j7Nuc/</a></p> <p>My initial question was going to be regarding how to highlight the font size upon clicking the drop down as the following does not work:</p> <pre><code>$('#Font-Size input:text').text().highlight('1...
jquery
[5]
1,598,947
1,598,948
How do i calcalate using the padding
<p>I am trying to do some calculation with the height of an element and i need to factor in the padding of an element.</p> <pre><code>var element_top = $(".box").position().top; var element_height = $(".box").height(); var element_padding = $(".box").css("padding"); </code></pre> <p>the first two give me numbers i ca...
jquery
[5]
1,870,722
1,870,723
How to force my app to the front
<p>I have developed an android app that uses a timer with a call back. When a specific criteria has been satisfied, the app either rings or vibrates the phone depending on user settings. It will continue to ring until the user acknowledges an alert box. This all works fine. However, if the user has brought another ...
android
[4]
4,087,010
4,087,011
passing a text string and a variable into into href selector
<p>I need to pass a string AND a variable as a selector into a href attribute, but I can't seem to get the syntax correct. Can anybody help?</p> <p>I currently have a variable 'gallery' which I need to pass in the something like:</p> <pre><code>$('#work_gallery li a[href="http://www.ddbremedy.co.uk/siteupdate/" + gal...
jquery
[5]
1,863,368
1,863,369
GradientDrawable in Code
<p>I can use the following XML just fine</p> <pre><code> &lt shape android:shape="rectangle" xmlns..."> &lt gradient android:startColor="#255779" android:centerColor="#3e7492" android:endColor="#a6c0cd" android:angle="90" /> &lt stroke android:width="1dp" android:color="#0...
android
[4]
5,210,795
5,210,796
MultipartEntity image is not upload
<p>I want to upload image using MultipartEntity. I have try below code.</p> <p>I did not get any error but image is not upload. I have enough permission for upload</p> <p>PHP</p> <pre><code>&lt;?php //Receive the data from android $name = $_POST['name']; $data = $_POST['data']; //Receive the file ...
android
[4]
971,195
971,196
Animate drawableLeft APNG in button?
<p>I'm trying to add an animated PNG to a Button as a drawableLeft. </p> <p>Basically, the button begins its life disabled and unclickable with animated PNG of a 16x16 indeterminate progress icon. </p> <ul> <li><p>If I can grab a cached location from the GPS, the button becomes enabled &amp; clickable and has its tex...
android
[4]
5,174,696
5,174,697
call subclass methods by superclass reference
<p>I have code like this:</p> <pre><code>String stringRef = new String("Java"); // (1) System.out.println("(2): " + stringRef.getClass()); // (2) System.out.println("(3): " + stringRef.length()); // (3) Object objRef = stringRef; // (4) // System.out.p...
java
[1]
3,017,353
3,017,354
C++ -- why the operator= return a reference to *this rather than an object to *this?
<pre><code>class MyClass { public: ... MyClass &amp; operator=(const MyClass &amp;rhs); // return MyClass&amp; ... } </code></pre> <p>why not</p> <pre><code>class MyClass { public: ... MyClass operator=(const MyClass &amp;rhs); // return MyClass ... } </code></pre> <p>Is it the reaso...
c++
[6]
4,652,370
4,652,371
message sending while pressing the button
<p>I am creating basic application in android and i am beginner of the android devloping.</p> <p>I am creating the application which the numbers of inbuild messages in that when user click on send sms then that message deliver to user using their message box</p> <p>in that below gives the snapsot.</p> <p><img src="h...
android
[4]
528,299
528,300
Python: Check if all dictionaries in list are empty
<p>I have a list of dictionaries. I need to check if all the dictionaries in that list are empty. I am looking for a simple statement that will do it in one line.</p> <p>Is there a single line way to do the following (not including the print)?</p> <pre><code>l = [{},{},{}] # this list is generated elsewhere... all_em...
python
[7]
5,242,085
5,242,086
How to get Items from Database to Combobox and textBox
<p>I have a table from Sqlite: </p> <p><code>KHACHHANG(id,name,email,phone,address)</code>.</p> <p>I want to create a windows form which show a combobox of KHACHHANG.name , when I choose a name in that list . Another textboxes ( Email,Phone,Address ) will auto fill in :) Thanks so much .</p>
c#
[0]
1,448,490
1,448,491
What's the equivalent of IE's document.all in DOM?
<p>I basically want to dynamically apply some style to all elements in a page, I know document.all is proprietary to IE, so, what's the equvalent (if any) in DOM? Is there an equivalent to * in css in DOM?</p> <p>Note: Don't want to use JQuery or any other JS lib for this, just JS, thanks</p>
javascript
[3]
1,273,598
1,273,599
Which CodeIgniter-like program for PHP, based on my idea?
<p>What is the best program like CodeIgniter for PHP that I should use to create a student database system?</p> <p>I'm doing this as just a random project so that I can learn about these types of programs.</p> <p>I just wanted to ask the more experienced users what they would recommend.</p> <p>Thank you.</p>
php
[2]
5,617,586
5,617,587
C2678 error on remove from list of custom datatypes
<p>I'm currently hard at work on an assignment piece, which contains several custom datatypes. I've run into a problem where list is complaining that I am trying to remove a custom data type from a list of that same data type.</p> <pre><code>Error 3 error C2678: binary '==' : no operator found which takes a left-h...
c++
[6]
1,814,973
1,814,974
C# How to show the default Image selector when clicked in a propertygrid?
<p>I have a class with an Image property. This property is exposed via the propertygrid. I want to show the default image window. How can I do this? And how can I get the selected value?</p> <p>It is the same functionality as when you choose an Image for a Form. I want to show that window.</p>
c#
[0]
75,988
75,989
What to do if I want to remove the effect generated by innerfade
<p>What to do if I want to remove the effect generated by innerfade. Means What to do if I want to stop this rotation? My code looks like below. </p> <pre><code>$('#brands').innerfade({ speed:500, timeout: 6000 }); </code></pre>
jquery
[5]
3,194,015
3,194,016
When are javascript functions executed
<p>I think it has to be an easy question but I have been searching around and have not found the answer anywhere.</p> <p>The think is that I have an html page with some scripts (in the body) like this one:</p> <pre><code>&lt;script type="text/javascript"&gt;grf();&lt;/script&gt; </code></pre> <p>The grf() function i...
javascript
[3]
2,964,883
2,964,884
jQuery select dropdown and selectedq
<pre><code> var colorID = 3; $('#color').each(function(){ if($('#color').val() == colorID ) $('#color').attr('selected'); }); </code></pre> <p>Why doesn't this work?</p> <p>My html</p> <pre><code>&lt;select id="color"&gt;&lt;option value=""&gt;Select Color&lt;/option&gt; &lt;option value="1"&gt;Red&...
jquery
[5]
3,211,648
3,211,649
streaming video from android phone to pc using wifi and bluetooth
<p>hi i am developing an application that needs to play video and audio to PC via WIFI and Bluetooth streaming from android device , i have done lots of search on google but cant find the tutorial, can anyone provide me some Tutorial or Link. Thanks in advance</p>
android
[4]
1,845,977
1,845,978
Compile error "'struct' type redefinition" although it's the first definition for it
<p>Everything was working well untill I moved some code from the main file to a new class, then I had the following error:</p> <blockquote> <p>error C2011: 'color1' : 'struct' type redefinition</p> </blockquote> <pre><code>struct color1 { color1() { red = green = blue = 0; } color1(float _r...
c++
[6]
5,629,262
5,629,263
JS Query- Global Window Object
<p><a href="http://jsfiddle.net/yjcXe/" rel="nofollow">This code generates x is not defined</a></p> <pre><code>var myobj1 = { x:9, myfunction:function() { if(this === window) alert("x is not Defined"); else if (this === myobj1) alert(this.x); else ...
javascript
[3]
3,103,911
3,103,912
how to set values from database into the textfield
<pre><code> private void btgetinvActionPerformed(java.awt.event.ActionEvent evt) { //JOptionPane.showMessageDialog(null, "REMITTANCE ID IS VALID!"); try { DBUtil util = new DBUtil(); Connection con = util.getConnection(); PreparedStatement stmt = con.prepareStatement(...
java
[1]
5,003,541
5,003,542
What is the equivalent keyword for extern in java?
<p>I have one public static variable in one file and how can I export the same variable to other files?</p> <p>For ex:-</p> <p>file1.java</p> <pre><code>public final static int buf = 256; </code></pre> <p>file2.java</p> <p>How can I access the variable "buf" in this file?</p>
java
[1]
5,132,657
5,132,658
prevent all elements within a div from being selected. \
<p>i am trying to prevent all elements within a div from being selected. this is not working. </p> <p><code>$('*').not('#someid &gt; *')</code></p>
jquery
[5]
2,016,595
2,016,596
How am I able to assign a value to a literal? ('a' = 10)
<pre><code>def foo(**args): for k, v in args.items(): print type(k), type(v) for k, v in args.items(): k = v print k print type(k) foo(a = 10) foo(**{'a':10}) </code></pre> <p>Gives me</p> <pre><code>&lt;type 'str'&gt; &lt;type 'int'&gt; 10 &lt;type 'int'&gt; &lt;type 'str'&gt; &lt;ty...
python
[7]
3,851,545
3,851,546
Javascript validation, where string is compiled of only any number of spaces
<p>I am looking for a function that will return true / false if the string in question is complied of any number of spaces. The common method of doing this is <code>if (string == " ")</code> but this only works for one space. I need a function that would resolve any number of spaces to a return statement.</p> <p>examp...
javascript
[3]
1,942,827
1,942,828
Finding the two highest numbers based on input
<p>I'm tasked in completing a program where the user enters student names and their scores. In the end, the program should output the two students with the highest scores, however I'm only able to output the student with the highest score.</p> <pre><code>public class StudentScores { public static void main(String[] ar...
java
[1]
812,500
812,501
Difference between Object.create(foo) and new Object(foo)?
<p>Why is that this code:</p> <pre><code>var foo = {one: 1, two: 2}; var bar = new Object( foo ); bar.three = 3; bar.one = 100; document.write(bar.one); //100 document.write(foo.one); //100 </code></pre> <p>results in bar.one &amp; foo.one being both 100, while</p> <pre><code>var foo = {one: 1, two: 2}; var bar = ...
javascript
[3]
2,470,030
2,470,031
PHP error: Undefined index: submit
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index">PHP: “Notice: Undefined variable” and “Notice: Undefined index”</a> </p> </blockquote> <p>In this once the submit button is clicked it retrieve ...
php
[2]
4,964,503
4,964,504
How to condense multiple for loops with different initial values
<p>In a function, I have several consecutive for loops with the same code but different initial values for the control variable. The initial values are obtained from inputs to the function. Ie,</p> <pre><code>void thisFunction( class A a){ //some other code for (int i = a.x; i != 0; --i){ code } for (int...
c++
[6]
5,205,016
5,205,017
How to Inpect Content of a Function?
<p>There is a function called <strong>ytPlayerSIZE_CLICKED2</strong> on Youtube.com. I want to inspect the code of that function. Using the below code does not give me enough information via Firebug console:</p> <pre><code>alert(ytPlayerSIZE_CLICKED2.toString()) </code></pre> <p>How can I find the contents of that fu...
javascript
[3]
483,113
483,114
Cannot find associated value in a hashmap from a passed in key
<p>I am working with some existing code in my Eclipse project. In the method below called <code>cardTypeForPbfValue()</code>, I cannot find the key in the <code>HashMap</code> even though I can see it while debugging my the code. The <code>pbfValueMap</code> is populated as follows:</p> <pre><code>[1=ATM, 2=DEBIT, 3...
java
[1]
4,060,059
4,060,060
php merge arrays
<p>I have been trying (unsuccessfully) to merge the output of multiple arrays into a single array. An example of what I tried was:</p> <pre><code>$data1 = array("cat", "goat"); $data2 = array("dog", "cow"); print_r(array_merge($data1, $data2)); </code></pre> <p>That worked fine, but with the code I am using below, ho...
php
[2]
2,533,254
2,533,255
Scrolling to radio button on form onBlur of textbox
<p>I have a questionnaire form for users to complete. When a user completes one question (firing the onBlur event), the page scrolls smoothly to the next question (using an anchor tag) for them to complete. This works fine except for the following scenario (shown in the jsFiddle):</p> <ul> <li>User enters text in fi...
jquery
[5]
5,955,469
5,955,470
Unique email addresses by domain
<p>Im trying to make the below function only return 1 email per domain. </p> <p>Example: if i feed the function:</p> <blockquote> <p>email1@domain.com email2@domain.com email1@domain.com email1@domain.com email3@test.co.uk</p> </blockquote> <p>I want it to return </p> <blockquote> <p>email1@domain.com email3@...
php
[2]
6,025,045
6,025,046
Date Time Picker Custom Format
<p>this is my code: </p> <pre><code>dateTimePicker1.ShowUpDown = true; dateTimePicker1.CustomFormat = "HH:MM"; dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom; </code></pre> <p>Hi I use Custom Format for my <code>dateTimePicker</code> until do not show second but its format hide A...
c#
[0]
5,287,962
5,287,963
Getting Android Play/Market ID of the user
<p>Is it possible to somehow get the ID of the user with which they are currently logged in on Andoid Play?</p> <p>It would be really useful for the developers. They won't need to have users signed up on each application. They could just identify the user by their Android Play ID.</p>
android
[4]
75,377
75,378
How do I call a c# windows application from a control?
<p>I need to invoke a c# application within my c# control, as I do not feel like rewriting the application as a control. </p> <p>I am able to launch the application using System.Diagnostics.Process.Start.</p> <p>Now how do I call the methods in my application from/via the c# control as this is where I invoked the app...
c#
[0]
2,124,907
2,124,908
C++ very simple thread?
<p>What is the simplest way of making a thread in c++? I want to make one that uses an already declared method to run. Something like:</p> <pre><code> void task1(){ cout &lt;&lt; "Thread started"; } thread t1 = thread(task1()); </code></pre> <p>I guess I want to make a thread that doesn't require downloading a...
c++
[6]
3,452,150
3,452,151
Android get contact number using name
<p>I am trying to make an application on android that takes the contact name as a string input and returns his phone number if that contact exists in the phone book...</p> <p>I tried searching around but there is no clear tutorial as to how to do exactly that</p> <p>input:contact name outputs:the phone number</p> <p...
android
[4]
5,534,734
5,534,735
Can't access fields of a Javascript Object
<p>The following Javascript function returns a JS object:</p> <pre><code>function getCookies() { var result = {}; var cookie = {}; var cookies = document.cookie.split(';'); for (var i = 0; i &lt; cookies.length; i++) { cookie = cookies[i].split('='); result[cookie[0]] = cookie[1]; }...
javascript
[3]
2,146,435
2,146,436
java.util.zip.ZipException: error in opening zip file
<p>I have a Jar file, which contains other nested Jars. When I invoke the new JarFile() constructor on this file, I get an exception which says "java.util.zip.ZipException: error in opening zip file". When I manually unzip the contents of this Jar file and zip it up again, it works fine. Also, please note that this exc...
java
[1]
3,731,480
3,731,481
How to ask PHP to find filename that contains something
<p>im trying to do this :</p> <pre><code>$filename = "/destination/destination2/file_*"; </code></pre> <p>" * " = anything</p> <p>destination2 files :</p> <p>file_somethingrandom</p> <p>and since it $filename contains * so it should be selecting file_somethingrandom </p> <p>how to do it?</p>
php
[2]
1,905,844
1,905,845
How can I use jQuery to change my HTML so each text in an <li> is surrounded by a <span>?
<p>I have the following HTML:</p> <pre><code>&lt;ul id="breadcrumb"&gt; &lt;li&gt;abc&lt;/li&gt; &lt;li&gt;&lt;span&gt;xx&lt;/span&gt;&lt;/li&gt; &lt;li&gt;xxxxx&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>How can I use jQuery to make it so that every <code>&lt;li&gt;</code> has its contents enclosed with a <...
jquery
[5]
3,862,386
3,862,387
Album artwork from mp3
<p>i managed to read album artwork from my mp3 file(on sdcard) but the picture is biger than activity. How can i downsize(compress) picture to 150x150 pixels?</p>
android
[4]
1,553,043
1,553,044
jquery with or without extend keyword
<p>Can anyone tell me any difference between these two kinds of extend function? thanks.</p> <pre><code>$.fn.alertWhileClick= function() { alert($(this).val()); } $.fn.extend({ alertWhileClick:function(){ alert($(this).val()); } }); </code></pre>
jquery
[5]
5,525,137
5,525,138
Turn PHP echo into if/else
<p>I have a PHP echo like this, code below:</p> <pre><code>&lt;?php echo($row['buildingdesignsvo']); ?&gt; </code></pre> <p>How do I turn this into a If/Else based on the contents of the echo? If the echo for example is either value1 or value2 it displays a link like this <code>&lt;a href=""&gt;Link&lt;/a&gt;</code>...
php
[2]
2,792,840
2,792,841
focus on user input using Scanner class in java
<p>When using a Scanner object is it possible to ensure the cursor always focuses in the console? For example when I run my program if I do not click in the console and start typing my input ends up in the middle of my program code if I am not paying attention.</p> <pre><code>Scanner s = new Scanner(System.in); String...
java
[1]
4,528,959
4,528,960
grep prefix python strings
<p>I'm having problems using findall in python. </p> <p>I have a text such as:</p> <p><code>the name of 33e4853h45y45 is one of the 33e445a64b65 and we want all the 33e5c44598e46 to be matched</code></p> <p>So i'm trying to find all occurrences of of those alphanumeric strings in the text. the thing is I know they a...
python
[7]
2,388,115
2,388,116
jQuery slow fade element on interval and fade back in if user hovers
<p>I'm using jQuery to show some notifications to the user which will appear on screen using the jQuery append method. Once they appear on screen I want to wait say 5 seconds and THEN slowly begin to fade the element out before removing it from the DOM. It should only begin its fade after 5 seconds and not start fading...
jquery
[5]
2,134,179
2,134,180
C++ Overloading the + operator results in error
<p>I have tried to overload the "+" operator for my class:</p> <pre><code>Vector operator+( const Vector&amp; a, const Vector&amp; b ); </code></pre> <p>However,it tells me:</p> <pre><code>vector.h(12): error C2804: binary 'operator +' has too many parameters </code></pre> <p>I really don't get it. Please help me</...
c++
[6]
4,581,089
4,581,090
Message via intent error
<p>I'm learning how to use the intent to open a new activity and also pass a message, but when the new activity start, it needs to close down! What have I done wrong? Help is preciated! Thanks!</p> <pre><code>package test.intent; import android.os.Bundle; import android.app.Activity; import android.content.Intent; im...
android
[4]
2,177,892
2,177,893
Compare $_GET variable to array in php
<p>I am getting a variable from the url in php using $_GET[]. The url looks like: <a href="http://www.site.com/index.php?x=B%FCergschaften" rel="nofollow">http://www.site.com/index.php?x=B%FCergschaften</a> which i am comparing to values in an array: <code>$y=array('Bauherrenhaftpflicht','Gebäudeversicherung','Büergsch...
php
[2]
2,414,781
2,414,782
iPhone, how to calculate iPhone device three axis angle via UIAcceleration?
<p>as topic, </p> <p>I am try to use the code as follows :</p> <p><code> xAngle = 90.0 *x; yAngle = 90.0* y; zAngle = 90.0* z; </code></p> <p>but seem it is not right (x,y,z is the UIAcceleration attributes x, y and z) </p> <p>am I miss some thing in this algorithm ?</p> <p>thanks for your help </p> ...
iphone
[8]