Unnamed: 0
int64 65
6.03M
| Id
int64 66
6.03M
| Title
stringlengths 10
191
| input
stringlengths 23
4.18k
| output
stringclasses 10
values | Tag_Number
stringclasses 10
values |
---|---|---|---|---|---|
4,193,716 | 4,193,717 | SurfaceView (camera preview) goes black after screen On/Off | <p>I'm trying to understand interesting thing. I made simple application with SurfaceView and Button. SurfaceView shows camera preview and Button shoot picture. Everything goes good except one moment:</p>
<p>If i press home button, my app goes to background, ok, then i turn screen off/on, then i tap on app icon and my app moves to foreground and everything is correct, i see preview camera again. BUT If i turn screen off/on without moving my app to background, then i see black preview without camera and cant make any pictures.</p>
<p>Please, help, i broke my brain :)</p>
<p>Thank you for your help!</p>
| android | [4] |
5,663,887 | 5,663,888 | How can i use mouse right click button in a listBox on selected index? | <p>I have this selected index event of a <code>ListBox</code>:</p>
<pre><code>private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (listBox1.SelectedItem != null)
{
label4.Text = listBox1.SelectedItem.ToString();
string startTag = "Url: ";
string endTag = " ---";
int startTagWidth = startTag.Length;
int endTagWidth = endTag.Length;
int index = 0;
index = label4.Text.IndexOf(startTag, index);
int start = index + startTagWidth;
index = label4.Text.IndexOf(endTag, start + 1);
string g = label4.Text.Substring(start, index - start);
label4.Text = g;
mainUrl = g;
}
}
</code></pre>
<p>I want that after I selected an index(item) in the <code>ListBox</code> and I make now right click with the mouse on this index it will do something. But if I will make mouse right click button on any other area on the <code>ListBox</code> or the Form it won't do anything. Only if the mouse is on the selected index. </p>
<p>What I need to do is that the user will be able to remove/delete an item from the <code>ListBox</code>.
I just don't know what is the best logic of how to do it when the user click the right mouse button.</p>
<p>Show I make it when the user first selected an item and only if the mouse is above/on this selected item ? Show I do it that if the user clicked mouse right button on any item it will select it automatic and do something ? </p>
<p>Im not sure wich way is better and logic and how to do it.</p>
| c# | [0] |
2,352,747 | 2,352,748 | Show last 7 days without week-end days (php) | <p>I need to show last seven day in a select box but without week end day, in php </p>
<p>my code </p>
<pre><code> for($time=0; $time<(86400*14); $time+=86400)
{
?> <option value="<?php echo $date=date('Y-n-j', time()-$time);?>"><?php echo $date=date('n/j', time()-$time);?></option>
<?php
}
?>
</code></pre>
| php | [2] |
5,826,499 | 5,826,500 | Using sprintf will change the specified variable | <p>I have a code,</p>
<pre><code>char* bin2hexchar( const unsigned char& ibin, char* pbcd )
{
sprintf( pbcd, "%02X", ibin );
return pbcd;
}
</code></pre>
<p>The problem is, the value of ibin variable will change to zero value.</p>
<p>Please advice.</p>
<p>Thanks</p>
| c++ | [6] |
1,766,210 | 1,766,211 | Use of Meter in Android App | <p>can any one tell me about this problem? I have an two image one image is frame and other image is mask and i want to use it like frame fill with the mask with respect to result of some kind of calculation.e.g result is 60 then then frame also fill with the masks but not full but 60% fill it.</p>
| android | [4] |
2,382,116 | 2,382,117 | curl output to database | <p><strong>curl_setopt($ch, CURLOPT_FILE, $fp)</strong> which is used for output to a file. Is any way to set </p>
<p>output to database.</p>
| php | [2] |
740,080 | 740,081 | how to implement google map5 feature in my application in android | <p>I want to implement google map5 feature in offline in my application .can anybody tell how to implement?</p>
| android | [4] |
2,834,970 | 2,834,971 | MegaVideo download (using Premium account) | <p>How to get the link to the original megavideo file (avi, mvk etc.) with Premium account using PHP? There are some scripts in the net, however all of them are enabling to download .flv only.</p>
| php | [2] |
3,412,263 | 3,412,264 | How to count all the entries in a table using javascript? | <p>I have a table in html template which might contain 100s of rows. Those data might be paginated. I want to count all the total number of rows in the table and write in this tag:</p>
<pre><code><p id="entry"> <span>.. Entries</span> </p>
</code></pre>
<p>How can I do that?</p>
| javascript | [3] |
5,993,905 | 5,993,906 | How to create a edit text with a permanent hint inside it | <p>I have a edit text in which the user enters amount. What I want to do is set a textview value before it that is not editable by the user like "INR" and then the user will enter the amount in front of it. I want edittext to look like the below one. How can I do that?</p>
<p><img src="http://i.stack.imgur.com/gFGIb.png" alt="enter image description here"></p>
<pre><code><EditText
android:id="@+id/Eamnt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button1"
android:layout_alignParentBottom="true"
android:layout_marginBottom="180dp"
android:ems="10"
android:inputType="numberDecimal"
</code></pre>
| android | [4] |
88,397 | 88,398 | open photo gallery on second tab bar click? | <p>How do I open a photo gallery on second tab bar click??</p>
| iphone | [8] |
3,125,114 | 3,125,115 | Android Simulate Roaming | <p>I have an application which takes certain action when Phone gets a Roaming event.To test that its perfectly working , can i simulate the SIM Roaming event.Its not practically possible for me to do that in reality</p>
| android | [4] |
1,813,341 | 1,813,342 | how can i read variable to other page by post | <p>i have link like this</p>
<pre><code><a href="PrintSingleCashier.php?id=<?=$objResult["cashiers_CashierID"]; ?>" target="_new"><img src="../images/print.png"></a>
</code></pre>
<p>and i wont to print variable <code>id</code> to other pages called <code>PrintSingleCashier.php</code>, i will insert id on link same this <code>PrintSingleCashier.php?id=<?=$objResult["cashiers_CashierID"]; ?></code>.</p>
<p>but when go to this page <code>PrintSingleCashier.php</code> i cannot read <code>id</code>.</p>
<p>why !!</p>
<p>i read it like <code>$_GET["id"];</code> but i need read it like <code>$_POST["id"];</code></p>
| php | [2] |
5,701,132 | 5,701,133 | Traversing a JQuery object and replacing text | <p>Assuming I have the following html div which I want to replicate its children, changing the value of each span in the process</p>
<pre><code><div><span class="foo">[Name]</span> <span class="bar">[Name]</span></div>
</code></pre>
<p>Using jQuery I can get a reference to the "div" by</p>
<pre><code>var $div = $("div");
</code></pre>
<p>and then clone as in</p>
<pre><code>var clone = $div.children().clone();
</code></pre>
<p>How can I then traverse the clone and change the values for each span?</p>
| jquery | [5] |
5,537,862 | 5,537,863 | Is there an online ECMAScript beautifier which supports chaining? | <p>Is there an online ECMAScript beautifier which supports aligning chained methods (and also, preferably, comma first)? </p>
<p>I've used jsbeautifier.org for years, and I've seen the modified version at <a href="http://jsfiddle.net/RabTN/29/" rel="nofollow">http://jsfiddle.net/RabTN/29/</a> which does comma first (though other bits of jsbeautifier.org's beautifier are a bit funky there...). However, what I've missed is a beautifier that can support aligning chained methods, rather than just joining them all into one long string. Ie:</p>
<pre>
$(this).parents('tr:eq(1)').prevAll('[id^=foo_]:first').find('.TrackList_LineBreak').text();
</pre>
<p>into</p>
<pre>
$(this).parents('tr:eq(1)')
.prevAll('[id^=foo_]:first')
.find('.TrackList_LineBreak')
.text();
</pre>
<p>Does anyone know if such a beautifier exists? If one does, is there a copy/paste web-enabled version of it, like jsbeautifier?</p>
| javascript | [3] |
2,852,708 | 2,852,709 | Play iPhone audio in ear speker | <p>How can we play audio using the ear speaker from an application.
The audio plays like some one is talking at the other end of the phone.</p>
<p>Thanks</p>
| iphone | [8] |
2,780,980 | 2,780,981 | string array in spinner | <p>i have an array which is populated in the spinner adapter.
now i wanna change the size of the array! is it possible?
help!
thank u
`public void classpopulate() {
if (PEP.getUser() == null) {
return;
}</p>
<pre><code> classdetails = masterDataManager.getClassSections(PEP.getUser()
.getUsername(), getApplicationContext());
spnrClass = (Spinner) findViewById(R.id.spnrClass);
spnrSubject = (Spinner) findViewById(R.id.spnrSubject);
classname = new String[classdetails.size() + 1];
classname[0] = "SELECET CLASS";
for (int i = 1; i < classdetails.size() + 1; i++) {
classname[i] = classdetails.get(i - 1).getClass_name() + " "
+ classdetails.get(i - 1).getSection_name().toString();
}
ArrayAdapter<CharSequence> adapterClasses = new ArrayAdapter<CharSequence>(
getApplicationContext(), R.layout.spinner_item_class,
R.id.spinnerclasstxt, classname);
spnrClass.setAdapter(adapterClasses);
spnrClass.setSelection(0);
spnrClass
.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1,
int pos, long arg3) {
// LinearLayout layoutSpinnersubj = (LinearLayout)
// findViewById(R.id.layout_spinner);
// RelativeLayout subject_Text
// =(RelativeLayout)findViewById(R.id.layoutsubjecttext);
int selectedindex = pos;
if (selectedindex == 0) {
spnrSubject.setVisibility(View.INVISIBLE);
} else {
spnrSubject.setVisibility(View.VISIBLE);
selectedClass = classdetails.get(selectedindex - 1);
subjectpopulate(selectedClass);
}
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
});
</code></pre>
<p>`</p>
| android | [4] |
1,504,654 | 1,504,655 | Object Oriented Programming | <p>Object Oriented Programming..
I have a problem in my main method, it says cannot find symbol. why?</p>
<p>in this part:</p>
<pre><code>double grossPay = payroll.getHoursWorked * payroll.getPayRate * payroll.getTaxRate ;
</code></pre>
<p>all I know is that I already declared it in my base class
in here:</p>
<pre><code>public class Exercise1 {
private long hoursWorked;
private double payRate;
private double taxRate;
public void setHoursWorked(long temp){
hoursWorked = temp;
}
public void setPayRate (double temp){
payRate = temp;
}
public void setTaxRate (double temp){
taxRate = temp;
}
public double getTaxRate (){
return(taxRate);
}
public double getPayRate (){
return(payRate);
}
public double getHoursWorked (){
return(hoursWorked);
}
}
</code></pre>
<p>Here is my main class:</p>
<pre><code>public class payroll{
public static void main(String args[]){
Exercise1 payroll = new Exercise1();
payroll.setHoursWorked(28);
payroll.setPayRate (120.00);
payroll.setTaxRate (0.30);
double grossPay = payroll.getHoursWorked * payroll.getPayRate * payroll.getTaxRate;
System.out.println("Gross pay is:"+ grossPay);
}
}
</code></pre>
<p>why keeps asking "cannot find symbol" ?
please help.. I'm new to programming :(</p>
| java | [1] |
2,310,016 | 2,310,017 | How could i manage to open a popup window in a secondary monitor if it exists using javascript? | <p>How could I manage to open a popup window in a secondary monitor if it exists using javascript??
Thank you so much...</p>
| javascript | [3] |
2,344,470 | 2,344,471 | Sending a web request with a python script to select a specific radio button on a web page | <p>I have to test an internal web page.
The web page contains text fields, buttons, and radio buttons.
Based on a specific radio button selected another sub-form is displayed in the web page.</p>
<p>I'm using urllib2, and some of its modules, to successfully connect to the web server and perform some actions.</p>
<p>However, not able to select the radio button, via a POST from the python script, I'm not able to proceed with the test automation.</p>
<p>Reading some of the online posts about selecting radio buttons I read that some people are using "mechanize". I'm not familiar with this. Is there another specific module in urllib2 that would allow me to send a POST request to select a specific radio button.</p>
<p>Roland</p>
| python | [7] |
4,240,163 | 4,240,164 | How will GCM handle all queueing and delivery for messages to Android applications? | <p>If multiple PUSH messages are sent to the same device, then how is the queuing working in GCM.</p>
| android | [4] |
5,753,109 | 5,753,110 | Navigation bar similar to LinkedIn on Android | <p>So for Android's LinkedIn app, there is a navigation bar and once you click on the LinkedIn logo, a subnav will drop down. If you click the logo again it will go back up.</p>
<p>What is this referred to as for Android? What steps would I need to take to produce a similar effect?</p>
<p>I'm no so much looking for someone to do it for me, rather point me in the right direction. </p>
<p>Thanks.</p>
| android | [4] |
4,840,721 | 4,840,722 | why can't we declare object of a class inside the same class? | <pre><code>class A
{
A a;//why can't we do this
};
</code></pre>
| c++ | [6] |
727,655 | 727,656 | How do I create an instance of OnClickListener | <p>I wrote this code, but I get an error with View.OnClickListener.</p>
<p>The error said that View can't be resolve as type. I have imported android.view.View.OnClickListener but still get the same error.</p>
<p>If I use the quick fix another error appears.</p>
<pre><code>public class Net extends Activity implements View.OnClickListener
{
EditText edt;
TextView text;
Button ping;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
edt=(EditText)findViewById(R.id.edt);
text=(TextView)findViewById(R.id.text);
ping=(Button)findViewById(R.id.ping);
Button.setOnClickListener(new View.OnClickListener());
}
public void onClick(View v)
{
</code></pre>
| android | [4] |
5,654,365 | 5,654,366 | int a; ...; (a == a) fails? | <p>if we set <em>float</em> and <em>double</em> type to <em>NaN</em> then they are not equal to anything including <strong>themselves</strong>.<br>
can such a thing happens for <em>int</em>?</p>
| c++ | [6] |
5,648,856 | 5,648,857 | Uncatchable webview exception? | <p>I want to clear all webview data from my app. I'm doing the following:</p>
<pre><code>WebViewDatabase wvd = WebViewDatabase.getInstance(context);
if (wvd != null) {
try {
wvd.clearUsernamePassword(); <-- throws an uncatchable exception
} catch (Exception ex) {
Log.e(TAG, "nope!", ex);
}
}
</code></pre>
<p>The clearUsernamePassword() line throws an exception, and it's not being caught by the above try / catch:</p>
<pre><code>native_execute (step): errno = 2, error message = No such file or directory, handle = 0x47ec78
clearUsernamePassword Storage full, abort doing SQLite operation.
android.database.sqlite.SQLiteDiskIOException: error code 10: disk I/O error
at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:61)
at android.database.sqlite.SQLiteDatabase.delete(SQLiteDatabase.java:1721)
at android.webkit.WebViewDatabase.clearUsernamePassword(WebViewDatabase.java:1278)
</code></pre>
<p>What are we supposed to do here?</p>
<p>Thanks</p>
<p>-------- Update ---------</p>
<p>Here's a link to the method that's causing it (it's not mine, it's part of android):
<a href="http://developer.android.com/reference/android/webkit/WebViewDatabase.html#clearUsernamePassword" rel="nofollow">http://developer.android.com/reference/android/webkit/WebViewDatabase.html#clearUsernamePassword</a>()</p>
<p>I'm actually getting a few exceptions like this from different methods of WebViewDatabase (the app has lots of downloads thus the high volume I'm seeing. I actually was able to finally reproduce this on a device).</p>
<p>The above code is not being run on a separate thread.</p>
| android | [4] |
492,013 | 492,014 | jQuery replaceAll() function | <p>I want to replace every link by an input box whose value is the URL of the link. I would like to use the jQuery replaceAll() function. The standard format is</p>
<pre><code>$(content).replaceAll(target);
</code></pre>
<p>My question is: how do you refer to the target object? In other words, in the following code, what should I replace <em>TheCurrentLink</em> with?</p>
<pre><code>$('<input>').attr('value', TheCurrentLink.href}).replaceAll($("a"));
</code></pre>
| jquery | [5] |
4,636,622 | 4,636,623 | PHP Depend and @package-annotations | <p>Similar to <a href="http://stackoverflow.com/questions/2099431/whats-the-point-of-package-annotations">What's the point of package annotations?</a>, I'm running pdepend against a section of our source code, looking for problems. However, it spits out the following:</p>
<p><code>The parser doesn't detect package informations within the analyzed project, please check the documentation blocks for @package-annotations or use the --bad-documentation option.</code></p>
<p>What does this actually mean, how do I fix it, and where?</p>
| php | [2] |
2,466,815 | 2,466,816 | C++ and SDL problem | <p>I want to blit surfaces that I've created in two classes. One is called <code>Map</code>, that holds the relevant map vector as well as some other stuff. The other is a <code>Tile</code> class. There is a problem when I run the program.</p>
<p>I get no errors, and the program runs as it should. Any ideas? It's probably a stupid mistake somewhere.</p>
<pre><code>Map populate
void map::Populate(map M)
for(int x=0;x<=19;x++)
{
for(int y=0;y<=15;y++)
{
int y2 = (y*32);
int x2 = (y*32);
Tile T(x2,y2);
M.AddToMap(&T);
printf("Added Tile");
Render
void map::Render(SDL_Surface* screen)
{
for(int x=0;x<grid.size();x++)
{
printf("test");
Tile* T = grid[x];
SDL_Surface* k = T->GetIcon();
SDL_Rect dstrect;
dstrect.x = (screen->w - k->w) / 2;
dstrect.y = (screen->h - k->h) / 2;
SDL_BlitSurface(k, 0, screen, &dstrect);
</code></pre>
| c++ | [6] |
436,537 | 436,538 | jquery datepicker on jquery dialog won't show after cancel is pressed | <p>I've successfully created a jquery datepicker on jquery's dialog box that was loaded via load() function.</p>
<p>I was able to achieved it by overriding dialog box's open event:</p>
<pre><code> open: function (event, ui) {
if ($('input.date-picker').length > 0) {
$('input.date-picker').datepicker({
showOn: "button",
buttonImage: "/Content/images/calendar.gif",
buttonImageOnly: true
});
$('input.date-picker').datepicker("refresh");
}
},
</code></pre>
<p>The datepicker successfully show after I press the image button. But I noticed something strange, when I open the dialog, click cancel then open the dialog again and click the calendar image button, the datepicker won't show.</p>
<p>Might help, I've also overriden dialog's close event:</p>
<pre><code>close: function (event, ui) {
$('input.date-picker').datepicker("destroy");
$(this).dialog("destroy");
}
</code></pre>
<p>Thanks,
<br />czetsuya</p>
| jquery | [5] |
5,510,157 | 5,510,158 | How to fix stack overflow error in visual C/C++? | <p>I am writing a file in C/C++ which generates <code>100000</code> lines of records <code>(name, int[5] grade, double[5].value)</code>. The code should generate <code>100000</code> random characters for name and integer for value. I am getting stackoverflow error. Can anyone pls help?</p>
| c++ | [6] |
3,639,185 | 3,639,186 | What is the "length" in the char[]? | <pre><code>char[] name = "VIKKYHACKS".toCharArray();
System.out.println(name.length);
</code></pre>
<p>In this program what is the "length" , If it were <code>(new String("VIKKYHACKS")).length()</code> then the length would be a method. But char[] is a datatype and cannot have fields or methods inside it. How does the second line of that program work ???</p>
| java | [1] |
5,492,731 | 5,492,732 | Placing a button at a fixed position? | <p>How do I place a button at a particular position (i.e at a particular pixel) on the screen, on Android?</p>
| android | [4] |
5,661,696 | 5,661,697 | ViewFlipper crashes after orientation change | <p>I'm trying to use inflate while using ViewFlipper to access to the data inside my view. I've done sample project that crashes.</p>
<p><code>main.xml</code><br>
< ?xml version="1.0" encoding="utf-8"?><br>
< ViewFlipper<br>
xmlns:android="http://schemas.android.com/apk/res/android"<br>
android:id="@+id/RelativeLayout"<br>
android:layout_width="wrap_content"<br>
android:layout_height="wrap_content" /></p>
<p><code>FlipViewBug.java</code> </p>
<pre><code>package android.FlipViewBug;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
public class FlipViewBug extends Activity {
private static LayoutInflater inflater = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
}
</code></pre>
<p>When I rotate emulator from horizontal to vertical orientation (CTRL+F11) app crashes with "stopped unexpectedly". If I remove line<br>
inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);<br>
app works 'fine'. Am I trying to do something wrong? In my app I have more complex LinnarView that ViewFlipper is nested and the results are the same.<br>
I was checking this on android 1.5, 2.2 and galaxy tab. There is no problem while rotating form vertical view to horizontal.</p>
| android | [4] |
5,291,423 | 5,291,424 | What is the numerical value for "slow"? | <p>If I were to do <code>.fadeIn('slow')</code></p>
<p>what would be the number that replaces the word slow but is the same exact speed?</p>
| jquery | [5] |
928,606 | 928,607 | Choosing application to open file with programmatically | <p>My application is trying to open a text file, and is presented with a list of apps that are able to open the text file, for eg (HTMLViewer, OpenOffice, etc). I want my application to open text file via OpenOffice automatically, without the list dialog popping out. Is there any ways to do that programmatically?</p>
<p><strong>NOTE: This question is assuming that the user has the necessary applications installed and the applications mentioned in this question only serve as examples.</strong> </p>
| android | [4] |
976,775 | 976,776 | How to make method calls dynamically in Java | <p>I'm trying to make a list of function calls. I want to be able to call a specific method by simply choosing the method from an array.</p>
<p>So for example if I want to call, drawCircle() and that method is in the first index than I could say runMethod[0].</p>
<p>Here's what I have so far. I've made an interface with two inputs:</p>
<pre><code>public interface Instruction {
void instr( int a, int b );
}
</code></pre>
<p>In my other class I have a list of methods (or should they be classes that implement Instruction?). I want to be able to call any of these methods from a list, like so:</p>
<pre><code>instList[0].mov( 1, 3 );
instList[2].add( 4, 5 );
</code></pre>
<p>and so on. Hope that was clear enough. Thanks in advance.</p>
| java | [1] |
3,414,051 | 3,414,052 | Returning constructor-less object as output parameter | <p>I want to return an object from a function as an output parameter, but the object has no default constructor so I can't do this:</p>
<pre><code>bool FindFlaggedObject(MyObject& myObject)
{
std::vector<MyObject> myObjects = GetSomeObjectList();
for (UINT i = 0; i < myObjects.size(); i++)
{
if (myObjects[i].Flag) {
myObject = myObjects[i];
return true;
}
}
return false;
}
void main()
{
MyObject myObject; // NOT ALLOWED - OBJECT HAS NO DEFAULT CONSTRUCTOR
if (FindFlaggedObject(myObject))
{
...
}
}
</code></pre>
<p>So, it looks like I should return it on the heap and manage it with a shared_ptr instance, like this:</p>
<pre><code>bool FindFlaggedObject(MyObject& myObject)
{
std::vector<MyObject> myObjects = GetSomeObjectList();
for (UINT i = 0; i < myObjects.size(); i++)
{
if (myObjects[i].Flag) {
myObject = new MyObject(myObjects[i]);
return true;
}
}
return false;
}
void main()
{
MyObject* myObjectPtr;
if (FindFlaggedObject(myObjectPtr))
{
std::shared_ptr<MyObject> myObject(myObjectPtr);
...
}
}
</code></pre>
<p>The downside is that anyone calling the method will have to remember that he is responsible for deallocating the object.<br>
<strong>What is the best practice for returning constructor-less objects as output parameters?</strong></p>
| c++ | [6] |
3,375,282 | 3,375,283 | jQuery: Use variables within selector | <p>Mind you, I'm not a jQuery guru and just still learning.</p>
<p>I have this looong function:</p>
<p><code>$('.client1 > *:first-of-type, .client2 > *:first-of-type, .client3 > *:first-of-type, .client4 > *:first-of-type, .client5 > *:first-of-type').append('<span class="jsi"/>');</code></p>
<p>It does work, yes, but I know it's not efficient and not easily scalable because every time I have to add a new 'client' I have to add it to the selector list.</p>
<p>So I know I could use (a) variable(s) for the <code>> *:first-of-type</code> part, and maybe an "array" (I don't know if I'm saying that right) for the <code>.clientX</code> part.</p>
<p>This is honestly a bit over my head.</p>
<p>This is what I've tried but of course doesn't work:</p>
<pre><code>var fot = "> *:first-of-type";
$('.client1' + fot, '.client2' + fot, '.client3' + fot, '.client4' + fot, '.client5' + fot).append('<span class="jsi"/>');
</code></pre>
<p>What happens is not only I would like to not have to repeat myself but be able to scale this more efficiently as new clients need to be added to the function.</p>
<p>Any help on this is greatly appreciated.</p>
| jquery | [5] |
5,972,323 | 5,972,324 | Focus and select all input box after append of input box | <p>I need to implement a generation input box, and upon generation there is a default value, that default value should auto focus and all text should be selected;</p>
<p>Here is my function in JS assuming a button has been click and call this function </p>
<pre><code>function createFolder()
{
var newTextBoxDiv = $(document.createElement('div')).attr({
"id" : 'TextBoxDiv',
"class" : 'TextBoxDiv+ctr'
});
newTextBoxDiv.html('<input type="text" name="folder_name" id="folder_name" value="New Folder"/>');
$("#folder_name").focus(function() { $(this).select(); } );
newTextBoxDiv.appendTo("#fileTreeView");
}
</code></pre>
| jquery | [5] |
749,356 | 749,357 | Jquery Mobile JSON Listview | <p>I have the following JSON returned:</p>
<p><code>{"aaData":[["Vision Plaza","KE ","JKIA","KE ","Myself"],["987 Avenue","KE ","654 Avenue","KE ","Laptops"],["Merimela","UG ","Nairobi","KE ","Antiques"],["Ngong Road","KE ","JKIA","KE ","Walter"]]}</code></p>
<p>These are four records i.e </p>
<p>This is the first record <code>["Vision Plaza","KE ","JKIA","KE ","Myself"]</code>,
This is the second record <code>["987 Avenue","KE ","654 Avenue","KE ","Laptops"]</code>,
This is the third record <code>["Merimela","UG ","Nairobi","KE ","Antiques"]</code>,
This is the fourth record <code>["Ngong Road","KE ","JKIA","KE ","Walter"]</code>,</p>
<p>How do I display these records in a listview with each record in its own listview node (li)?</p>
| jquery | [5] |
649,830 | 649,831 | Upload file to remote server (PHP) | <p>I have a scenario where I have a page on one server which prompts a user to upload a file. I need this file to be uploaded to a different server with a larger storage facility. I then need to get the absolute path of where the file now resides on the server sent back to the originating page. </p>
<p>The file size that will be around 15mb, so they aren't small files, and I'd like to avoid double uploading if possible (uploading to the server, then pushing over to remote server).</p>
<p>Any direction on this is appreciated.</p>
| php | [2] |
4,116,371 | 4,116,372 | Understanding Global & Local Scope in Javascript | <p>I've been learning Javascript using <a href="http://www.packtpub.com/object-oriented-javascript/book" rel="nofollow">Object-Oriented JavaScript by Stoyan Stefanov</a></p>
<p>He offers an example comparing global and local scope:</p>
<pre><code>var a = 123;
function f() {
alert(a);
var a = 1;
alert(a);
}
f();
</code></pre>
<p>Looking at this example, I expected the first alert to be '123' and the second alert to be '1'. Lo and behold, Stoyan says:</p>
<blockquote>
<p>You might expect that the first alert() will display 123 (the value of
the global variable a) and the second will display 1 (the local a).
This is not the case. The first alert will show “undefined”. This is
because inside the function the local scope is more important than the
global scope. So a local variable overwrites any global variable with
the same name. At the time of the first alert() a was not yet defined
(hence the value undefined) but it still existed in the local space.</p>
</blockquote>
<p>The explanation was not clear to me, how can the local variable overwrite the global variable in the first alert? Any other/different explanations would be appreciated.</p>
| javascript | [3] |
3,649,123 | 3,649,124 | Alert Message with external js file | <p>I have a external test.js file with code:</p>
<pre><code>$(document).ready(function() {
alert("I am an alert box2!");
});
function show_alert()
{
alert("hihi");
}
</code></pre>
<p>In my .html, I have included test.js, jquery file and there is a button. When click on it, <code>show_alert()</code> function will be called and it works. However, The message "I am an alert box2!" is not fired.<br>
Also, if I put the document.ready function in my .html with <code><script>... </script></code>. It works. What wrong with my code? External file not support?</p>
| jquery | [5] |
403,881 | 403,882 | image processing in android | <p>how to change the contrast and brightness of a picture, i have taken the image for that need to change the brightness and contrast when seekbar is changing</p>
| android | [4] |
2,189,157 | 2,189,158 | Programmatically clear browser cache/history | <p>During my activity I'm sending an intent to the browser in order to display a webpage :</p>
<pre><code>
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://ww.mywebpage.com");
startActivity(i);
</code></pre>
<p>I need to make sure that before sending the intent the browser cache and history are cleared so that the page get loaded from server directly and not from phone.</p>
<p>So far I've found the 2 following but I'm not sure they are used correctly :</p>
<pre><code>
Browser.clearHistory(getContentResolver());
Browser.clearSearches(getContentResolver());
</code></pre>
<p>Also with that cache is not cleared.</p>
<p>Do you know how to do that ?</p>
| android | [4] |
3,104,192 | 3,104,193 | java array pass by reference does not work? | <p>guys i thought almost all language including java pass array into function as reference (modifiable) </p>
<p>but somehow it does not work here. and the testArray is still 1,2,3 with size of 3 </p>
<p>strange enough, when if i change result[i] = 2 to a[1] =2; it work . it did pass by reference</p>
<p>what is wrong with this code? </p>
<p>at the end, i had a = result; (which update the a). did result get removed from stack. that is why a still get to the original a ? </p>
<p>i am confused.</p>
<p>thanks</p>
<pre><code>class Test
{
public static void main(String[] args)
{
int[] testArray = {1,2,3};
equalize(testArray, 6);
System.out.println("test Array size :" + testArray.length);
for(int i = 0; i < testArray.length; i++)
System.out.println(testArray[i]);
}
public static void equalize(int[] a, int biggerSize)
{
if(a.length > biggerSize)
throw new Error("Array size bigger than biggerSize");
int[] result = new int[biggerSize];
// System.arraycopy(a, 0, result, 0, a.length);
// int array default value should be 0
for(int i = 0; i < biggerSize; i++)
result[i] = 2;
a = result;
}
}
</code></pre>
| java | [1] |
484,019 | 484,020 | add namespace to java dom attribute | <p>I am trying to create an attribute with a namespace prefix. The following code does not seem to work:</p>
<pre><code>Element newData = docFromXML.createElement("Data");
Attr typeAttr = docFromXML.createAttributeNS(namespaceContext.getNamespaceURI("ss"), "type");
typeAttr.setValue("String");
newData.setAttributeNode(typeAttr);
</code></pre>
<p>I expect the following:</p>
<pre><code><Data ss:type="String"></Data>
</code></pre>
<p>But the following is produced:</p>
<pre><code><Data type="String"></Data>
</code></pre>
<p>How do I explicitely add the namespace prefix "ss". The getNamespaceURI function returns the URL for the ss prefix in the DOM.</p>
| java | [1] |
5,390,037 | 5,390,038 | Java getAudioInputStream() Symbol not found | <p>I have created a <code>class</code> to play the sound when I click the buttons.</p>
<p>Here is the code : </p>
<pre><code>public void playSound()
{
try
{
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(new File("beep-1.wav"));
Clip clip = AudioSystem.getClip( );
clip.open(audioInputStream);
clip.start( );
}
catch(Exception e)
{
System.out.println("Error with playing sound.");
e.printStackTrace( );
}
}
</code></pre>
<p>But when I compile, I get this error : </p>
<pre><code>error: cannot find symbol
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(new File("beep-1.wav"));
^
symbol: class File
location: class MemoryGame
1 error
Process completed.
</code></pre>
<p>What is the problem with the <code>getAudioInputStream()</code>? </p>
<p>I had used <code>import javax.sound.sampled.*;</code> in my program.</p>
| java | [1] |
2,293,278 | 2,293,279 | Android - Brain Cramping | <p>Alright, I have a simple boolean at the top of this class, standing. In the thread, I have the following code:</p>
<pre><code> @Override
public boolean onTouchEvent(MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN) {
if(standing == true){
player.handleActionDown((int)event.getX(), (int)event.getY());
standing = false;}
if(standing == false){
playerC.handleActionDown((int)event.getX(), (int)event.getY());
standing = true;}
//check if in the lower part of the screen we exit
if(event.getY() > getHeight() -50 && event.getX() > getWidth() -50) {
thread.setRunning(false);
((Activity)getContext()).finish();
}else {
Log.d(TAG, "Coords: x=" + event.getX() + ",y=" + event.getY());
}
}
if(event.getAction() == MotionEvent.ACTION_UP){
//touch was released
}
return true;
}
@Override
protected void onDraw(Canvas canvas) {
canvas.drawBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.bg1),0, 0, null);
//canvas.drawColor(Color.BLACK)
if(standing == true){
player.draw(canvas);
}
if(standing == false){
playerC.draw(canvas);
}
}
</code></pre>
<p>Why won't it switch the dawing back to standing, that's all I want. Click it once and it goes to crouching, click it again and it stands. I know this is stupid simple, but I can't get it right for some reason. Thanks in advance.</p>
| android | [4] |
1,431,197 | 1,431,198 | What's a good resource to build my first python project? | <p>I'm tired of books and tutorials who walk me through how to print things before I can do anything fun. I want to build simple apps or programs. Any suggestions for where to start so I can make and learn at the same time?</p>
| python | [7] |
4,172,424 | 4,172,425 | define local variable in some given scope | <p>How could I define local variable in some given scope? </p>
<pre><code>var f = function() {
// (1) var localVariable = 'some value';
alert(localVariable);
}
var defineLocalVariable = function(fnTarget) {
// (2) fnTarget['localVariable'] = 'blah...';
/* (3)
with (fnTarget) {
var localVariable = 'blah...'
} */
}
defineLocalVariable(f);
f();
</code></pre>
<p>Look at example. If uncomment (1) code will alert value of local variable of 'f' function 'some value'. What if I want to define this local variable programmatically in runtime, is it feasible? Could you propose implementation of 'defineLocalVariable' function to define local variable in 'f', something like (2) or (3) which are not working solutions. </p>
<p>Thanks.</p>
| javascript | [3] |
4,706,182 | 4,706,183 | How to embed <script> video in Shadowbox.js | <p>I'd like to embed a video delivered by Ooyala in a Shadowbox.js object using Wordpress. I've successfully installed Shadowbox.js and tested it with images and videos. The syntax for Shadowbox is something like:</p>
<pre><code><a href="mymovie.swf" rel="shadowbox;height=140;width=120">My Movie</a>
</code></pre>
<p>However, Ooyala's embed feature uses a . If I pull the href out of the script, I don't get the full player controls. Is there anyway to embed a script tag inside the a tag and have it display in the shadowbox?</p>
| javascript | [3] |
5,818,857 | 5,818,858 | $GLOBALS["argv"] and $argv empty, $_SERVER["argv"] just fine | <p>I am fighting with a (perhaps) simple problem with PHP CLI running on Hostgator shared hosting. A simple code:</p>
<pre><code><?php
var_dump($argv);
var_dump($GLOBALS["argv"]);
var_dump($_SERVER["argv"]);
var_dump(ini_get("register_argv_argv"));
?>
</code></pre>
<p>When run on my local machine as well as several other instances of php as:</p>
<pre><code>php test.php arg1
</code></pre>
<p>Outputs correctly as predicted:</p>
<pre><code>array (
0 => 'test.php',
1 => 'arg1'
)
array (
0 => 'test.php',
1 => 'arg1'
)
array (
0 => 'test.php',
1 => 'arg1'
)
1
</code></pre>
<p>But run from cron on Hostgator shared hosting it outputs:</p>
<pre><code>array (
)
NULL
array (
0 => 'test.php',
1 => 'arg1'
)
1
</code></pre>
<p>The code I am fighting with is a legacy one and that relies heavily upon $GLOBALS["argv"] to parse command line parameters. I have no means to modify the whole codebase to rely on $_SERVER["argv"] instead.</p>
<p>What might be the reason why all my instances of PHP fills all the arrays with commandline parameters, and the hosted php on Hostgator does not populate $GLOBALS["argv"] at all?</p>
<p>I made a workaround to deal with this problem, but I hate when I don't know why something is happening :)</p>
<p>Thanks for any ideas!</p>
| php | [2] |
2,553,358 | 2,553,359 | How to quickly unbind an event wherever it's attached? | <p>I've bound a couple events like so:</p>
<pre><code>$('#window-overlay').on('click', overlayClickHandler);
$clickedObj.on('click', overlayClickHandler);
</code></pre>
<p>Is there some easy way so that if I click on one of these things, the click event is removed from the other thing? Removing it from <code>#window-overlay</code> is simple enough, but $clickedObj is a variable within an <code>if</code> block, so later on it may be difficult to figure out what object the handler was bound to.</p>
| jquery | [5] |
4,755,255 | 4,755,256 | c#: SerializableAttribute | <p>The <code>SerializableAttribute</code> class is explained on <a href="http://msdn.microsoft.com/en-us/library/system.serializableattribute.aspx" rel="nofollow">this link</a>. In the start it is written:</p>
<blockquote>
<p>Indicates that <strong>a class can be serialized</strong></p>
</blockquote>
<p>Can anybody expalin what this means (the bold part). I am not clear about it.</p>
| c# | [0] |
1,836,170 | 1,836,171 | jquery and highslide | <p>I use this js <a href="http://highslide.com" rel="nofollow">http://highslide.com</a>.
I have a separate div and i want open the highslide with this div with onclick event..
I have try this but not work..</p>
<p><pre><code>
$('#po').click(function(){
var s = $('#ap_1');
return hs.expand(s, config1);
});
</pre></code></p>
<p><code>#ap_1</code> is the first a tag element ...</p>
| jquery | [5] |
2,538,153 | 2,538,154 | I need a regular expression to find out the marks from multiple lines between tags and number of lines are not specified | <p>I am having text file from which i want to find out the marks value which is 65 in the current text.</p>
<p>I need expression to find out the marks from each file which comes after My Marks statement.
The number of lines in the code are not specified or fixed it may be 2 or more.</p>
<p>I don't have any idea how to get values including newline using regular expressions.I am new to regular expression so please help me.</p>
<p>Thanks in advance. </p>
<pre><code><FONT STYLE="font-family:ARIAL" SIZE="2">My Marks</FONT></P></TD>
<TD ALIGN="bottom"><FONT SIZE="1">&nbsp;</FONT></TD>
<TD ALIGN="top"><FONT STYLE="font-family:ARIAL" SIZE="2">&nbsp;</FONT></TD>
<TD ALIGN="top" ALIGN="right"><FONT STYLE="font-family:ARIAL" SIZE="2">65</FONT></TD>
</code></pre>
| c# | [0] |
4,850,624 | 4,850,625 | "foo" and "bar" used commonly in php.net and other sites | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/53609/what-does-foo-really-mean">What does 'foo' really mean?</a> </p>
</blockquote>
<p>It is a very common thing to encounter in <a href="http://php.net/" rel="nofollow">php.net</a> statements like <code>$foo="bar"</code> or other such statements. Is there any significance of <code>foo</code> and <code>bar</code> or are they just conventions evolved as a matter of time?</p>
| php | [2] |
1,510,291 | 1,510,292 | Progress info on client side? | <p>I've a Servlet which is used to generate and download file using <strong>ServletOutputStream</strong>. It's working well. But the Servlet some time take several seconds to process request depending on size of the file. </p>
<p>My questions is I want show the some progress information to client side. How do I do it?</p>
| java | [1] |
510,503 | 510,504 | How do I get a Java Set to iterate in the same order every time? | <p>Is there any way that I can get a Java Set object (not a SortedSet) to iterate over its elements in the same order every time that I run the program. (The elements are the same for each run.) I am trying to debug my program but I'm having trouble reproducing my error because the iterator returns the values in a different order each time. Thanks.</p>
| java | [1] |
2,950,026 | 2,950,027 | How to refresh a folder's data in asp.net 2.0 using c# | <p>Again i rewrite my question with more details i.e. I am developing a website in Asp.net 2.0 in that i'm tracking the user's some details like their id,no of page hitted and time of hitting etc, in a LogfileDate(the LogfileDate contains whole day summary of all users) saved inside a folder(Folder is inside my project). And at another day when a new logfileDate created i want to mail the previous day Logfile and delete that file after sending. Everything happened but when It is going to delete its shows file is accessed by another process. So I need to refresh that folder after sending mail so that it got free with buffer. I'm not using IIS and i dont want it to use.</p>
| asp.net | [9] |
133,737 | 133,738 | Passing array in popups to parent | <p>I have inherited an application that makes considerable use of popups, much to my dismay. I cannot find a way to close these popups when the parent page closes. This application also uses framesets. I've tried passing an array of with the names of the popups in it, but the parent doesn't see the array. Is this due to the frameset? Do I need to write a java program to save these values and pass this? That seems an extreme measure, but my parent window can't find any of the javascript arrays I create. </p>
| javascript | [3] |
4,676,616 | 4,676,617 | Getting an unique id from an element | <p>Had a good crack at this, quite a few articles around but I can't make sense of them. Any help appreciated.</p>
<p>When I click 'slide-toggle', I need 'slickbox' to expand, but ONLY that instance of 'slickbox' within 'slide' (i.e. there is more than one slickbox element on the page).</p>
<p>I have tried to use this to denote that it should only expand the relevant div, but not working so far. Thanks :)</p>
<p>My html:</p>
<pre><code><div class="slide">
<a class="slick-toggle" href="#">Toggle the box</a>
<div class="slickbox">
<p>Hello</p>
</div>
</div>
</code></pre>
<p>My jquery:</p>
<pre><code>$('a.slick-toggle').click(function() {
$('.slickbox',this).slideToggle(400);
return false;
});
</code></pre>
| jquery | [5] |
2,707,971 | 2,707,972 | boost::split: how to split a string with a character? | <p>I'm stuck with this simple problem.
Say I have a string which is consisted from characters [0-9]. What I would like to do is split the string by the single characters using boost::split.</p>
<pre><code>std::string str = "0102725";
std::vector<std::string> str2;
boost::split(str2, str, boost::is_any_of(SOMETHING));
</code></pre>
<p>I'm looking for SOMETHING so that str2[0] contains "0", str2[1] contains "1", str2[2] contains "0" and so on. So far I have tried "", ':' and ":" but no luck...</p>
| c++ | [6] |
5,085,432 | 5,085,433 | Python script to copy files | <p>I am trying to write a Python script that will copy files from one user’s home directory into another user’s home directory. I want it to copy the permissions, as well. I read the Python API and I think that the copy2 method does just that. However, when I run the following code, I get errors.</p>
<pre><code>import shutil
src = raw_input("Please enter a source: ")
dst = raw_input("Please enter a destination: ")
shutil.copy2(src, dst)
</code></pre>
<p>The error says:</p>
<pre><code>Traceback (most recent call last):
File "copyfiles.py", line 5, in <module>
shutil.copy2(src, dst)
File "/usr/lib/python2.6/shutil.py", line 99, in copy2
copyfile(src, dst)
File "/usr/lib/python2.6/shutil.py", line 52, in copyfile
fsrc = open(src, 'rb')
IOError: [Errno 2] No such file or directory: '../../../../Desktop/byteswap.c'
</code></pre>
| python | [7] |
3,803,322 | 3,803,323 | What is the main difference in packaging an applet vs. an application (for deployment) in Eclipse? | <p>Couldn't find a thread that explained the difference between both.</p>
<p>What is the difference?</p>
<p>Thank you to all that helps!</p>
| java | [1] |
3,565,828 | 3,565,829 | How to get an object name? | <p>I have the following code snippet</p>
<pre><code>function receiver(callback)
{
console.log( callback );
}
function callback(){}
receiver( new callback() );
OUTPUT: callback {}
</code></pre>
<p>is there a method or way to get 'callback' out of callback parameter? I like to get an object's name.</p>
| javascript | [3] |
4,314,170 | 4,314,171 | jQuery Event for link click not firing | <p>I have the following function:</p>
<pre><code> $("a#mylink").click(function(e){
e.preventDefault();
$.ajax({ url: $(this).attr("href") });
$(this).parent().parent().fadeOut("slow");
});
</code></pre>
<p>A link is being created on the page with the following code:</p>
<pre><code>'<div style="margin-top: 4px; border: solid 2px #515151; color: #515151; width: 300px;"><span style="padding-left: 4px">' +
file.name+
' </span><div style="float: right; padding-right: 4px;"><a class="mylink" href="remove.aspx?img='+safeUrl+'">Remove</a></div>' +
'</div>'
</code></pre>
<p>When I click the link, a new page pops up and it does not hit my function. Any ideas?</p>
| jquery | [5] |
4,842,228 | 4,842,229 | Multiple controls with single event using jquery | <p>I am trying to reduce some code here. I will explain how</p>
<p>I have multiple Button controls. I am using the click event for each</p>
<pre><code>$("#B1").click(function() {
var v1 = "abc";
});
$("#B2").click(function() {
var v1 = "efg";
});
$("#B3").click(function() {
var v1 = "xyz";
});
</code></pre>
<p>I want to remove these 3 clicks event and write a single click event. If the click is from </p>
<p>B1 then v1 should be "abc";
B2 then v1 should be "efg";
B3 then v1 should be "xyz'</p>
<p>How can I write code in the best possible way</p>
| jquery | [5] |
1,210,925 | 1,210,926 | how to check the value of sumbitted form field against an variable array | <p>I have a simple post code check, I'd to check the submitted value against a pre-made variable, how can I do this in Jquery,</p>
<p>any help would be appreciated.</p>
<pre><code> <form method="post" action="#">
<input name="textfield" type="text" id="textfield" size="8" maxlength="8" />
<input type="submit" value="submit">
</form>
</code></pre>
<p>and my variable contains B1,B2 and B3.</p>
<p>if the post code entered is similar to the variable an ok message is sent otherwise a no message is sent.</p>
<p>thanks</p>
| jquery | [5] |
450,520 | 450,521 | How do I make an instance of an object accessible to multiple swing forms? Java | <p>I'm making a text based RPG to help me learn Java. So I have a bunch of different classes that make swing forms right now and each of which will lead to one another. However, in one form I actually create the instance of the object called Player, where I will set the stats (strength, agility, level, etc.) based on the choices the user makes.</p>
<p>However, I can only access that object in that class/window and I can't call it for manipulate that object anywhere else in the application.</p>
<p>How do I make it globally accessible?</p>
<p><strong>Edit</strong><br>
I should have phrased this better. Let's say I have a class called PlayerCreation and in PlayerCreation I make an object by calling the Player class Player p1 = new Player(); Now I move out of that class completely and go to another form called PlayerStats and I want to call p1.getStrength(); but since p1 was in PlayerCreation class, I can't get it.</p>
| java | [1] |
322,714 | 322,715 | jQuery - Display the value of a textbox and input the value to another | <p>Basically I want to get the value of a textbox which is to select a date and output the value that is selected to another textbox.</p>
<p>These textboxes are on the same page (different steps of the same page) and the document is loaded when the page is ready on click of the next step, I've tried using:</p>
<pre><code>$('#TextBox1').val($('#TextBox2').val());
</code></pre>
<p>But this doesn't seem to be working. What is it I am doing wrong? </p>
<p><em>EDIT</em></p>
<p>Here is some of the HTML:</p>
<p>I want to get the value the user has inputted for the Date for example:</p>
<pre><code><label for="txt-outbound-date" class="left p-input-label" >Date: </label>
<input type="text" id="txt-outbound-date" name="txt-outbound-date" class="input-txt-sml left required" />
</code></pre>
<p>And output the value they select in the following textbox:</p>
<pre><code><input type="text" class="input-txt-med required left" id="txt-selected-date" name="txt-selected-date" />
</code></pre>
<p>This is for a summary page which will display all the results the user has input, as I've said, this is all on one page and the .js file is loaded each time the user clicks 'Next' so I would have thought the following would work:</p>
<pre><code>$('#txt-outbound-date').val($('#txt-selected-date').val());
</code></pre>
<p>Any suggestions?</p>
| jquery | [5] |
5,908,982 | 5,908,983 | Stopping an app generated log from running | <p>I am new to android programming and development. I am working on app that auto generates a log file and attaches it to an email. The problem I am having is making the log stop running. It generates the .text file to the sd card to attach to the email, but the log keeps running and never stops. The only way I am able to attach the log is to power cycle the phone and stop the log from running. I have looked at the timer class, but I am not sure if that is what I need or if there is another way to do this. Here is the beginning and end, I left out the intents in the middle due to just being email intents.</p>
<pre><code>private void submit() {
try {
log.createNewFile();
String cmd = "logcat -f "+log.getAbsolutePath();
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
e.printStackTrace();
}
startActivity(Intent.createChooser(emailIntent, "Send report..."));
String log = "file:///sdcard/log.txt";
try {
Runtime.getRuntime().exec("rm "+log);
} catch (IOException e) {
e.printStackTrace();
}
</code></pre>
| android | [4] |
735,317 | 735,318 | modify function and If statement | <p>I have a inputbox that displays a default text "Input Network ID Here...". I need to take <code>$inputUri</code> and check it against function <code>checkUrl($string)</code> to see if its still there. If the text hasn't been cleared then display the <code>addError</code> message </p>
<pre><code>public function checkUrl($string)
{
$inputUri = 'Input Network ID Here...';
if(empty($string) || preg_match("#^([A-Z0-9][A-Z0-9_ -]*(?:.[A-Z0-9][A-Z0-9_ -]*)+):?(d+)?/?#i", $string))
{
return true;
}
else
{
if( isset($this) )
{
$this->addError("Input Network ID");
}
return false;
}
}
</code></pre>
| php | [2] |
1,412,626 | 1,412,627 | Incomplete type in c++ | <p>I have declared DynArray var_name in c++, but while compiling it gives me an error "incomplete type not allowed"
I tried to search but nothing came up with an example of dynamic array.
Could anyone please explain the error?
Thanks.</p>
| c++ | [6] |
3,276,724 | 3,276,725 | java newbie question | <p>if I have something like this</p>
<pre><code>Map<String, Foo> foos;
...
Foo f = foos.get("key1");
foos.removeAll();
</code></pre>
<p>Am I still able to do <code>String s = f.getSomeProperty();</code></p>
| java | [1] |
1,714,691 | 1,714,692 | Mail exchange without SMTP server | <p>Is there any way to create a mail server application without using SMTP server in c#?</p>
| c# | [0] |
4,873,102 | 4,873,103 | Authorization check using Global.asax | <p>In my ASP.NET web application, I want to check every time the user is trying to get a page from my application if the user exist in the DB (of course after the first time we save the user details in the session).
I tried to use the Application_AuthenticateRequest event in the global.asax to
check for each request but the session does not exist in this event.
I need an advice for where i can put my authorization logic that i would still have the session data available (to reduce db access).</p>
| asp.net | [9] |
2,911,347 | 2,911,348 | Disable & resize IE | <p>I have a few questions in mind...</p>
<ol>
<li>I want to disable right click on my webpage so that noone can alter
the source code</li>
<li>I want to disable the addressBar as well</li>
<li>I wish to resize it to a particular size in the bottom right of my
screen & with a text area so that when ever I click the button
inside that webpage all the contents in that text box should be
copied</li>
</ol>
<p>I tried experimenting but it doesn't seem to work, javascript maybe has some issues.
I wan't it purely on javascript & HTML (Can't use php/asp), want it to work on IE only, dont care about other browsers....</p>
| javascript | [3] |
653,417 | 653,418 | Dynamically add to TR class value from selected option | <p>Probably easy task but I can not find working solution?</p>
<p>I need add a class value of selected option to relative TR:</p>
<pre><code><table>
<tr class="odd views-row-first">
<td class="views-field views-field-website-id">1</td>
<td class="views-field views-field-changed">1349422708</td>
<td class="views-field views-field-created">1349422708</td>
<td class="views-field views-field-title">Double field</td>
<td class="views-field views-field-field-rules-conditional views-field-editablefield">
<div id="editablefields-field-rules-conditional" class="editablefield-item">
<select id="edit-field-rules-conditional-0-field-rules-conditional-und" name="field_rules_conditional[0][field_rules_conditional][und]" class="form-select">
<option value="_none">- None -</option>
<option value="green">green</option>
<option value="red">red</option>
<option value="blue" selected="selected">blue</option>
</select>
</div>
</td>
</tr>
</table>
</code></pre>
<p>What I want to have:</p>
<pre><code><tr class="odd views-row-first blue">
</code></pre>
| jquery | [5] |
522,997 | 522,998 | Javascript variable returning blank | <p>I am testing this code:</p>
<pre><code>var thecol = '';
// Note: I know that value.cat = '3'
if (value.cat === '1') {
thecol = 'cat1';
} else if (value.cat === '2') {
thecol = 'cat2';
} else if (value.cat === '3') {
thecol = 'cat3';
} else if (value.cat === '4') {
thecol = 'cat4';
} else if (value.cat === '5') {
thecol = 'cat5';
};
alert(thecol);
</code></pre>
<p>The alert is blank for some reason.</p>
<p>Any ideas why.</p>
| javascript | [3] |
1,677,045 | 1,677,046 | Dynamic configuration object based on __setattr__ and _getattr__ | <p>I tried to create dynamic object to validate my config in fly and present result as object. I tried to achieve this by creating such class:</p>
<pre><code>class SubConfig(object):
def __init__(self, config, key_types):
self.__config = config
self.__values = {}
self.__key_types = key_types
def __getattr__(self, item):
if item in self.__key_types:
return self.__values[item] or None
else:
raise ValueError("No such item to get from config")
def __setattr__(self, item, value):
if self.__config._blocked:
raise ValueError("Can't change values after service has started")
if item in self.__key_types:
if type(value) in self.__key_types[item]:
self.__values[item] = value
else:
raise ValueError("Can't assing value in different type then declared!")
else:
raise ValueError("No such item to set in config")
</code></pre>
<p>SubConfig is wrapper for section in config file. Config has switch to kill possibility to change values after program started (you can change values only on initialization).</p>
<p>The problem is when I setting any value it is getting in infinity loop in getattr. As I read <code>__getattr__</code> shouldn't behave like that (first take existing attr, then call <code>__getattr__</code>). I was comparing my code with available examples but I can't get a thing.</p>
<p>I noticed that all problems are generated my constructor.</p>
| python | [7] |
1,081,298 | 1,081,299 | Indicative Python prints | <p>I would like it if there was some way to generate a more indicative python prints: when printing some value, not only the result will be printed out,
but also the expression that got me that result.</p>
<p>For example, lets say I have:</p>
<pre><code>>>> x = 1
</code></pre>
<p>Then, for printing x and its type, we get:</p>
<pre><code>>>> print x ; print type(x)
1
<type 'int'>
</code></pre>
<p>I would like to get somthing like:</p>
<pre><code>>>> print x ; print type(x)
x: 1
type(x): <type 'int'>
</code></pre>
<p>I've tried using locals(), inspect module, but I couldn't get this result.
Any id
Thanks.</p>
| python | [7] |
44,495 | 44,496 | Jquery showing matching content when page loads | <p>I have a a particular page that I am showing two diff items on and when you click one of the items the content on the page switch's to that particular items info and hides the other items info. SO its pretty much a tab system in simple terms but my problem is that i would like to show the by default the first items info and right now all my content is hiddn until i click one of the two items .</p>
<p>Here is what I have for my Jquery:</p>
<pre><code>$(".packBat:first").addClass("active");
$(".showWraps").hide();
$(".packBat .photoWrap").click(function () {
var batpackData = $(this).closest('.packBat').metadata({
type: 'attr',
name: 'data'
});
$(".packBat").removeClass("active");
$(this).closest('.packBat').addClass("active");
$('.showWraps').hide();
$('.showWraps').each(function () {
var wrapData = $(this).metadata({
type: 'attr',
name: 'data'
});
if (wrapData.productId == batpackData.productId) {
$(this).fadeIn("fast");
}
});
});
</code></pre>
| jquery | [5] |
2,886,652 | 2,886,653 | javascript print without print dialog box | <p>The below snippet working fine, but it opening the dialog box window, </p>
<p>but i dont want to open the print dialog box , </p>
<p>just print should done without dialog box, </p>
<p>what snippet i should add in the below snippet ,</p>
<p>And also one doubt, i want to take print out in DOT Matrix Printer, the below snippet will work know ?</p>
<pre><code>var prtContent = document.getElementById(strid);
var WinPrint =
window.open('','','left=0,top=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
prtContent.innerHTML=strOldOne;
</code></pre>
<p>i developed the billing application , </p>
<p>If i show the print dialog box, then it consume some seconds to give the print , see i done have more printer,
i have only one printer ,that is dot matrix, when ever i give print command , then it should print the BILL without open the print dialog box, </p>
| javascript | [3] |
5,394,525 | 5,394,526 | What is jQuery18007779947370290756 | <p>I use jQuery in my page, when I use Chrome developer tool, I found jQuery18007779947370290756 and jQuery object in Console. jQuery18007779947370290756 only contains a few methods. jQuery contains a lot more methods. so what is jQuery18007779947370290756 ? I do not have the url of the page, since it is internal page. the lib I include is just jquery-1.8.0.min.js and jquery-ui-1.8.23 and
no JSONP calls.</p>
<p>It looks like if I added a global event <code>'beforeunload'</code> to window object. and it is stored in window[expando]. However if I added some events to other DOM object such as <code>button</code>, and they are stored in jQuery.cache.
here is the screen shot form jQuery.cache and window[jQuery1800xxxxxxxxxxxxxxxx]
I am not sure why the guid for that 2 click events are both 8. those 2 click events are binded to 2 buttons. and click event handler are the same function.</p>
<p><img src="http://i.stack.imgur.com/jO3FN.png" alt="enter image description here"></p>
| jquery | [5] |
1,261,601 | 1,261,602 | PHP: how to print a variable value to screen if this is in a inner function | <p>how can I print the content of a php variable on screen if the code is inside a function that is called without refreshing the page, but just to store same values in the database ?</p>
<p>thanks</p>
| php | [2] |
5,076,716 | 5,076,717 | How do we determine the number of days for a given month in python | <p>I need to calculate the number of days for a given month in python. If a user inputs Feb 2011 the program should be able to tell me that Feb 2011 has 28 days. Could any one tell me which library I should use to determine the length of a given month. </p>
| python | [7] |
2,909,317 | 2,909,318 | Why is for(;;){…} an infinite loop? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4740979/empty-for-loop-for">Empty for loop - for(;;)</a> </p>
</blockquote>
<p>I just found a strange construct in the JS parser of UglifyJS (at <a href="https://github.com/mishoo/UglifyJS/blob/master/lib/parse-js.js#L1045" rel="nofollow">L1045</a>): <code>for(;;){…}</code>.</p>
<p>I assumed that an empty condition would resolve to <code>undefined</code>, which is converted to the boolean value <code>false</code>. But that's definitely not the case.</p>
<p>Apparently, it triggers an infinite loop. I was able to reproduce this behavior, but I have no clue why. Any (logical) explanations?</p>
<p>Besides: When this is possible, why doesn't <code>while(){…}</code> work?</p>
| javascript | [3] |
3,567,406 | 3,567,407 | Script for login page in eclipse for robotium | <p>Can u tell me how to write the scripts for login page for the android application in eclipse using robotium tool.</p>
| javascript | [3] |
946,218 | 946,219 | Android connectivity with Desktop app | <p>Currently i am building a mobile app on ubuntu 11.10 system.For checking the local app on phone i am using emulator.Is it possible to check the local app through my android phone.via emulator i am accessing my app via 10.0.2.2:3000.For android mobile how to do</p>
| android | [4] |
839,094 | 839,095 | how to develop VOIP application for iphone | <p>Hi all great programmers,</p>
<p>just wanted to check how to start developing VOIP IPhone application what are the supported libraries API's available.</p>
<p>thanks in advance</p>
| iphone | [8] |
4,900,906 | 4,900,907 | fragments and mapView | <p>can i use fragments and map view in the same activity. I have seen a subject talking about this: <a href="http://stackoverflow.com/questions/5109336/mapview-in-a-fragment-honeycomb">MapView in a Fragment (Honeycomb)</a>
I was than able to create a fragment list and a map view in the right.
Can i print other fragments under the map?
I tried to do this but got a problem because my mainActivity extends FragmentActivity and not Fragment.</p>
<p>Here is a picture that explain whet i want to do</p>
<p><img src="http://i.stack.imgur.com/c4PVZ.jpg" alt="enter image description here"></p>
<p><img src="http://i.stack.imgur.com/OCwni.png" alt="enter image description here"></p>
| android | [4] |
3,953,308 | 3,953,309 | Getting checkboxes to maintain checked state on click | <p>I've tried various methods to get my checkboxes to be checked upon a click. </p>
<p>The following works on document ready:</p>
<pre><code>$('input[name=foo]').attr("checked","checked");
</code></pre>
<p>However as soon as I surround it with a click event the checkboxes won't maintain checked state. On the click they check (as they should) and then immediately uncheck.</p>
<pre><code>$("#selectall").click(function(){
$('input[name=foo]').attr("checked","checked");
});
</code></pre>
<p>My HTML:</p>
<pre><code><form id="frm1">
<input type="checkbox" name="foo" value="bar" />
</form>
</code></pre>
| jquery | [5] |
238,610 | 238,611 | app release build issue for iphone | <p>just one query , i run the code via release mode since i am about to launch the app ,</p>
<p>i can see these info when i clikc on build result</p>
<pre><code>Validate build/Release-iphoneos/abc.app
cd /Users/applefan/Desktop/ssabc/Code/DatabaseTest
setenv PATH "/Developer/xcode3.2/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/xcode3.2/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
setenv PRODUCT_TYPE com.apple.product-type.application
/Developer/xcode3.2/Platforms/iPhoneOS.platform/Developer/usr/bin/Validation /Users/applefan/Desktop/hj/Code/DatabaseTest/build/Release-iphoneos/as.app
CodeSign build/Release-iphoneos/abc.app
cd /Users/applefan/Desktop/ssabc/Code/DatabaseTest
setenv IGNORE_CODESIGN_ALLOCATE_RADAR_7181968 /Developer/xcode3.2/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
setenv PATH "/Developer/xcode3.2/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/xcode3.2/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/usr/bin/codesign -f -s "iPhone Distribution: aa LTD." --resource-rules=/Users/applefan/Desktop/ssabc/Code/DatabaseTest/build/Release-iphoneos/abc.app/ResourceRules.plist --entitlements /Users/applefan/Desktop/ssabc/Code/DatabaseTest/build/DatabaseTest.build/Release-iphoneos/abc.build/abc.xcent /Users/applefan/Desktop/ssabc/Code/DatabaseTest/build/Release-iphoneos/abc.app
</code></pre>
<p><strong>and this release mode is working on my iphone , i have heard that you cant run the release file with release profile</strong> </p>
<p>so does that mean my app is alright and i can upload app without any issues to app store???
anything else needed to do the last checking since this is my 1st app so i dont want them to reject</p>
<p>plz suggest</p>
<p>Thanks</p>
| iphone | [8] |
4,821,309 | 4,821,310 | Bookmarking the page in which get attribute is written | <p>I am starting PHP. While reading form from <a href="http://www.w3schools.com/php/php_post.asp" rel="nofollow">here</a> I came across this text,</p>
<h2>When to use method="post"?</h2>
<blockquote>
<p>Information sent from a form with the POST method is invisible to
others and has no limits on the amount of information to send.</p>
<p>However, because the variables are not displayed in the URL, it is not
possible to bookmark the page.</p>
</blockquote>
<p>Now I understand what bookmarking is and the importance of security but I am unable to get why would anyone want to bookmark a user document submission page?</p>
<p>Thanks in advance.</p>
| php | [2] |
4,201,926 | 4,201,927 | Jquery getting a child class of a selector retrieved using .prev | <pre><code>back = $("#contactus_"+id).prev();
</code></pre>
<p>I'm probably asking a simple question, but how do I get at .up_btn class from the id above?</p>
<p>normally to target this class i would do $("#contactus_"+id+" .up_btn") however in this instance I can't place the class name in there like that since I want the previous sibling's child.</p>
<p>Thanks</p>
| jquery | [5] |
5,680,523 | 5,680,524 | Class factory mixin | <p>I would like to create in a mixin <code>class</code> that would impart a <code>class</code> factory method for the final class of a concrete type through several layers of inheritance. More specifically, I would like to have the factory method produce a new instance of the actual object it is called as a member of.</p>
<p>So, class "factory" is inherited by class <code>A</code>, class <code>A</code> is inherited by class <code>B</code>, I would like to find a way to do <code>B::create()</code> and create an instance of <code>B</code>. As far as I can tell this precludes the use of a template taking the type in the class <code>A</code> since then <code>B::create()</code> would produce an instance of <code>A</code>.</p>
| c++ | [6] |
5,872,013 | 5,872,014 | can we assign a integer value to a reference varible? | <p>It is not possible to assign an integer value to a reference varible directly, say like:</p>
<pre><code>int &x=10; //not possible
</code></pre>
<p>Is there any other way we can modify this statement to make it possible?</p>
<p>But not like this:</p>
<pre><code>int a=10;int &x=a;
</code></pre>
<p>This works fine. But I want some other way or modify a little bit my expression and make it work!</p>
| c++ | [6] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.