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,976,933 | 4,976,934 | Helpful libraries for C++ | <p>Everyone should know about <a href="http://www.boost.org/" rel="nofollow">boost</a>. What are other helpful libraries for C++? If you need to mention specifics (like libcurl, freeimage) please note what they are specific to (web protocol, image loading).</p>
| c++ | [6] |
5,889,535 | 5,889,536 | How to make data from a database accessible from other web applications | <p>I have a database from which I want to expose data.</p>
<p>Ideally I would like to be able to just add a URL into some other web page and that URL would then call the correct datum using the web app I use to interact with the database.</p>
<p>Would a web service be the best option? </p>
| java | [1] |
4,040,096 | 4,040,097 | jQuery append after into an element before | <p>I am trying to move content to be after test2 but at the moment it's not working.</p>
<pre><code><div id="test">
<div id="test2"></div>
</div>
<div id="content"></div>
</code></pre>
<p>I'm using the following jQuery:</p>
<pre><code>$("#test2").after("#content");
</code></pre>
<p>This is how <code>.after()</code> is meant to function? I've checked the jQuery docs and can't find what I'm doing wrong?</p>
| jquery | [5] |
2,288,611 | 2,288,612 | how to add fieldname as a variable in OCCI | <p>In the below C++ code, i am updating a field of emp table based on the search value. But this code is not working properly. I am getting output as aborted. </p>
<pre><code>void UpdateData(string field_name,string updated_value,string search_value)
{
stmt->createStatement("UPDATE emp SET :1=:2 where search=:3");
stmt->setString(1,field_name);
stmt->setString(2,updated_value);
stmt->setString(3,search_value);
stmt->executeUpdate();
}
</code></pre>
<p>In my program user will select which field they have to update and the selected field name is passed into function as field_name parameter. updated_value is the new value entered by the user and search_value is the search key to find the appropriate record. </p>
<p>If i do like
stmt->createStatement("UPDATE emp SET field_name=:2 where search=:3");</p>
<p>its working..</p>
<p>But the problem is, the field name will change according to user selection. How i can overcome this problem. Is there any other way ?</p>
| c++ | [6] |
1,060,415 | 1,060,416 | php using files in the parent folder | <p>Is there any way to use a php file in the parent folder. I have a tree like this</p>
<pre><code>\
- index.php
- requirements.php
\Learning Center
- index.php
</code></pre>
<p>When in the root folder, I can call <code>./requirements.php</code>, but i cannot do this from inside the Learning Center folder. </p>
<p>In an attempt to fix this, I used the full url path to the file, but now I get this error:</p>
<p>Warning: require_once() [function.require-once]: URL file-access is disabled in the server configuration</p>
<p>I cannot change the server configuration, is there any way for me to refer to the requirements.php file from inside the Learning Center folder? I do not want to resort to putting a copy of all the resources I need into each folder.</p>
<p>Note: Sorry if this sounds like a stupid question, but I have only been programming in php for 2 days.</p>
| php | [2] |
2,032,220 | 2,032,221 | How to count online users on a website | <blockquote>
<p><strong>Possible Duplicates:</strong><br>
<a href="http://stackoverflow.com/questions/568835/script-to-tell-me-who-and-how-many-users-are-online">script to tell me who, and how many users, are online</a><br>
<a href="http://stackoverflow.com/questions/1822921/best-way-to-keep-track-of-current-online-users">Best way to keep track of current online users</a> </p>
</blockquote>
<p>How should I count the people online on a PHP website at a given time, if they don't have to be logged-in?</p>
| php | [2] |
2,749,308 | 2,749,309 | finding the start and end index for a max sub array | <pre><code> public static void main(String[] args) {
int arr[]= {0,-1,2,-3,5,9,-5,10};
int max_ending_here=0;
int max_so_far=0;
int start =0;
int end=0;
for(int i=0;i< arr.length;i++)
{
max_ending_here=max_ending_here+arr[i];
if(max_ending_here<0)
{
max_ending_here=0;
}
if(max_so_far<max_ending_here){
max_so_far=max_ending_here;
}
}
System.out.println(max_so_far);
}
}
</code></pre>
<p>this program generates the max sum of sub array ..in this case its 19,using {5,9,-5,10}..
now i have to find the start and end index of this sub array ..how do i do that ??</p>
| java | [1] |
519,688 | 519,689 | jquery action on loading page | <p>I'm using a script which activates a light-box (popup). the popup decides whether the shopping basket has been filled correctly if it has then i wish it to close onload if not then the user has to click to acknowledged that something is wrong. I've got the click to close script working how could i use this script to close the pop without any action ie. onload or something can you help?</p>
<p>this is what i use to close the window on click</p>
<pre><code><a href='javascript:closePopup(300);'>close window</a>
</code></pre>
<p>would it be possible to add this to close pop with our action?</p>
<pre><code><body onLoad(closePopup(300))>
</code></pre>
| jquery | [5] |
2,637,104 | 2,637,105 | Accessing Array Index OutSide The for Loop | <p>I have a problem in accessing the the value of <code>i</code> outside the for loop. At first I want to get 5 Names From User and after that wants to print all of them on the Screen using Arrays. Please Help.</p>
<pre><code>public class Student {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
String []Name;
Name=new String[5];
System.out.println("Please Enter The Names Of 5 Students: ");
//INPUTS 5 STUDENTS NAME FROM USER
for(int i=0; i<5; i++)
{
System.out.println("Enter The Name of student: "+(i+1));
Name[i]=input.nextLine();
}
//Prints All The Students Names
System.out.println("The Name of student: "+(i+1)+" is : "+ Name[i]);
}
}
</code></pre>
| java | [1] |
3,281,693 | 3,281,694 | select content of div from certain offset | <p>I'd like to select all the contents of a division from a certain height, using the height as a sort of offset. I load data from a database, put it in a div, and then get the height of the div:</p>
<pre><code><div id='gtheight' style='display:none;'>
<!--content is returned from database here-->
</div>
</code></pre>
<p>i get the height of the div:</p>
<pre><code>var heit=$(\"#gtheight\").height();
</code></pre>
<p>I have a threshold of 470px. If the content returned gives the div a height of anything more than 470px, the surplus content should be extracted, and placed in another div. So if the content gives a height of 500px, content occupying the last 40px or so (i add a surplus to the difference for appearance reasons) should be taken and placed into another
div(500-470=30px, i add 10px to give 40px). I know i can't do this:</p>
<pre><code> divsaved.innerHTML=divloaded.innerHTML;//where divloaded is the variable relating
//to the data from the db.
</code></pre>
<p>because that'll just put all the html from div1 to div2. So is there a way to do this using javascript?</p>
| javascript | [3] |
2,809,709 | 2,809,710 | What is a "wrapper" program? | <p>The place where I work has employees that use a third-party desktop program for their clients. This program saves data to a flat file. My colleague wants to write a Java program that uploads that flat file to a remote server, opens the desktop program when the flat file is downloaded from a Web site, and checks if the desktop program is running or not by looking at the Windows processes. He keeps calling this helper/utility program a "wrapper." But it doesn't wrap anything! I tried to clear it up with him, but he said, "Well, I call it a wrapper." He now has everyone in the company calling it a "wrapper." What would you call it? I say that it's a helper program or utility program.</p>
| java | [1] |
5,776,478 | 5,776,479 | How to extract separate bytes from a wav file? | <p>..and do some action, say, print an "a" the number of times as the number of bytes ??</p>
| java | [1] |
2,333,408 | 2,333,409 | what's a common way to concat two dictionary given that no duplicate keys in two? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/294138/merging-dictionaries-in-c">Merging dictionaries in C#</a> </p>
</blockquote>
<p>My way is:</p>
<pre><code>Dictionary<string, int> C =new[] { A, B }.SelectMany(x => x)
.ToDictionary(x => x.Key, x => x.Value);
</code></pre>
<p>Can it be simplified?</p>
| c# | [0] |
1,432,811 | 1,432,812 | Handling large datasets in charts quickely | <p>I have a large dataset(around 50000 points) which has be visualized in a line chart.The size of Canvas may vary according to the size of dataset. Massive amount of points makes the drawing too slow.It also results in cluttering and overlapping of points due to plotting of several points close to each other.So visual representation of data will be unsatisfactory. How can I display subset of available points which will increase the performance? Can anybody suggest me with a suitable algorithm which will help to extract the subset of actual number of points?</p>
| c# | [0] |
1,275,592 | 1,275,593 | What are the consequences of having a lot of packages in a Android Project App? | <p>I'm working on a Android project which six packages (which commanicate between them) with at least 5 classes in each of them.</p>
<p>I'm trying to optimize my project in order to change my Application Structure and to make it as generic and reliable as possible. Thus, I'm trying to reduce the number of package.</p>
<p>Is it recommanded to have a project with few packages? In other word, what are the consequences (especially on the project execution) of having a lot of packages?</p>
| android | [4] |
5,661,503 | 5,661,504 | Cloning a Java object | <p>I found <a href="http://stackoverflow.com/questions/869033/how-do-i-copy-an-object-in-java">this answer</a> about cloning java objects. However, with the approach in the accepted answer there, is the cloned object is totally a new instance? I mean not really a linked copy? </p>
<p>I am asking this because the java object I need to clone is a "global object" which gets updated at some point in time. And at some point in time I need to "snapshot" the object and essentially put than on a HashMap. </p>
| java | [1] |
2,390,716 | 2,390,717 | Which JavaScript libraries will handle popout windows (i.e. like Meebo or Gmail chat windows)? | <p>I could write this, but before I do, I wanted to check to see if there are existing solutions out there since it seems a lot of websites already do this, so I was wondering if there was a quick way to do this.</p>
<p>Also, I am talking about "popout" windows, not "popup" windows. All JavaScript libraries support "popup" windows, but I want ones where they originally open as "popup" windows in the same browser window, but there is also a link to open them up in a brand new browser window.</p>
| javascript | [3] |
3,269,071 | 3,269,072 | Writing a simple array program in python | <p>I have a simple problem and the statement goes like this:</p>
<p>Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
I want to create the numbers as above:</p>
<p>The code that I am trying to write is as follows:</p>
<pre><code>num(1)=1
num(2)=2
for i in range(3,10):
num(i)=num(i-1)+num(i-2)
print num(i)
</code></pre>
<p>The algorithm that I designed is as follows:</p>
<pre><code>x(i)=x(i-1)+x(i-2)
</code></pre>
<p>I will start from <code>x(3)</code> with <code>x(1)</code> and <code>x(2)</code> unknown. Can anyone help me with in array syntax error ? Thanks. </p>
| python | [7] |
700,094 | 700,095 | python class definition | <p>some time i see some classes defined as subclass of object class, as </p>
<pre><code>class my_class(object):
pass
</code></pre>
<p>how is if different from the simple definition as </p>
<pre><code>class my_class():
pass
</code></pre>
| python | [7] |
3,609,320 | 3,609,321 | How to get permission to use unlink()? | <p>I make a site and it has this feature to upload a file and that file is uploaded to a server</p>
<p>Im just a newbie to php I download xampp and I run this site that i made in my local machine.
My site is like this you upload a file then that file will be uploaded to a server, but when i tried unlink() because when i try to remove the filename to a database I also want to remove that pic on the server, but instead I got an error and it says <strong>"Permission denied"</strong>.</p>
<p><strong>question:<br/></strong>
How can I got permission to use unlink();?</p>
<p>I only run this on my localmachine using xampp</p>
| php | [2] |
3,543,468 | 3,543,469 | How to format Time and String value in Java's String formatter | <p>Using Java String.format() how do I format a string to result in "Time - userId" (ie. 3:02 pm - joe user).</p>
<p>I have worked several iterations, and I think it is the space between the minutes and the am/pm that is throwing me off. My last iteration is </p>
<pre><code>String.format("%1$tl:%1$tM %1$tp - %2s", new Date(), "joe user");
</code></pre>
<p>I am about to punt and use a SimpleDateFormat, but thought I would ask here first.</p>
| java | [1] |
3,797,831 | 3,797,832 | Trasferring binary files through PHP | <p>[if you can find a better title for this question, please fix]</p>
<p>I got an unlimited shared hosting plan [unlimited storage+bandwidth] where i wanna create a virtual online mp3 library. But the problem is the restriction from the hosting provider is </p>
<h1>at most 40% of bandwidth can be mp3 or image files</h1>
<p>So how to fool the provider so we can allow users to download the files.</p>
<p>I'll use PHP</p>
| php | [2] |
441,088 | 441,089 | How to get the list request from android to asp.net webservice? | <p>i have one webservice,use one webmethod,In android developer pass the request in List
Example:</p>
<pre><code>Itemid Itemname Date
1 aaaa 12/4/2013
2 bbbb 11/4/2013
3 cccc 10/4/2013
</code></pre>
<p>How to get this request in webservice?..and how to receive this request? Advance thanks....</p>
| asp.net | [9] |
2,582,024 | 2,582,025 | One-of-a-kind objects | <p>I want to create a one-of-a-kind object for certain properties:</p>
<pre><code>import java.util.HashMap;
public class SourceLanguage {
private final String name;
private static HashMap<String,SourceLanguage> existing;
private SourceLanguage(String name){
this.name = name;
}
public String getName(){
return name;
}
public static SourceLanguage get(String name){
if(existing==null){
existing = new HashMap<>();
SourceLanguage sl = new SourceLanguage(name);
existing.put(name.toLowerCase(),sl);
return sl;
}
SourceLanguage check = existing.get(name);
if(check==null){
SourceLanguage sl = new SourceLanguage(name);
existing.put(name.toLowerCase(),sl);
return sl;
}else {
return check;
}
}
}
</code></pre>
<p>I want to use objects of this class as keys in another map.</p>
<p>I feel it's a bit of an overkill.
Is there an easier way to achieve the goal?</p>
| java | [1] |
2,815,757 | 2,815,758 | remove an overlay in map | <p>I am showing current location using a red marker and some other set of location using a blue marker. After an operation, I have to remove some of the locations indicated using blue marker. Rest should be shown in the map itself. How will I do it?</p>
| android | [4] |
2,344,528 | 2,344,529 | loading Tabbar controller from view controller | <p>I am working with a project in which I have to have a login page and after successful login we should have a tabbar view( I am using tabbar controller) when I try to load the tabbar controller using the following code.Nothing works out.</p>
<p>LoginSuccess *viewController = [[LoginSuccess alloc] initWithNibName:@"LoginSuccess" bundle:nil];
[self.view addSubview:viewController.tabBarController.view];
[viewController release];</p>
<p>Can any one please help me.</p>
| iphone | [8] |
4,864,410 | 4,864,411 | jQuery : button click event must fire on click, but happens on pageload. how to fix? | <p>I have a fiddle here - <a href="http://jsfiddle.net/hhimanshu/SDr3F/2/" rel="nofollow">http://jsfiddle.net/hhimanshu/SDr3F/2/</a> </p>
<ul>
<li>The left pane is already available</li>
<li>I need that when I click on "search", the input box should show up with focus(an alert for time being) </li>
</ul>
<p><strong>Problem</strong> </p>
<ul>
<li>When I load the page with left pane setting jQuery fires the event and clicking on "search has no effect" </li>
</ul>
<p>Please help me understanding what am I doing wrong here</p>
<p><strong>UPDATE</strong> </p>
<ul>
<li>I can see alert, but it fails to focus, here is my latest jQuery </li>
</ul>
<blockquote>
<pre><code>// loading search page
$(function(){
$("#search").click(function(){
$('#feature').load('templates/search.html');
$('#search-input').focus();
// alert("hi");
});
});
</code></pre>
</blockquote>
<p>and <code>search.html</code> is </p>
<pre><code><input id="search-input" type="text" class="input-medium search-query span4 youtube-search-box">
</code></pre>
<p>How can I focus on it?</p>
| jquery | [5] |
5,993,449 | 5,993,450 | error while importing Tkinter in python | <p>I get the following error while importing Tkinter:</p>
<pre><code>Python 2.7.1 (r271:86832, Jun 11 2011, 11:34:27)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
>>>
</code></pre>
<p>What shall I do? </p>
| python | [7] |
3,098,231 | 3,098,232 | Format string as currency | <p>I have <code>string</code> variable that contain price. For example, <code>10000</code>. I want use a space for thousand separator.<br>
e.g. display <code>10000</code> as <code>10 000</code>, <code>150000</code> as <code>150 000</code><br>
How can I do this? </p>
| c# | [0] |
3,748,982 | 3,748,983 | Using a href can we call a function from a file using javascript or jquery..? | <p>I want to call a function from a file using href. Below is my javascript code:</p>
<pre><code> function createtable() {
function displaytable(argument) {
var tr=document.createElement('tr');
for (var i=0; i < argument.length; i++) {
var td=document.createElement('td');
if (i == 0) {
td.appendChild(document.createTextNode(argument[i]));
}
if (i == 1) {
td.appendChild(document.createTextNode(argument[i]));
}
if (i == 3) {
td.appendChild(document.createTextNode(argument[i]));
}
if (i == 2) {
td.ondblclick= function () {
var column_index= (this.cellIndex) -1;
var row_index= (this.parentNode.rowIndex);
search_cell(row_index,column_index);
}
td.appendChild(document.createTextNode(argument[i]));
}
tr.appendChild(td);
}
document.getElementById('table_body').appendChild(tr);
}
document.write("<table border=\"1\"><tr><th>INDEX</th><th>--CELL NAME--</th><th>--PIN NAME--</th><th>--PG PIN--</th></tr><tbody id='table_body'></tbody></table>");
for (var x=0; x < array_cells.length; x++) {
displaytable([x+1,array_cells[x].cell,array_cells[x].pins,array_cells[x].pg_pins])
}
function search_cell(row_index,column_index) {
</code></pre>
<p>//Want to call this function using href
}
}</p>
<p>I want to add a functionality i my code that when i click over a cell in my html table it calls a function from file using href.</p>
| javascript | [3] |
5,023,980 | 5,023,981 | take specific data from a list in php | <p>I have a string like this: </p>
<pre><code> house1- a normal house
house2-an office
house3-a scholl
</code></pre>
<p>There are about 2000 lines. I want to get only house1,house2,house3 etc. from that it and put it in another file. Like:</p>
<pre><code> house1
house2
house3
</code></pre>
<p>I understand that the explode function works for separating strings, but how can I do this? </p>
| php | [2] |
3,264,024 | 3,264,025 | MotionEvent.Action_UP fails | <p>I am writing a simple code on ontouchevent..the code is</p>
<pre><code>class MyTouchListener implements View.OnTouchListener{
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
if(event.getAction()==MotionEvent.ACTION_DOWN)
{ Log.i(TAG, "^^^^^^^^^^^ACTION DOWN^^^^^^^^^^^^");
}
else if(event.getAction()==MotionEvent.ACTION_UP)
{
Log.i(TAG, "^^^^^^^^^^^ACTION UP^^^^^^^^^^^^");
}
}
</code></pre>
<p>while i pressed the screen it prints ^^^^^ACTION DOWN^^^^^
But when I released the screen it does not print ^^^^^^ACTION UP^^^^^^....</p>
<p>means MotionEvent.ACTION_UP fails..why this is so??</p>
| android | [4] |
5,559,515 | 5,559,516 | List structure for c++ game | <p>I'm making a very very basic game in C++ to gain some experience in the language and I have hit a bit of a brick wall in terms of progress.</p>
<p>My problem is, while I was designing a class for the player's weapons, I realized I required a list, as I will only have a certain number of weapons throughout the game.</p>
<p>So I ask you, if you were designing this, what implementation would you use for storing all of the weapons in a game? Why?</p>
<p>Here is my code so far for the weapons. as you can see I was just about to start defining all of them manually, starting with the "DoubleBlades"... (Edit* I forgot to note that players should be able to have more than one wepaon, and they can pick up more or drop some, so the list can grow and shrink)</p>
<pre><code>#ifndef __WEAPON_H__
#define __WEAPON_H__
#include <string>
class Item
{
public:
Item(const std::string& name)
: name(name){ }
const std::string& getName(void) const { return name; }
int getID(void) const { return this->itemID;}
private:
std::string name;
int itemID;
};
class Weapon
: public Item
{
private:
int damage;
public:
Weapon(const std::string& name)
: Item(name) { }
virtual int getDamage(void) const = 0;
};
class DoubleBlades
: public Weapon
{
public:
DoubleBlades(int ammo)
: Weapon("DoubleBlades") { }
virtual int getDamage(void) const { return 12; }
};
#endif
</code></pre>
<p>Also if you spot any bad habits I would really appreciate letting me know.</p>
| c++ | [6] |
1,056,244 | 1,056,245 | can i get low or high wifi connectivity in android | <p>can i get low or high wifi connectivity. I mean can i measure the signal level from 1 to 5.(assume only one network). i used calculatesignallevel. but it either returns 0 or 1.
kindly, help me out</p>
| android | [4] |
6,000,842 | 6,000,843 | Writing files with php | <p>I have written a php script to generate files of random text. Everything works fine but I can only generate about 200 at a time. After that, the script just stops incrementing and I have to go and adjust the start and stopping points in the loop and then rerun it. This would be fine if I only wanted a few hundred, the problem is that I want to generate tens of thousands. Does anybody know what is limiting php to only writing a few hundred files at a time?</p>
<p>I haven't been able to find any questions on here that really address my problem.</p>
| php | [2] |
1,607,419 | 1,607,420 | Difference between Python Generators vs Iterators | <p>What is the difference between iterators and generators? Some examples for when you would use each case would be helpful.</p>
| python | [7] |
72,716 | 72,717 | How to check whether an application can be uninstalled? | <p>I use the <strong>PackageManager</strong> to get the list of installed Android applications. But some stock applications cannot be uninstalled from the device. How do I check for those programmatically?</p>
<pre><code>Intent i = new Intent(Intent.ACTION_MAIN, null);
i.addCategory(Intent.CATEGORY_LAUNCHER);
PackageManager pm = this.getPackageManager();
List<ResolveInfo> activities = pm.queryIntentActivities
(i, PackageManager.PERMISSION_GRANTED);
</code></pre>
| android | [4] |
3,912,714 | 3,912,715 | Non-urgent Android layout id attribute quirk | <p>I'm working on a couple of apps at the moment while I try to learn my way around the Android SDK. I had a bit of trouble recently with my layouts where I was defining, for example, an EditText element as such...</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText
android:id="@+id/price_per_pack"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/price_per_pack"
android:layout_alignParentLeft="true"
android:textSize="12pt"
android:text="Price Per Pack"/>
</LinearLayout>
</code></pre>
<p>The application was compiling correctly, however when I attempted to start the activity which utilizes this layout nothing would happen. Through a process of elimination I identified the id attribute as the troublesome one and while playing about I discovered that changing </p>
<pre><code>android:id="@+id/price_per_pack"
</code></pre>
<p>to </p>
<pre><code>android:id="@+android:id/price_per_pack"
</code></pre>
<p>solved my problem and the application behaved as expected. My initial attempt at declaring the id attribute was based upon examples in the SDK documentation so I'm wondering if somebody could explain to me why I needed to make the above change to get it working?</p>
<p>I'm sure that it won't make any difference but I'm developing using the android-mode.el emacs plugin and have a completely up-to-date copy of the SDK.</p>
<p>Thanks in advance.</p>
| android | [4] |
83,610 | 83,611 | the operation could not be completed | <p>I am getting "The Operation Could not be Completed" error while adding the ajax control from tool box to the design page .</p>
<p>How to solve this problem .
Can anybody help me in this .</p>
<p>Thanks in advance</p>
| asp.net | [9] |
3,771,148 | 3,771,149 | AppendTo, does it change the DOM? | <p>I have two list boxes and some JQuery function that does the following:</p>
<pre><code> $(document).ready(function () {
//If you want to move selected item from fromListBox to toListBox
$("#AddButton").click(function () {
$("#fromListBox option:selected").appendTo("#toListBox");
});
});
</code></pre>
<p>I have a button that when clicked moves items from one list to another. This works, however when I do "View Page Source" in chrome, the list contains the original list and not the newly added items.</p>
<p>I expected appendTo to change the DOM but clearly this is not what is happening. Why is this?</p>
<p>JD</p>
| jquery | [5] |
3,849,271 | 3,849,272 | None Type issues in Python 2.6 | <p>I'm doing a script where I get some values from a Database but sometimes this value can be None, but when I assign it to a variable and try to compare it I get this error:</p>
<pre><code>TypeError: 'NoneType' object is unsubscriptable
</code></pre>
<p>I've already tried this:</p>
<pre><code>if sgSlate[ 'sg_client_2' ][ 'name' ] != None:
self.ui.brandComboBox_2.setEditText( sgSlate[ 'sg_client_2' ]['name' ] )
if not isinstanceof( sgSlate[ 'sg_client_2' ][ 'name' ], None ) != "":
self.ui.brandComboBox_2.setEditText( sgSlate[ 'sg_client_2' ]['name' ] )
if sgSlate[ 'sg_client_2' ][ 'name' ] is not None:
self.ui.brandComboBox_2.setEditText( sgSlate[ 'sg_client_2' ]['name' ] )
if type( sgSlate[ 'sg_client_2' ][ 'name' ]) is not type(None):
self.ui.brandComboBox_2.setEditText( sgSlate[ 'sg_client_2' ]['name' ] )
</code></pre>
<p>and none of them worked.</p>
<p>Thank you in advance.</p>
| python | [7] |
1,711,085 | 1,711,086 | Save previous preferences/choices using PHP | <p>This is my first question here, probably a very simple one but I can't really find how to do it.</p>
<p>When I tried to google it, I only came across cookies and sessions, but I don't know how to use them, and was hoping there was a more simple way. I only started with PHP today.</p>
<p>On the following page I want the user to be able to switch background, text color, text decoration, etc. I got that to work as well, but I would love to find a way to save the previous choice, and add it to the next one.</p>
<p>So if someone picks a red background-color, it should not switch back to white when they pick another style, such as a black text color.</p>
<p>Is there a easy way (for starters like me) to fix this?</p>
<p>This is the site so far: <a href="http://mark.wigf7.sde.dk/PHP/opgave_g.php?baggrundfarve=FF8000" rel="nofollow">http://mark.wigf7.sde.dk/PHP/opgave_g.php?baggrundfarve=FF8000</a></p>
| php | [2] |
4,120,091 | 4,120,092 | C#,ASP.NET: Formatting a GRIDVIEW row Based on Content | <p>Greetings Gurus. I have a gridview who's rows I need to higlight if the 'Status' field is null. The code below throws an exception. I'm getting a "Non-invocable member 'System.Web.UI.WebControls.GridViewRow.DataItem' cannot be used like a method". I think I'm really close but I don't know where to turn next.</p>
<pre><code>protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow &&
e.Row.DataItem("Status") == null)
{
// e.Row.BackColor = Drawing.Color.Red;
}
}
</code></pre>
| asp.net | [9] |
5,707,633 | 5,707,634 | How can i reach frame title inside Handler | <p>I can't reach my title inside Handler.</p>
<p>Example of my code:</p>
<pre><code>public Frame extends JFrame {
public Frame() {
super("Frame 1");
.
.
.
</code></pre>
<p>There needs to be a button in my GUI and whenever you click it, it needs to change the title from Frame 1 to Frame 2, and vice versa.</p>
<pre><code>ButtonHandler handler = new ButtonHandler();
.
.
.
}
class ButtonHandler implements ActionListener {
public void actionPerformed(ActionEvent event) {
JButton but = (JButton) event.getSource();
if (??.getTitle(equals("Frame 1"))) {
setTitle("Frame 2");
} else {
setTitle("Frame 1");
}
</code></pre>
<p>So everytime I click the button all it does is the else part. I can't use the getTitle inside my if :/</p>
| java | [1] |
5,671,486 | 5,671,487 | Data binding on combo box | <p>I am adding items to a combo box as given below:</p>
<pre><code> readonly Dictionary<string, string> _persons = new Dictionary<string, string>();
....
//<no123, Adam>, <no234, Jason> etc..
foreach (string key in _persons.Keys)
{
//Adding person code
cmbPaidBy.Items.Add(key);
}
</code></pre>
<p>I want make the combo box more readable by displaying the values from dictionary (ie Names). But I need the person codes (no123 etc) for fetching from the database based on user input. </p>
<p>What is the right way to do this? How can I bind both value and key to combo box item?</p>
| c# | [0] |
3,302,438 | 3,302,439 | Altitude value in iphone 3GS | <p>I am using CLLocation to get altitude values. It is working fine with iphone4. But it takes long time to get the value in iphone 3GS (more than 5 min). I checked it using wi-fi on and off. In both cases, the output is same. Please help.</p>
| iphone | [8] |
5,656,875 | 5,656,876 | Remove precision from divide | <p>well basically if I write something like this -</p>
<pre><code>float a = 0;
a = (float) 1/5;
a += (float) 1/9;
a += (float) 1/100;
</code></pre>
<p>It will automatically decrase precision to 2 digits after comma, but I need to have 5 digits after comma, is it available to create, so it displays 5 digits? With setprecision(5) it, just shows 00000 after comma.</p>
<p>It get's all data from input file just fine.</p>
| c++ | [6] |
5,129,527 | 5,129,528 | Add image view to sub class in Android? | <p>In my sub class I am trying to add an image View:</p>
<pre><code>ImageView image = new ImageView(this);
</code></pre>
<p>But it breaks the app. I think it is because of the 'this' param.</p>
<p>Does my class need to extend something? At the minute it extends Activity.</p>
| android | [4] |
5,555,356 | 5,555,357 | Monty Python References in the Python Language/ Community | <p>Its quite well known that Python gained its name from the BBC show Monty Python's Flying Circus, but I just recently realized that the ide that is usually packaged with it, Idle, is also a reference (it became obvious when I found out about the Eric ide). I'm sure that there's other ones too. Is anyone aware of any others?</p>
| python | [7] |
5,490,674 | 5,490,675 | Read temperature of a 1-wire device connected to a HA7E | <p>I am trying to read the temperature of a 1-wire device by issuing ascii commands to the 1-wire adapter. The problem is the ser.write('W0144') requires a carriage return but the code isn't sending it for some reason. The command ser.read(32) returns A69000001CFD7E328 when it should return 44 (from HA7E ascii commands/manual. If I enter the two ser.write commands (without the /r) in Windows XP Hyper Terminal, it works fine.</p>
<p>I've been on this a week (yes I'm a newbie) and I'm stumped. I've tried different timeouts and time.sleeps but no joy. Can anyone make a suggestion?</p>
<pre><code>import serial
import time
ser = serial.Serial(port = 'COM1', baudrate=9600, bytesize=8, parity=serial.PARITY_NONE, stopbits=1, timeout=0)
#show the port is open
print ser.isOpen()
ser.write('A69000001CFD7E328')
time.sleep(1)
ser.write('WO144/r')
ser.read(32)
ser.close()
</code></pre>
| python | [7] |
2,956,695 | 2,956,696 | Unable to set background for a surface view in android | <p>I am streaming video from a http url.i have a surface view for this purpose which u can see below</p>
<pre><code> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/backgroundplain"
>
<com.myview.HttpIPCamView
android:id="@+id/single_camera"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="right"
android:duplicateParentState="true"
android:drawingCacheQuality="low"
android:text="Loading.." >
</com.myview.HttpIPCamView>
</code></pre>
<p>when ever i tried to set a background bitmap it never allows to set it instead a black screen with video comes up.Please help me to solve this problem as i am stuck for days</p>
| android | [4] |
936,876 | 936,877 | Checking querystring for a not null value using JS | <p>Is it possible to check a querystring for a not null value using javascript? Can you show me an example on how to do this?</p>
<p>Like the IF clause of this snippet:</p>
<pre><code> protected void Page_Load(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(Request.QueryString["someParameter"]))
{
DataListWithLinksID.Attributes.Add("style", "display:none");
}
}
</code></pre>
| javascript | [3] |
5,860,286 | 5,860,287 | Enumeration methods | <p>Enumeration interface has method hashMoreElements is used with refrence variable (Enumv), how can they be used
since they are not implemented ?
I meant it is an interface method so how can it be called - Enumv.hasMoreElements() it does not have a implementation .</p>
<pre><code>Vector v = new Vector();
//v contains list of elements - Suppose
Enumeration Enumv = v.elements();
while(Enumv.hasMoreElements()) {
System.out.println(Enumv.nextElement());
}
</code></pre>
<p>How is this possible?</p>
| java | [1] |
5,845,682 | 5,845,683 | Why the List is not updated and why the var w is all the time null? | <p>In the button 8 click event i did:</p>
<pre><code> private void button8_Click(object sender, EventArgs e)
{
if (buttonLockMode == true)
{
trackBar1.Enabled = true;
button8.ForeColor = Color.Red;
button8.Enabled = false;
textBox1.Text = "Frame Number : " + trackBar1.Value;
this.trackBar1.Select();
textBox3.Enabled = true;
textBox4.Enabled = true;
wireObjectAnimation1 = new WireObjectAnimation(this, wireObject1);
int currentFrameIndexRight = trackBar1.Value;
wireObjectCoordinates1 = new WireObjectCoordinates() { FrameNumber = currentFrameIndexRight };
WireObjectCoordinatesCloneFrame();
List<WireObjectCoordinates> temp = wireObjectAnimation1.CoordinatesList;
temp.Add(wireObjectCoordinates1);
//wireObjectAnimation1.CoordinatesList.Add(wireObjectCoordinates1);
//WireObjectCoordinatesCloneFrame();
}
else
{
button8.ForeColor = Color.Black;
}
}
</code></pre>
<p>Phoog i used the same idea of temp List.
And in the wireObjectanimation i did:</p>
<pre><code>private List<WireObjectCoordinates> _coordinateslist = new List<WireObjectCoordinates>();
public List<WireObjectCoordinates> CoordinatesList
{
get { return _coordinateslist; }
}
</code></pre>
<p>And still when i put a breakpoint on the get line the _coordinateslist and CoordinatesList both empty.</p>
| c# | [0] |
1,388,511 | 1,388,512 | How do you walk through the directories using python? | <p>I have a folder called notes, naturally they will be categorized into folders, and within those folders there will also be sub-folders for sub categories. Now my problem is I have a function that walks through 3 levels of sub directories:</p>
<pre><code>def obtainFiles(path):
list_of_files = {}
for element in os.listdir(path):
# if the element is an html file then..
if element[-5:] == ".html":
list_of_files[element] = path + "/" + element
else: # element is a folder therefore a category
category = os.path.join(path, element)
# go through the category dir
for element_2 in os.listdir(category):
dir_level_2 = os.path.join(path,element + "/" + element_2)
if element_2[-5:] == ".html":
print "- found file: " + element_2
# add the file to the list of files
list_of_files[element_2] = dir_level_2
elif os.path.isdir(element_2):
subcategory = dir_level_2
# go through the subcategory dir
for element_3 in os.listdir(subcategory):
subcategory_path = subcategory + "/" + element_3
if subcategory_path[-5:] == ".html":
print "- found file: " + element_3
list_of_files[element_3] = subcategory_path
else:
for element_4 in os.listdir(subcategory_path):
print "- found file:" + element_4
</code></pre>
<p>Note that this is still very much a work in progress. Its very ugly in my eyes...
What I am trying to achieve here is to go through all the folders and sub folders down and put all the file names in a dictionary called "list_of_files", the name as "key", and the full path as "value". The function doesn't quite work just yet, but was wondering how would one use the os.walk function to do a similar thing?</p>
<p>Thanks</p>
| python | [7] |
5,468,693 | 5,468,694 | Removing the values using JQuery | <p>I need to remove some values from a hidden and text input box using JQuery, but somehow this is not working</p>
<p>Example:</p>
<pre><code><input type="hidden" value="abc" name="ht1" id="ht1" />
<input type="text" name="t1" id="t1" />
</code></pre>
<p>I use the following JQuery code to remove the values with an onclick event</p>
<pre><code>$('#rt1').click(function() {
$('#t1').val();
$('#ht1').val();
});
</code></pre>
<p>I can I empty the contents of the input box and clear the value of the hidden field using JQuery?</p>
| jquery | [5] |
4,137,384 | 4,137,385 | Read and write bytes from a file (c++) | <p>I think I probably have to use an fstream object but i'm not sure how. Essentially I want to read in a file into a byte buffer, modify it, then rewrite these bytes to a file. So I just need to know how to do byte i/o. Thanks</p>
| c++ | [6] |
2,913,112 | 2,913,113 | Basic ImageButton onClick event not firing - surely something simple? | <p>I'm trying to get a simple onClick to fire from an ImageButton - it seems like a simple enough task, but I'm obviously missing something here.</p>
<p>Here is my java file:</p>
<pre><code>package com.jlbeard.android.testapp;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.Toast;
public class testapp extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//handle the button press
ImageButton mainButton = (ImageButton) findViewById(R.id.mainButton);
mainButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//show message
Toast.makeText(testapp.this, "Button Pressed", Toast.LENGTH_LONG);
}
});
}
}
</code></pre>
<p>Here is my layout file:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:id="@+id/whereToEat"
android:src="@drawable/where_to_eat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="8px"
/>
<ImageButton
android:id="@+id/mainButton"
android:src="@drawable/main_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@null"
android:clickable="true"
android:onClick="mainButtonClick"
/>
</RelativeLayout>
</code></pre>
<p>It seems to me that I'm missing something simple... but can't seem to figure it out. Thanks!</p>
| android | [4] |
5,342,856 | 5,342,857 | How to loop through the index of a list in python? | <p>I'm trying to write to a file, with the first line being [0] in the list, 2nd line being [1], etc.</p>
<p>Here's a quick example</p>
<pre><code>crimefile = open('C:\states.csv', 'r')
b = crimefile.read()
l = b.splitlines()
print l[1]
states = open('c:\states.txt', 'w')
states.write('"abc"' + " " + '%s' '\n' %l[0+=])
states.close()
</code></pre>
<p>I'm really new to loops in Python and I am not too sure about loops and how to increase integers during loops, basically.</p>
| python | [7] |
1,085,585 | 1,085,586 | The following code not working in android? | <pre><code>details.replaceAll("null", " ");
</code></pre>
<p>In the above code i am getting the String details from the database and it may get values of the form : <strong>null,null,null,null</strong>.</p>
<p>In order to remove all the "null" from the string i am using the above code, but it is not working.</p>
<p>what is going wrong?</p>
<p>thank you in advance.</p>
| android | [4] |
5,707,779 | 5,707,780 | beginner: python subprocess.call with hundreds of args | <p>Disclaimer: I am a beginner in python but have Drupal programming experience.</p>
<p>I have this:</p>
<pre><code>f = ['/path/1.jpg', '/path/2.jpg', '/path/3.jpg'] #less than 1500 files
</code></pre>
<p>and I need to do this</p>
<pre><code>call(['c:/program files/ABBYY FineReader 10/finereader.exe'] + f)
</code></pre>
<p>BUT, there is an argument limit (http://stackoverflow.com/questions/2381241/what-is-the-subprocess-popen-max-length-of-the-args-parameter) of 32K characters, so I need to drop the /path first. How can I proceed, allowing the .exe to locate the files?</p>
<p>Thanks!</p>
| python | [7] |
5,389,948 | 5,389,949 | Java executes "if" block when condition is demonstrably false | <p><img src="http://i.stack.imgur.com/qGJtM.png" alt="Screen shot of my problem."></p>
<p>This pretty much says it all. <code>paneNum</code> is 0. Test for <code>paneNum < 0</code> is apparently <code>true</code> since the instruction pointer is inside the if-block, and the function returns <code>false</code>.</p>
<p>Any ideas?</p>
| java | [1] |
5,217,398 | 5,217,399 | JQuery can I display the result then have it fade away? | <p>Is there a way I can display the result and then have it fade away after about 10 seconds or something using JQuery?</p>
<p>Here is the code.</p>
<pre><code>function stop(){
$.ajax({
type: "GET",
url: "http://update.php",
data: "do=getSTOP",
cache: false,
async: false,
success: function(result) {
$("#rate").html(result);
},
error: function(result) {
alert("some error occured, please try again later");
}
});
return false;
}
$(document).ready(function() {
$('.rating li a, .srating li a').click(stop);
});
</code></pre>
| jquery | [5] |
2,204,795 | 2,204,796 | C++ program that reads from file and performs bitwise operations | <p>I'm not asking for code I'm asking for help. yes it is for a project for class.</p>
<p>Program reads a .txt file that contains something like this,</p>
<ul>
<li>NOT 10100110</li>
<li>AND 00111101</li>
</ul>
<p>Program needs to read the operator and perform a function according to that operator to alter the byte. Then output the altered byte.</p>
<p>What I know how to do:</p>
<ul>
<li>Open the file up.</li>
<li>read from the file.</li>
<li>I can store the byte in an array.</li>
</ul>
<p>What I need help with: </p>
<ul>
<li>Reading the operator (AND, OR, NOT)</li>
<li>Store each bit inside an array (I can store the byte but not the bit)</li>
</ul>
<p>My code: </p>
<pre><code>#include <iostream>
#include <fstream>
#include <istream>
#include <cctype>
#include <cstdlib>
#include <string>
using namespace std;
int main()
{
const int SIZE = 8;
int numbers[SIZE]; // C array? to hold our words we read in
int bit;
std::cout << "Read from a file!" << std::endl;
std::ifstream fin("small.txt");
for (int i = 0; (fin >> bit) && (i < SIZE); ++i)
{
cout << "The number is: " << bit << endl;
numbers[i] = bit;
}
fin.close();
return 0;
}
</code></pre>
| c++ | [6] |
1,123,398 | 1,123,399 | Comparing two objects . | <p>If i have a complex object, what is the best practice pattern to write code to compare 2 instances to see if they are the same</p>
| c# | [0] |
5,834,927 | 5,834,928 | Can we run flash file from java through pure java code? | <p>I have a requirement to run flash file from java application so that it can be used any where as a runnable jar file. Also this should be in pure Java (for example should not have to use a Windows dll)</p>
<p>I tried to do the same and only thing I found on net is through JFlashPlayer which is platform dependent as it requires some dlls to run the flash file.</p>
<p>Any pointers will be useful.</p>
<p>Thanks in a</p>
| java | [1] |
5,118,420 | 5,118,421 | Is empty enum ( enum{}; ) portable? | <pre><code>class Test
{
enum{};
...
};
</code></pre>
<p>Is this empty enum definition portable? Compiles in gcc and and msvc.</p>
| c++ | [6] |
5,862,115 | 5,862,116 | Conversion to special characters (example from "æ" to "æ") | <p>I want to save files which will have name with danish characters, for example "Helloæ".</p>
<p>The string which saves the filename has this value: <code>Hello&aelig;</code></p>
<p>How to make it convert <code>&aelig;</code> to <code>æ</code> ? This question isn't just about the "æ" characters, but for all other possible letters.</p>
| c# | [0] |
3,349,507 | 3,349,508 | how to connect backgroud thread if i am lunching my GUI thread again in Android | <p>i have 2,3 parallel running background process in my application. when i exit from the application how to connect my GUI thread with background processes again. i am using Async task for my background process since i have to update my progress bar on GUI. </p>
| android | [4] |
4,827,509 | 4,827,510 | Direct parameter Vs passing a class | <p>Assume that there is a class with 3 attributes.</p>
<p>Employee</p>
<ol>
<li>Name</li>
<li>Age</li>
<li>Sal</li>
</ol>
<p>I have a webmethod, <code>GetInfo</code>.</p>
<p>Does it make any difference with regard to performance for passing direct param vs. direct classs?</p>
<pre><code>GetInfo(Employee emp) // This will internally call emp.age & return the values.
GetInfo(int age)
</code></pre>
<p>Any thoughts?</p>
| c# | [0] |
4,651,541 | 4,651,542 | Android Java, bitmap from resources | <p>I have my images in my res/drawable folder, there's no problem about that.
The thing is, i'd like to be able to do something like this:</p>
<pre><code>Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.*img[contar]*);
</code></pre>
<p>In other words eclipse doesn't let me do this <code>img[contar]</code> it only accepts the specific name of the image file (example: crystalblue), and i'd like to lets say move from "crystalblue" to "crystalred" image and in my case i need a variable to do it.</p>
<p>Obs: I did declare img as string array.</p>
<p>Any solutions anyone?</p>
| android | [4] |
1,530,847 | 1,530,848 | Python: How to define a function that gets a list of strings OR a string | <p>Let's say I want to add a list of strings or just one to a DB:</p>
<pre><code>names = ['Alice', 'Bob', 'Zoe']
</code></pre>
<p>and I want that <code>add_to_db</code> will accept both cases</p>
<pre><code>add_to_db(names)
add_to_db('John')
</code></pre>
<p>Is this the correct way to go:</p>
<pre><code>def add_to_db(name_or_names):
if (...):
... # add a single name
else:
for name in name_or_names:
... # add a single name
commit_to_db()
</code></pre>
<p>What should I put in the first <code>...</code>, as condition to whether it's a list of strings or just a string (don't forget that string is also iterable)?</p>
| python | [7] |
5,099,553 | 5,099,554 | How to get comma seperated values from the string in php | <p>I have a string <code>$employee="Mr vinay HS,engineer,Bangalore";</code>. i want to store Mr vinay H S in <code>$name</code> ,engineer in <code>$job</code> and Bangalore in <code>$location</code>. how to do this </p>
| php | [2] |
1,667,921 | 1,667,922 | How do i get count of an unknown attribute in a JSON object without a loop | <p>eg. </p>
<pre><code>var myObject = {
'item_123': {
'id': 1,
'name': 'Some name'
},
'item_789': {
'id': 2,
'name': 'Another name'
}
};
</code></pre>
<p>The number part of the item attribute/object is not known before hand since they are unique ids and are auto generated. Is it possible to get item count from myObject without looping through it?</p>
| javascript | [3] |
3,001,517 | 3,001,518 | Comparing Java Beans with BeanComparator | <p>I am trying to compare 2 beans of the same class and determine what part of the beans (if any) do not match. This may include beans with internally nested beans of another class, but for the most part the classes will be matching. Basically I want to derive the first class from the database and compare it with a new copy which will inevitably update the data in the database that is not already the same as whats currently in there.</p>
<p>So basically I will need to loop through each variable in the bean and compare it with bean 2. If it matches...move onto the next. If it does not match, return the index of the variable so I know what field to update in the database. </p>
<p>Is this something I can do with apache commons BeanComparator? Or will I have to come up with my own custom tool?</p>
| java | [1] |
5,584,798 | 5,584,799 | why the javascript code doesn't work? | <pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
<script type="text/javascript">
window.onload = function(){
document.getElementById("myMessage").innerHTML = "hello,world!";
}
</script>
</head>
<body>
<h1 id=="myMessage"></h1>
</body>
</html>
</code></pre>
<p>when i run the file, there is no <code>hello,world!</code> output. why?</p>
| javascript | [3] |
2,382,634 | 2,382,635 | How to use multiple listviews in a single activity on android? | <p>I have 9 listviews which should come under single activity. All the lists may/maynot display at a time on the screen (all at a time is nice)</p>
| android | [4] |
4,228,059 | 4,228,060 | Legally avoiding popup blocking | <p>What is causing some browsers to see my code as unsolicited?</p>
<p>I have a web site devoted to helping people with interactive sessions. It starts with the user clicking [Begin] so this is a consented action. This should (1) open a popup while (2) redirecting the first page to a end page as below : </p>
<pre><code><head>
<SCRIPT language="JavaScript">
function openwindow(){window.open("{INTERACTION}","interaction","resizable=0,width=800,height=600,status=0");}</SCRIPT>
</head>
<body>
<FORM action="end.php" method="{METHOD}" >
<input type="submit" class="button"
onClick="javascript: openwindow()"
value="Begin" />
</FORM>
</body>
</code></pre>
<p>As said, this is not trying to open an unrequested popup but some strains of IE and Chrome appear to be treating it as such. I have been trying to get a fix, most recently digesting <a href="http://stackoverflow.com/questions/668286/detect-blocked-popup-in-chrome">this post</a>. </p>
<p>In it Bobince comments </p>
<blockquote>
<p>these days, you don't really need to ask the question “was my unsolicited popup blocked?”, because the answer is invariably “yes” — all the major browsers have the popup blocker turned on by default. Best approach is only ever to window.open() in response to a direct click, which is almost always allowed.I'm quite happy to buy into this principle because I simply want my popup to open. </p>
</blockquote>
<p>What is causing some browsers to see my code as unsolicited?</p>
<p>I'd appreciate any help you could give me. (as you might have guessed, client side is not my bag and this topic has been bugging me for ages).</p>
<p>Many thanks in advance (and fingers crossed)
Giles</p>
| javascript | [3] |
3,101,610 | 3,101,611 | How can I read a file that is in use by another process? | <p>I need to read a file that is in use by another process. How can I achieve that in C#?</p>
<p>Thanks!</p>
| c# | [0] |
1,953,349 | 1,953,350 | Logview in Imshow | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/13478460/logarithmic-yscale-in-imshow">Logarithmic yscale in imshow</a> </p>
</blockquote>
<p>In my imshow view, I want the logarithmic scale in the <code>y</code>. the answers like <code>yscale('log')</code> is not my answer. any suggestion please?</p>
| python | [7] |
1,580,225 | 1,580,226 | Is it possible to undefine a javascript method? | <p>Specifically I am needing to unset a function in mootools for one page that is conflicting with a FB.ui. But I don't want to do anything drastic such as permanently remove that function as it would break the rest of the site.</p>
| javascript | [3] |
2,877,403 | 2,877,404 | TextView highlighting text doubts | <p>I am doing a bible application ,i have completed the displaying of verses in textview.I became struck when i tap a verse i shouldn't highlighted.I didn't know how to do this.I provide a image url to show that i want exactly like this.
Thanks in advance</p>
<p><img src="http://i.stack.imgur.com/YCzUl.jpg" alt=".image"></p>
| iphone | [8] |
1,318,445 | 1,318,446 | Use more than one font to drawstring | <p>I want to use drawString to print a sentance but some parts of it has to be bold. What is the best way to do this? Yes, I have considered using two drawString. But is there a intelligent way of using two drawStrings if we have to.</p>
<p>We cannot make any assumtion about the length of the sentance. However it is prepared in a format.</p>
<p>eg: </p>
<p>Say hello to <strong>name</strong>. Good afternoon
<strong>name</strong>. </p>
<p>Thanks</p>
| c# | [0] |
1,492,232 | 1,492,233 | jQuery .delegate() not working on load and changeData events | <p>Can someone enlighten me on the jQuery delegate, what events are handled and what aren't. The follow code doesn't work</p>
<pre><code>$("#browser").delegate( ".photo", {
"load": function(e) {
alert("photo loaded");
}
});
</code></pre>
<p>but the following code work</p>
<pre><code>$(".photo").load( function(e) {
alert("photo loaded");
} );
</code></pre>
<p>I also try to delegate changeData event to a class which doesn't work as well</p>
<pre><code>$("#browser").delegate( ".thumbnail", {
"changeData": function(e, prop, value) {
alert( prop + " = " + value );
}
});
</code></pre>
<p>but the following code work</p>
<pre><code>$(".thumbnail").bind( "changeData", function(e, prop, value) {
alert( prop + " = " + value );
}
</code></pre>
| jquery | [5] |
2,701,195 | 2,701,196 | Best method for storing mysql passwords? | <p>What do you use? What are the benefits of using it?</p>
<p>Gimme the lowdown on all the techniques, pros and cons all the tutorials don't tell you about.</p>
| php | [2] |
1,027,803 | 1,027,804 | how to add items to resource file (resx) on run time? | <p>i have some global resource files that store my dictionary for app.<br>
when a key is not in the resource file i return the key.</p>
<pre><code>public Object MyGetGlobalResourceObject(string classKey, string resourceKey)
{
try
{
if (GetGlobalResourceObject(classKey, resourceKey) == null)
{
return resourceKey;
}
else
return GetGlobalResourceObject(classKey, resourceKey);
}
catch (MissingManifestResourceException ex)
{
return classKey + "-" + resourceKey + " " + ex.ToString();
}
}
</code></pre>
<p>i want to add the resourceKey to the classKey file.</p>
| asp.net | [9] |
4,558,725 | 4,558,726 | Duplicate symbol Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-4.2 failed with exit code 1 | <p>ld: duplicate symbol _teapot_vertices in /Users/iphone/Library/Developer/Xcode/DerivedData/ImageTargets-cbbgriyhgpamtidfvkqsbglovpup/Build/Intermediates/ImageTargets.build/Debug-iphoneos/ImageTargets.build/Objects-normal/armv6/CC3ModelSampleFactory.o and /Users/iphone/Library/Developer/Xcode/DerivedData/ImageTargets-cbbgriyhgpamtidfvkqsbglovpup/Build/Intermediates/ImageTargets.build/Debug-iphoneos/ImageTargets.build/Objects-normal/armv6/SYN_AR_EAGLView.o for architecture armv6
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-4.2 failed with exit code 1</p>
| iphone | [8] |
1,201,499 | 1,201,500 | How the code execute immediately without hit the button? | <p>I made a very simple Ajax test code snippet:</p>
<pre><code><!DOCTYPE html>
<html>
<head>
<script src='main.js'></script>
</head>
<body>
<button id='get-content'>Click</button>
<p></p>
</body>
</html>
</code></pre>
<p>main.js</p>
<pre><code>(function(){
window.addEventListener('load', function(){
var xml_request = new XMLHttpRequest();
xml_request.open('GET', '/test.txt', true);
xml_request.addEventListener('readystatechange', change_content);
var button_element = document.getElementById('get-content');
button_element.addEventListener('click', fireup(xml_request));
function fireup(xml_request) {
xml_request.send();
}
function change_content(){
if (xml_request.readyState == 4 && xml_request.status == 200) {
document.getElementsByTagName('p')[0].textContent = xml_request.responseText;
};
};
});
})();
</code></pre>
<p>it works, but except, the ajax request send and change the p tag, without I hit the button,
any idea?</p>
| javascript | [3] |
5,520,694 | 5,520,695 | Android - ResolveInfo set preferredOrder of application | <p>The preferredOrder is a property of ResolveInfo class.</p>
<p>How can I set the preferredOrder of the application, so that it can be accessed with the List of ResolveInfo collection while retrieving them from PackageManager object?
Is there any tag or attribute in manifest of application where this can be set?</p>
<pre><code>PackageManager manager = getPackageManager();
final List<ResolveInfo> apps = manager.queryIntentActivities(mainIntent, 0);
for (int i = 0; i < apps.size(); i++) {
ResolveInfo info = apps.get(i);
int order = info.preferredOrder; // How to set this - Default always come zero.
}
</code></pre>
<p>Thanks</p>
| android | [4] |
5,459,017 | 5,459,018 | How To Merge 3 lists into one dictionary(with unique elements) | <h3>Code Written In Python</h3>
<blockquote>
<p><code># Following Are The 3 Lists</code><br>
<code>sections = ['A', 'B', 'A', 'A', 'B']</code><br>
<code>students = ['Jack', 'Jim', 'Jack', 'Leena', 'Jim']</code><br>
<code>subjects = ['Maths', 'Biology', 'Chemistry', 'English', 'Physics']</code></p>
<p><code># The Output Should Be A Dictionary</code><br>
<code>classDict = {'A':{'Jack' :{1:'Maths', 2:'Chemistry'}, 'Leena':{1:'English'}}, 'B':{'Jim':{1:'Biology', 2:'Physics'}}}</code> </p>
</blockquote>
<p>I can merge any of the two list into one dictionary, taking only first two lists in account</p>
<pre><code>classDict = {}
for stu in students:
if not stu in classDict:
classDict[stu] = []
classDict[stu].append(stu)
</code></pre>
<p>But unable to extend it to n(n=3, in my case) list.</p>
| python | [7] |
1,677,068 | 1,677,069 | Need to fetch all span values in a div as an array or string? | <p><strong>I need to fetch all span values in a div into array or string</strong></p>
<pre>
var tag_text_arr=$("#div_id span").each(function(){
return $(this).text();
});
</pre>
<p>Actually i need to fetch all span values inside div and want to create a string like this </p>
<p>span1_val|span2_val|span3_val|span4_val</p>
<p>If this is possible explain me...</p>
| jquery | [5] |
4,633,140 | 4,633,141 | salted md5 password generated with spring different from salt md5 password generated in php | <p>I am using username as a salt for spring security however when I tried to do the similar case in php it generates a different hashed password. The following is my php code:</p>
<pre><code><?php
$un=$_POST['username'];
$pw=$_POST['password'];
$salt ='weiren';
$passw='enjoyit';
$pass=md5($passw.md5($salt));
mysql_connect("localhost","root","");
mysql_select_db("dbname");
$sql=mysql_query("select * from people where username = '$un' and password = '$pw'");
if(mysql_num_rows($sql) > 0)
// ( $un == “ajay” && $pw == “ajay”)
echo 1; // for correct login response
else
echo $pass;
// for incorrect login response
?>
</code></pre>
| php | [2] |
2,040,301 | 2,040,302 | dynamic binding gives lesser execution time than static binding | <p>Consider the following code:</p>
<pre><code> import java.io.*;
import java.util.*;
class parent{
private static int static_count;
final void static_display(){
for(int i=0; i< 1000000; i++){
Object obj = new Object();
}
System.out.println("Static method called"+static_count+"times");
}
public void dynamic_display(){
System.out.println("implemented in child");
}
}
class child extends parent{
private static int dynamic_count;
public void dynamic_display(){
for(int i=0; i< 1000000; i++){
Object obj = new Object();
}
System.out.println("dynamic method called"+dynamic_count+"times");
}
}
class sample{
public static void main(String args[]){
parent pnt= new parent();
parent pnt2=new child();
//static binding
long startTime = System.nanoTime();
pnt.static_display();
long elapsedTime = System.nanoTime() - startTime;
System.out.println("Total execution time for static binding in millis: "
+ elapsedTime/1000000);
//dynamic binding
long startTime2 = System.nanoTime();
pnt2.dynamic_display();
long elapsedTime2 = System.nanoTime() - startTime2;
System.out.println("Total execution time for dynamic binding in millis: "
+ elapsedTime2/1000000);
}
}
</code></pre>
<p>When this code is executed i am getting the following answer,</p>
<pre><code> Static method called0times
Total execution time for static binding in millis: 11
dynamic method called0times
Total execution time for dynamic binding in millis: 9
</code></pre>
<p>consider only the execution time in the result.i tried to find the time taken for statically and dynamically binnded method to execute.but according to my answer,dynamic binding is faster than static binding.how is this possible.am i wrong anywhere.</p>
| java | [1] |
3,454,069 | 3,454,070 | JQuery cycle plugin - buttons | <p>Please Delete!! Dont really need it.
All good after rechecked options</p>
<pre><code>function validate_email_address($email = FALSE) {
return (preg_match('/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i', $email))? TRUE : FALSE;
</code></pre>
<p>}</p>
| jquery | [5] |
2,712,409 | 2,712,410 | Memory leaking issue iPhone | <p>Anyone have a idea about solve memory leak issues</p>
<p>i have found one memory related issue
NSAutoreleaseNoPool(): Object 0x3588aea0 of class NSCFString autoreleased with no pool in place - just leaking</p>
<p>can anyone have a idea about how can i solve..</p>
<p>Thnak you</p>
| iphone | [8] |
2,505,717 | 2,505,718 | how to start Android example project from command-line? | <p>I dislike using Eclipse and wish to start an example Android project from the command-line, how can i do this? Is there a way to use "android create project" command to automatically pull in example code from the SDK? A similar method to the following perhaps?</p>
<pre><code>android create project --package com.example.helloandroid \
--activity HelloAndroid \
--target 1 \
--path HelloAndroid
</code></pre>
| android | [4] |
2,139,559 | 2,139,560 | DEBUG/SntpClient(60): request time failed: java.net.SocketException: Address family not supported by protocol | <p>I m running server on Linux console which written in C and creating client in android. i have not getting any error on DDMS but following Debug message come </p>
<pre><code>11-12 20:38:06.787: DEBUG/SntpClient(60): request time failed:
java.net.SocketException: Address family not supported by protocol
</code></pre>
<p>but message will not go to the server. But if create client in C or java it working fine.
any suggestion. </p>
<pre><code>public class UDPDemo extends Activity {
private EditText mEditText;
private Button sendButton;
private DatagramSocket client_socket;
private static InetAddress IPAddress;
private byte[] send_data = new byte[1024];
static{
try {
IPAddress = InetAddress.getByName("127.0.0.1");
} catch (UnknownHostException e1) {
e1.printStackTrace();
}
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mEditText = (EditText)findViewById(R.id.EditText01);
sendButton = (Button)findViewById(R.id.Button01);
sendButton.setOnTouchListener( send);
}
OnTouchListener send = new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if( event.getAction() == MotionEvent.ACTION_UP)
try {
client_socket = new DatagramSocket();
String data = mEditText.getText().toString();
send_data = data.getBytes();
DatagramPacket send_packet = new DatagramPacket(send_data,
send_data.length, IPAddress, 5000);
client_socket.send(send_packet);
mEditText.setText("");
}catch (IOException e) {
System.out.println("UDPDemo.enclosing_method() error"+e.getMessage());
e.printStackTrace();
}
return true;
}
};
}
</code></pre>
| android | [4] |
4,681,957 | 4,681,958 | Jquery comparing background color | <p>I am using:</p>
<pre><code>var element = $(this).parents("tr:first");
if (element.css("background-color")=="black)")
element.animate({ backgroundColor: "white" }, 1000);
else
element.animate({ backgroundColor: "black" }, 1000);
</code></pre>
<p>To change background color, but comparision seems to fail, I also tried:</p>
<pre><code>if (element.css("background-color")==rgb(0,0,0))
</code></pre>
<p>But the if condition seems to return false everytime?</p>
| jquery | [5] |
327,675 | 327,676 | how to generate sound program for capctha in php | <p>I am making API like recapctha.I am hanging to make coding for sounde system for this API.</p>
<p>What is the concept behind to make this code?
Id it possible to make this is javascript ?</p>
| php | [2] |
1,656,059 | 1,656,060 | what is NSParameterAssert? | <p>what is NSParameterAssert?can anyone explain with example?</p>
| iphone | [8] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.