Unnamed: 0 int64 65 6.03M | Id int64 66 6.03M | Title stringlengths 10 191 | input stringlengths 23 4.18k | output stringclasses 10 values | Tag_Number stringclasses 10 values |
|---|---|---|---|---|---|
1,365,726 | 1,365,727 | setting the background attribute to transparent in editext dynamically | <p>hi
how to set edittext background attribute to transparent dynamically.</p>
<pre><code>setBackgroundColor()
setBackgroundDrawable()
setBackgroundResource()
</code></pre>
<p>these options only available .
how to set background totransparent with this methods.
Please help me to solve this issue.</p>
| android | [4] |
3,572,970 | 3,572,971 | How to change package information thru Java code? | <p>In my current Java project, I have written a Java program that copies some Java files from package "fr.inria.arles.pankesh.gen" to package "fr.inria.arles.pankesh.impl".</p>
<p>After copying Java files from package “fr.inria.arles.pankesh.gen” to package “fr.inria.arles.pankesh.impl” , my java files are giving errors , due to package Information change of Java file.</p>
<p>My question is “Is there any way to change package information ( thru java code, not manually) in header , when my program copies Java files from package “fr.inria.arles.pankesh.gen” to package “fr.inria.arles.pankesh.impl”.</p>
| java | [1] |
3,653,606 | 3,653,607 | Adding a Toast or Dailog in Exception Handling class | <pre><code>package com.greenway.primemobile.common;
import java.io.PrintWriter;
import java.io.StringWriter;
import com.greenway.primemobile.login.LoginActivity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.widget.Toast;
public class ExceptionHandler implements java.lang.Thread.UncaughtExceptionHandler
{
private final Context myContext;
public ExceptionHandler(Context context) {
myContext = context;
}
public void uncaughtException(Thread thread, Throwable exception) {
StringWriter stackTrace = new StringWriter();
exception.printStackTrace(new PrintWriter(stackTrace));
System.err.println(stackTrace);
Intent intent = new Intent(myContext, ClassName.class);
myContext.startActivity(intent);
System.exit(0);
}
}
</code></pre>
<p>The above class get's called when force-close happens, but how can i show a <code>dialog or toast</code> message to user that the application has crashed. Since its run on a different thread, i am not sure about how to add one.</p>
| android | [4] |
4,010,503 | 4,010,504 | 2D Array Unintended Assignment Bug | <p>I want to create a 2D array, like so:</p>
<pre><code>grid[y][x]
</code></pre>
<p>So that there are y amount of rows and x amount of columns.</p>
<p>Below is the way I did it, but I when I tried to assign the (0,0) of the array to contain the value '2', the code assigned the first value of each subarray to '2'. </p>
<p>Why is this happening? How should I pythonically instantiate a 2D array? </p>
<pre><code>n = 4
x=0
y=0
grid = [[None]*n]*n
print grid
grid[y][x]='Here'
print grid
</code></pre>
| python | [7] |
4,105,016 | 4,105,017 | Can't find ant in the Android SDK | <p>Hey all,
I'm working my way through APress's Beginning Android 2 and I've made it all the way to chapter 3, where we build a skeleton app. The book tells me to compile my application by typing "ant" in the command line, but my pc doesn't know what "ant" is yet. I checked in the SDK files and it looks like it wasn't included with the Android SDK. Does anybody know where ant is?</p>
<p>Thanks</p>
| android | [4] |
1,859,322 | 1,859,323 | Implementation of fgets() function in PHP | <p>I'm usinng Windows operating system and new to PHP.
Namely I'm trying to implement php function fgets() in php file:</p>
<pre><code>$file = fopen("$DOCUMENT_ROOT/Chapter02/test.txt","r");
while(! feof($file))
{
echo fgets($file). "<br />";
}
fclose($file);
</code></pre>
<p>I have created test.txt file with the following content: </p>
<blockquote>
<p>Hello, this is a test file.<br>
There are three lines here.<br>
This is the last line. </p>
</blockquote>
<p>as example from <a href="http://www.w3schools.com/" rel="nofollow">http://www.w3schools.com/</a></p>
<p>Both files, .php and .txt are located in a directory:</p>
<p>C:/wamp/www/Chapter02/</p>
<p>but after execution this php file, is not showing anything, and shall show:</p>
<blockquote>
<p>Hello, this is a test file.<br>
There are three lines here.<br>
This is the last line. </p>
</blockquote>
<p>I suppose, I'm making a mistake in a path "$DOCUMENT_ROOT/Chapter02/test.txt", but I really don't know where the mistake is...</p>
<p>I would highly appreciate your help:)</p>
<p>kind regards,</p>
<p>Ivana </p>
| php | [2] |
4,093,074 | 4,093,075 | Cannot use object of type ConfigClass | <p>When I try to log on to <a href="http://www.notthenation.com" rel="nofollow">www.notthenation.com</a> I get the following error message:</p>
<p>Fatal error: Cannot use object of type ConfigClass as array in /home/content/p/e/r/percyalberts/html/includes/system.class.php(40) : eval()'d code on line 9</p>
<p>Are you able to tell me whether this is an internal problem of the notthenation people or whether this site has been blocked by the government?</p>
<p>Thank you.</p>
<p>Sam Deedes.</p>
<p>samdeedesfoofoog@yahoo.co.uk</p>
| php | [2] |
3,784,185 | 3,784,186 | how to access datakey value in .cs file of a listview control | <pre><code> protected void ListView1_SelectedIndexChanging(object sender, ListViewSelectEventArgs e)
{
string id = ListView1.DataKeys[e.NewSelectedIndex].Value.ToString();
lblMessage.Text = "ListView Selected ID : " + id;
}
</code></pre>
<p>is there any other way to access datakeynames values
in my .aspx page datakeynames="ResourceID"</p>
| asp.net | [9] |
1,198,974 | 1,198,975 | Jquery Load(); - finding html portion not div? | <p>I have the following jquery code.</p>
<pre><code><div id="result"> <script>
$('#result').load('http://www.mystie.com/speicificpage #uniqueid li:lt(3)');</script> </div>
</code></pre>
<p>So far it works great. Is there a way to do this for the content withing h2 tags? meaning instead of matching to an ID can you match to what's inside an h2?</p>
<pre><code><div id="result"> <script>
$('#result').load('http://www.mystie.com/speicificpage <h2> unique title</h2> li:lt(3)');</script> </div>
</code></pre>
<p>I have a page that is a series of ul and each have a title. I have separate pages that need to EACH call in a specific ul (as they are updated.) can I just specify or match the h2 title?</p>
| jquery | [5] |
5,963,126 | 5,963,127 | jQuery - Migrating from live() to on() | <p>I understand that the "live" function is now deprecated. How can I migrate the following to make use of the new "on"?</p>
<pre><code>$('a.action').live( "click", function (evt) {
// Do stuff
}
</code></pre>
<p>The scenario is that the a.action is being created on the fly. I've tried this, to no avail:</p>
<pre><code>$('a.action').on( "click", function (evt) {
// Do stuff
}
</code></pre>
| jquery | [5] |
3,673,174 | 3,673,175 | How to get google search counter? | <p>When I type a keyword like "Doing Homework"+"having class", google would return "About 4,360 results".
I tried to fetch a webpage but it spent too much time to read and search the source code.</p>
<p>Could google return a XML file?</p>
<p>or</p>
<p>How can I get the counter quickly?</p>
| android | [4] |
4,446,744 | 4,446,745 | Best strategy for ensuring users are always using the latest version of your Android app? | <p>I'm wondering what techniques Android developers are using to ensure that (almost) all users are using the latest version of their app? I'm getting close to releasing my first Android application and anticipate an iterative release schedule. I'd like to avoid the situation where we find ourselves having to support a dozen different versions in the wild.</p>
| android | [4] |
2,653,637 | 2,653,638 | java catching exceptions | <pre><code> try {
if (x.length == Styles.size()) {
}
else{
throws InputMismatchException ;
}
} finally {
OutputFileScanner.close();
}
</code></pre>
<p>I get compile error in method contains code above , is there any way to throw InputMismatchException in else block ?</p>
| java | [1] |
3,205,123 | 3,205,124 | issue regarding post data programmatically to another aspx page | <p>basically i have to pages like test.aspx and test1.aspx. test.aspx has one button and when button click then a routine is being called which will post data programmatically to test1.aspx page and test1.aspx page will show the data.</p>
<h2>so here is the code for test.aspx page</h2>
<pre><code>protected void Button1_Click(object sender, EventArgs e)
{
PostForm();
}
private void PostForm()
{
WebRequest request = WebRequest.Create("http://localhost:14803/PaypalCSharp/Test1.aspx");
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
string postContent = string.Format("parameter1={0}&parameter2={1}", "Hello", "Wow");
byte[] postContentBytes = Encoding.ASCII.GetBytes(postContent);
request.ContentLength = postContentBytes.Length;
Stream writer = request.GetRequestStream();
writer.Write(postContentBytes, 0, postContentBytes.Length);
writer.Close();
}
</code></pre>
<h2>so here is the code for test1.aspx page</h2>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
string str1 = Request.Form["parameter1"];
string str2 = Request.Form["parameter2"];
}
}
</code></pre>
<p>i just do not understand what is wrong in my code as a result data is not posting to that page. basically i want that when user click on button in test.aspx then data will post from test.aspx page to test1.aspx page programmatically and test1.aspx will show in the browser with posted data. please guide me what i need to change in my code as a result my requirement will be fulfill. thanks</p>
| asp.net | [9] |
4,804,027 | 4,804,028 | jquery rotating text animation (recreating css3 effects) | <p>Does anybody know if there is a jquery plugin that does something similar to this effect?
<a href="http://tympanus.net/Tutorials/CSS3RotatingWords/index5.html" rel="nofollow">http://tympanus.net/Tutorials/CSS3RotatingWords/index5.html</a></p>
<p>i like the effect, but i need it to be compatible down to IE7, or at least, just display the text for those rotating words in IE9/8/7</p>
| jquery | [5] |
4,343,491 | 4,343,492 | how to make an array in java without length? | <p>I am making an algorithm to save a path of zeroes between 0 1 array
the length of the path will be variable and so i need an array without predefined length</p>
| java | [1] |
320,978 | 320,979 | How to deal with callback to your UIController after your UIController unloads? | <p>Suppose your controller is a table view and one of the cells you are going off to do a length task (say download a thumbnail) to be viewed in the cell. Typically you would have the network call do a callback to your controller when it is done downloading. The callback can then reload the table or do some other form of UI update (hides a spinner etc).</p>
<p>However, what if the controller is unloaded? Say the user navigated away from this controller and it got released? What happens? Will the callback still work despite the controller now not in memory? Also, if the callback operates on some objects (say the UITableView) what happens when the controller is deallocated? I suppose the controller can release all the objects and the callback would just be calling methods on nil to prevent crash. But is this the convention?</p>
| iphone | [8] |
1,179,641 | 1,179,642 | Overlapping Book-Page Range | <p>I have a set of <code>Book-Page(6794-47)</code> range. Please note that page limit is not confirm.</p>
<p>Now I want to check the overlapping of book page range in multiple range list</p>
<p>Please check below example.</p>
<p>Below is my parameter range.</p>
<pre>
Start Book-Page Range ---- (21205-41)
End Book-Page Range ---- (21206-1674)
</pre>
<p>and want to extract the overlapped ranges from a range list
Range List e.g</p>
<pre>
---------------------------------------------------------------------------------
21206-974 to 21206-5196 (overlapping since page 974 lies between parameter range)
--
21206-1974 to 21206-5196 (not overlapping)
21207-74 to 21207-193 (not overlapping)
21204-71 to 21205-100 (overlapping since page 100 lies between parameter range)
--
21205-31-21205-59 (overlapping)
--
</pre>
<p>Now I need to get the all overlapping from list range. Please help me. </p>
<p>Regards
Arun Bhandari</p>
| c# | [0] |
967,144 | 967,145 | How to do something if sentence include one of the words in this array? | <p>I want to do something if my sentence include one of the words in this array, How to do that ?</p>
<pre><code>$sentence = "I dont give a badwordtwo";
$values = array("badwordone","badwordtwo","badwordthree","badwordfour");
</code></pre>
<p>Thanks...</p>
| php | [2] |
3,867,281 | 3,867,282 | How do I load a second CSV in jQuery? | <p>I have the following code snippet from highcharts</p>
<pre><code> $(function() {
$.get('trades.csv', function(csv, state, xhr) {
// inconsistency
if (typeof csv != 'string') {
csv = xhr.responseText;
}
// parse the CSV trades
var trades = [], header, comment = /^#/, x;
$.each(csv.split('\n'), function(i, line){
if (!comment.test(line)) {
if (!header) {
header = line;
}
else {
var point = line.split(';'),
date = point[0].split('-');
time = point[1].split(':');
if (point.length > 1) {
x = Date.UTC(date[2], date[1] - 1, date[0], time[2], time[1], time[0]);
trades.push([
x, // time
parseFloat(point[2]) // close
]);
}
}
}
});
</code></pre>
<p>Suppose I wish to load a second spreads.csv into
var spreads = ...</p>
<p>I have tried pasting $.get again with the appropriate modifications but the page no longer loads. What is the correct syntax for loading a second CSV?</p>
| jquery | [5] |
2,984,382 | 2,984,383 | C#, Is it possible to avoid defining private fields and still use set/get on public fields? | <p>like this:</p>
<pre><code>public String text {get; set{
// here comes some setter checking / setter logic
// finally assign the value to the var without using the setter
<is_there_a_"without_setter"_keyword?> text = value;
}
}
</code></pre>
<p>Thx for your help,
Juve</p>
| c# | [0] |
1,030,310 | 1,030,311 | PHP WMV file upload failed | <p>I'm doing a test with PHP file upload but seems like my script isn't allowing me to upload WMV.</p>
<p>Here is the PHP script that I have</p>
<pre><code><?php
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
</code></pre>
<p>Here is the HTML script</p>
<pre><code><form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
</code></pre>
<p>When I try other formats like jpg, mov it works just fine.<br>
Is there a special setup I need to do for wmv?<br>
I'm using XAMMP on mac</p>
<p>Thanks,<br>
Tee</p>
| php | [2] |
2,556,872 | 2,556,873 | UI Interface of iPhone Application of goDaddy | <p>i am newb in ios, and just started to build some simple application,</p>
<p>i just saw the iPhone app of goDaddy, that seems impressive to me,</p>
<p>can anyone guide me how to build an interface like goDaddy iPhone App.</p>
<p>by the way, i am familiar with basics like Tabview and tabielview and Navigation controller etc. and i am using storyboarding with xcode 4.3</p>
<p>Thanks</p>
| iphone | [8] |
1,169,443 | 1,169,444 | How to get diffreence between GMT time and any time zone in C++ | <p>I want a soultion in C++ to get hours diffreence between GMT time and any time zone.
e.g.
This is in Java I want to make in C++</p>
<pre><code>// New York
Calendar c = new GregorianCalendar(TimeZone.getTimeZone("America/New_York"));
// Alaska
c = new GregorianCalendar(TimeZone.getTimeZone("America/Anchorage"));
// Difference between New York and Alaska
</code></pre>
<p>Please tell me how I can get this time zone in C++</p>
| c++ | [6] |
2,030,457 | 2,030,458 | More than one thing that needs to be true in if statement for it to execute? c++ | <p>If I want to make a if statement that requires more than one thing to be true do I need to do it with "else if"? Because I think it looks ugly so I would prefer if I could solve that in one statement. </p>
<p>Here is the code: </p>
<pre><code>if(x == 2 OR 4 OR 6 OR 8 OR 10)
{
something......
}
etc. etc.
return 0;
</code></pre>
<p>Will that work? </p>
| c++ | [6] |
1,566,764 | 1,566,765 | display an image from online into imageview of iphone and save in to database | <p>I want to dispay an online image in imageview and save it to database
following code display only a particular image. I can also save that image to database.</p>
<pre><code>UIImage *image = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://tvaraj.files.wordpress.com/2012/03/sachin-tendulkar-when-young.jpg&w=231&h=2500&ei=SiKqT9-fKILprQfIudWCAQ&zoom=1"]]];
NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSData *data1 = [NSData dataWithData:UIImagePNGRepresentation(image)];
img.image=[UIImage imageWithData:data1];
NSLog(@"image=%@",img.image);
imageToUse1= img.image;
[image release];
//i want to add this code. this is for
WebView *Wview=[[WebView alloc]init];
[self.navigationController pushViewController:Wview animated:YES];
</code></pre>
<p>My requirement is if I click any image that should display in the imageview.</p>
<p>How is it possible?</p>
| iphone | [8] |
1,895,333 | 1,895,334 | Light-colored icon on ActionBar not visible on system menu? | <p>I am using the ActionBarCompat sample. If our action bar has a dark background, we want to use white-colored icons. But these icons are also used for the system menu items (when they don't fit on the action bar, pre-honeycomb). So the white icons aren't visible on the system menu white background. Example:</p>
<p><img src="http://i.stack.imgur.com/LkYkz.png" alt="action bar icon on titlebar and system menu"></p>
<p>What can we do about this? Is there a way to use the dark version of icons when shown on the system menu, and light colored when on the action bar?</p>
<p>Thanks</p>
| android | [4] |
5,355,726 | 5,355,727 | How to group Enum values? | <p>How can I group Enum values?<br>
Assume I have an enum like</p>
<pre><code>public enum Colors
{
LightBlue,
LightGreen,
DarkGreen,
Black,
White,
LightGry,
Yellow
}
</code></pre>
<p>Now I want to define some groups of colors, e.g. the light colors (LightBlue, LightGreen, White, LightGray, Yellow) and dark colors (Black, DarkGreen).<br>
So I can ask for groups at different places in my code.<br>
If I remember correctly my Java time I just could add methods to the enums in Java. I think that is not possible in C#. But maybe there are other ways.</p>
<p>Edit1: Of course I can add a Utility class with static member like <code>IsADarkColor(Colors c)</code>. But I would like do it without an additional class because I could forget that related class when I need that feature.</p>
| c# | [0] |
5,468,132 | 5,468,133 | Activity tag or mark | <p>I've got about 10 activities. They can be divided into groups based on their layout header.
I also have a base activity, which is a ancestor to all other. In this base activity I'd like to enable different helpers regarding the specific child activity, e.g. initialize button handlers for specific header - group.</p>
<p>Is it possible to assign to Activity tag that'll group it with similar ?</p>
<p>I don't want to if instanceof in the base class.</p>
<p>Thank you.</p>
| android | [4] |
5,391,555 | 5,391,556 | Correct (App Store Safe) way to resign a first responder? | <p>What's the correct way to resign the current firstResponder? </p>
<p>I've seen the following:
Looping through fields and calling resignFirstResponder on each.</p>
<pre><code>[[self textFieldForRow:0] resignFirstResponder];
[[self textFieldForRow:1] resignFirstResponder];
[[self textFieldForRow:2] resignFirstResponder];
[[self textFieldForRow:3] resignFirstResponder];
</code></pre>
<p>And this which looks like it's calling a private function, is this app store safe?:</p>
<pre><code>UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
UIView *firstResponder = [keyWindow performSelector:@selector(firstResponder)];
[firstResponder resignFirstResponder];
</code></pre>
<p>Is there a better way? </p>
<p>Thanks!</p>
<p>Comments:
Looks like the second method is using a private api and someone's app has been rejected because of it: <a href="http://stackoverflow.com/questions/1823317/how-do-i-legally-get-the-current-first-responder-on-the-screen-on-an-iphone">link</a></p>
| iphone | [8] |
2,426,309 | 2,426,310 | ASP.NET authentication mode=Forms - so why am I getting a Windows Login prompt? | <p>I have authentication mode set to forms in my asp.net web.config but am still getting a windows login prompt when i browse to the website.</p>
<p>Could authentication mode be set elsewhere, in IIS for example? My site runs on IIS 6.</p>
<p>Thanks.</p>
| asp.net | [9] |
1,914,853 | 1,914,854 | get the enclosing class object from anonymous inner class as function parameter | <p>Not sure if I am asking a sound question. I know every inner class keeps a reference to the enclosing class object. So can I reference the enclosing class object outside that enclosing class given the anonymous inner class as function parameter?</p>
<pre><code>class A{
public static void foo(Thread t) {
//here, how to get the reference of the enclosing class object of "t",
//i.e. the object of class B. I know, somebody might have put in a
//non-inner class Thread. But how can I check if "t" is really from an
//anonymous inner class of class B and then do something here?
}
}
class B{
public void bar() {
A.foo(
new Thread() {
public void run() {
System.out.println("inside bar!");
}
});
}
}
</code></pre>
| java | [1] |
218,705 | 218,706 | How should i deal with a Large database (17mb)? | <p>I have a big database file in my project that is locate in my Assets folder, now i can not devise it to small pieces,
it is another option to use a large database file in the app ??</p>
<p>Thanks for helping!!</p>
| android | [4] |
4,070,100 | 4,070,101 | read android dmesg with code | <p>How can I read dmesg output in my program?</p>
<p>Thanks..</p>
| android | [4] |
5,293,903 | 5,293,904 | TCP Connection Oracle and C# | <p>My question is, I want to create an application in C# that using tcp port connect with oracle.
My C# application is TCP Server that start listen from oracle send message to it. How can I write code to connect with oracle. It doesn't mean that I use ODP.Net to connect it. Anything is not clear, please command to me.</p>
<p>Thank for your help.</p>
<p>Thanks,
Sopolin Ung</p>
| c# | [0] |
4,815,216 | 4,815,217 | Do I have to configure PHP everytime I add a new site to my server? | <p>I'm standing in as the net admin for my company and learning on the job. I just added a new site to our server, and it works fine all except for the php email contact form. Do I have to configure php to let it know there is a new site that uses it?</p>
| php | [2] |
5,754,560 | 5,754,561 | php operator <<< | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6062830/what-is-the-name-for-the-operator">What is the name for the “<<<” operator?</a> </p>
</blockquote>
<p>I've just seen this code on this website:</p>
<p><a href="http://css-tricks.com/1907-php-for-beginners-building-your-first-simple-cms/" rel="nofollow">PHP for Beginners: Building Your First Simple CMS</a></p>
<p>The code is:</p>
<pre><code>private function buildDB() {
$sql = <<<MySQL_QUERY
CREATE TABLE IF NOT EXISTS testDB (
title VARCHAR(150),
bodytext TEXT,
created VARCHAR(100)
)
MySQL_QUERY;
return mysql_query($sql);
}
</code></pre>
<p>I've search high and low for this operand "<<<" but I can't seem to find the documentation anywhere!</p>
<p>If this operand is <i>real</i> I would like to know how it works because writing SQL queries like this makes code much more readable and would make SQL bugs simpler to find!</p>
<p>Might i add that i tried this code and got a compile error:</p>
<pre><code>Parse error: syntax error, unexpected $end in C:\Users\Alex Morley-Finch\Dropbox\Shared\Projects\htdocs\test\php\database.php on line 121
</code></pre>
| php | [2] |
3,868,052 | 3,868,053 | Related to ProcessStartInfo() method in C# | <p>I want to give command name and file path in ProcessStartInfo() method in C#.</p>
<p>So I have a command name("F:\AndroidProjects\AndProj3>) and file path("F:\Android\apache-ant-1.8.2-bin\apache-ant-1.8.2\bin\ant debug") just like that but it is not working and process can not be started.</p>
<p>Please give me a solution for starting the process because command name first execute and after that file path will be execute.
How I can pass the both argument in ProcessStartInfo() method?</p>
<pre><code>public static string BuildAndroidProject()
{
string result="";
// string ProjNameNDLocation = ProjectLocation + "\\" + ProjectName + ">";
try
{
System.Diagnostics.ProcessStartInfo androidBuildProj = new System.Diagnostics.ProcessStartInfo("F:\\AndroidProjects\\AndProj3 F:\\Android\\apache-ant-1.8.2-bin\\apache-ant-1.8.2\\bin\\ant debug");//ProjNameNDLocation, Program.ANDROIDDEBUGGCMD);
androidBuildProj.RedirectStandardOutput = true;
androidBuildProj.UseShellExecute = false;
androidBuildProj.CreateNoWindow = true;
System.Diagnostics.Process androidProcess = new System.Diagnostics.Process();
androidProcess.StartInfo = androidBuildProj;
androidProcess.Start();
result = androidProcess.StandardOutput.ReadToEnd();
androidProcess.Close();
}
catch (Exception e)
{
}
return result;
}
</code></pre>
<p>Problem is in the <code>ProcessInfoStart</code> Function. How can I run this command?</p>
| c# | [0] |
2,446,235 | 2,446,236 | OnHold Call information in android | <p>In my android application I am listening to phone state listening to PhoneState. In this I want to know know whether any call is onHold. Can I do that?</p>
<p>Thanks in advance</p>
| android | [4] |
2,467,717 | 2,467,718 | Is there API to delete photo in camera roll? | <p>Is there iphone API to delete photo in camera roll as Apple's photo app?</p>
| iphone | [8] |
403,319 | 403,320 | Facing problem in toggle method of jquery | <p>HI,</p>
<p>I have following html </p>
<pre><code> <div id="LineInfoHeader" class="div_header_inner headertitle align_center defaultheadercolor portlet-header-left-padding default_bottom_border default_border_color"><span class="ui-icon ui-icon-minusthick"></span>Line Item Information</div>
**Edit**
<div class="div_content_inner" id="Order_header"></div>
</code></pre>
<p>I am trying to toggle span class and Order_header div.<br>
I am using following code:</p>
<pre><code>$(".div_header_inner.ui-icon").toggleClass("ui-icon-minusthick").toggleClass("ui-icon-plusthick").toggle();
}
</code></pre>
<p>I don't know why its not working.
Please suggest where I am going wrong.
Thanks in advance.
<a href="http://jsfiddle.net/RPEK9/" rel="nofollow"><strong>You can see the problem here</strong></a></p>
| jquery | [5] |
3,207,941 | 3,207,942 | In android phonegap application language (Indian language Hindi) font is worked in android emulator but it is not working in real device. | <p>I created an android phonegap application which displays information in multiple languages like Hindi, Fijian, etc. Hindi language content displays properly in properly in emulator but it is not working on actual android device. It displays a small square box. </p>
<p>I'll explain the steps:</p>
<ul>
<li><p>I used web font converter and converted <code>de.ttf</code>, it generated 3 files.</p></li>
<li><p>I copied all theses files to folder named "font" in my project directory.</p></li>
<li><p>I added <code>font-face</code> in css.</p></li>
</ul>
<p>I called the <code>font-face</code> in a div and added Hindi text.</p>
<p>Thanks in advance.</p>
| android | [4] |
5,353,822 | 5,353,823 | Mysterious 1 when using php include | <p>My backup content (should the database fail) is brought in with include(). For some reason, there's a mysterious lone '1' below the div the include is wrapped in. It does it every time, but just on the content include. I've checked the function, all pages involved, no stray 1. If it loads from the database, everything's fine.</p>
<p>Any ideas why?</p>
<pre><code>(empty($Content)?(empty($dbContent)?include($URL):$dbContent):$Content);
</code></pre>
<p>That's the core of the function. No code to provide really, just a strange 1.</p>
| php | [2] |
3,469,097 | 3,469,098 | Changing element ClientId in repeater | <p>In asp.net repeater how can I change what unique id each element generated. Now it generates something like parent_repeater_ct001_controlinsiderepeater. What I would like to do is to replace this obscure ct001 to my value or even beter modify the whole id</p>
| asp.net | [9] |
3,233,400 | 3,233,401 | Examples and explanation for javascript regular expression (x), decimal point, and word boundary | <p>Can someone give a better explanation for these special characters examples in <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Regular_Expressions" rel="nofollow">here</a>? Or provide some clearer examples?</p>
<p><strong>(x)</strong> </p>
<blockquote>
<p>The '(foo)' and '(bar)' in the pattern /(foo) (bar) \1 \2/ match and
remember the first two words in the string "foo bar foo bar". The \1
and \2 in the pattern match the string's last two words.</p>
</blockquote>
<p><strong>decimal point</strong></p>
<blockquote>
<p>For example, /.n/ matches 'an' and 'on' in "nay, an apple is on the
tree", but not 'nay'.</p>
</blockquote>
<p><strong>Word boundary \b</strong></p>
<blockquote>
<p>/\w\b\w/ will never match anything, because a word character can never
be followed by both a non-word and a word character.</p>
</blockquote>
<p><strong>non word boundary \B</strong> </p>
<blockquote>
<p>/\B../ matches 'oo' in "noonday" (, and /y\B./ matches 'ye' in
"possibly yesterday."
totally having no idea what the above example is showing :(</p>
</blockquote>
<p>Much thanks! </p>
| javascript | [3] |
4,876,252 | 4,876,253 | How to pass jQuery data to return php file befor execute ajax code. | <p>I have develop 3 pages ....1) Usermgmt.php--- Form of user registration in this file I call dropdown function from my common class file. 2)User.js is jquery file after selecting dropdown id will get and for further process to send ajax-user.php 3) ajax-user.php --- show the second dropdown list dependt on the value of 1 dropdown. </p>
<p>Problem is that I want to pass the 2nd dropdown value from object in ajax file or either .js file var str to pass on 1st page. I am trying by $_POST['unitid'] but it will not... any once can help me ......</p>
| php | [2] |
2,561,541 | 2,561,542 | What is the cleanest way to validate an web site address and username that a user enters that is iOS 2.0 compatible? | <p>i am new iphone developer,any know about this please tell me how to validate web site address and username(username don't allow space,enter key ans special characters),how can i do this.</p>
<pre><code>Thanks in advance.
</code></pre>
| iphone | [8] |
5,405,400 | 5,405,401 | Variable in PHP http link | <p>I'm trying to get the cureent url and send that through in a link and I'm stuck. The link displays but it's missing the url that I want to include (content in the code sample here)</p>
<pre><code>'href' => ( "http://chart.apis.google.com/chart?cht=qr&chs=300x300&choe=UTF-8&chld=H&chl='.$content .'")
</code></pre>
| php | [2] |
3,149,503 | 3,149,504 | How do I load a javascript file dynamically? | <p>I have this code:</p>
<pre><code> <script type="text/javascript">
function js() {
var getJs = document.getElementById("jogo");
if (JS == true) { //if button JS is pressed - it is correct?
< script type = "text/javascript"
src = "file1.js" >
} else < script type = "text/javascript"
src = "file2.js" >
</script>
}
</script>
</code></pre>
<p>it doesn't work. I gave two buttons, if the first is pressed, <code>file1.js</code> should be loaded. In case the second one is pressed, <code>file2.js</code> should be loaded.</p>
<p>How can I do that?</p>
| javascript | [3] |
343,373 | 343,374 | Firing off some url requests (GET) after page load | <p>After a user logs off from our web-site we need to fire off some HTTP requests to 2-3 other external urls (we don't need a response from these btw).</p>
<p>The url request must be performed on the client as the requests will cause a log-off to be performed on these external sites on the users current session.</p>
<p>The only way I thought that this could be achieved would be to render some invisible iframes and set the url to each of them so that when the page loads the requests will be executed.</p>
<p>Is there another way this could be achieved? The above solution seems a bit hacky.</p>
<p>EDIT: I cannot use JS for this as we need to conform to standards.</p>
| asp.net | [9] |
754,550 | 754,551 | C++ returning queue pointer from function error | <p>I have a function </p>
<pre><code>queue< pair<int,int> > * factorize(int n) {
...}
</code></pre>
<p>It shows this compile error.</p>
<pre><code>generatePrimes.cpp:20: error: expected constructor, destructor, or type conversion before '<' token
generatePrimes.cpp:20: error: expected `,' or `;' before '<' token
</code></pre>
<p>What's wrong?</p>
| c++ | [6] |
1,145,072 | 1,145,073 | is PHP fast enough to transmit heavy data traffic? | <p>i'm developing a chat program in PHP where more than 500 users to be connected per day. plus it would own file transfer function as well thus the program must be fast enough. so i wanna know if the PHP is fast enough to accomplish this job or i must use other one platform??</p>
| php | [2] |
1,541,125 | 1,541,126 | Why is there no String.Empty in java? | <p>I understand that every time I type the String literal <code>""</code>, the same String object is referenced in the String pool.</p>
<p>But why doesn't the String API include a <code>public static final String Empty = "";</code>, so I could use references to <code>String.Empty</code>?</p>
<p>It would save on compile time, at the very least, since the compiler would know to reference the existing String, and not have to check if it had already been created for reuse, right? And personally I think a proliferation of String literals, especially tiny ones, in many cases is a "code smell".</p>
<p>So was there a Grand Design Reason behind no String.Empty, or did the language creators simply not share my views?</p>
| java | [1] |
3,259,880 | 3,259,881 | Accessing the Object values inside an array | <pre><code>var Array = [];
{'DateOfBirth' : '06/11/1978',
'Phone' : '770-786',
'Email' : 'pbishop@hotmail.com' ,
'Ethnicity' : 'Declined' ,
'Race' : 'OtherRace' , }
</code></pre>
<p>I need to access the 'Race' here.. how can i do it... Its an array which holds this data... </p>
| javascript | [3] |
147,154 | 147,155 | C# DateTimePicker reference issue | <p>I have a <code>DateTimePicker (dtpDate)</code> on a windows GUI and another <code>DateTimePicker (trackDate)</code> defined behind the code.</p>
<p>For some reason when I use <code>trackDate = dtpDate;</code> Any changes I make to trackDate affect dtpDate as well.</p>
<p>Why is this happening? I don't believe it should continue to reference dtpDate.</p>
<p>I've tried
<code>DateTimePicker trackDate</code> and <code>DateTimePicker trackDate = new DateTimeTracker();</code></p>
<p>Any help is welcomed.</p>
<p>Thanks.</p>
| c# | [0] |
1,116,629 | 1,116,630 | Make property assignment an Action | <p>Just an example: I have a class that reacts to set properties. More specifically, there are three properties from which an assembly is loaded once they are all set. Afterwards an event is triggered.</p>
<p>My unit test for this behavior look something like this:</p>
<pre><code>bool assemblyLoaded = false;
loader.AssemblyLoaded += () => assemblyLoaded = true;
loader.Type = "someType";
Assert.IsFalse(assemblyLoaded); // not loaded, only one property was set
</code></pre>
<p>This would lead to three unit tests, one test for each property. So I'd like to abstract the test by using a helping method (see below) to avoid code replication:</p>
<pre><code>private void Testfoobar(Action setProperty)
{
bool assemblyLoaded = false;
loader.AssemblyLoaded += (sender, args) => assemblyLoaded = true;
setProperty();
}
</code></pre>
<p>Unfortunately, I cannot make a property assignment an Action.</p>
<p>So, I wonder, can you somehow "transform" the assignment to Action? Or is there maybe a different way to abstract the code?</p>
| c# | [0] |
3,441,083 | 3,441,084 | Writing a method for factorial | <p>I'm studying the code below in my textbook. It uses the combinations method and the factorial method to calculate the possible outcomes given n and k. My question is with the factorial method specifically the content in the for loop. <br/></p>
<p>I understand everything else about the program but I don't understand the code i <=n in the for loop in the factorial method. What other part of the program is n referred to? I'm just not sure about the rationale behind i <= n or how the programmer comes up with that. </p>
<pre><code>import acm.program.*;
public class combinations extends ConsoleProgram {
public void run(){
int n = readInt("Enter the number of objects in the set (n): ");
int k = readInt("Enter the number to be chosen (k): ");
println("C (" + n + ", " + k + ") = " + combinations (n, k) );
}
private int combinations (int n, int k){
return factorial (n) / (factorial (k) * factorial (n-k));
}
private int factorial (int n){
int result = 1;
for (int i = 1; i <= n; i++){
result *= i;
}
return result;
}
}
</code></pre>
| java | [1] |
3,048,831 | 3,048,832 | Which is the protocol through Apache communicates with database? | <p>If database server is out of web server Apache communicates with database server through TCP/IP protocol, but when database and Apache is on the same computer which is the protocol by which they communicate? </p>
| php | [2] |
1,631,897 | 1,631,898 | How to reload Main Page from within an iFrame | <p>Within my scenario, I have a button within an iframe section of my page that performs some database processing.</p>
<p>What I basically need is a means of performing a page refresh of the main page, when this button within the iframe is pressed. </p>
<p>Would appreciate the javascript that I can trigger within the iframe, that will reload the main window holding the iframe.</p>
<p>Thanks.
Tony.</p>
| javascript | [3] |
4,239,444 | 4,239,445 | never stop the service in android | <p>I want to develop a service at system Level for Android which can not be stopped by a user.</p>
<p>Is this possible ?</p>
<p>How can I achieve this?</p>
<p>thanks </p>
| android | [4] |
760,688 | 760,689 | Page Response Time Shown by Mozilla Plugin FireBug | <p>What a Wonderful website stackoverflow has been , promptly getting responses . </p>
<p>I have Created a Simple JSP Page which will retrive some Data From Datbase and shows it on to the FrontEnd .</p>
<p>When i used Mozilla plugin FireBug Profiler it showed these Values 10.3s (onload: 10.33s)</p>
<p>Could anybody please suggest me , what this Values actaully indicate ?? </p>
<p>Thanks . </p>
| javascript | [3] |
3,208,206 | 3,208,207 | Strange property in a class | <p>Could you describe what it does? I met it in one of projects and don't know how it works.</p>
<pre><code>public object this[int i]
{
get { return columnValues[i]; }
}
</code></pre>
| c# | [0] |
1,146,394 | 1,146,395 | Circumstances to make a class final? | <p>Are there any general guidelines as to when to make a class final? </p>
<p>I thought it was if you did not want people extending your class, but that seems slightly.... naive?? </p>
| java | [1] |
4,283,153 | 4,283,154 | need to store files in root folder | <p>i have an application to store files in root folder. do i need to to check the status of the root folder?? amd how can i store files in the root folder???</p>
| android | [4] |
5,062,595 | 5,062,596 | Turn off scientific notation on float | <p>I'm trying to display number in standard notation</p>
<p>for example:</p>
<pre><code>float f = 1230000.76
</code></pre>
<p>turns out to be,</p>
<pre><code>1.23e+006
</code></pre>
| c++ | [6] |
45,677 | 45,678 | How does compiler combine an executable project using generic parameterized types from another class library project? | <p>Assume I have a class library project name <strong>Utilities.dll</strong> as follows:</p>
<pre><code>public static class Utilities
{
public static T Min<T>(T[] data) where T : IComparable<T>
{
T min = data[0];
foreach (T x in data)
{
if (x.CompareTo(min) < 0)
min = x;
}
return min;
}
}
</code></pre>
<p>Then I create a new console app project <strong>Tester.exe</strong> referencing Utilities.dll as follows</p>
<pre><code>class Program
{
static void Main(string[] args)
{
int[] data = { 3, 2, 4, 5, 1, 0, -1, 10 };
Console.WriteLine(Utilities.Min<int>(data));
}
}
</code></pre>
<p>I want to know how the compiler does its job behind the scene. Can anybody know the rough idea about it?</p>
<p>Note that: Assume I have no access to the source code of Utilities.dll when using it on Tester.exe project. Only Utilities.dll is provided.</p>
| c# | [0] |
5,182,809 | 5,182,810 | Ways to find maximum digit | <p>Currently my mini algorithm looks like this.</p>
<pre><code>int a,b,c,max;
cout <<"Enter 3 digits: \t";
cin>>a>>b>>c;
if(a>b && a>c)
max=a;
else if(b>c && b>a)
max=b;
else
max=c;
cout <<"max: "<<max<<endl;
</code></pre>
<p>It works but Is there any other way to find maximum of 3 digits?</p>
| c++ | [6] |
1,081,491 | 1,081,492 | Requesting feedback on unistall | <p>Is there a way to request feedback from user on app when user is uninstalling the app on his device? </p>
| android | [4] |
1,970,868 | 1,970,869 | send value from textarea | <p>hello i have the following script : <a href="http://jsfiddle.net/EFjcA/" rel="nofollow">http://jsfiddle.net/EFjcA/</a></p>
<p>i would like my function :</p>
<pre><code>var saveEdit = function(event2){
var btn = event2.target,
li = btn.parentNode,
p = li.getElementsByClassName('paratext')[0],
te = p.parentNode;
te.style.display="none";
p.appendChild(te.value);
p.style.display="block";
btn.innerText = "Edit";
btn.onclick = makeAreaEditable;
};
</code></pre>
<p>..to save the value from inside the textarea and display it after the button Ok is pressed.</p>
| javascript | [3] |
5,768,575 | 5,768,576 | android - app installation | <p>i developed a application and it works fine on the emulator, so tried to install it on my phone using a .apk of the file
(<strong>NOTE</strong>: It is a unSigned one).</p>
<p>on installing the app on the phone, during installation i get a error as installation failed.
(<strong>NOTE</strong>: Other applications from the market are installing without any errors, the ones downloaded from the internet are working fine, but one developed by me aren't)</p>
<p>tried to debug the application on my phone using USB debugging.</p>
<p>the app gets installed fine by USB debugging.</p>
<p>Still can't figure out how to install using the .apk file.</p>
<p>Thanks in advance. :)</p>
| android | [4] |
2,303,476 | 2,303,477 | RadioButtonList selection IndexChanged | <p>My Scenario,</p>
<p>When i select the option in list i need to perform some action like Textbox should be disabled. But i don find my breakpoint pointing to that action to be performed.Pls help</p>
| asp.net | [9] |
2,283,288 | 2,283,289 | how to make a copy-paste script with jcreator? | <p>can u help me with the coding of java, so i can copy a single file using command prompt.</p>
<p>so, i wanna run the java file from command prompt of windows, like "java "my java script" "my file target"" and make a copy of my "my file target" at the same directory without replace the old one.</p>
<p>please help me?</p>
<p>i came out with this</p>
<pre><code>import java.io.*;
class ReadWrite {
public static void main(String args[]) throws IOException {
FileInputStream fis = new FileInputStream(args[0]);
FileOutputStream fos = new FileOutputStream("output.txt");
int n;
if(args.length != 1)
throw (new RuntimeException("Usage : java ReadWrite <filetoread> <filetowrite>"));
while((n=fis.read()) >= 0)
fos.write(n);
}
}
</code></pre>
<p>but the copy of the file is named as output.txt
can u guys help me with the coding, if i wanna choose my own output name?
if i type "java ReadWrite input.txt (this is the output name that i want)" on command prompt</p>
<p>really need help here...</p>
| java | [1] |
3,384,077 | 3,384,078 | How to create small dict from another dict with array of keys? | <p>I have a simple dictionary <code>{'a': 1, 'b': 2, 'c': 3, 'd': 4 }</code> and list of keys: <code>['a', 'd']</code>.</p>
<p>What is the better way to construct dict object containing only keys from the list: <code>{'a': 1, 'd': 4}</code>?</p>
| python | [7] |
3,775,474 | 3,775,475 | Is it possible to preg replace unique variables into a string? | <p>What I want to do is use preg replace to replace matches within a string with a varying replacement, and I was wondering if anyone knew if that is possible in php or at least achievable by some means. For example, a string has two matches, then those matches will be replaced with two different variables. What I want are replacements to each be a unique id and I cannot figure out how this could possibly work or if php could even do this. For example if the match is 'a' and there is a sentence, <strong>'put a smile on a person'</strong> then one 'a' will be unique id 98aksd00 and the other will be 09alkj08. I am retrieving my comments from a database so the preg replace is happening within </p>
<pre><code>while ($row=mysql_fetch_assoc($query)){
//preg replace
</code></pre>
<p><br />If anyone could provide any insight into this, I would really appreciate it</p>
| php | [2] |
3,776,648 | 3,776,649 | method return types | <p>I'm new to C# and I'm trying to figure out the best way to test if a method returns correctly, ie; did the method get the information I wanted.</p>
<p>It's the types that are making this difficult. Is there a way that I can sometimes return bool and sometimes return something else?</p>
<p>In PHP I would create my function like this</p>
<pre><code>function myFunc(){
//Do Stuff
if(/*whatever*/) return (string) "abcdefg";
return false; //otherwise it will just return false
}
</code></pre>
<p>Then call it like this to test if it worked or not</p>
<pre><code>if(!$var=myFunc()) die("It Didn't Work");
echo $var;
</code></pre>
<p>But with C#, my function has to return a specified type, not a string or bool false if it didn't work out.</p>
<p>If in C# I have a method that returns IntPtr I could have it return <code>(IntPtr) 0</code> instead of false, but this is messy and there's probably a better way of doing it. </p>
<p>Any Ideas? What's the standard and usual way of doing this in C#?</p>
| c# | [0] |
737,677 | 737,678 | php dynamically generate file with argument | <p>I'm new to web programing and just started using php. I wonder if there's a way to dynamic generate a file (like html) by passing an argument. like by calling some function </p>
<pre><code>some_function($my_arr)
</code></pre>
<p>and</p>
<pre><code>$my_arr={$obj1, $obj2, $obj3}
</code></pre>
<p>while obj is just a class with some class member in it.
Is it possible to dynamically generate 3 file (such as html) that prints the info of three objects to some format seperately in each of them?</p>
| php | [2] |
784,222 | 784,223 | how to make jQuery .resize() function trigger only when the div actually resizes to grid? | <p>When you snap resizable to a grid like in the example below you get the .resize() function triggered for every pixel you drag your mouse.</p>
<pre><code>$("#box").resizable({grid:[50,50]);
$("#box").resize(function(){
var w = $(this).width();
var h = $(this).height();
}
</code></pre>
<p>How to make it so it triggers only when the size of the div actually changes?</p>
<p>Thanks!</p>
| jquery | [5] |
4,926,959 | 4,926,960 | link click event - Add a function to be executed after the normal page link is executed | <p>There is an existing link on the page that updates the data on the page.
(provides the next 15 records)</p>
<pre><code><li>
<a href="#statistic=general;page=4;name=" target="self" class="ABC">
<span class="btnBg">&nbsp;</span>
<span class="icn next">&nbsp; </span>
</a>
</li>
</code></pre>
<p>Is there a way using JQuery or Javascript to have my JQuery function execute right after the above link is updated? </p>
| jquery | [5] |
2,412,693 | 2,412,694 | What is the solution of clicking problem of a button, it needs 7-8 times clicking for opening an activity in android 1.6 | <p>I have a problem in my app. After clicking once when I have to access the activity again I need to click the button
7-8 times to go the UI from it. But this was not happening before I added "android.permission.WAKE_LOCK" this permission. Can anyone help me to figure out it ??
Here is the error while this is occurring ---</p>
<pre><code>04-25 09:29:02.594: ERROR/BatteryService(2026): Could not open '/sys/class/power_supply/usb/online'
04-25 09:29:02.609: DEBUG/WifiService(2026): ACTION_BATTERY_CHANGED pluggedType: 0
</code></pre>
<p>Thanks in advance.</p>
| android | [4] |
5,011,106 | 5,011,107 | system() mangles the command in php | <p>I'm trying to execute a command through system() in PHP. The command is /usr/bin/unzip, but the function returns with the error code 127. There is nothing else outputted. If I run the very same command directly in a shell it works.</p>
<p>The apache error log says 'sh: /unzip: not found'. I have also tried to put the command into a shell script that is in the same directory as the PHP script and call the shell script through system(). The same happens: if the shell script was called 'doit.sh' the error message in the apache log would be 'sh: /doit.sh: not found'.</p>
<p>exec() has the same behaviour.</p>
<p>The PHP version is 5.2.11-2 with suhosin extensions.</p>
<p>Any ideas what PHP could be doing to my command? </p>
| php | [2] |
116,975 | 116,976 | Javascript sort array function performance | <p>Does anyone know how the built-in JS function <code>array.sort()</code> functions internally? I mean does it change strings to numbers....etc</p>
<pre><code>var keys = new Array();
keys.sort();
</code></pre>
| javascript | [3] |
2,868,499 | 2,868,500 | How to write native newline character to a file descriptor in Python? | <p>The <code>os.write</code> function can be used to writes bytes into a file descriptor (not file object). If I execute <code>os.write(fd, '\n')</code>, only the LF character will be written into the file, even on Windows. I would like to have CRLF in the file on Windows and only LF in Linux. What is the best way to achieve this?</p>
<p>I'm using Python 2.6, but I'm also wondering if Python 3 has a different solution.</p>
| python | [7] |
1,408,515 | 1,408,516 | Detect click on a specified area | <pre><code><div id="main">
hello world
<div id="second-div">
bye
</div>
</div>
jQuery('#main:not(second-div)').click(function() {
alert('works!');
});
</code></pre>
<p>I want to detect mouse click on the "main" div, but the click event shouldn't trigger when I click on the "second-div" div.
I've tried using ":not(second-div)" but the click triggers anyway.</p>
| jquery | [5] |
2,255,026 | 2,255,027 | How does the compiler resolve infinite reference loops? | <pre><code>// edited by Neil Butterworth to conserve vertical space
#include <stdio.h>
struct A;
struct B;
A& GetAInstance();
B& GetBInstance();
struct A {
A() {
printf( "A\n" );
}
~A() {
printf( "~A\n" );
B& b = GetBInstance();
}
};
struct B {
B() {
printf( "B\n" );
}
~B() {
printf( "~B\n" );
A& a = GetAInstance();
}
};
A& GetAInstance() {
static A a;
return a;
}
B& GetBInstance() {
static B b;
return b;
}
int main( ) {
A a;
}
</code></pre>
<p>Consider the above scenario. I would expect this to result in an infinite reference loop resulting in the program being unable to exit from static de-initialization, but the program ran just fine with the following printout:</p>
<pre><code> A
~A
B
~B
A
~A
</code></pre>
<p>Which was unexpected.</p>
<p>How does a compiler deal with this situation? What algorithms does it use to resolve the infinite recursion? Or have I misunderstood something fundamental? Is this, somewhere in the standard, defined as undefined?</p>
| c++ | [6] |
272,195 | 272,196 | I want to add space between numeric and alphanumeric characters | <p>When the textbox changes I want add a whitespace between numeric and alphanumeric characters. </p>
<p>For example</p>
<pre><code>34 YT 567 *Allowed*
22 KL 2345 *Allowed*
22KL 2345 *Not Allowed*
22KL2345 *Not Allowed*
22 KL2345 *Not Allowed*
</code></pre>
| c# | [0] |
2,084,192 | 2,084,193 | How to create a Equalizer as separate activity in the MediaPlayer? | <p>I'm learning to a create the MediaPlayer and want to have a button of equalizer which will be called as a separate activity.
The issue is I want to pass the pass the reference of currently running MediaPlayer so that when I change the equalizer settings, the MediaPlayer running gets effected.
For e.g.</p>
<p>In onItemClick if equalizer button is clicked, I can pass mediaplayer reference:</p>
<pre><code>MyEqualizer eq = new MyEqualizer(this, mPlayer);
</code></pre>
<p>But this method doesn't seem to be working.
I know I can rather create a AlertDialog within this class only, but I want to call Equalizer in a separate activity.
Please suggest.</p>
| android | [4] |
931,916 | 931,917 | how do i extract the last value of every output? | <p>Here is the contents of my text file which consists of a name like "output1" followed by a series of numbers, "output2" followed by a series of numbers and so on separated by a single space...I want to extract last value of every output. How do i do this? ie., I want to extract the value of "output1" as 29.933215(ie. the value just before "output2") and the values of "output2" as 379.983559 </p>
<ul>
<li>content of text file is as shown below:</li>
</ul>
<p>output1 30.000000 29.999969 29.999907 29.999783 29.999535 29.999039 29.998047 29.996063 29.992133 29.988202 29.984273 29.980343 29.976414 29.972485 29.968556 29.964628 29.960700 29.956773 29.952846 29.948919 29.944992 29.941066 29.937140 29.933215
output2 380.000000 379.999990 379.999970 379.999930 379.999850 379.999691 379.999372 379.998734 379.997469 379.996204 379.994940 379.993675 379.992411 379.991146 379.989882 379.988617 379.987353 379.986088 379.984824 379.983559
output3 1.761964 1.761964 1.761964 1.761964 1.761964 1.761964 1.761964 1.761964 1.761963 1.761963 1.761963 1.761963 1.761963 1.761963 1.761963 1.761963 1.761962 1.761962 1.761962 1.761962 1.761961 1.761961 1.761961 1.761960 </p>
| c# | [0] |
83,458 | 83,459 | count values of checked checkbox | <p>I want to get the total value of all checked checkboxes. What i've tried is this:</p>
<pre><code>$("input[type=checkbox]:checked").each(function() {
total_modules += parseFloat($(this).val());
});
$("#total_modules").text(total_modules.toFixed(2));
</code></pre>
<p>This didn't work.</p>
<p>I hope someone can help me.</p>
<p>Thanks in advance!</p>
<p>PS: I fixed it, this is my new code:</p>
<pre><code>function calculation()
{
$("input[type=checkbox]:checked").each(function() {
total_modules += parseFloat($(this).val());
});
$("#total_modules").text(total_modules.toFixed(2));
}
calculation();
$("input[type=checkbox]").click(function()
{
calculation();
});
</code></pre>
<p>Thank you all</p>
| jquery | [5] |
2,636,588 | 2,636,589 | value preserving across multiple pages | <p>i am trying to post the some data on another page at this i have a back button onclick of back button i wanna reload the original page with posted data. </p>
| php | [2] |
3,642,793 | 3,642,794 | In C++ how to have memory only for one variable define both in base & derived class | <p>Is it possible to have memory for only one variable (defined in both base as well as derived class)if we create object of derived class. If can, what is the reason behind it, please provide complete explanation.</p>
<pre><code>class Base
{
private:
int i;
}
class derived: public /* or private or protected (whatever fits in my question) */
Base
{
private:
int i;
}
int main()
{
derived obj;
}
</code></pre>
| c++ | [6] |
994,220 | 994,221 | How to POST xml file using http request in Android? | <p>I'm trying to POST the following xml to a server url, but i don't know how to go about it. GET requests are easy enough, but I'm having a problem with POST requests.</p>
<pre><code><? xml version=1.0>
<Request>
<Elemtnt>
<data id="1">E1203</data>
<data id="2">E1204</data>
</Element>
</Request>
</code></pre>
| android | [4] |
4,846,734 | 4,846,735 | Is it programmer responsibility to delete temp file | <p>Currently, I have an application, which will save a temporary screenshot, and let user share it through facebook. The image saving code is more or less as follow.</p>
<pre><code>// Use external cache dir, as our image file is large (>1M)
File outputDir = this.getExternalCacheDir();
File tempFile = File.createTempFile("CHEOK", "CHEOK", outputDir);
// In Desktop's J2SE, this file will automatically be deleted, once my desktop
// application quit. However, this is not the case for Android. My guess is, JVM
// is not terminated, even our Android application had quit.
tempFile.deleteOnExit();
</code></pre>
<p>I realize even I quit my Android application (By pressing system "back" button), the tempFile is still there even we are using <code>deleteOnExit</code>. My guess is that the JVM is not terminated yet.</p>
<p>May I know, is it our application programmer responsibility, to delete the created temp file, during Activity's <code>onDestroy</code>? If not, what is the common best practice?</p>
| android | [4] |
3,765,228 | 3,765,229 | How would I capitialize the first letter of a sentence in Java? | <p>I tried splitting up the words in the line and checking if they had periods, but I got an error: </p>
<pre><code>falls.falls.falls.Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6
at Alpha.main(Alpha.java:10)
</code></pre>
<p>Code:</p>
<pre><code>import java.io.*;
import java.util.*;
public class Alpha
{
public static void main(String[] args)
{
String phrase = "the moon falls. the flowers grew.";
String beta = "";
String[] array = phrase.split(" ");
for (int i = 0; i < array.length; i++)
{
if (array[i].endsWith("."))
{
array[i + 1] = array[i + 1].substring(0, 1).toUpperCase() + array[i + 1].substring(1);
beta = beta + array[i];
}
System.out.print(beta);
}
}
}
</code></pre>
<p>(Also I don't think that's how I would call another word of an array, any suggestions on how I can fix that?)</p>
| java | [1] |
3,922,762 | 3,922,763 | YouTube new video notification Android | <p>I everyone I’m currently in the process of creating an Android application for my YouTube channel. I was wondering if anyone knew if there was any way to check for a new video uploads so I could use it to trigger a notification within my application.
Thank you for any help. </p>
| android | [4] |
3,965,476 | 3,965,477 | what is the best static code analysis tool for android project? | <p>I have developed one android app using eclipse IDE and now code count grows very hugh, so i want to do the code review using some static code analysis tool which can help me to find out all silly mistakes in the code,duplicate code ,exception handling errors etc.. and it should be pluggable with eclipse IDE</p>
<p>Can anybody suggest me the tool which i can use it in my project to resolve all coding issues.</p>
<p>Regards,
Piks</p>
| android | [4] |
1,875,028 | 1,875,029 | showing a html format string on browser in java | <p>I have problem about showing a string in html format on my browser in java. Here I have a java string like this</p>
<pre><code><HTML><HEAD><TITLE>403 Forbidden</TITLE></HEAD><BODY><H2>403 Forbidden</H2>
</P></H3>You need permission for this service</BODY></HTML>
</code></pre>
<p>With this method "rep.formForbidden()", I get this html format string, so I need it show it on my browser. Thanks</p>
| java | [1] |
3,624,165 | 3,624,166 | Set object key to value of variable - why have two different ways? | <p>In JavaScript, if you have the following code: </p>
<pre><code> var map_id = 100;
var myobj = {};
myobj[map_id] = 6;
var myobj2 = { map_id : 6 };
console.log(myobj, myobj2);
</code></pre>
<p>The console output is as follows: </p>
<pre><code>{ '100': 6 } { map_id: 6 }
</code></pre>
<p>Questions: </p>
<ol>
<li>Why does JavaScript syntax work differently in these two different cases - why is they key in <code>myobj2</code> set to the literal <code>map_id</code> rather than <code>100</code>? What is the reasoning behind having this difference?</li>
<li>Is there any way to set the key to the value of the <code>map_id</code> variable <em>in a compact, one-line way</em>, rather than having to define the object separately first?</li>
</ol>
<p>Thanks. </p>
| javascript | [3] |
4,627,964 | 4,627,965 | Problems with Pirobox on website | <p>i have a problem on my site! When click a image to open movie, the content is moving up and left!</p>
<p><a href="http://micheel.net/2012/index2.php" rel="nofollow">http://micheel.net/2012/index2.php</a></p>
<p>When closing the movie, the content moves to bottom again! But it is a bad effect. Have anybody of you a idea how to solve this!? </p>
<p>Thanks for your help</p>
<p>best cominaction</p>
| jquery | [5] |
962,210 | 962,211 | Javascript to replace text in Gmail message (Chrome Extension) | <p>I'm trying to write a Chrome Extension which will replace a string of text in Gmail messages.</p>
<p>If I open a Gmail message and click the print button to see it in print view and run the extension it works well and replaces all instances of the string.</p>
<p>However, if I run the extension in the normal Gmail discussion view it causes the page to refresh and it does not actually replace any of the text.</p>
<p>Here is the code I'm using. Any ideas what I'm doing wrong?</p>
<pre><code>function doIt(){
findAndReplace("Father","Mother");
}
var haystackText = "";
function findAndReplace(needle, replacement) {
if (haystackText.length == 0) {
haystackText = document.body.innerHTML;
}
var match = new RegExp(needle, "ig");
var replaced = "";
if (replacement.length > 0) {
replaced = haystackText.replace(match, replacement);
document.body.innerHTML = replaced;
}
}
doIt();
</code></pre>
<p><strong>Update:</strong>
Here is the updated code I'm using after Felix Kling's help. Similar issue to the one above, it works in print preview but not in the regular Gmail view. It does not however reload the page.</p>
<pre><code>function findAndReplace(root, needle, replacement) {
var children = root.childNodes;
var pattern = new RegExp(needle, 'ig');
var node;
for(var i = 0, l = children.length; i < l; i++) {
node = children[i];
if(node.nodeType === 3) { // we have a text node
node.nodeValue = node.nodeValue.replace(pattern, replacement);
} else if(node.nodeType === 1) { // Element node
findAndReplace(node, needle, replacement);
}
}
}
function doIt(){
findAndReplace(document,"Father","Mother");
}
doIt();
</code></pre>
| javascript | [3] |
157,760 | 157,761 | What is the way in which we import Map? | <p>Whenever I import <em>com.android.maps.MapActivity</em> it gives an error as "<em>cant resolve the class</em>".</p>
| android | [4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.