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 |
|---|---|---|---|---|---|
3,910,249 | 3,910,250 | Whats wrong with this jquery variable | <p>I'm kinda new to Jquery but doing my best to be better. </p>
<p>I have a problem with a variable, so would like to have some help. Have tried and search the web for hours but can't get it to work. </p>
<pre><code>$(document).ready(function() {
$("a").click(function(){
var lek = "http://dif.se/wp-content/uploads/2012/03/bortajersey_topp.jpg";
$(".contact").slideDown();
var imageurl = $(".contact").text($("img", this).attr("src"));
$(this).add("img",this).css("background", "yellow");
$(".contact").append("<img src="+imageurl+">");
});
});
</code></pre>
<p>The variable I have problems with is the imageurl, I get it to work just as I want with the "lek" variable. </p>
<p>Thanks guys,
Michael</p>
| jquery | [5] |
2,881,340 | 2,881,341 | Java application - which all parts of my code are being fired up in production? | <p>I have a java web based application running in production. I need some way to be able to see which all parts of the code is being actually used, by the actions of the end user. </p>
<p>Just to clarify my requirement further. </p>
<ol>
<li><p>I do not want to put a logging based solution. Any solution that needs me to put some logs and analyse the logs is not something that I am looking from. </p></li>
<li><p>I need some solution that works on similar lines like unit test coverage reporter. Like cobertura or emma reports, after running the unit tests, it shows me which all part of my code was fired up by the unit tests. I need something that will listen to JVM in production and tell me which all parts of my code is being fired up in production by the action of end user. </p></li>
</ol>
<p>Why am I trying to do this?
I have a code that I have inherited. It is a big piece - some 25,000 classes. One of the bits that I need to do is to chop off parts of the application that is not being used too much. If I can show to management that there are parts of the application that are being scarcely used, I can chop off those parts from this product and effectively make this product a little more manageable (as in the manual regression test suite that needs to run every week or so and takes a couple of days, can be shortened). </p>
<p>Hope there is some ready solution to this. </p>
| java | [1] |
5,913,210 | 5,913,211 | Execute PHP Code from File On Other Computer | <p>Is it possible, to include PHP code in a separate file on another computer. If so, how?</p>
<p>For example:</p>
<p>On the first computer:</p>
<pre><code>#Host 1 Script
$username = "dfgd";
$password = "sdff";
#Code I need help with
</code></pre>
<p>And then on the second:</p>
<pre><code>#Host 2 Script
#Code which needs to be run on Host 1 which will manipulate $username and $password
</code></pre>
<p>Obviously, I would not be able to store the script on Host 2 in a .php file because when it is read, nothing would print out... But is it possible?</p>
| php | [2] |
3,851,748 | 3,851,749 | I need an explanation of when to use class variables? | <p>Suppose we have a class like:</p>
<pre><code>public class test {
int a=1;
static int b=1;
public int getA()
{
return a;
}
public void incrementA()
{
a++;
}
public void incrementB()
{
b++;
}
public int getB()
{
return b;
}
}
</code></pre>
<p>and I have a class with main method like this</p>
<pre><code>public class testmain {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
test t= new test();
t.incrementA();
test t1= new test();
test t2= new test();
t2.incrementB();
test t3 = new test();
test t4= new test();
t4.incrementB();
System.out.println("t= "+t.getA());
System.out.println("t1= "+t1.getA());
System.out.println("t4= "+t4.getB());
System.out.println("t3= "+t3.getB());
System.out.println("t2= "+t2.getB());
}
}
</code></pre>
<p>I need the explanation about why <code>t</code> and <code>t1</code> have different value of <code>a</code>, and all <code>t2</code>, <code>t3</code>, <code>t4</code> have the same value of <code>b</code>. I know that I have declared <code>b</code> as static and all objects access the same address of that variable <code>b</code>. Why it is not causing any problem for a variable when each object it has its own <code>a</code>, now my question is since all the objects look to the same location in memory then why is <code>a</code> different value of each object?</p>
| java | [1] |
3,702,902 | 3,702,903 | Is there an Android Testing Service I can use to give me real debug information from a device? | <p>I need test my Android app on a Motorola Cliq but don't have one. Is there a testing service that will let me make a debug connection to that device so I can run some tests and find out where the code is failing. Video connections won't tell me that.</p>
| android | [4] |
682,442 | 682,443 | I want to change MAC address of android device? | <p>I am getting MAC address of devices using wifi interface:</p>
<pre><code>WifiManager wifiMan = (WifiManager) this.getSystemService(
Context.WIFI_SERVICE);
WifiInfo wifiInf = wifiMan.getConnectionInfo();
String macAddr = wifiInf.getMacAddress();
</code></pre>
<p>Is there any way for retrieve mac address without wifi interface?</p>
<p>Also confirm me Can we able to change MAc address of android devices?</p>
<p>Please confirm me android framework support these things or not?</p>
| android | [4] |
1,050,176 | 1,050,177 | jQuery Calculation Problem | <p>I've been struggling trying to get jQuery to make a calculation for me, and i'm kinda pulling my hair out a bit now!</p>
<p>I need to make a calculation to work out the theoretical weight of a given amount of steel sheets based upon the quantity and the dimensions. The output will be a weight in kg.</p>
<p>The equation is as follows:
Qty x 7.85 x Length(mm) x Width(mm) x Gauge(mm) / 1000</p>
<p>The details need to be pulled from form fields and then the result outputted to text or in an input, preferably as the person edits the quantity field.</p>
<p>You can see an example of what i am trying to achieve here: <a href="http://www.clifton.rogr.net/enquiry" rel="nofollow">http://www.clifton.rogr.net/enquiry</a></p>
| jquery | [5] |
2,986,870 | 2,986,871 | How does the regular expression match 3 in JavaScript? | <p>This is a statement from JavaScript regular expression description:</p>
<blockquote>
<p><code>^</code> has a different meaning when it appears as the first character in a character set pattern.<br>
For example, <code>/[^a-z\s]/</code> matches the <code>'3'</code> in <code>"I have 3 sisters"</code>.</p>
</blockquote>
<p>How does <code>^</code> match <code>3</code>?</p>
| javascript | [3] |
5,111,156 | 5,111,157 | How can I remove some characters from a C# string? | <p>I have the string:</p>
<pre><code>http://127.0.0.1:96/Cambia3
</code></pre>
<p>The number 96 could be anything from 75 to 125. </p>
<p>Is there a simple way that I could remove this number to get:</p>
<pre><code>http://127.0.0.1/Cambia3
</code></pre>
| c# | [0] |
636,155 | 636,156 | How to have app talk to a web page, ie send gps location | <p>I'm trying to write a app, where a webpage will have a button that when press will give the GPS location of the phone.</p>
<p>I was going to have the android app create a thread that waits on a scket connection. The issue is that
1. Getting the ip addrs of the phone
2. I was told this would really drain the battery</p>
<p>I was also thinking about having the phone send the gps location to a webserver like evrry 10 seconds. This sort of seams like a waste of bandwidth.</p>
<p>Is there a good way to do this?</p>
| android | [4] |
465,297 | 465,298 | Is there any server configuration or anything that make __DIR__ failed | <p>I have develop a framework where most of its path depend on <code>__DIR__</code>. Is there any server configuration or anything that would make <code>__DIR__</code> unreliable?</p>
| php | [2] |
3,446,781 | 3,446,782 | Create my own Unique ID | <p>I am trying to create a my own unique ID in C# for each document in my NoSQL database but I am not too sure how I would do that?</p>
<p>My example UID would look something like this <code>######.entityType@######.contextName.worldName</code></p>
<p>The hashes are alphanumeric characters.</p>
| c# | [0] |
1,461,083 | 1,461,084 | Is this a wrapper script? What is the correct name for it? (Python) | <pre><code>execfile("es.py")
execfile("ew.py")
execfile("ef.py")
execfile("gw.py")
execfile("sh.py")
print "--Complete--"
</code></pre>
| python | [7] |
3,996,012 | 3,996,013 | Rsa Cryptography in c#. i have encrypted an xml file and saved it | <p>Rsa Cryptography in c#. i have encrypted an xml file and saved it .after that i transferred this file to another pc .the main problem is that it couldn,t decrypt.i dont know why??
when iam decrypting on the same machine the xml file is decrypted..</p>
<p><pre><code>
public static byte[] decryptFile(XmlDocument Doc, RSA rsaKey, string KeyName)
{</p>
Doc = new XmlDocument();
Doc.PreserveWhitespace = true;
Doc.Load(@"MLPACK1.xml");
EncryptedXml encXml = new EncryptedXml(Doc);
encXml.AddKeyNameMapping(KeyName, rsaKey);
encXml.DecryptDocument();
string contentOfDocument = Doc.OuterXml;
byte[] buffer = StrToByteArray(contentOfDocument);
return buffer;
}
</code></pre>
| c# | [0] |
659,902 | 659,903 | PHP, included more than one time require include_once or include? | <p>I'am asking myself why should i use include or include_once.</p>
<p>I know there is a question <a href="http://stackoverflow.com/questions/186338/why-is-require-once-so-bad-to-use">about it</a>, but i dont find my answer in it.</p>
<p>In my case my problem is a little bit different, but it can summarize as following.
If i use 4 files who includes themselves, by example:</p>
<p>A includes D</p>
<p>B includes C,D</p>
<p>C no include</p>
<p>D includes C</p>
<p>Should i use "include" or "include_once", and why ?</p>
<p><strong>EDIT</strong></p>
<p>Little mistake in the problem. I just rewrite.</p>
<p><strong>EDIT</strong></p>
<p>To explain my self, D need C to works, but C does not need for D to works. Sometime i have to include C, sometimes i have to include D. D has been refactored, so now it includes C automatically, but there is more than 2 thousand files to review in many directories... so i'am wondering if i use a "include_once" in D is better to use a "include" in D.</p>
| php | [2] |
4,822,431 | 4,822,432 | noticed variations of %1$s being used in code, cannot google escaped charecters. Please link a resource | <pre><code>String.format("com.dummy.%1$s.", strVarName)
</code></pre>
| java | [1] |
2,560,609 | 2,560,610 | Android debugger in Eclipse IDE is not working properly | <p>when i proceed step by step debugging I got following things.</p>
<p>Activity.class</p>
<p>Class File Editor</p>
<p>Source not found</p>
<p>The JAR file E:\eclipse\android-sdk-windows\platforms\android-4\android.jar has no sourse attachment.</p>
<p>But i have android.jar in the specified location</p>
<p>This is the one i got while debugging.</p>
<p>My using Win 7 home basic 32-bit, Eclipse Java EE IDE for Web Developers, Version: Indigo Release, Android sdk upto 1.6_r1</p>
<p>Can any one help me....</p>
<p>Thanks in advance</p>
| android | [4] |
5,457,658 | 5,457,659 | Any danger of using PHP getimagesize function? | <p>I have this host that disables allow_url_fopen as they said it is a security risk which in turns prevents my use of getimagesize function because I am passing in a http.</p>
<p>My site is on Wordpress and I am using getimagesize to pull in a image within the uploads folder of a Wordpress site which obviously contains http://. </p>
<p>So my question is if this is not safe? If it is not safe, how can this be done within a Wordpress environment?</p>
<p>Thanks.</p>
| php | [2] |
5,685,643 | 5,685,644 | what is apply doing here? | <p>What specifcially does <code>func.apply(this, arguments);</code> do in this code? I can see that it will not work to resize the elements dynamically without the <code>apply</code>, however, it seems as though nothing further is done with <code>this</code> or <code>arguments</code> after <code>apply</code> is used.</p>
<pre><code>function throttle (func, wait) {
var throttling = false;
return function(){
if (!throttling){
func.apply(this, arguments);
throttling = true;
setTimeout(function(){
throttling = false;
}, wait);
}
};
}
</code></pre>
<p><a href="http://jsbin.com/axugek/1/edit" rel="nofollow">jsbin</a></p>
| javascript | [3] |
295,896 | 295,897 | Including strings in class | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5578732/how-can-i-include-php-file-in-php-class">how can i include php file in php class</a> </p>
</blockquote>
<p>I have a PHP file that starts like this:</p>
<pre><code><?php
include("strings.php");
class example {
</code></pre>
<p>The strings.php is formatted like this</p>
<pre><code>$txt['something'] = "something";
$txt['something_else'] = "something else";
</code></pre>
<p>My question is, how do I call the <code>$txt['something']</code> inside a method in <code>example</code> class?
I know <code>$this->txt['something']</code> doesn't work</p>
<p>It's probably basic stuff, but I just started learning PHP</p>
| php | [2] |
1,425,874 | 1,425,875 | How to escape a path in PHP | <p>Basically I want to put C:\cameraTest\something\ into a single quoted string, but I'm not entirely sure how to properly escape the final backslash as it ends up escaping the single quote if I do so. Thanks for any help in advance! </p>
| php | [2] |
2,251,166 | 2,251,167 | Python builtin function as keyword argument default? | <p>Are Python's built-in functions not available for use as keyword defaults, or should I be using some other way of referring to a function?</p>
<p>I wanted to write a function like this:</p>
<pre><code>def isPNGBlock(bytes, blockLen, pngOffset=0, pngErrorLogger=print):
...
try:
r.validate_signature()
width, height, pixels, metadata = r.read(lenient=True)
except png.Error as e:
pngErrorLogger(e)
</code></pre>
<p>Instead I've had to settle for doing this with a default argument of None as a flag value.</p>
<pre><code>def isPNGBlock(bytes, blockLen, pngOffset=0, pngErrorLogger=None):
...
try:
r.validate_signature()
width, height, pixels, metadata = r.read(lenient=True)
except png.Error as e:
if pngErrorLogger is None:
print(e)
else:
pngErrorLogger(e)
</code></pre>
<p>or using a wrapper function:</p>
<pre><code>def defaultLogger(str):
print(str)
def isPNGBlock(bytes, blockLen, pngOffset=0, pngErrorLogger=defaultLogger ):
...
try:
r.validate_signature()
width, height, pixels, metadata = r.read(lenient=True)
except png.Error as e:
pngErrorLogger(e)
</code></pre>
| python | [7] |
2,578,513 | 2,578,514 | jQuery Animation on multiple items | <p>On the page i have multiple thumbs images, each has it's own id, generated by php.</p>
<p>I need to do the jQuery animation for each element.</p>
<p>I'm stuck here, how i can detect witch <code>thumb_id-??</code> the user is hovering, and animate it?</p>
<p>I know i can do two simple js function for onmouseover/out and pass the id.. but there is another method of doing it with jQuery?</p>
<pre><code><script>
$(document).ready(function(){
$('#thumb_id- ??? ').mouseover(function(){
div = $('div.thumb-img-hover');
div.animate({opacity: '1'}, 150);
}).mouseout(function(){
div.animate({opacity: '0'}, 150);
});
});
</script>
</code></pre>
<hr>
<pre><code>foreach($arr as $val){
echo '
<a class="group1" text="TESTING" title="" href="'.$baseurl.'uploads/'.$val["filename"].'">
<div class="thumb-img-container right">
<div class="thumb-img" style="position:relative;background:url(\''.$baseurl.'uploads/thumbs/'.$val["filename"].'\') no-repeat center center;background-size: cover;">
<div id="thumb_id-'.$val["id"].'" class="thumb-img-hover"><a href="'.$baseurl.'index.php?action=image&id='.$val["id"].'">test</a></div>
</div>
</div>
</a>
';
}
</code></pre>
| jquery | [5] |
2,197,208 | 2,197,209 | Repeat ImageView in layout - Android | <p>I want to repeat image in a layout. Number of times the image should be repeated , will be given dynamically. Image should be displayed Horizontally. How can I do this?</p>
<p>Please help me. Looking for your reply. Thanks.</p>
| android | [4] |
129,707 | 129,708 | BSE/NSE quote in PHP | <p>I want to display NSE/BSE quote in my PHP website. please let me know what I have to do, if I get the webservices for this then how to use it in PHP.
Please help</p>
| php | [2] |
4,785,296 | 4,785,297 | Read end of line while looping word by word in c++ | <p>Am reading a file which contains list of sentences , I need to read each word and try to figure out this word in which line number ..
the file contains :</p>
<pre><code>I am for truth
no matter who tells it,
I am for justice,
no matter who it is for or against
Malcom X
</code></pre>
<p>and I want the output to be in this form :</p>
<pre><code>against 4
matter 4
am 1, 3
no 2, 4
for 1, 3, 4
or 4
I 1, 3
tells 2
is 4
truth 1
it 2, 4
who 2,4
justice 3
X 5
Malcolm 5
</code></pre>
<p>am using binary search trees and here is my code :</p>
<pre><code>int main(int argc, char *argv[]) {
fstream infile ;
BSTFCI <string>* bst = new BSTFCI<string>();
string word;
string line;
infile.open("test.txt" , ios::in);
if(infile.fail())
{
cout<<"Error Opening file"<<endl;
return 0;
}
while(!infile.eof())
{
infile>>word;
for(int i=0 ; i<word.size();i++)
{
if(ispunct(word[i]))
word.erase(i,1);
}
cout<<count<<endl;
if(!bst->search(word))
{
cout<<word<<endl;
bst->insert(word);
cout<<"add"<<endl;
}
else
{
cout<<word<<endl;
cout<<"exist"<<endl;
}
}
infile.close();
return 0;
}
</code></pre>
| c++ | [6] |
1,290,451 | 1,290,452 | Sending a string to a Bluetooth serial port using android | <p>I need to send a string to a blue tooth serial port of a PC to a desktop application.the phone should be connected to the PC all the time.and when ever the mobile gets a call.the phone number should be sent to the PC using bluetooth.I need it in android </p>
| android | [4] |
1,164,863 | 1,164,864 | How to set up a cron job via PHP (not CPanel)? | <p>How to set up a cron job via PHP (not CPanel)?</p>
| php | [2] |
3,220,985 | 3,220,986 | Java : Bound mismatch error | <p>I'm learning Java and I have to create a program that implements an interface defined by the teacher to pratice ADT (using ArrayList). I got errors that I don't understand maybe new explanations can help me.</p>
<p><strong>Interface :</strong></p>
<pre><code>public interface A<T extends C> { ... }
</code></pre>
<p><strong>Class signature in error :</strong></p>
<pre><code>public class AImpl<T> implements A<T> { /*Bound mismatch error*/ ... }
</code></pre>
<p><strong>JUnit test class</strong></p>
<pre><code>//Declaration
A<Alphabet> alphaList;
//in setUp()
alphaList = new AImpl<Alphabet>;
// in one method
alphaList.size(); /* The method size() is undefined for the type A<Alphabet> */
</code></pre>
<p>Note that Alphabet is given by the teacher too and there's the signature :</p>
<pre><code>public class Alphabet implements C { ... }
</code></pre>
<p>Can someone help to point out where is my errors with some explanations ? </p>
<p>Regards.</p>
| java | [1] |
3,386,243 | 3,386,244 | Dynamically loaded dropdownlist control doesn't fire SelectedIndexChanged event | <p>I have the control <code>dropdownlist</code> which has been loaded inside the template column of <code>RadGrid</code>.<br>
While loading I have set <code>AutoPostBack='True'</code> for <code>dropdownlist</code> and also created the event <code>SelectedIndexChanged</code>.</p>
<pre><code> DropDownList ddlConditions = new DropDownList();
ddlConditions.ID = "ddl" + name;
ddlConditions.AutoPostBack = true;
ddlConditions.SelectedIndexChanged += new EventHandler(ddlConditions_SelectedIndexChanged);
</code></pre>
<p>My question is while i change the selected index of <code>dropdownlist</code> the event <code>SelectedIndexChanged</code> is not getting triggered.<br>
Can anyone help me to solve this problem?<br>
Thanks in advance.</p>
| asp.net | [9] |
4,717,504 | 4,717,505 | Generate a random string with a specific bit size in java | <p>How do i do that? Can't seems to find a way. Securerandom doesn't seems to allow me to specify bit size anywhere</p>
| java | [1] |
4,035,776 | 4,035,777 | php date conversion | <p>How would i convert a format like:</p>
<pre><code>13 hours and 4 mins ago
</code></pre>
<p>Into something i can use in php to further convert?</p>
| php | [2] |
3,047,599 | 3,047,600 | Which MVC framework for my code | <p>MVC frameworks for javaScript (backbone ember etc) seem suited to web apps where data is the central component. </p>
<p>I have a web page that has a fair amount of JS but no data at all. I'm doing lots of SVG, lots of API stuff with youTube and lots of animation. I'm using a <a href="http://is.gd/vkd07K" rel="nofollow">pub/sub</a> pattern to handle events which is nice and tidy and a modified module pattern allowing for public/private scope. Problem is that my code (currently running at about 1000 lines) is starting to feel like <a href="http://en.wikipedia.org/wiki/Spaghetti_code" rel="nofollow">Spaghetti</a>.</p>
<p>Can I practically use an MVC framework for this type of project or perhaps is there another approach I could take?</p>
<p>I'm hoping this question isn't too conversational in style. Perhaps there is a library/resource out there that can help me.</p>
| javascript | [3] |
2,521,639 | 2,521,640 | Best Place to Filter Inputs? | <p>I am wondering where the best place to filter user submitted input is. In regards to filter, I am talking about <a href="http://php.net/manual/en/function.filter-var.php" rel="nofollow">filter_var</a> and <a href="http://www.php.net/manual/en/function.filter-input.php" rel="nofollow">filter_input</a>.</p>
<p>I've come up with three scenarios:<br/></p>
<ol>
<li>Filter data from POST/GET, and pass filter data to function which takes it as-is.</li>
<li>Take raw data from POST/GET, and pass as-is to function where the function filters it.</li>
<li>Filter data from POST/GET, and filter is a second time in the function.</li>
</ol>
<p>Each of these methods has its advantages and disadvantages. I was looking for some insight into which may be best or standard practice.</p>
<p>Method 1 passes sanitized data to the function, and thus functions can be smaller not having to sanitize everything coming in. The downfall is if any other place your function is called and the data isn't sanitized, this can lead to problems. This simply requires good coding practice to remember to sanitize everything before passing to a function.</p>
<p>Method 2 you will never have to worry about your function dealing with unsanitized data, but the functions will be bigger.</p>
<p>Method 3 is the safest, but is wasteful. More code is written, and data may be sanitized multiple times as it passes through possibly various functions, wasting CPU resources and time.</p>
| php | [2] |
5,845,581 | 5,845,582 | How to load images from the Documents folder that have been saved dynamically? | <p>I have problem with loading images from the Documents folder of iPhone application into the tableView.</p>
<p>In a separate request, I check on the server all the images available and download them into the "images" folder under Documents. I am pretty sure that the images are saved correctly.</p>
<pre><code>NSString *filePath = [imagesFolderPath stringByAppendingPathComponent:imageFileName];
[urlData writeToFile:filePath atomically:NO];
NSLog(@"Saved to file: %@", filePath);
2010-01-22 17:07:27.307 Foo[2102:207] Saved to file: /Users/Hoang/Library/Application Support/iPhone Simulator/User/Applications/6133A161-F9DC-4C92-8AE6-5651022EAA94/Documents/images/86_2.png
</code></pre>
<p>[NSBundle mainBundle] is not suitable for loading the images because at runtime, the application tries to connect to the server to download the images, they are not static.</p>
<p>But loading the images from Documents/images folder does not give me the image on the TableView. </p>
<pre><code>static NSString *CellIdentifier = @"CellCategory";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
UIImageView *imageView = cell.imageView;
MenuItem *item = (MenuItem *) [arrayMenuItems objectAtIndex:indexPath.row];
cell.textLabel.text = item.descrizione;
NSString *strImagePath = [[imagesFolderPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%d_%d", item.idItem, item.idNode]] stringByAppendingPathExtension:@"png"];
NSLog(@"strImagePath: %@", strImagePath);
imageView.image = [[UIImage imageWithContentsOfFile:strImagePath] autorelease];
2010-01-22 17:07:42.842 Foo[2102:207] strImagePath: /Users/Hoang/Library/Application Support/iPhone Simulator/User/Applications/6133A161-F9DC-4C92-8AE6-5651022EAA94/Documents/images/86_2.png
</code></pre>
<p>Is there anyone having the same problem?</p>
<p>I have looked around in stackoverflow but have not succeeded.</p>
<p>Thanks in advance.</p>
| iphone | [8] |
4,659,857 | 4,659,858 | how to create a program in java | <p>how to create a program that will sort the elements of array in ascending and descending order.
sample output:
Enter size: 4
Enter elements
11
26
8
30
Ascending
8
11
26
30
descending
30
26
11
8</p>
| javascript | [3] |
916,697 | 916,698 | PHP: using an environment variable as a reference to a local constant | <p>My code:</p>
<pre><code>const T = 'test';
const B = 'boat';
$const_var = getenv('FOO');
</code></pre>
<p>In my VirtualHost section, I have:</p>
<pre><code>SetEnv FOO T
</code></pre>
<p>Obviously $const_var evaluates to the character <code>T</code>.</p>
<p>What I want to do is to be able to use the value of local const T, by using the value of the environment variable as a reference. Is there a way to do that?</p>
| php | [2] |
4,891,800 | 4,891,801 | Does null have Object type? | <p>Why does this output: "inside String argument method"? Isn't null "Object" type?</p>
<pre><code>class A {
void printVal(String obj) {
System.out.println("inside String argument method");
}
void printVal(Object obj) {
System.out.println("inside Object argument method");
}
public static void main(String[] args) {
A a = new A();
a.printVal(null);
}
}
</code></pre>
| java | [1] |
3,290,156 | 3,290,157 | NaN in multiplication | <p>I am trying this code, but i am getting NaN</p>
<pre><code>a = unidade.val();
b = unitario.val();
//alert(a);5
//alert(b);50,00
$(total).val(a * b); //NaN
</code></pre>
<p>Why? because is a <code>int*float</code>?</p>
| javascript | [3] |
2,281,230 | 2,281,231 | Toggle table row siblings | <p>I have a table structured like this:</p>
<pre><code><table>
<tr id="id1" class="parent"></tr>
<tr class="id1"></tr>
<tr class="id1"></tr>
<tr class="id1"></tr>
<tr class="id1"></tr>
<tr id="id2" class="parent"></tr>
<tr class="id2"></tr>
<tr class="id2"></tr>
<tr class="id2"></tr>
<tr class="id2"></tr>
.....etc
</table>
</code></pre>
<p>As you can see child classes are coresponding to their parent id. Now I want to toggle all the rows which have class names equal to their parent row id whenever parent row is clicked.</p>
<p>I have tried this, perhaps stupid try:) and can't seem to get this working:</p>
<pre><code> $('tr.parent').click(function() {
//alert('yay');
var tog = $(this).attr('id');
$(this).siblings().hasClass(tog).slideToggle();
return false;
});
</code></pre>
<p>Thanks.</p>
| jquery | [5] |
869,740 | 869,741 | Convert NaN to 0 in javascript | <p>Is there a way to convert NaN values to 0 without an if statement:</p>
<pre><code>if (isNaN(a)) a = 0;
</code></pre>
<p>It is very annoying to check my variables every time.</p>
| javascript | [3] |
5,153,534 | 5,153,535 | Import from parent directory failed with ImportError | <p>I'm busy developing an application in python, my application is structured as follows</p>
<pre><code>main.py
pr/
core/
__init__.py
predictor.py
gui/
predictor/
__init__.py
predict_panel.py
__init__.py
pr_app.py
__init__.py
</code></pre>
<p>I launch the application using <code>main.py</code></p>
<p>inside <code>pr_app.py</code> I've got</p>
<pre><code>class PrApp(wx.App):
PREDICTOR = Predictor()
</code></pre>
<p>inside <code>predict_panel.py</code> I can successfully do </p>
<p><code>from pr.core.predictor import Predictor</code></p>
<p>but for some reason I cannot do</p>
<p><code>from pr.gui.pr_app import PrApp</code></p>
<p>I get presented with</p>
<p><code>ImportError: cannot import name PrApp</code></p>
<p>Is there some kind of gotcha when importing from parent directories in python, or am I missing something?</p>
| python | [7] |
5,931,339 | 5,931,340 | textfile in string | <p>all i want is to display the contains from pageset.txt line by line.</p>
<p>ok i have this code:</p>
<pre><code>$lines = file('pageset.txt');
foreach($lines as $line) {
// do something with $line.
$hh = $line . "<br/>";
echo $hh;
</code></pre>
<p>now i want to display it line by line as you see there is <br/> so it means each contains should display line by line and so it must however it doesnt display line by line and the bad thing is it only display one contains from pageset.txt. hope someone here could help, thank you in advance.</p>
| php | [2] |
5,916,060 | 5,916,061 | Library for Image Filters In Android | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4280162/android-image-filter-libraries">Android image filter libraries</a> </p>
</blockquote>
<p>Can Anyone provide me the library file to filter image in Android like Black & White, Sepia,vintage, polaroid etc....</p>
| android | [4] |
3,719,542 | 3,719,543 | Read a large text file into Textview | <p>I want to read large file from sdcard into text view.
I have idea but i don't know how to apply.</p>
<p>I think this things need to use:
Handler And
Thread</p>
<p>But i dont know how to apply.
Anybody give some example or Tutorial.</p>
<p><b>Updated:</b></p>
<pre><code>Thread test=new Thread()
{
public void run()
{
File sfile=new File(extras.getString("sfile"));
try {
StringBuilder text = new StringBuilder();
BufferedReader br = new BufferedReader(new FileReader(sfile));
String line1;
while(null!=(line1=br.readLine()))
{
text.append(line1);
text.append("\n");
}
subtitletv.setText(text.toString());
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
test.start();
</code></pre>
<p>This is my code.But it is better than previous code,
but it is not able to read 2MB file.
How to slove this?
And How to set Progress?</p>
| android | [4] |
5,508,344 | 5,508,345 | Listview using arraylist | <p>How can we create the listview using arraylist in a simple way</p>
| android | [4] |
5,999,891 | 5,999,892 | Virtual Functions Dilemma in C++ | <p>I have two questions to ask...</p>
<p>a) </p>
<pre><code>Class A{
int a;
public:
virtual void f(){}
};
Class B {
int b;
public:
virtual void f1(){}
};
Class C: public A, public B {
int c;
public:
virtual void f(){} // Virtual is optional here
virtual void f1(){} // Virtual is optional here
virtual void f2(){}
};
Class D: public C {
int d;
public:
void f2(){}
};
</code></pre>
<p>Now C++ says that there won't be 3 virtual pointers in C's instance but only 2. And then, how could a call to say,</p>
<pre><code>C* c = new D();
</code></pre>
<p><code>c->f2();</code> // Since there is no virtual pointer corresponding to the virtual function defined in f2(). How is the late binding done ?..</p>
<p>I read saying that , the virtual pointer to this function is added in the virtual pointer of the first super class of C. Why is that so ?.. Why is there no virtual table ?...</p>
<p>sizeof(*c); // It would be 24 and not 28.. Why ?...</p>
<p>Also say, considering the above code, i do this ,</p>
<pre><code>void (C::*a)() = &C::f;
void (C::*b)() = &C::f1;
printf("%u", a);
printf("%u",b);
// Both the above printf() statements print the same address. Why is that so ?...
// Now consider this,
C* c1 = new C();
c1->(*a)();
c1->(*b)();
</code></pre>
<p>// Inspite of a and b having the same address, the function invoked is different. How is the definition of the function bounded here ?...</p>
<p>Hope I get a reply soon.</p>
| c++ | [6] |
1,230,227 | 1,230,228 | How to call built-in camera app from my own application in Android? | <p>Being a newbie to Android I can't work out how to call the camera application (or you can say camera preview?) when I click a button in my custom application.</p>
| android | [4] |
2,926,114 | 2,926,115 | Can we move the success function outside .ajax? | <p>In the jquery example , I saw it is usually to define success function inside $.ajax()
can we move it outside the body.</p>
| jquery | [5] |
4,559,472 | 4,559,473 | jQuery Hover not work in Chrome and Safari | <p>I have the HTML code:</p>
<pre><code><span style="padding-right:100px;" class="tree_list">
<p>Hover Here</p>
<span class="admin_tools" id="tree_list_tool">
<a href="http://google.com">Google</a>
<a href="http://facebook.com">Facebook</a>
</span>
</span>
</code></pre>
<p>The CSS code:</p>
<pre><code>.admin_tools {
display:none;
}
</code></pre>
<p>And the jQuery code to execute:</p>
<pre><code>$('.tree_list').hover(
function(){
$('#tree_list_tool', $(this)).show();
} ,
function(){
$('#tree_list_tool', $(this)).hide();
}
);
</code></pre>
<p>The jQuery hover function works well on Firefox and IE, but not in Chrome and Safari. I have searched on Google but no the result. Could you give me some solutions ?</p>
<p>Thank in advance!</p>
| jquery | [5] |
149,358 | 149,359 | sending data to server with javascript | <p>how can i send a string value to a sever with java script without submit method?
i know i can use jquery or ajax but is there any other way to do that without any library?
i searched in Google and i find some good links:
<a href="http://stackoverflow.com/questions/5049635/how-to-send-data-to-remote-server-using-javascript">How to send data to remote server using Javascript</a>
http://bytes.com/topic/html-css/answers/154271-post-data-server-javascript-client-side</p>
<p>but all of them said we should use jquery or ajax</p>
| javascript | [3] |
4,771,268 | 4,771,269 | Using "eval" for user-supplied integration function? | <p>I am trying to understand eval(), but am not having much luck.</p>
<p>I am writing my own math library and am trying to include integration into the library. I need help getting python to recognize the function as a series of variables, constants, and operators. I was told that eval would do the trick but how would i go about it? </p>
<pre><code>fofx = input ("Write your function of x here >")
def integrate (fofx):
#integration algorithm here
#input fofx and recognize it as f(x) to be integrated.
</code></pre>
<p>i have tried the documentation but that is limited and i have no clue how i could apply it to my function to be evaluated. </p>
| python | [7] |
1,713,317 | 1,713,318 | why hackers can decrypt my encrypted Connection String in web.config(C#) | <p>My application is on the shared Hosting.I've encrypted my Connection String programmatically to make it secure. However, the hacker still is able to decrypt the encrpted Connection String adding scripts into the DB.
Just wondering if there is a way to solve this problem? Many thanks !!! </p>
| asp.net | [9] |
4,769,760 | 4,769,761 | Call a DOS executable file from Python | <p>Sorry if this question has been asked many times. I have a DOS .exe file. It works well by double clicking it in Windows, which generates some output files in the working folder. However, I need to call it from Python.
I have tried the following commands (subprocess.Popen and os.system), but it only opens a DOS window without saving output files. So can someone give me a hint?</p>
<p>Thanks!</p>
<p><strong>CODE</strong></p>
<pre><code>a=subprocess.Popen(r"I:/dosefile.exe")
a1=os.system(r"I:/dosefile.exe")
</code></pre>
<p><strong>UPDATE</strong>
It worked by putting the .py script file to the fold containing dosefile.exe. Is there a way to make it work without migrating .py file?</p>
<p>Figure it out. I need to change the working folder by using os.chdir() if .py file is somewhere else</p>
| python | [7] |
2,177,077 | 2,177,078 | javascript's quotation mark question | <p>I have a very simple question.</p>
<p>I have the following code</p>
<pre><code>var replyName = "1";
var test = "<div id=replyName></div>"
</code></pre>
<p>I want to set the class name to replyName, what should I do?</p>
<p>Thank you very much</p>
| javascript | [3] |
150,478 | 150,479 | How do i use a BinaryReader im getting error? | <p>I need ot read a binary file. But getting error. How can i do it ?
Im trying to explain what else can i write ?</p>
<pre><code>using System;
using System.IO;
using System.Net;
using System.Text;
namespace BinaryReader
{
public partial class Form1 : Form1
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
public void R()
{
using (BinaryReader br = new BinaryReader(File.Open("file.bin", FileMode.Open)))
{
// 2.
// Position and length variables.
int pos = 0;
// 2A.
// Use BaseStream.
int length = (int)b.BaseStream.Length;
while (pos < length)
{
// 3.
// Read integer.
int v = b.ReadInt32();
Console.WriteLine(v);
// 4.
// Advance our position variable.
pos += sizeof(int);
}
}
}
}
}
</code></pre>
<p>On this line im getting error:</p>
<pre><code>using (BinaryReader br = new BinaryReader(File.Open("file.bin", FileMode.Open)))
</code></pre>
<p>Error 'BinaryReader' is a 'namespace' but is used like a 'type'</p>
<p>How can i fix it ?</p>
| c# | [0] |
5,012,709 | 5,012,710 | Presenting a ModalViewController containing a TabBarController | <p>I have a problem with presenting and dismissing a modalViewController that contains a tabBarView controller (with two viewControllers). </p>
<p>I have no problem in presenting and dismissing the modal, but I have a navbar setup at the top of each view controller with a done button that will dismiss the modal and return the user back to the main view. The problem is that when the user taps the button to bring up the modal, it brings up the viewController that released the modal. I would prefer it to bring up the first viewController (the one furthest left on the tabBar). </p>
<p>I know it's really vague, but any ideas?</p>
| iphone | [8] |
1,053,408 | 1,053,409 | how do i print some string just below the loop simultaneously in python | <p>i want to do multi process simultaneously,
for example i want to print some string just below the looping underway...</p>
<pre><code>import time
from threading import Thread
print 'top'
def foo():
for i in range(1,10):
sys.stdout.write(str('\r%s\r'%i))
sys.stdout.flush()
time.sleep(1)
timer = Thread(target=foo)
timer.start()
'''bottom'
</code></pre>
<p>i wanna the code above will looks like this</p>
<pre><code>top
'''looping counter is underway'''
bottom
</code></pre>
| python | [7] |
1,049,894 | 1,049,895 | Is it possible to add shortcut key to button in app? | <p>I wrote an application with the multiple screens, one of the screen is LoginScreen containing two TextView's two EditText's & two Buttons,</p>
<p>my question is, is it possible to add a shortcut key for Button when you device has hard keyboard present.</p>
<p>Best Regards,
Anup</p>
| android | [4] |
1,027,854 | 1,027,855 | How ASP.NET Web Pages Threading / Multi Tasking Works for Single user? | <p>This Might be a very basic Questing. (URGENT)</p>
<p>I have a Web application with multiple pages.</p>
<p>When a user is Logged in using Visual Studio(Development) / IIS (Production )</p>
<p>If the user have opened a Page 1 from home page which is long running process (Lets say few minutes)</p>
<p>Can the same user open Page 2 from home page while Page 1 is still running.</p>
<p>There is no connection between Page1 and Page 2.</p>
<p>Remember I am talking about the same user in the same machine.</p>
<p>Does ASP.NET takes care of this MultiThreading by default for above situation?</p>
<p>Or I Should create Separate Thread for each page?</p>
<p>I my case I not able to open the second page still the first page is Finished.</p>
<p>Please shed me some light.</p>
<p>Regards</p>
| asp.net | [9] |
1,340,162 | 1,340,163 | What is the diifference between ScriptManager.RegisterStartupScript() and ScriptManager.RegisterClientScriptBlock(), as both does the same thing? | <p>Hi
I am just wondering why some people suggest RegisterStartupScript() to call client side js while some suggests RegisterClientScriptBlock(). </p>
<p>Please make me clear whats the difference between the two as they doing the same operations, for using js statement calls and which one is preferable if I only use js statements like alert, return confirm from codebehind.</p>
| asp.net | [9] |
5,539,264 | 5,539,265 | How to open an activity using custom URI? | <p>I am trying to start an activity within my app from a custom uri returned from my service. </p>
<p>For example my service is going to return me something like: "activity2". Basically I want to start the activity that has the correct filter listening for the "activity2" intent. I am kind of stuck on how I would do this. Can anyone give me an example of some sort? </p>
<p>In my Activity2 declaration I put this as an intent filter but it doesnt seem to work:</p>
<pre><code><intent-filter>
<action android:name="activity2"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="foo"/>
</intent-filter>
</code></pre>
| android | [4] |
4,964,055 | 4,964,056 | how to configure the php mail function with SMTP server? | <p>I have used php mail function for sending mail to local mail id's and external mail id's.
using this mail function I am able to send mail to my local mail id's but the mail function is not sending mail to external mail id's. like ss@gmail.com </p>
<p>I have used the following methods to set the SMTP server address.</p>
<blockquote>
<p>ini_set("SMTP","net4india.com");<br>
ini_set("sendmail_from","sugumar@csoft.co.in");</p>
</blockquote>
<p>and I added with header also</p>
<blockquote>
<p>$headers .= "SMTP-Hott:
net4india.com";</p>
</blockquote>
<p>but the mail is not going to gmail.</p>
<p>where I need to configure the SMTP server name in my program to send the mail to gmail,yahoo ,hotmail,etc.,?</p>
| php | [2] |
5,604,881 | 5,604,882 | Why doesn't the value of my textbox change when I click on a radio button in ASP.NET? | <p>I'm trying to change the value of my textbox by clicking on a radio button. But when I click on that radio button, nothing happens! Does someone know why? Here is the code: </p>
<pre><code>protected void rbOpgelost_CheckedChanged(object sender, EventArgs e)
{
tbEinddatum.Text = DateTime.Now.ToString();
}
</code></pre>
| asp.net | [9] |
5,069,133 | 5,069,134 | Build a solution | <p>Why do server errors occur on running a solution, even if the solution is building successfully?</p>
| asp.net | [9] |
2,105,068 | 2,105,069 | Windows service with queing | <p>I need to develop windows service, functionality is it should fetch the data from SQLServer database on specific intervals (ex: Every 4.5 mins) and pushing into the Access2003 database.
But that access db is not always available, this is service needs to check the availability of access DB if it is there need to push the data.
In this case how better I can handle, using staging of DB tables or MSMQ.
Please guide me in this regard, if any samples plz provide me.
I'm using VS2008 version.</p>
| c# | [0] |
5,764,519 | 5,764,520 | Getting innerhtml value into the variable | <p>I am getting a value by using document.getElementById("forloop").innerHTML. And I am displaying that value in the file with some div id as </p>
<pre><code><div id="forloop"></div>.
</code></pre>
<p>But I want to asign that value to a variable in the file. Can you please how can I asign to the variable</p>
<p>Thanks
Sateesh</p>
| javascript | [3] |
2,737,739 | 2,737,740 | Calling function defined in an object | <p>I have an object that defines the name and parameters of a function to be called in the click event of a page element.</p>
<pre><code>object_array = [
{
id: "id1",
onclick: "load_file(filename.php);",
},
{
id: "id2",
onclick: "open_url('http://url.com');",
}
];
</code></pre>
<p>That information must be retrieved dynamically. I'd like in the click event to call the onclick function for a given object in the array.</p>
<pre><code>$('element').click(function() {
// call object.onclick
});
</code></pre>
<p>Seems that eval() is not a good choice. Is there a different way of calling that function?</p>
| javascript | [3] |
1,041,946 | 1,041,947 | Capturing setOnClickListener() and setOnFocusChangeListener() | <p>I'm writing an API for Android and I need to know when the developer using the API calls <code>View.setOnClickListener()</code> and <code>View.setOnFocusChangeListener()</code>. I don't want to override either because that would mean to extend <code>View</code> and I don't want to force the developer to use my subclass -basically because he wouldn't be able to use the Android GUI editor for Eclipse-.</p>
<p>I tried to override <code>Activity.dispatchTouchEvent()</code> but then I cannot capture movements done with keypad/virtual keyboard.</p>
<p>Any ideas or guidelines on how to do this?</p>
| android | [4] |
5,070,859 | 5,070,860 | cheap reverse dns lookup | <p>Currently, I am running asp.net on a 4.0 Framework. I found one section of my code that is truly expensive for me to use. I currently get the IP Address and the reverse dns for users accessing my site, however, I am trying to keep performance in mind.</p>
<p>Is there a cheaper alternative to this? </p>
<pre><code>return System.Net.Dns.GetHostEntry(HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]).HostName;
</code></pre>
| asp.net | [9] |
3,997,515 | 3,997,516 | Send music control keys from my app in android | <p>Is there a simple way to tell the default media player to change track back or forward?</p>
<p>I want the ability to send commands to the system media player (Music) to change track back and forward from within my app.</p>
<p>Is there a simple way? Code examples or descriptive explanation please, I have not developed for Android before.</p>
<p>Update: Is it just the HTC Music that isn't part of the SDK or even the stock one? Either player would be fine if I could manage way to change tracks.</p>
<p>The HTC Lock screen has some method of changing tracks in the music player. Is it possible I could get hold of this and use it?</p>
<p>Baksmali?</p>
| android | [4] |
4,266,199 | 4,266,200 | thread dump of a stand-alone java app | <p>I have a stand-alone java app running on linux + Java 6, which seems to be stuck (no logs being generated)
How can i take thread dump of this, without using any other tool (eg. jstack)</p>
<p>Tried below commands, but they are not doing anything</p>
<pre><code>kill -3 <pid>
kill -QUIT <pid>
</code></pre>
<p>Am I missing anything ?</p>
| java | [1] |
2,054,524 | 2,054,525 | java.lang.RuntimeException: Unable to start activity ComponentInfo: java.lang.NullPointerException | <p>My app gives me this error when using this onclicklistener</p>
<pre><code>private OnClickListener btn_Config_Onclick = new OnClickListener() {
public void onClick(View v) {
Bundle bundle = new Bundle();
bundle.putString("Name", selected_Name);
bundle.putString("Image", selected_Image);
Intent intent = new Intent(v.getContext(), Configure.class);
intent.putExtras(bundle);
v.getContext().startActivity(intent);
}
};
</code></pre>
<p>The class for configure is here: <a href="http://pastebin.com/njMa9buE" rel="nofollow">http://pastebin.com/njMa9buE</a></p>
<p>and the complete error here: <a href="http://pastebin.com/REemSken" rel="nofollow">http://pastebin.com/REemSken</a></p>
<p>I have been looking over everything and cant for the life of me find whats wrong, everything is correctly defined in the manifest etc.
Hoping fresh eyes will find the issue</p>
| android | [4] |
682,327 | 682,328 | how do display the another set of menu-items by selecting particular menu from menu list? | <p>In my application I am having 3 menu like options,setting and favorites. In that If I press 'favorites' means it should display another set of (new)menu and I want to hide the previous set of (old)menu. IS it possible with android? If anyone knows, help me please.</p>
| android | [4] |
2,235,036 | 2,235,037 | trying to write a program by implementing single inheritance... need help please | <p>I want to get the values that i got from the mark class and evaluate in the result class. How can I do that?</p>
<pre><code>import java.util.*;
import java.lang.*;
import java.io.*;
class Marks{
float age,S1,S2,S3,S4,S5;
String Name,Roll;
void displayMarks() {
Scanner input = new Scanner(System.in);
System.out.println("Enter your name:");
Name=input.nextLine();
System.out.println("Enter your Roll no:");
Roll=input.nextLine();
System.out.println("Enter the marks of first subject:");
S1=input.nextFloat();
System.out.println("Enter the marks of second subject:");
S2=input.nextFloat();
System.out.println("Enter the marks of third subject:");
S3=input.nextFloat();
System.out.println("Enter the marks of fourth subject:");
S4=input.nextFloat();
System.out.println("Enter the marks of fifth subject:");
S5=input.nextFloat();
}
}
class Result extends Marks{
void displayResults(){
float total,average;
total=(S1+S2+S3+S4+S5);
average=(total/5);
System.out.println("Roll no:"+Roll);
System.out.println("Name:"+Name);
System.out.println("Age:"+age);
System.out.println("The marks of the individual subjects are:subject1="+S1+ " ,subject2="+S2+ " ,subject3="+S3+ " ,subject4="+S4+ " ,subject5="+S5);
System.out.println("Total:"+total);
System.out.println("Average:"+average);
}
}
public class Lab04{
public static void main(String [] args){
Marks m=new Marks();
Result r=new Result();
m.displayMarks();
r.displayResults();
}
}
</code></pre>
| java | [1] |
5,440,595 | 5,440,596 | Print ">" on every line | <p>How would I do to print a ">" before every line?</p>
<pre><code>if ($quoteid) {
echo '
> '.$quote['message'].'
';
}
</code></pre>
<p>Currently It Looks like this:</p>
<pre>> I would move Heaven and Hell and anything in between to get to you.
You wouldn't be safe anywhere if I was mad at you.
And that's not bull; that's truth. I've went up against people.
You could pull a gun on me and if I'm mad at you I'm coming forward.
You'd have to shoot me to stop me and if you don't kill me... you're stupid cause the next time you see me I will kill you.</pre>
<p>I want it to look like this:</p>
<pre>> I would move Heaven and Hell and anything in between to get to you.
> You wouldn't be safe anywhere if I was mad at you.
> And that's not bull; that's truth. I've went up against people.
> You could pull a gun on me and if I'm mad at you I'm coming forward.
> You'd have to shoot me to stop me and if you don't kill me... you're stupid cause the next time you see me I will kill you.</pre>
| php | [2] |
1,482,473 | 1,482,474 | How to open URL from Android application and post values to the URL? | <p>I am newbie to Android development, can you please help me for below scenario</p>
<ol>
<li><p>From Android native application</p></li>
<li><p>Open url into browser, along with</p></li>
<li><p>Post some values to that page</p></li>
</ol>
<p>Share me if you have test code.</p>
| android | [4] |
4,189,835 | 4,189,836 | Android ActivityManager showing every 2 secs that the application is open? | <p>Can anyone please help me ?<br>Here is my alarmmanager code that will open up the service after every 2 seconds..</p>
<pre><code>AlarmManager alarmManager =
(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
calendar.getTimeInMillis(), 2*1000 , pintent);
</code></pre>
<p>And here is my code for checking running application</p>
<pre><code>ActivityManager activityManager = (ActivityManager)
this.getSystemService( ACTIVITY_SERVICE );
List<RunningAppProcessInfo> procInfos = activityManager.getRunningAppProcesses();
for(int i = 0; i < procInfos.size(); i++){
if((procInfos.get(i).processName.equals("com.android.browser")
&& procInfos.get(i).importance==procInfos.get(i).IMPORTANCE_FOREGROUND)) {
Toast.makeText(getApplicationContext(), "Browser is running",
Toast.LENGTH_LONG).show();
</code></pre>
<p>The problem is that when the browser is open a toast appears every 2 secs. How should I make this appear only once as the browser gets foreground ? Really need some help </p>
<p>Thank You !</p>
| android | [4] |
2,200,939 | 2,200,940 | Using static class data in std::max and min | <p>I have a static class data member declared as:</p>
<pre><code>static const float MINIMUM_ZOOM_FACTOR = 4.0;
</code></pre>
<p>I'm using this constant in a class member function like this:</p>
<pre><code>zoomFactor_ = max(zoomFactor_, MINIMUM_ZOOM_FACTOR);
</code></pre>
<p>At this point, the compiler complains that MINIMUM_ZOOM_FACTOR is an undefined reference. However if I use it directly like this:</p>
<pre><code>if(fabs(zoomFactor_ - MINIMUM_ZOOM_FACTOR) < EPSILON) ...
</code></pre>
<p>it works a-ok. What am I doing wrong?</p>
| c++ | [6] |
1,306,414 | 1,306,415 | python store variable in function and use it later | <p>is it possible to store a variable from a while loop to a function and then call that same variable from the fucntion at the end of the loop</p>
<p>for eg:during while loop, problem here is that when i try to retrieve the variable from store() it fails...as it needs arguments to be passed..</p>
<pre><code>def store(a,b,c):
x1 = a
y1 = b
z1 = c
return (x1,y1,z1)
def main():
while condition:
loop ..
x = .......
y = .......
z = .......
.......
.......
store(x,y,z) #store to function...
......
......
.......
......
s1,s2,s3 = store()
.....
.......
...
end
</code></pre>
| python | [7] |
4,212,031 | 4,212,032 | url obfuscator in php | <p>hello
I need a url obfuscator that a spider should not extract my links like safe_mailto in codeiginitor... is it possible using PHP if so please give an example.</p>
| php | [2] |
1,127,099 | 1,127,100 | Add Item into a generic List in C# | <p>I tried to insert an object into a generic BindingList.
But if I try to add a specific object the compiler says:
<em>"Argument type ... is not assignable to parameter type"</em></p>
<pre><code>private void JoinLeaveItem<T>(BindingList<T> collection)
{
if (collection.GetType().GetGenericArguments()[0] == typeof(UserInformation))
{
var tmp = new UserInformation();
collection.Add(tmp);
}
}
</code></pre>
<p>Please help me </p>
| c# | [0] |
5,112,013 | 5,112,014 | How do you convert a stringed dictionary to a Python dictionary? | <p>I have the following string which is a Python dictionary stringified:</p>
<pre><code>some_string = '{123: False, 456: True, 789: False}'
</code></pre>
<p>How do I get the Python dictionary out of the above string?</p>
| python | [7] |
2,321,523 | 2,321,524 | Does alert('hello'); work in pageLoad() function? | <p>Alert does not work in pageLoad, why? thanks</p>
<pre><code><html>
<head>
<script type="text/javascript">
function pageLoad()
{
alert('hello');
}
</script>
</head>
<body />
</html>
</code></pre>
<p><strong>Problem found:</strong> Dave Ward suggests that since my page does not have a script manager (which calls PageLoad for me). that is the reason I was puzzled. I never realised I had to call it for myself when there was no script manager.</p>
| javascript | [3] |
5,338,116 | 5,338,117 | Report viewer in Android | <p>Is there any report viewer tool or api in android for generating reports of any form.
I want to create sales report, purchase report in my android phone. So i am looking an api or framework which makes my work easy.</p>
| android | [4] |
2,518,177 | 2,518,178 | J query scroller asp.net | <p>I have to make a jquery scroller as given in <a href="http://www.isango.com/" rel="nofollow">http://www.isango.com/</a>. Look at the bottom of the site. Please Help me making this. </p>
<p>Any help will be appreciated.
Thanks</p>
| jquery | [5] |
2,823,641 | 2,823,642 | Count from 0 to 100 in 7 seconds while doing an jQuery.animate() for a progress bar | <p>I've a simple progress bar that has to go from 0 to 100% width in 7 seconds. I've no problem handling operations, it just need to be 7 seconds long.</p>
<p>The code is actually so simple:</p>
<pre><code>$('.progress-bar').animate({width:'100%'}, 7000);
</code></pre>
<p>The width of the progress is 0% so just I need to animate it to 100%. My problem is that I also need to count from 0 to 100 to show the percentage in the same way I do for the progress (within 7 seconds).</p>
<p>How I can do it?</p>
<p>Thank you!</p>
| jquery | [5] |
5,450,751 | 5,450,752 | jQuery menus with + and - for opening and closing submenus | <p>Does anyone know any good jQuery menu which has + and - for opening and closing submenus.</p>
<p>I found in google only this:<br>
<a href="http://berndmatzner.de/jquery/hoveraccordion/" rel="nofollow">http://berndmatzner.de/jquery/hoveraccordion/</a></p>
<p>but this does not have + and - for opening and closing menus and has only 1 submenu.</p>
<p>example</p>
<pre><code>+ link
+ link 2
+ link 3
</code></pre>
<p>if i click on link2</p>
<pre><code>+ link
- link 2
+ foo
+ foo2
+ link 3
</code></pre>
| jquery | [5] |
2,808,200 | 2,808,201 | My jQuery is not working | <pre><code><%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!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 runat="server">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
$(document).ready(function()
{
$(".button1").click(function ()
{
$("p").hide("slow");
});
$(".button2").click(function ()
{
$("p").show("slow");
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<input id="Button1" type="button" value="button" class="button1"/>
<input id="Button2" type="button" value="button" class="button2"/><h2>Welcome to F5 Technologies </h2>
<p>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp F5 Technologies is a rapidly developing company, acquiring its position on the business market,
Our company helps make products
delivery more effective, efficient, and meaningful to our customers, and allow them to take greater
responsibility for their own new products.Software is developed by the most experienced development staffs. </p>
</form>
</body>
</html>
</code></pre>
| asp.net | [9] |
1,790,990 | 1,790,991 | java outputstream java.lang.OutOfMemoryError: Java heap space | <p>I am trying to publish a large video/image file from the local file system to an http path, but I run into an out of memory error after some time...</p>
<p>here is the code</p>
<pre><code>public boolean publishFile(URI publishTo, String localPath) throws Exception {
InputStream istream = null;
OutputStream ostream = null;
boolean isPublishSuccess = false;
URL url = makeURL(publishTo.getHost(), this.port, publishTo.getPath());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
if (conn != null) {
try {
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("PUT");
istream = new FileInputStream(localPath);
ostream = conn.getOutputStream();
int n;
byte[] buf = new byte[4096];
while ((n = istream.read(buf, 0, buf.length)) > 0) {
ostream.write(buf, 0, n); //<--- ERROR happens on this line.......???
}
int rc = conn.getResponseCode();
if (rc == 201) {
isPublishSuccess = true;
}
} catch (Exception ex) {
log.error(ex);
} finally {
if (ostream != null) {
ostream.close();
}
if (istream != null) {
istream.close();
}
}
}
return isPublishSuccess;
}
</code></pre>
<p>HEre is the error i am getting...</p>
<pre><code>Exception in thread "Thread-8773" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
at sun.net.www.http.PosterOutputStream.write(PosterOutputStream.java:61)
at com.test.HTTPClient.publishFile(HTTPClient.java:110)
at com.test.HttpFileTransport.put(HttpFileTransport.java:97)
</code></pre>
| java | [1] |
3,260,919 | 3,260,920 | How do I make a dotted/dashed line in Android? | <p>I'm trying to make a dotted line. I'm using this right now for a solid line:</p>
<pre><code>LinearLayout divider = new LinearLayout( this );
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, 2 );
divider.setLayoutParams( params );
divider.setBackgroundColor( getResources().getColor( R.color.grey ) );
</code></pre>
<p>I need something like this, but dotted instead of solid. I'd like to avoid making hundreds of layouts alternating between a transparent layout and solid layout.</p>
| android | [4] |
2,714,452 | 2,714,453 | get size of dynamic pointer C++ | <p>I want to write a dynamic pointer to a file in C++.</p>
<p>This is my declaration in header file:</p>
<pre><code>byte* buffer;
</code></pre>
<p>Then in Cpp file, I allocated it:</p>
<pre><code>buffer = new byte[1000];
</code></pre>
<p>However the size will be bigger than 1000 in dynamic allocation.</p>
<p>Then I write to the file:</p>
<p>ofstream myfile;</p>
<pre><code>myfile.open("test.txt", ios::binary);
myfile.write((char*)buffer, 1000);
myfile.close();
</code></pre>
<p>If I specify the length of buffer to 1000, then the rest of bytes after 1000 will be discarded. If I use: sizeof(buffer) then it is only 1 byte written.</p>
<p>How can I get the dynamic size of the buffer?</p>
<p>Thanks in advance.</p>
| c++ | [6] |
1,927,706 | 1,927,707 | generating a grid in a function | <p>We made a little script in computer science class for finding the shortest path through a grid of nodes, some interlinked, some not.
The griddata is stored in a way that doesn't require to define any new classes, namely in a nested list. For n nodes, the list should have n elements, each being a list with n elements.</p>
<p><code>grid[a][b]</code> should return the distance from node a to node b, and 0 if the nodes aren't connected or if a and b references to the same node.</p>
<p>for example the list <code>[[0,2,2],[2,0,2],[2,2,0]]</code> would define a grid with 3 nodes, each with a distance of 2 from each other.</p>
<p>Here is the script I wrote that should define such a grid by requesting individual distances from the user:</p>
<pre><code>def makegrid(nodes):
res=[[0]*nodes]*nodes
for i in range(nodes):
for j in range(nodes):
if res[i][j]==0 and not i==j:
x=raw_input('distance node %d zu node %d: ' % (i,j))
if x:
res[i][j]=res[j][i]=int(x)
else:
res[i][j]=res[j][i]=None
for i in range(nodes):
for j in range(nodes):
if res[i][j] is None:
res[i][j]=0
return res
</code></pre>
<p>My problem ist that the function isn't quite doing what I intended it to do, and I can't seem to work out why. What it actually does is only running through the requests for the first node, and somehow it does to all the sublists what it should only do to the first (and ignoring that the first element should not be changed).</p>
<p>Can anyone help me figure it out?</p>
| python | [7] |
4,555,358 | 4,555,359 | what's the fastest way of converting a string time stamp into epoch time with python? | <p>I need to do lots of conversation from string time stamp like '2012-09-08 12:23:33' into a seconds which is based on epoch time.Then i need to get time gap between two timestamp.I tried two different ways:</p>
<pre><code>date1 = '2012-09-08'
time2 = '12:23:33'
timelist1 = map(int, date1.split('-') + time1.split(':'))
date2 = '2012-09-08'
time2 = '12:23:33'
timelist2 = map(int, date2.split('-') + time2.split(':'))
delta = datetime.datetime(*timelist2) - datetime.datetime(*timelist1)
print delta.seconds
</code></pre>
<p>The second way is:</p>
<pre><code>date1 = '2012-09-08'
time1 = '12:23:33'
d1 = datetime.datetime.strptime(date1 + ' ' + time1, "%Y-%m-%d %H:%M:%S")
seconds1 = time.mktime(d1.timetuple())
....
seconds2 = time.mktime(d2.timetuple())
print seconds2-deconds1
</code></pre>
<p>However these two ways are not fast enough because I have almost 100 millions actions to do.Any suggestion?</p>
| python | [7] |
314,553 | 314,554 | Android: animation | <p>In my App I have an <code>ImageSwitcher</code>, and to buttons at the bottom (Next and Previous). I'm trying to set a smooth animation to <code>ImageSwitcher</code>, but everything looks awfully. Have any body knows smooth animation ? The best practice I think would be to create fade_in and fade_out animation...when I click next button first image should fade_in, and only after that next image should fade_out...But if to set to <code>ImageSwitcher</code> fade_in to AnimationIn and fade_out to animationOut, than when I will press next button fist image will fade_in and second image will fade_out at the same time, and that's looks awfully....Have any idea how to do that ? Thanks....</p>
| android | [4] |
899,346 | 899,347 | Android - Download a folder from server or anywhere from internet and apply changes according to it in app | <p>I just finished one app, but i want to let user install different language packs (a folder containing mp3 files ), and also apply those mp3 files in my app ! how should i do it ?
how to let user user download that folder ?
and how to make changes in my app as they download ?</p>
<p>(this is like google maps app, they tell you which map you want to install and so on ! mine is related to mp3 files ! )</p>
| android | [4] |
1,586,054 | 1,586,055 | iPhone - cleaning the context of a UIView outside drawRect | <p>I have this UIView that I subclassed and implemented my own drawRect method.</p>
<p>When the drawRect method runs the first time, I grab the context in a variable using </p>
<pre><code>ctx = UIGraphicsGetCurrentContext();
</code></pre>
<p>later on the code, outside drawRect, I am trying to clean the whole context filling it with a transparent color, then I do: </p>
<pre><code>CGContextClearRect(ctx, self.bounds);
[self setNeedsDisplay];
</code></pre>
<p>The problem is that the context is not erased and continues as before.</p>
<p>At this point ctx is not nil.</p>
<p>am I missing something?</p>
<p>thanks</p>
| iphone | [8] |
2,683,548 | 2,683,549 | how do you pass a parameter to a function when it is called by reference? | <p>I've created a global variable to pass informatin to a method that is called via a method reference</p>
<pre><code>d_g.onerror=i_bm_err_fix;
</code></pre>
<p>I tried passing it the variable like this(below) but it did not work.</p>
<pre><code>d_g.onerror=i_bm_err_fix(d_g);
</code></pre>
<p>All I'm trying to do is have a generic image load if the site favicon does not.</p>
<pre><code>function i_bm_err_fix(d_g)
{
d_g.src='http://www.archemarks.com/favicon1.ico';
}
</code></pre>
<p>Currently I'm using a global variable to pass this info. but this does not seem like good practice.</p>
| javascript | [3] |
1,280,408 | 1,280,409 | strtotime calculates wrong when moving over to linux (webhost) from windows (localhost) | <p>I've some problem with make a simple PHP function to work on my webspace meanwhile it works like expected at my localhost server.</p>
<p>The problem is the following calculation:</p>
<pre><code>echo $Formated = date("Ymd",strtotime("last day of next month"));
</code></pre>
<p>This script dosen't seem to work b/c i simply gets the default date <code>19691231</code> instead of the correct one <code>20110630</code> when running it on my server.</p>
<p>I use windows (XAMP) as my localhost server so i guess there must be some form of problem that lies within the two platforms way of handling it?</p>
| php | [2] |
2,564,336 | 2,564,337 | php debug problem in hellios | <p>im trying to debug and im using eclipse hellios php version
and i get this message
"the debug session could not be started. please make sure that your debugger in properly configured as a php.ini directive"</p>
<p>what do i need to do
could someone help me?</p>
| php | [2] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.