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,565,453 | 1,565,454 | Java - Storing a "score" from play to play | <p>I wish to be able to keep a score that a player gets when playing my game from game to game and to when they close the game and re-open the scores are still saved. The only way I can think of is to do so using a text file, like I would of done in VB6. However, that then means that they can edit the text file? Or not? My score is stored in a "double" that can be accessed from any class and is being transferred around classes as it is, if that makes a difference.</p>
<p>Hope someone can suggest the best way to go about this.</p>
| java | [1] |
1,431,222 | 1,431,223 | do message queues provide transactional support? | <p>Say I load messages in a queue from multiple nodes.</p>
<p>Then, one or many nodes are pulling messages from the queue.</p>
<p>Is it possible (or is this normal usage?) that the queue guarantees to not hand out a message to more than one server/node?</p>
<p>And does that server/node have to tell the queue it has completed the operation and the queue and delete the message?</p>
| java | [1] |
5,095,228 | 5,095,229 | To get the position number of selected text in the text view | <p>I am trying to highlight the selected text and find the position of selected text in the text view.</p>
<p>for example :</p>
<blockquote>
<p>It is stackOverFlow .Stackoverflow is very useful.</p>
</blockquote>
<p>Now when user Select <strong>stackoverflow</strong> then the back ground color should change and give an alert that the 3 rd word is selected if user select <strong>very</strong> then there is an alert saying 6th words selected</p>
| iphone | [8] |
3,923,071 | 3,923,072 | function not working properly in chrome | <p>Hi I have a function that's working correcty in Firefox, but failing in chrome. It's supposed to open a test window, and <strong>IF</strong> successful, close the test and redirect the parent. I'm still getting into java. I understand there are differences in how browsers interpret JS, just not sure why in this instance, chrome is redirecting the parent window even if the child "testWindow" is not created (e.g.). I'd apprecitate your comments</p>
<p>thanks
Gillian</p>
<pre><code><script type="text/javascript">
function openwindow(){
testWindow = window.open("popup.php","interaction");
if(testWindow){
setTimeout(function() { testWindow.close(); },1000);
setTimeout(function() { window.parent.location = "http://www.google.com"; },1000);
}
}
</script>
</code></pre>
| javascript | [3] |
694,471 | 694,472 | How to specify string padding with a variable in Python 2.5? | <p>For example:</p>
<pre><code>print('items %05d'%12)
</code></pre>
<p>would print 00012.</p>
<p>Can the amount of padding be specified by a variable instead of a literal? I believe python 2.6+ has the .format function but what are the options with python 2.5?</p>
| python | [7] |
4,169,298 | 4,169,299 | How can I tell if a listener is already running? | <p>I am adding a event listener to my Singleton class. I am adding the listener in a add method.</p>
<pre><code> public void add(TCComponentItemRevision tcRevision, TCComponentDataset selectedDataset) {
String revMasterForm;
tcRevision.getSession().addAIFComponentEventListener(this);
try {
revMasterForm = tcRevision.getRelatedComponent("IMAN_master_form_rev").getUid();
RevDataset pp = new RevDataset(tcRevision, selectedDataset, revMasterForm);
if (!rds.contains(pp)) {
rds.add(pp);
}
}
catch (TCException e) {
e.printStackTrace();
}
fireTableDataChanged();
}
</code></pre>
<p>I only want the lister to be adding once. So I figure there has to be some sort of a check.
something like</p>
<pre><code>if (listener value == null) {
tcRevision.getSession().addAIFComponentEventListener(this);
}
</code></pre>
<p>But I am not sure how to get the listener value?</p>
| java | [1] |
3,848,786 | 3,848,787 | Are there any thread managers java | <p>I have been making a threadmanager class in java and wanted it so you could input a class and it would run the threadrun method in that class but when I write my code my ide says:cannot find symbol threadrun</p>
<p>Code:</p>
<pre><code>package thenetwork;
/**
*
* @author Jman
*/
public class Threadmanager implements Runnable
{
Class clas;
Object parameter1 = null;
public Threadmanager(Class classobj)
{
clas = classobj;
}
public Threadmanager(Class classobj, Object param1)
{
clas = classobj;
parameter1 = param1;
}
public void run() {
if(parameter1 != null)
{
clas.threadrun(parameter1);
}
else
{
clas.threadrun();
}
}
}
</code></pre>
<p>If this is not clear comment it and I will edit my post
Edit:I need this class to be able to run multiple types of other classes</p>
| java | [1] |
993,838 | 993,839 | calling function inside a another function | <pre><code>S.ui.createpulldown = function() {
function someName(){
}
someName() // gets called
}
someName() // does not get called, when outside because of scope issue.
</code></pre>
<p>I want to call this function outside the <code>s.ui.createpulldown</code> function. Is it possible, on what changes i have to make to <code>function someName()</code></p>
| javascript | [3] |
1,169,576 | 1,169,577 | How do we call a super class method if we already have a super class of sub class? | <p>My Question is like that if there is a child class extend by father class and which is extended by Grandfather class then how can child class directly access the Grandfather's method.</p>
| java | [1] |
5,315,732 | 5,315,733 | Why would a language let programmer to handle divison by zero | <p>This happens in Javascript, for example, that division by zero is not handled by the language itself.
Is there's a valid reason for this?</p>
<p>I see this as a very basic exception that a language should be able to handle (they even handle 0/0 as NaN NaN).</p>
<blockquote>
<p>or take the square root of a negative number or use arithmetic
operators with non-numeric operands that cannot be converted to
numbers.</p>
</blockquote>
| javascript | [3] |
2,355,089 | 2,355,090 | Generate a radio button in JQUery | <pre><code> <li><a href="#" id="radio">Multiple Choices</a></li>
</code></pre>
<p>onclick of this radio i am trying to generate a radio button with two choices .. How to do so in JQUery??</p>
| jquery | [5] |
5,711,062 | 5,711,063 | Joining values in an arraylist | <p>Say I have an arraylist a with the values:</p>
<pre><code>a[0] = G
a[1] = B
a[2] = D
</code></pre>
<p>I was wondering, how can I create a new arraylist in java, that joins index values at random places and puts it into a new arraylist b
So like:</p>
<pre><code>b[0] = GB
b[1] = D
</code></pre>
<p>or</p>
<pre><code>b[0] = G
b[1] = BD
</code></pre>
<p>or </p>
<pre><code>b[0] = GBD
</code></pre>
<p>The order of the values is kept the same, it's just the different combinations of the joins, and at different places over different amounts.</p>
| java | [1] |
1,784,345 | 1,784,346 | jc1: Cannot allocate 1342179073 bytes after allocating 185472 bytes | <p>I compiled Test.java use gcj:gcj -C Test.java</p>
<p>and it return the error: jc1: Cannot allocate 1342179073 bytes after allocating 185472 bytes</p>
<p>this is the source Test.java:</p>
<pre><code>public class Test {
}
</code></pre>
<p>my gcj version: gcj --version</p>
<p>gcj (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)</p>
<p>my jdk version: java -version</p>
<p>Java(TM) SE Runtime Environment (build 1.6.0_14-b08)</p>
<p>Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode, sharing)</p>
<p>how to solve the problem?</p>
| java | [1] |
5,178,422 | 5,178,423 | asp.net response.redirect avoid validation | <p>I have an ASP.NET form which has many requiredfield validators. Now under some consditions , I have to choose response.redirect to go to another form (this happens when a menu item is chosen under some complex conditions). In this case the navigation fails because of Requiredfield validators on the current form.</p>
<p>Any Idea how I can solve this</p>
<p>thanks</p>
| asp.net | [9] |
76,955 | 76,956 | Navigation Bar, Relative Links | <p>i'm building a php cms style app for tracking of members characters, the projects coming along nicely, but I am wondering if there is a more efficient way of coding my navigation bar.</p>
<p>the bar is included in many different pages so relative links as standard will not work for obvious reasons, the way I have been getting around this is by</p>
<pre><code>if (strstr($_SERVER['SCRIPT_FILENAME'], "admin/char/")) {
$home = "../../index.php";
$logout = "../user/logout.php";
} else if (strstr($_SERVER['SCRIPT_FILENAME'], "admin/user/")) {
</code></pre>
<p>etc.</p>
<p>so I have each combination of path that could be typed, and this solution works, and quite well, but since I am copying pasting code and making changes the chances of me missing something is increased, and with more links this chance is increased.</p>
<p>I am wondering if there a better way of achieving the same result with less code?</p>
<p>Any advise would be greatly appreciated.</p>
| php | [2] |
5,494,993 | 5,494,994 | Need Help in Changing Screen Orientation in Android | <p>I want to change the screen orientation from portrait to landscape and vice versa when the user rotates his Android mobile phone clockwise/anticlockwise. Can anyone help me how to achieve this? I do not know what event is fired when the user rotates his Android mobile phone.</p>
<p>For instance, when the user touches the button in UI, touch event is fired. So, when the user shakes his Android mobile phone, what is the event that is fired? Please help me on this.</p>
| android | [4] |
667,564 | 667,565 | datagrid speed issue | <p>i m binding gridview in asp.net application...
i m about to bind some thousand records in datagrid...
on RowDataBound event of the grid i need to check if the log in user is authorised to view the perticuler record...so i need to send database request...like wise such other two to three operation requires to send request to database....</p>
<p>about three to four request are sended to database during each row bound of the gridview...is it effective on speed of the grid? </p>
| asp.net | [9] |
4,689,152 | 4,689,153 | How to get data out of a deferred callback; | <p>How do I get the returned data to work outside the deferred callback below?</p>
<pre><code> results.done(function(data)
{
alert(data); // works
});
alert(data); // does not work but need it to work...
</code></pre>
| jquery | [5] |
2,900,170 | 2,900,171 | fire an event after document is rendered | <p>How to fire an event or call a method after the document body is fully rendered in jQuery</p>
| jquery | [5] |
774,717 | 774,718 | Send Key Strokes to Games | <p>I can send any windows application key strokes with PostMessage() api.But i cant send key strokes to Game window by using PostMessage.</p>
<p>Anyone know anything about using Direct Input functions for sending keys to games from C#.</p>
| c# | [0] |
4,354,218 | 4,354,219 | Check existance of a file to unlock app | <p>I wish to create a file on my device somewhere (I don't mind where or what the file contains, my only concern is the name of the file), then have my app look for the existence of that file. The idea is to have a mechanism to secretly unlock some features of my app to anyone I tell about the file.</p>
<p>My only problem is that I have never written any code to read/write files outside of my own app's space before, so I'm not sure how to do it. Can someone give me some pointers.</p>
| android | [4] |
3,937,646 | 3,937,647 | Changing Background Image with set Interval | <p>I've got the following function which changes that background image of 4 classes so one background goes green and then another making a loading bar:</p>
<pre><code>clearInterval(start);
var i = 0;
function boxes() {
in_loading = ".in_loading:eq(" + i + ")";
$(".in_loading").css("background", "url(images/load_bar_green.png) no-repeat");
$(in_loading).css("background", "url(images/load_bar_blue.png) no-repeat");
if(i == 3) {
i = 0;
} else {
i++;
}
}
var start = setInterval(function() {
boxes();
}, 350);
</code></pre>
<p>When I keep clicking the submit button the 'flashing' alters as if their is 2 or more functions going at once. I've tried using remove() and display() but what I think I need is something to delay the start of the function and to 'clear' the function so multiple clicks doesn't screw it up!</p>
<p>Cheers
Sam</p>
| jquery | [5] |
976,293 | 976,294 | android mirroring (wireless display mirroring) | <p>I want to display my content on the both devices (ex mobile , others) through wireless display mirroring (mircast). My Question is here how can be implement this concept using miracast . which has been launched by google in android jelly beans 4.2 . Please give me any idea or suggestion.</p>
<p>Thanks in advance </p>
| android | [4] |
2,334,926 | 2,334,927 | $.fn or Function.prototype | <p>I'm trying to get this to work. </p>
<pre><code>$.fn.createDelegate = function(scope){
var fn = this;
return function() {
return fn.apply(scope, arguments);
}
}
</code></pre>
<p>The below version works but I thought they were both the same. The first being a shorthand way of writing the second.
Or maybe I have gotten the idea incorrect.</p>
<pre><code>Function.prototype.createDelegate = function(scope){
var fn = this;
return function() {
return fn.apply(scope, arguments);
}
}
</code></pre>
<p>When I call the first like this:
var delegate = this.myMethod.createDelegate(this);
setTimeout(delegate, 3000);</p>
<p>It says not a function. The second method with Function.prototype works. Can someone explain why and set me straight.</p>
<p>Also would it be best to have this as a small plugin so it doesn't get overwritten thought a large project. </p>
| jquery | [5] |
1,077,156 | 1,077,157 | NoClassDefFoundError trying to use OpenCyc, what could be wrong? | <p>I want to create cycAccess object to connect to the openCyc knowledge base, but I could not create this object. I got NoClassDefFoundError from this code... Plz anybody can help me ? Following is my code....</p>
<pre><code>public static void exampleConnectingToCyc() {
System.out.println("Starting Cyc connection examples.");
CycAccess access = null;
try {
access = new CycAccess("localhost", 3602);
System.out.println("Successfully established CYC access " + access);
// The following code should only be called if you will be modifying the KB
// and one should typically use a real user and more specific KE purpose.
// This information is used for accurately maintaining KB content
// bookkeeping information.
CycConstant cycAdministrator = access.getKnownConstantByName("CycAdministrator");
CycConstant generalCycKE = access.getKnownConstantByName("GeneralCycKE");
access.setCyclist(cycAdministrator);
access.setKePurpose(generalCycKE);
// Do stuff with the connection here.
// Note: The class CycAccess contains many of the
// useful public methods for interacting with Cyc.
// Note: Establishing a connection with Cyc is relatively expensive.
// If you have a lot of work to do with Cyc over time, make a single
// CycAccess object and use that everywhere.
} catch (UnknownHostException nohost) {
// if cyc server host not found on the network
nohost.printStackTrace();
} catch (IOException io) {
// if a data communication error occurs
io.printStackTrace();
} catch (CycApiException cyc_e) {
// if the api request results in a cyc server error
// example: cannot launch servicing thread;
// protocol errors, etc.
} catch (Exception e) {
} finally {
// ensure that the connection is closed when finished
if (access != null) {
access.close();
}
}
System.out.println("Finished.");
</code></pre>
<p>}</p>
| java | [1] |
2,742,898 | 2,742,899 | camera in android | <p>how can i simulate camera of an android device?And what is the format of image obtained?
thanks in advance..</p>
| android | [4] |
2,169,628 | 2,169,629 | Suspend layout during DOM interaction | <p>In Javascript I'm clearing out the contents of a DIV and then re-populating it, is there any way to suspend layout of these elements or lock the UI until I've finished slashing away at the HTML? I don't want any messages popping up, I just don't want to see the flicker as the items are removed/added.</p>
<p>Thanks
Kev</p>
| javascript | [3] |
2,789,270 | 2,789,271 | Android App- Using a loop for setText procedure to populate EditText | <p>Trying to use a loop to set the text of 12 checkboxes from a db query. Would like to substitute "add1" with an array value and loop through all 12 instead of spelling out each one. Any ideas of how to do this?</p>
<p>Here is the code I am trying to modify:</p>
<pre><code>add1Text= (CheckBox) findViewById(R.id.add1);
if (cursor.getString(cursor.getColumnIndex("add1")) == null) {
add1Text.setVisibility(View.GONE);
}
else {
add1Text.setText(cursor.getString(cursor.getColumnIndex("add1")));
}
</code></pre>
| android | [4] |
4,920,123 | 4,920,124 | Difference in results returned between .has() and :has() | <p>I have a gnarly navigation structure that can be generalized as:</p>
<pre><code><ul id="navigation">
<li>
A
<ul>
<li>
B
<ul>
<li>C</li>
</ul>
</li>
<li>
D
<ul>
<li>
E
<ul>
<li>F</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</code></pre>
<p>Sub-items are hidden until hover. I want to indicate that B, D, and E have sub-items by styling them so I used the selector:</p>
<pre><code>$('#navigation > li li:has(ul)')
</code></pre>
<p>Which only returned B and D. Changing it to:</p>
<pre><code>$('#navigation > li li').has('ul')
</code></pre>
<p>returned all of the correct items but I'm confused as to why.</p>
<p><strong>EDIT</strong></p>
<p><code>:has()</code> doesn't appear to be affected (entirely) by nesting as</p>
<pre><code>$('#navigation ul > li:has(ul)')
</code></pre>
<p>returns the same results as <code>.has()</code> above.</p>
| jquery | [5] |
2,449,492 | 2,449,493 | iPhone SDK - How to play a video with transparency? | <p>I recorded a video with a bluescreen. We have the software to convert that video to a transparent background. What's the best way to play this video overlaid on a custom UIView? Anytime I've seen videos on the iPhone it always launches that player interface. Any way to avoid this?</p>
<p>Thanks!</p>
| iphone | [8] |
2,330,256 | 2,330,257 | how to play only one sound at a time with AVAudioplayer | <p>i am playing sound when user tap on the respected button.</p>
<p>i have 10 buttons with 10 audio files.</p>
<p>i am playing the selected sound by using the AVAudioPlayer</p>
<pre><code>AVAudioPlayer *myaudio=[[AVAudioPlayer alloc]initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:[sounds objectAtIndex:button.tag] ofType:@"mp3"]]error:NULL];
[myaudio play];
</code></pre>
<p>Now i have a problem that if i click another button before completion of playing previous sound then both sounds are mixed and getting noise.</p>
<p>I need to play second sound after completion of first sound.</p>
<p>i mean at a time only one sound will be played.</p>
<p>How can i done,can any one please help me.</p>
<p>Let me add comment if this question is not understandable. </p>
<p>Thank u in advance. </p>
| iphone | [8] |
4,506,749 | 4,506,750 | Anyone can let me know the following syntax in C++? | <p>Why we can access <code>value_type</code> by <code>myType::value_type</code>, any c++ reference talk about it?</p>
<pre><code>class myType{
public:
typedef double value_type; // the type for elements in the array
private:
};
</code></pre>
| c++ | [6] |
791,182 | 791,183 | Predict C++ program running time | <p>How to predict C++ program running time, if program executes different functions (working with database, reading files, parsing xml and others)? How installers do it?</p>
| c++ | [6] |
3,897,293 | 3,897,294 | conversion operator and operator>> | <p>I have a program following:</p>
<pre><code>class INT {
public:
INT(int ii = 0) : i(ii) {}
operator int() { return i; }
private:
int i;
};
int main()
{
INT i;
cin >> i;
}
</code></pre>
<p>the statement <code>cin >> i</code> is compiled error, but I don't know the reason?</p>
<p>In my option, the compiler can find the function <code>cin.operator>>(int&)</code> for that statement, since <code>INT</code> can be converted to <code>int</code> through <code>INT::operator int()</code>.</p>
| c++ | [6] |
5,195,700 | 5,195,701 | Is the method WifiManager.setWifiEnabled synchronous? | <p>I had to do something. Just when Wi-Fi was enabled, so I called method <code>WifiManager.setWifiEnabled()</code>, when the method returns, does Wi-Fi state change at the same time?
If not, how can I trace the change of Wi-Fi state? </p>
| android | [4] |
5,675,636 | 5,675,637 | How to use single quote inside an echo which is using single quote | <p>First of all, i have gone through the related questions.. haven't found any answer..
I m using this code to display a message</p>
<p><code>echo 'Here goes your message with an apostrophe S like thi's ';</code></p>
<p>How can i make this work, as any quote inside this echo will break the statement...</p>
| php | [2] |
2,903,291 | 2,903,292 | PHP StdErr after Exec() | <p>In PHP i am executing a command with exec(), and it returns if successful an URL;</p>
<p>$url = exec('report');</p>
<p>However, I want to check STD_ERR, if something went wrong. How would I read the stream?
I want to use php://stderr, but not sure how to use it.</p>
<p>Thanks,
Martin</p>
| php | [2] |
3,812,369 | 3,812,370 | ASP .NET expressions (inline tag) with String.Format | <p>I was juste wondering if it was possible to use <code>String.Format</code> with the following inline tag :</p>
<pre><code><asp:RequiredFieldValidator ControlToValidate="tbTest" Text="<%$ Resources:ErrorMsg, E3032 %>" runat="server" />
</code></pre>
<p>like this so</p>
<pre><code><asp:RequiredFieldValidator ControlToValidate="tbTest" Text='<%= String.Format(<%$ Resources:ErrorMsg, E3032 %>, "Other Text to insert")' runat="server" />
</code></pre>
<p>I know you can't do that but it's just for the picture.</p>
<p>tx</p>
| asp.net | [9] |
4,656,685 | 4,656,686 | jQuery: Can we use it to serialize a form that returns JSON? | <p>Can I easily use jQuery or a plugin of jQuery that serializes the data in a form as a JSON instead of a <em>"text string in standard URL-encoded notation"</em></p>
<p>ref: <a href="http://api.jquery.com/serialize/" rel="nofollow">http://api.jquery.com/serialize/</a></p>
| jquery | [5] |
2,024,610 | 2,024,611 | change labels orientation,programmatically | <p>can we change the orientation of label,programmatically.</p>
<p>i created few labels on landscape mode, but my application works on portrait,
so wen i start my app, the labels still comes according to landscape mode only,</p>
<p>i cant change the orientation of labels through,IB,i hv some restrictions.</p>
<p>so,only option left is, doing it programmatically...and i dont knw how to do it.</p>
<p>quick help is always appreciated</p>
<p>regards
shishir</p>
| iphone | [8] |
46,178 | 46,179 | Array elements vs properties? | <p>So to follow up a previous question;</p>
<p>Due to the dynamic functionality of using properties and iterating with </p>
<pre><code>for(var key in array)
</code></pre>
<p>I've used this quite a lot in favor of trying to enumerate an array and iterating by numbers.</p>
<p>What are the pro's and cons of just .pushing elements and setting as properties instead?</p>
<p>Apart from the obvious identification differences that is.</p>
| javascript | [3] |
1,203,834 | 1,203,835 | The computer hangs when debugging an ASP.NET webform | <p>I start learning ASP.NET few days. I don't know why my computer hangs when I debug my very simple application? My computer hangs, not only IDE hangs? Please help me!</p>
| asp.net | [9] |
760,914 | 760,915 | php 5.2.17 source code repository | <p>The php developers do not support anymore php 5.2.17. However, normal apps are using this php instead of the new one, 5.3 branch (Whose idea was drop security support for 5.2.17? ). Normally we compile php from source code. However the official source code is outdated. Is there any public repository out there with backported patchs? </p>
<p>edit: I mean, my brother's repository is not valid. We are asking if any public and well known repository is available.</p>
<p>Thanks</p>
| php | [2] |
5,295,395 | 5,295,396 | How to get process ID in iPhone or iPad? | <p>i need to to end a process in my iPhone for security issues so i need it's id
How to get process ID in iPhone or iPad ?? in order to end it in Background process</p>
| iphone | [8] |
5,426,905 | 5,426,906 | How to attach a file and send it through any email application like gmail,yahoo,hotmail etc | <p>This is my code..</p>
<pre><code>import java.io.File;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class EMailActivity extends Activity
{
Button send;
EditText address, subject, emailtext ,emailcc;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.email_layout);
send=(Button) findViewById(R.id.emailsendbutton);
address=(EditText) findViewById(R.id.emailaddress);
subject=(EditText) findViewById(R.id.emailsubject);
emailtext=(EditText) findViewById(R.id.emailtext);
emailcc=(EditText) findViewById(R.id.emailcc);
Intent myintent = getIntent();
String ReqPath = myintent.getStringExtra("filepath");
File fileIn = new File(ReqPath);
final Uri u = Uri.fromFile(fileIn);
send.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
// TODO Auto-generated method stub
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{ address.getText().toString()});
emailIntent.putExtra(android.content.Intent.EXTRA_CC, new String[]{emailcc.getText().toString()});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject.getText());
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText());
emailIntent.putExtra(Intent.EXTRA_STREAM, u);
EMailActivity.this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
//finish();
}
});
}
}
</code></pre>
<p>now whe i am sending this Info throgh send Button None Application Like Gmail,Yahoo etc comes.
Please help me out</p>
| android | [4] |
1,915,773 | 1,915,774 | Write a python script that goes through the links on a page recursively | <p>I'm doing a project for my school in which I would like to compare scam mails. I found this website: <a href="http://www.419scam.org/emails/" rel="nofollow">http://www.419scam.org/emails/</a>
Now what I would like to do is to save every scam in apart documents then later on I can analyse them.
Here is my code so far:</p>
<pre><code>import BeautifulSoup, urllib2
address='http://www.419scam.org/emails/'
html = urllib2.urlopen(address).read()
f = open('test.txt', 'wb')
f.write(html)
f.close()
</code></pre>
<p>This saves me the whole html file in a text format, now I would like to strip the file and save the content of the html links to the scams:</p>
<pre><code><a href="2011-12/01/index.htm">01</a>
<a href="2011-12/02/index.htm">02</a>
<a href="2011-12/03/index.htm">03</a>
</code></pre>
<p>etc.</p>
<p>If i get that, I would still need to go a step further and open save another href. Any idea how do I do it in one python code?</p>
<p>Thank you!</p>
| python | [7] |
3,221,554 | 3,221,555 | save and load from sdcard shows empty file | <p>I have a layout where I have an Edit Text field where I enter my data.
I have 2 buttons.Save and Plot.</p>
<p>When I press save I want to save the data (in xls format) from edittext field and the current date in sd card.</p>
<p>When I press the plot ,I want to plot them.</p>
<p>To save data:</p>
<pre><code>case R.id.savebtn:
savefunc();
break;
...
public void savefunc(){
//saving
File sdCard = Environment.getExternalStorageDirectory();
File directory = new File (sdCard, "MyFiles");
directory.mkdirs();
File file = new File(directory, filename);
try {
FileOutputStream fOut = new FileOutputStream(file);
DataOutputStream os = new DataOutputStream(fOut);
os.writeUTF(thedata);
os.writeUTF(mydate);
os.close();
} catch (FileNotFoundException e) {
// handle exception
} catch (IOException e) {
// handle exception
}
}
</code></pre>
<p>For reading:</p>
<pre><code>public void readfunc(){
File sdCard = Environment.getExternalStorageDirectory();
File directory = new File (sdCard, "MyFiles");
File file = new File(directory, filename);
try{
FileInputStream fIn = new FileInputStream(file);
DataInputStream is = new DataInputStream(fIn);
String name = is.readUTF();
String content = is.readUTF();
is.close();
} catch (FileNotFoundException e) {
// handle exception
} catch (IOException e) {
// handle exception
}
}
</code></pre>
<p>and :</p>
<pre><code> case R.id.savebtn:
savefunc();
break;
case R.id.graphicsbtn:
readfunc();
...
</code></pre>
<p>But the xls file asks me format , I choose UTF8 and it is empty.</p>
<p>If I leave it shows chinese characters.</p>
<p>I am not sure about the "reading" part of the code.</p>
| android | [4] |
3,562,972 | 3,562,973 | Too many decimals after addition | <p>I would like to add 0.01 to 36.01 and get 36.02 as the result
But below code returns 36.019999999999994.</p>
<pre><code>Double d = 36.01;
d = d + 0.01;
</code></pre>
<p>Could anyone tell me how to get 36.02 as the result ?
Thanks in advance</p>
| c# | [0] |
1,885,114 | 1,885,115 | What is real purpose of isolated storages in .Net? | <p>I have heard of the term isolated storage in .Net. What is it really and how far is that used? Does that storage not visible to user and can be consumed or written to by Assemblies (specific assembly or AppDomain which created it) only?</p>
| c# | [0] |
2,012,932 | 2,012,933 | writing arraylist of objects in file | <p>I want to write arraylist of objects in a file. But only one object in going in file.Atfirst I am fetching all the stored objects and then appending new object after that I write whole arrayList to the file.</p>
<p>Here is my code....</p>
<pre><code>public void write(UserDetail u1) throws FileNotFoundException {
ArrayList<UserDetail> al = new ArrayList<UserDetail>();
FileInputStream fin = new FileInputStream(FILEPATH);
try {
if (fin.available() != 0) {
ObjectInputStream ois = new ObjectInputStream(fin);
while (fin.available() != 0 && ois.available() != 0) {
try {
al.add((UserDetail) ois.readObject());
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (ois != null) {
ois.close();
}
}
}
}
al.add(u1);
FileOutputStream fos = new FileOutputStream(FILEPATH);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(al);
oos.flush();
oos.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
throw e;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
</code></pre>
<p>help me......thnx in advance</p>
| java | [1] |
1,537,436 | 1,537,437 | How to remove all the punctuation except whitespaces or numbers in java | <p>How to remove all the punctuation <em>except</em> whitespaces or numbers in Java.</p>
<pre><code>"\\p{Punct}|\\d", "" //THIS WORKS BUT IT REMOVES THE NUMBERS AND I DONT WANT IT TO REMOVE THE NUMBERS...
</code></pre>
<p>I am reading text and I need to remove punctuation.</p>
<pre><code>String[] internal;
char ch = 'a';
int counter = 1;
int count;
int c;
Map<String, Set> dictionary = new HashMap<String, Set>();
BufferedReader in = new BufferedReader(new FileReader("yu.txt"));
while (in.ready()) {
internal = (((in.readLine()).replaceAll("\\p{Punct}|\\d", "")).toLowerCase()).split(" ");//this does not work in my case cause it removes numbers... and makes them whitespaces but other than that this one works I JUST dont want it to remove numbers and keep whitespaces...
for (count = 0; count < internal.length; count++) {
if (!dictionary.containsKey(internal[count])) {
dictionary.put(internal[count], new HashSet());
}
if (dictionary.get(internal[count]).size()<10)
{
dictionary.get(internal[count]).add(counter);
}
}
counter++;
}
Iterator iterator = dictionary.keySet().iterator();
while (iterator.hasNext()) {
String key = iterator.next().toString();
String value = dictionary.get(key).toString();
System.out.println(key + ": " + value );
}
</code></pre>
| java | [1] |
4,005,990 | 4,005,991 | How do I parse out the substrings in python? | <p>I need to parse out the following:</p>
<pre><code>2012
01
02
16
50
00
</code></pre>
<p>out of the string (in this format):</p>
<pre><code>2012-01-02 16:50:00 ABCABCABCABCABCABCABC
</code></pre>
<p>What's a simple command that would accomplish this?</p>
| python | [7] |
2,029,970 | 2,029,971 | Manipulating the "data" from $.ajax success: function(data) { | <p>i have this and a simple question to it.</p>
<pre><code>$.ajax({
type: "POST",
url: "/",
data: $(".form").serialize(),
dataType: "html",
success: function(data) {
$("#id").html(data);
}
});
</code></pre>
<p>Inside "data" is some html I am inserting into the DOM. Thats no problem. But I want to manipulate the "data" before doing so. How can I do that? For example there are some li elements in "data". How would I for example delete the last li element out of the "data" string before inserting it into the DOM?</p>
<p>I tried something like </p>
<pre><code>$(data li:last)remove();
</code></pre>
<p>...but that didnt work.</p>
<p>Thanks for your help.</p>
| jquery | [5] |
4,749,564 | 4,749,565 | Laying out controls on ASP Web Form using markup | <p>![enter image description here][1]I am new to ASP.NET and I am trying to recreate an existing Winform calculator application in ASP.NET. It is basically a bunch of text boxes on two different tab pages. I am having trouble laying out the text box controls on a web page. I have the Telerik UI Controls Library available. Should I be using a grid, tables ?</p>
<p>I have include a screen shot of the existing Winforms application.</p>
<p>Thanks for any help.</p>
<p>Sorry I am a new memeber so I can't post the image. It consists of six groups of text boxes; 3 on the left side of the form and 3 on the right side.</p>
| asp.net | [9] |
497,077 | 497,078 | how to make rest call with key and secret using md5 in android? | <p>I am trying to implement rest call with key and secret using md5. I tried a way but its giving me an error, </p>
<p>{"status":"error","message":"Signature mismatch"}. </p>
<p>Please help me, its very urjent!!</p>
<h1>this is my md5 method,</h1>
<pre><code>private static final String md5(final String parem) {
try {
// Create MD5 Hash
MessageDigest digest = java.security.MessageDigest
.getInstance("MD5");
digest.update(parem.getBytes());
byte messageDigest[] = digest.digest();
// Create Hex String
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < messageDigest.length; i++) {
String h = Integer.toHexString(0xFF & messageDigest[i]);
while (h.length() < 2)
h = "0" + h;
hexString.append(h);
}
return hexString.toString();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return "";
}
</code></pre>
<p>Thanks in advance.</p>
| android | [4] |
4,516,050 | 4,516,051 | Back button issues after forwarding intents via share menu | <p>I am working on a login screen for my application. If I open the application, by either running from eclipse or by selecting the application icon installed on the emulator, it will run an AuthUser.class which checks for a valid token on a remote server. If the user is not logged in then the AuthUser.class forwards to Login.class via...</p>
<pre><code>if (authtoken.length() == 0 || authtoken.length() > 0
&& checkAuthToken(authtoken) == false) {
Intent intent = new Intent();
intent.setClass(AuthUser.this, Login.class);
startActivity(intent);
finish();
}
</code></pre>
<p>This works great, as when I use the back button on the emulator it will close the app rather than go back to the login screen. Perfect.</p>
<p>Now when I am coming from a share menu, like when I select share icon on an image within the gallery, and then select my application from the popup menu I also forward to the Login.class via...</p>
<pre><code>Intent intent1 = new Intent();
intent1.setClass(SharePictureMenu.this, AuthUser.class);
startActivity(intent1);
finish();
</code></pre>
<p>Now when I login from here and it forwards to AuthUser.class as per usual, however, the back button press now takes me back to the login screen, even though I am forwarding and finishing exactly the same in both cases. Obviously I don't want that behavior as I want it to close the app and return to the gallery after login so the user can continue to share images immediately without having to go back through the login screen.</p>
<p>Any suggestions, hacks or otherwise on fixing this would be greatly appreciated.</p>
| android | [4] |
4,076,900 | 4,076,901 | Disable globbing in PHP exec() | <p>I have a PHP script which calls another script in order to add IP addresses to a whitelist. I sometimes want to whitelist all addresses, in which case I have it call</p>
<pre><code>exec("otherscript *.*.*.*", output, retval);
</code></pre>
<p>This worked fine, adding the string "*.*.*.*" to the whitelist until I happened to have another file in the directory of the php script that matched that pattern ("foo.1.tar.gz"), at which point the wildcards were expanded, and I ended up with the filename in my whitelist. Is there some way to disable globbing in php's exec? It isn't mentioned in the PHP docs as far as I can tell.</p>
| php | [2] |
3,321,140 | 3,321,141 | How can I load new content without reloading the page based on hashtags fragments? | <p>Imagine I'm on:</p>
<p><a href="http://example.com/" rel="nofollow">http://example.com/</a></p>
<p>I click in a link containing a hashbang <a href="http://en.wikipedia.org/wiki/Fragment_identifier" rel="nofollow">fragment identifier</a>, let's say:</p>
<p><a href="http://example.com/#!/login" rel="nofollow">http://example.com/#!/login</a></p>
<p>I would like it to show the login form without reloading the page. How is this done?</p>
| javascript | [3] |
2,359,678 | 2,359,679 | how to close all the opened windows(except the parent)onclick from a parent window in javascript? | <p>I have a parent window which calls for a function that opens 2 new windows in javascript.
When I click a close button, I want to close both the child windows.
I tried window.close(windowname); windowName.close(). Both didn't work.</p>
<p>Please help..</p>
| javascript | [3] |
4,455,927 | 4,455,928 | Action bar on pre-honey comb devices by using Android support-v4 library | <p>I want to design Action bar UI on pre-honeycomb devices. After my Google i got ActionBarSherlock library. Can i design without using this ActionbarSherlock library. is it possible to design Action bar on pre-honey comb devices by using Android support-v4 library itself?</p>
<p>Basically i trying to design without using third party libraries.</p>
| android | [4] |
902,755 | 902,756 | check box not working | <p>I need your assistance in my following scenario.</p>
<p>I have three checkboxes A, B and C and variables a. If I click on Checkbox B, the value of a should be kept 2 and if I check A then this should be changed to 3 and if I deselect it should go back to 2.</p>
<p>How to obtain this dynamically?</p>
<p>I am using onCheckedChangeListener which changes the variable only when I change the checked state of the checkboxes.</p>
<p>Any help is much appreciated.</p>
<p>few codes:</p>
<p>Code for ChkBxA :</p>
<pre><code> ChkBxA.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,boolean isChecked)
{
if (buttonView.isChecked())
{
variable_a = 1;
}
else
{
variable_a = 0;
}
}
});
</code></pre>
<p>ChkBxB Code:</p>
<pre><code>ChkBxB.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,boolean isChecked)
{
if (buttonView.isChecked())
{
if(variable_a == 1)
{
variable_b = 3;
}
else
{
variable_b = 2;
}
}
else
{
variable_b = 0;
}
}
});
</code></pre>
<p>The issue is as the value of variable_a changes when the state of the checkbox A, the value of variable_b doesn't change as this is within the checkedChangeListener. So any advice to overcome this is much appreciated.</p>
| android | [4] |
2,633,159 | 2,633,160 | javascript server issue | <p>Onchage of selection i am calling a javascript to make a server call using struts1.2 but its not making a call.Please let me know where i am going wrong,below is the code</p>
<pre><code><html:form action="/populate">
<html:select property="tName" onchange="test()">">
<html:option value="">SELECT</html:option>
<html:options name="tList" />
</html:select>
</html:form>
</code></pre>
<p>and stuts-config has</p>
<pre><code> <action path="/populate" name="tForm" type="com.testAction" validate="false" parameter="method"
scope="request" >
<forward name="success" path="/failure.jsp" />
</action>
</code></pre>
<p>and javascript is</p>
<pre><code>function test(){
var selObj = document.getElementById("tName");
var selIndex = selObj.selectedIndex;
if (selIndex != 0)
{
document.form[0].selIndex.action="/populate.do?method=execute&testing="+selIndex;
document.form[0].submit();
}
}
</code></pre>
| javascript | [3] |
3,757,026 | 3,757,027 | which is the best datepicker for birth date? | <p>Which is the easiest to use/select date of birth?</p>
| javascript | [3] |
1,038,579 | 1,038,580 | g++ cannot find header file | <p>I am migrating from Java to C++. It seems that C++ makes classes declaration in separate files, difficult. So I need your help,</p>
<p>in my main.cpp:</p>
<pre><code>#include "Sphere.h"
using namespace std;
.....
...
..
int main( void ) {
Sphere *earth = new Sphere(sphere_start ,sphere_end);
...
..
.
</code></pre>
<p>in my Sphere.h</p>
<pre><code>class Sphere
{
public:
Sphere(int,int);
}
</code></pre>
<p>and in my Sphere.cpp</p>
<pre><code>#include "Sphere.h"
using namespace std;
int sphere_start, sphere_end;
Sphere::Sphere (int a, int b)
{
sphere_start = a;
sphere_end = b;
}
void Sphere::render(int i)
{
....
..
.
}
</code></pre>
<p>This is the very basic code that I think causes the following error:</p>
<pre><code>main.cpp:14:20: fatal error: Sphere.h: No such file or directory
compilation terminated.
</code></pre>
<p>why?</p>
| c++ | [6] |
5,840,715 | 5,840,716 | Check boolean from another php script | <p>I want to check if a boolean is true or false from antoher phpscript.
Like if I have a boolean like this in one php script:</p>
<pre><code>$signedin = false;
</code></pre>
<p>then I want to check if it is false or true by another php script in another file.
I hope someone can help me! :)</p>
<p>Thanks!</p>
| php | [2] |
4,575,322 | 4,575,323 | android how to moving many image on my destination point | <p>how to implement my idea with android source code</p>
<p>i have many image, i want to move image one by one, if image move on destination point, then other image moving on behind image previous.</p>
<p>ilustration</p>
<pre><code>"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
image1,image2,image3 x (point destination move)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
</code></pre>
<p>if image3 move</p>
<pre><code>"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
image1,image2 image3 x
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
</code></pre>
<p>if image2 move then image3 follow move image2</p>
<pre><code>""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
image1 image2,image3 x
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
</code></pre>
<p>and so on</p>
<p>how to implementation to source code android</p>
<p>i am newbie</p>
<p>thanks</p>
| android | [4] |
6,029,969 | 6,029,970 | Starting an ACTION_VIEW activity to open the browser, how do I return to my app? | <p>In my app i need to open the bank's page, to make the user able to pay.
Reading the Android documentation I see that I should use an <code>ACTION_VIEW</code> (and not a WebView) to accomplish this.</p>
<pre><code> Uri uri = Uri.parse("http://www.example.com");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
</code></pre>
<p>My question is: After the user is done with the payment, <strong>how can i get back to the app</strong>?</p>
<p>I mean, I'd like to do something like</p>
<pre><code>startActivityForResult(intent, RESULT_CODE);
</code></pre>
<p>to open the bank's site, and then get back to the app when the user is done, using the</p>
<pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data) {
</code></pre>
<p>callback to handle the result of the payment.</p>
<p>And, am I following the right way? Or is there any other way to accomplish this?</p>
| android | [4] |
3,604,636 | 3,604,637 | Call to new HttpRequest fails | <p>I am trying to get a php script working. The purpose of the script is to call out to a web service. I've reduced the script down to it's simpliest components and it is still failing. Here it is:</p>
<pre><code><?php
print "Hello";
$request = new HttpRequest('http://www.pivotaltracker.com/services/v3/source_commits', HttpRequest::METH_POST);
print "Done";
?>
</code></pre>
<p>The output is:</p>
<pre><code>D:\svn\svndb\hooks>"c:\Program Files\PHP\php.exe" -f test.php
Hello
D:\svn\svndb\hooks>
</code></pre>
<p>As you can see, the script fails when trying to instantiate an instance of HttpRequest. However, no exception is thrown.</p>
<p>I am not a php program...I'm just trying to get this feature working. I suspect I have no loaded an extension library that I need...but I can't figure out which one that would be, if indeed that is the problem. Any help would be appreciated.</p>
<p>I am running on windows 2003. I am running php 5.3.3. </p>
<p>I did run phpinfo() but am hesitant to post the results here since it is so large. Is there a section of the phpinfo() output that would be helpful to provide?</p>
<p>Thanks in advance.</p>
<p>Bob</p>
| php | [2] |
472,375 | 472,376 | jQuery Novice: how to remove certain child elements | <p>I need to remove the 2nd and 3rd <code><br></code> elements in the parent <code><address></code> element such that the <code>City</code> and <code>StateCode</code> are on the same line. Here is the exact code:</p>
<pre><code><address>
<label>3651 Stardust Drive</label>
<br>
<label>Hannibal</label>
<br>
<label>MO</label>
<br>
<label>63401</label>
</address>
</code></pre>
<p>I need to modify the HTML such that it reads as follows:</p>
<pre><code>3651 Stardust Drive
Hannibal, MO
63401
</code></pre>
<p>The html I am having to work with is as it is because I am using jQuery Mobile with MVC. I know there are other ways to do this but would rather just write a jQuery function to fix it up for me.</p>
<p>I initially tried removing all the line breaks but I need to keep the first line break and keep the others....</p>
<pre><code>$(document).ready(function() {
//pretty-up the address & job descriptions
$('<br>').remove();
});
</code></pre>
| jquery | [5] |
2,731,829 | 2,731,830 | android gallery layout | <p>What type of layout i should use?</p>
<p>What layout elements I need?</p>
<pre><code>__________________________________________________
|list_item | |
|list_item | |
|list_item | |
|list_item | details with images on item click |
|list_item | |
|list_item | |
|list_item | |
</code></pre>
| android | [4] |
2,354,844 | 2,354,845 | how to use javascript change the form action | <pre><code><div class="fr_search"
<form action="/" accept-charset="UTF-8" method="post" id="search-theme-form">
.......
</form>
</div>
</code></pre>
<p>now i want to write a function to change the form action and method, when it equal a condition. how to write the code. thank you. eg: </p>
<pre><code>function test(){
if(selectedIndex === 1)....
}// how to write the code.
</code></pre>
| javascript | [3] |
5,559,371 | 5,559,372 | String comparison; finding 'like' characters | <p>I am doing a quick duplicate check on a form. When comparing two strings, I was trying something like this:</p>
<pre><code>if (stripos($_SESSION['website'], $f['website']))
</code></pre>
<p>I am getting this error:</p>
<pre><code>Fatal error: Call to undefined function: stripos() in...
</code></pre>
<p>I do not want it to be an exact match, basically if the <code>$_SESSION['website']</code> is www.google.com, I'd want <code>stripos</code> to return <code>true</code> if <code>$f['website]</code> is www.goog.com</p>
<p>Am I doing something wrong, or is there a better way to do this?</p>
<p>edit: I was doing some testing, and noticed if my <code>$_SESSION['website']</code> variable contains <code>www</code> and <code>.com</code>. As does my <code>$f['website]</code> variable. shouldn't <code>strpos</code> return that as true?</p>
| php | [2] |
1,204,006 | 1,204,007 | How to create Cash Register Effect using Pure Javascript? | <p>I wanted to create a Cash Register Effect using Pure Javascript(With out using any libraries),</p>
<p>Here is the link for Cash register Effect which is implemented Using Mootools,</p>
<p><a href="http://jsbin.com/ehuzes/edit#preview" rel="nofollow">http://jsbin.com/ehuzes/edit#preview</a></p>
<p>I want to get this effect using raw Javascript. It will be huge help, If somebody gives the solution.</p>
| javascript | [3] |
440,551 | 440,552 | Is it possible for a service to simulate power button? | <p>I'm writing a service on android and I need to turn off the screen after a certain time, I tried using all solutions on this thread <a href="http://stackoverflow.com/questions/6756768/turn-off-screen-on-android">enter link description here</a></p>
<p>but none of them worked, thus is there any way i can simulate the power button?
Thank you</p>
| android | [4] |
2,954,671 | 2,954,672 | how to print this result using PHP | <p>How to print this result using this code i didn't recognize myself what am i doing wrong can you please help me out </p>
<pre><code><?php
$brush_price = 5;
echo "<table border=\"1\" align=\"center\">";
echo "<tr><th>Quantity</th>";
echo "<th>Price</th></tr>";
for ( $counter++ = 10; $counter <= 100; $counter += 10) {
echo "<tr><td>";
echo $counter;
echo "</td><td>";
echo $brush_price * $counter;
echo "</td></tr>";
}
echo "</table>";
?>
</code></pre>
<p><strong>OUTPUT:-</strong> </p>
<pre><code>Quantity Price
10 50
20 100
30 150
</code></pre>
| php | [2] |
5,204,358 | 5,204,359 | PHP how to maintain/update querystring across all links in page | <p>I have a custom e-shop script written in PHP/MySQL.
On the product pages there is a form using GET with a series of form elements (drop downs, check boxes, sliders etc) who's values are used to construct the final MySQL query for pulling the right products based on the users selections. To construct my query, I go through the $_GET array and construct it accordingly. But on the pages I also have pagination & sorting href links, a "Cancel this filter" href link under each option in the form to reset each form value etc. </p>
<p>My question is, how do I maintain the add the querystring to all links throughout the page so that the variables are maintained in any action (links, form submission, browser back-forth)?</p>
| php | [2] |
2,920,511 | 2,920,512 | Project has no default.properties file! | <p>I downloaded a sample project from a website. when i import this project to eclipse work space. Im getting this error</p>
<p><strong>Project has no default.properties file! Edit the project properties to set one.</strong></p>
<p>How i can get rid of this problem. Please let me know</p>
<p>Thanks</p>
| android | [4] |
5,238,911 | 5,238,912 | jQuery - Access form items through function | <p>I found on some examples on the web that people were passing the form to a function and then they were only using the id of the item to access it like in :</p>
<pre><code><form id="frm">
<input type="text" id="textbox" name="textbox" value="some value" />
</form>
<script>
console.log(getelementval("#frm"));
function getelementval(frm) {
return frm.textbox.val();
}
</script>
</code></pre>
<p>But FireBug tells me that frm.textbox is undefined... Then I'm searching why it doesn't work on the net but I didn't find anything explaining this option and how to use it.
Any clues?</p>
| jquery | [5] |
4,625,157 | 4,625,158 | Is there a way to download the android 2.3.3_r1 platform source code without repo/git | <p>I'm trying to build the source and flash a phone.
The instructions given in source.android are specific to repo/git and it gives me a error saying Connection refused</p>
| android | [4] |
4,297,824 | 4,297,825 | How to launch MpMediaPlayer through HTML5 | <p>Please guide me how to launch MPMediaPlayer through HTML5. I am new to IOS and html.</p>
| iphone | [8] |
1,642,957 | 1,642,958 | how to display toast when email or mms is received to the other person | <p>I am sending emails and mms in my project. I want to show a tost when email or mms is received to the recipient. I am using built-in email and messaging application. I don't know how to implement this please help.</p>
<p>thanx</p>
| android | [4] |
2,456,329 | 2,456,330 | java-Passing argument into main method | <p>i can't pass the name of files as argument to the main method. here is my code...</p>
<pre><code>import java.io.*;
class four {
public static void main(String args[])throws IOException{
int i;
FileInputStream fin = null;
try{
fin = new FileInputStream(args[0]);
}catch(FileNotFoundException e){
System.out.println("File not found........");
}catch(IndexOutOfBoundsException e){
System.out.println("Index out of bound........");
}
do{
i = fin.read();
if(i != -1)
System.out.println(i);
}while(i!=-1);
fin.close();
}
</code></pre>
<p>}</p>
| java | [1] |
2,278,641 | 2,278,642 | How do I get a user control to be closed when I close a specific form? | <p>When I open from the main screen of the application a child form I also display a user control that should be displayed until the child form is closed or the user closes it. If I set the child form to be usercontrol's parent, the user control is not displayed (so the parent of the user control is the desktop). I used SetWindowPos with HWND_TOPMOST and I get the correct behaviour. now when I close the child form I want the usercontrol to close as well. Do you know what I shoud do to get this?
thanks,</p>
| c# | [0] |
3,202,851 | 3,202,852 | Creating paragraphs in UITextview | <p>Is it possible to split the text into paragraph in a UITextView?</p>
| iphone | [8] |
4,816,368 | 4,816,369 | WorkflowApplication generate unhandle exception in ASP.NET | <p>am using simple persistence workflow application in ASP.NET when i try start workflow using
WorkflowApplication invoker the .NET framework generate unhandled exception.</p>
<p>the exception is:</p>
<pre><code>Type 'VacationRequestWorkflow.VacationRequestModel' in Assembly 'VacationRequestWorkflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=84fad1a74027a4c8' is not marked as serializable.
</code></pre>
<p>i used</p>
<pre><code>ActivityXamlServices.Load(
ActivityXamlServices.CreateReader(
new XamlXmlReader("*XAML path*",
new XamlXmlReaderSettings { LocalAssembly = Assembly.GetExecutingAssembly() })));
</code></pre>
<p>to resolve this issue but didn't work.</p>
<p>please advice.</p>
| asp.net | [9] |
1,068,434 | 1,068,435 | how to get the height and width of the browser viewport without scrollbars using jquery? | <p>how to get the height and width of the browser viewport without scrollbars using jquery?</p>
<p>Here what I tried so far:</p>
<pre><code> var viewportWidth = $("body").innerWidth();
var viewportHeight = $("body").innerHeight();
</code></pre>
<p>THis solution does not take account for the browser scrollbars.</p>
| jquery | [5] |
398,490 | 398,491 | FormView + FileUpload - can I change a bound field based on the fileupload? | <p>I have a FormView control in an ASP.NET 2.0 app. I've got the database storing a filename (a person's picture) in a column. I can't bind the value of the column to a fileupload control - so I'm trying to use a hidden form field. Here's what I have:</p>
<pre><code><asp:HiddenField ID="pictureLink" runat="server" Value='<%# Bind("pictureLink") %>' />
<asp:FileUpload ID="pic" runat="server" />
</code></pre>
<p>Code Behind:</p>
<pre><code>//ItemUpdating event handler
void do_update(object sender, FormViewUpdateEventArgs e)
{
FileUpload newpic = (FileUpload)profile_edit.FindControl("pic");
if (newpic.HasFile)
{
//do a bunch of file uploading "stuff" which makes a new file name
e.Keys["pictureLink"] = new_filename;
}
}
</code></pre>
<p>My goal is to update the hidden form field's value to the newly updated file name so the database is properly updated.</p>
<p>I think I'm close - but it seems like I can't programmatically alter any of the bound data fields after-the-fact.</p>
<p>I've tried using javascript to change the control - but the new file name will actually be different than what they upload; which javascript can't necessarily "predict" and reliably put the correct file name into the hidden form field</p>
<p>Any suggestions?</p>
<p>Thanks</p>
| asp.net | [9] |
172,438 | 172,439 | app for android! | <p>i am final year student of a university, want to make some application on android, basically i am not sure which application should i go for, since its going to be a FINAL YEAR PROJECT!!,
... app should be good, and long lasting, and have some beneficial for humans. plz reply. </p>
| android | [4] |
4,334,803 | 4,334,804 | Error C2146: syntax error : missing ';' before identifier | <p>The line in question is:</p>
<blockquote>
<p>extern BOOL logged_in;</p>
</blockquote>
<p>Here are my includes:</p>
<pre><code>#define _WIN32_WINNT 0x0403 // Very important for critical sections.
#define WIN32_LEAN_AND_MEAN // Good to use.
#pragma optimize("gsy", on) // Global optimization, Short sequences, Frame pointers.
#pragma comment(linker, "/RELEASE") // Release code
#pragma comment(linker, "/opt:nowin98")
#pragma comment(linker, "/ALIGN:4096") // This will save you some size on the executable.
#pragma comment(linker, "/IGNORE:4108 ") // This is only here for when you use /ALIGN:4096.
#pragma comment(linker, "/ALIGN:4096") // This will save you some size on the executable.
//default headers
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <winsock2.h>
#include <time.h>
#include <stdlib.h>
#include <Winsvc.h>
#include <winuser.h>
#include <tlhelp32.h>
#include <tchar.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <shellapi.h>
#include <commctrl.h>
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "urlmon.lib")
#pragma comment(lib, "shlwapi.lib")
#pragma comment(lib, "shell32.lib")
</code></pre>
<p>Any ideas?</p>
| c++ | [6] |
2,565,263 | 2,565,264 | Is it possible to specify that jquery only searches within a particular div on the page? | <p><strong>In the selector syntax of jqeury $('.string') is it possible to specify that the search is performed only within a particular div or element on the page?</strong> I ask because I am using a web application framework which has a bug, namley producing container elements with the same id so when i search by id to find the container programmatically, it returns the first container out of the many containers with the same id. But the container I want always has a unique class attibute. <strong>So if I could select that container and tell jquery to perform it's queries within that container I would have a solution. Is this possible?</strong></p>
<p>Apologies if a basic question.</p>
| jquery | [5] |
1,888,522 | 1,888,523 | What kind of grammar it is in Android? | <pre><code>Dialog dialog = new AlertDialog.Builder(Activity01.this)
.setTitle("Login hint")
.setMessage("Here needs your login!")
.setPositiveButton(...)
.setNeutralButton(...
).create();
</code></pre>
<p>What kind of grammar it is? I cannot understand why those dots are one by one? And the <code>create()</code> is for <code>Builder()</code> or for <code>setNeutralButton()</code>? </p>
<p>Thanks!</p>
| android | [4] |
2,291,909 | 2,291,910 | Read until condition is met and read next line storing it as an array | <p>I currently have a conf file which exists out of the following format:</p>
<pre><code>[client]
person1,person2,person3,person4
[employee]
emp1,emp2,emp3,mp4
</code></pre>
<p>And so on. Now I need to read the file to store the data that comes after the line [employee] into and array.</p>
| c# | [0] |
3,977,824 | 3,977,825 | int.Parse, Input string was not in a correct format | <p>How would I parse an empty string? <code>int.Parse(Textbox1.text)</code> gives me an error: </p>
<blockquote>
<p>Input string was not in a correct format.<br>
System.FormatException: Input string was not in a correct format.</p>
</blockquote>
<p>If the text is empty (<code>Textbox1.text = ''</code>), it throws this error. I understand this error but not sure how to correct this.</p>
| c# | [0] |
1,058,628 | 1,058,629 | Easy jQuery Question - Selecing a div with the same class as the a | <p>I want to do this, but haven't figured it quite out yet...</p>
<pre><code> $(document).ready(function() {
$("a.whateverclass").click(function() {
$("div.whateverclass").show();
return false;
});
</code></pre>
<p>Basically when a link with a certain class is clicked all divs with that class are shown. The classes can be any class. And I won't know the name(s) of the classes in the application.js file so I need to match equal classes.</p>
| jquery | [5] |
1,778,680 | 1,778,681 | Java: What is "for (;;)" | <p>Would any one please explain this instruction for me:
for (;;)</p>
<p>I have encountered several kinds of these mark (like in ajax code of facebook and in concurrent stuff of Java).</p>
| java | [1] |
4,029,212 | 4,029,213 | Globals and singletons in Python | <p>I have some few classes which are widespread in my Python application and which should have only one global instance (eg Logger, DbConnection). Python does not support static variables/methods in a class, so the usual Java/C++ way to create a singleton here does not work. I have looked for alternatives to implement singleton in Python. I want a simple (no metaprogramming if possible) and clean implementation. This looks good:</p>
<pre><code>class MyClass(object):
def a():
pass
singleton = MyClass()
</code></pre>
<p>Using the singleton would be simple as</p>
<pre><code>import myClass
myClass.singleton.a()
</code></pre>
<p>The direct assignment could be replaced by a creation function if object initialization is not so simple.</p>
<p>I could also create a getInstance() in module scope and always use it to get myObj.</p>
<p>Question 1) This works ok? The module code (myObj assignment) only runs the first time it is imported into some other module and myObj won't be created every time I import this module somewhere?</p>
<p>An alternative method I have seen is to use a globals module. Something like:</p>
<pre><code>from myClass1 import MyClass1
from myClass2 import MyClass2
myObj1 = MyClass1()
myObj2 = MyClass2()
</code></pre>
<p>Using this:</p>
<pre><code>import globals
globals.myObj1.a()
</code></pre>
<p>I tend to prefer the first alternative. </p>
<p>Question 2) Between the 2 solutions, what do you recommend? </p>
<p>Question 3) A third solution would be passing the widespread objects such as Logger to several classes/functions, but this is not a good solution imho. Is there a better solution not mentioned here ?</p>
<p>I'm aware of the downsides of using global variables and singletons. However, having a global state is not a big issue in my application. I'll prefer solutions that have code clarity and are simple to use. </p>
| python | [7] |
3,912,735 | 3,912,736 | How do I display a decimal to a max of two zeroes after the point | <p>for example.</p>
<p>If I have the decimal</p>
<blockquote>
<p>123.4567</p>
</blockquote>
<p>I want the string</p>
<blockquote>
<p>123.4567</p>
</blockquote>
<p>but if I have the decimal</p>
<blockquote>
<p>123.4000000</p>
</blockquote>
<p>I want the string</p>
<blockquote>
<p>123.40</p>
</blockquote>
<p>Note, this is not rounding, I just don't want to end up with decimal strings with 4 zeroes after the point every time when I convert it to a string.</p>
| c# | [0] |
2,404,895 | 2,404,896 | Java: Solving sample question for exam | <p>I'm studying for a Java exam and I can't seem to solve this sample question correctly. </p>
<p>Suppose the method int sign(int x) returns 1 if x is positive, -1 if x is negative and 0 if x is 0. Given:</p>
<pre><code>int[] nums = {-2, -1, 0, 1, 2};
</code></pre>
<p>what are the values of the elements of nums after the following code is executed?</p>
<pre><code>for(int k=0; k<nums.length; k++)
{
nums[k] -= sign(nums[k]);
nums[k] += sign(nums[k]);
}
</code></pre>
<p>This is a snippet of how I tried to solve it:</p>
<pre><code>nums k -= sign (nums [k])
nums [0] = nums[0]- sign (nums[0])
nums [0] = (-2) - (0)
nums [0] = -2
</code></pre>
<p>Can someone please explain how you get to the answer: <code>-2, 0, 0, 0, 2.</code>. Thanks!</p>
| java | [1] |
4,656,628 | 4,656,629 | Why do print_r and var_dump execute before echo | <p>I'm calling either <code>var_dump()</code> or <code>print_r()</code> on an array that has one value in an <code>echo</code> statement:</p>
<pre><code>echo "<br><br>testArray is ==> " . var_dump($testArray) . " <===<br><br>";
</code></pre>
<p>Here is the actual output in the browser:</p>
<pre><code>array
0 => string '28' (length=2)
testArray is ==> <===
</code></pre>
<p>This is a nuance I don't get. To me, the order of execution is:</p>
<ol>
<li>echo executes and displays <code>testArray is ==></code></li>
<li>the call to var_dump executes and displays the array contents</li>
<li>then the <code><==</code> should execute</li>
</ol>
<p>Instead of seeing 1, 2 then 3 on the output, I'm seeing <code>2, 1, 3</code> in that order.
This is one line of server-side code. What is this nuance?</p>
| php | [2] |
2,840,989 | 2,840,990 | What is the size of a boolean variable in java? | <p>Can any one tell the bit size of boolean in java?</p>
| java | [1] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.