Unnamed: 0 int64 65 6.03M | Id int64 66 6.03M | Title stringlengths 10 191 | input stringlengths 23 4.18k | output stringclasses 10 values | Tag_Number stringclasses 10 values |
|---|---|---|---|---|---|
3,465,456 | 3,465,457 | Adding Years from Date class | <p>Let say i have this:</p>
<pre><code> PrintStream out = System.out;
Scanner in = new Scanner(System.in);
out.print("Enter a number ... ");
int n = in.nextInt();
</code></pre>
<p>i have a random date, for example, 05/06/2015 (its not a fixed date, its random everytime). If I want to take the 'year' of the this date, and add whatever 'n' is to this year, how do i do that?</p>
<p>all the methods in Date Class aren't 'int'. </p>
<p>and to add years from an int, 'years' has to be an int as well</p>
| java | [1] |
1,759,078 | 1,759,079 | android VerifyError | <p>i'm getting this message when i run my application i don't know why i'm getting it could any one help me. here is the logcat. </p>
<pre><code> java.lang.VerifyError: com.kosh.me.Smaller
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1429)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
at dalvik.system.NativeStart.main(Native Method)
</code></pre>
| android | [4] |
4,128,574 | 4,128,575 | is there any way to simplify this double conditional clauses structure? | <p>for example</p>
<pre><code>if (x=="A)
switch (y)
{
case "1": Do1();break;
case "2": Do2();break;
case "3": Do3();break;
}
else if (x=="B")
switch (y)
{
case "1": Do4();break;
case "2": Do5();break;
case "3": Do6();break;
}
else
switch (y)
{
case "1": Do7();break;
case "2": Do8();break;
case "3": Do9();break;
}
</code></pre>
<p>I wish I could do the following, however it has many redundant checks.</p>
<pre><code> if (x=="A" && y=="1")
Do1();
else if (x=="A" && y=="2")
Do2();
else if (x=="A" && y=="3")
Do3();
else if (x=="B" && y=="1")
Do4();
else if (x=="B" && y=="2")
Do5();
else if (x=="B" && y=="3")
Do6();
else if (x=="C" && y=="1")
Do7();
else if (x=="C" && y=="2")
Do8();
else if (x=="C" && y=="3")
Do9();
</code></pre>
| c# | [0] |
1,456,723 | 1,456,724 | How to check if a file has changed? | <p>I have an xml file with database information that should be loaded when the script is installed or when the content of the file changes. Can I use md5_file() on the xml file and then store the value in the db and compare it to the file's hash each time the script is run? Does it have any drawbacks and are there any other methods that are faster/simpler?</p>
| php | [2] |
970,881 | 970,882 | Getting specific value from an array with PHP | <p>If I have an array in the following format: </p>
<pre><code>Array ( [0] => stdClass Object ( [id] => 1 [c] => 1 [q] => value 1. ) [1] => stdClass Object ( [id] => 2 [c] => 1 [q] => value 2...
</code></pre>
<p>and I need to get </p>
<blockquote>
<p>value 1</p>
</blockquote>
<p>Shouldn't I be able to get it by doing something like? </p>
<pre><code>$myArray[0]['q']
</code></pre>
<p>FOr some reason I'm not getting anything...</p>
| php | [2] |
584,239 | 584,240 | Explicit Intent error | <p>I want to new activity when i click an image.
I already write <code>activity android:name=.openPdf</code> in manifestfile.</p>
<p>but it shows me an error:-</p>
<pre><code>"android.content.ActivityNotFoundException: Unable to find explicit activity class {Parsing.this/openPdf.class}; have you declared this activity in your AndroidManifest.xml?
"
</code></pre>
<p>Code ::</p>
<pre><code>iv1.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
// Toast.makeText(getApplicationContext(), "hello",Toast.LENGTH_SHORT).show();
Intent pdf=new Intent(Parsing.this,openPdf.class);
startActivity(pdf);
}
});
</code></pre>
| android | [4] |
74,784 | 74,785 | How to dissmiss keybord when editing UITextField | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/274319/how-do-you-dismiss-the-keyboard-when-editing-a-uitextfield">How do you dismiss the keyboard when editing a UITextField</a> </p>
</blockquote>
<p>I know that I need to tell my UITextField to resign first responder when I want to dismis the keyboard, but I'm not sure how to know when the user has pressed the "Done" key on the keyboard. Is there a notification I can watch for?</p>
| iphone | [8] |
2,436,588 | 2,436,589 | jQuery Xbox Tile Style Animation | <p>I'm wondering if anyone knows of an animation for jQuery similar to that present on the Xbox, specifically with Kinect. The animation takes tiles on the UI and applies a teeter-totter type of effect based on where the mouse (hand input) appears on the tile. So if the mouse appears on the top-right corner the tile will angle backwards ever so slightly to the top-right.</p>
<p>Any ideas?</p>
<p>Thanks,
Brent</p>
| jquery | [5] |
4,806,614 | 4,806,615 | PHP transfer data between 2 remote servers, what is fastest way? | <p>I have Server A and Server B which exchanges some data. Server A on user request pull data from Server B using simple file_get_content with some params, so server B can do all task(database etc) and return results to A which formats and show to user. Everything is in PHP.</p>
<p>Now I am interested what is fastest way to to this? I made some test and average transfer time for average response from server B at (~0.2 sec). In that 0.2 sec, 0.1 sec. aprox. is Server B operational time (pulling data calling few databases etc) what mean that average transfer time for 50kb with is 0.1 sec. (servers are NOT in same network)</p>
<p>Should I try with:</p>
<ol>
<li>cURL insted of file_get_content ?</li>
<li>Or to try to make whole thing with sockets( I never work work with sockets in PHP but I supose that easily can be done, on that way to skip web server )</li>
<li>or something third?</li>
</ol>
<p>I think that time can be 'found' on shortening connection establishing, since now, every request is new connection initiating (I mean on separate file_get_content calls, or I am wrong?)</p>
<p>Please give me your advices in which directions to try, or if you have some better solution I am listening.</p>
| php | [2] |
3,669,484 | 3,669,485 | truncate links with jQuery | <p>My first post here, but I learned a lot already by lurking =) This time, I can't find a solution for problem, although it looks like something that's easy to achieve.</p>
<p>I have a list of links to blogpost, generated with Feed2JS. Unfortunately, the RSS feed that is the source for this adds anchors to the links that I don't want. I can't change the feed, because it's generated automatically in RapidWeaver.</p>
<p>Is it possible to remove everything from the hash in the url's with jQuery? for example: change </p>
<p><a href="http://www.example.com/blog/files/398e042ea42b7ee9d1678b3c53132fc3-31.php#unique-entry-id-31" rel="nofollow">http://www.example.com/blog/files/398e042ea42b7ee9d1678b3c53132fc3-31.php#unique-entry-id-31</a></p>
<p>to</p>
<p><a href="http://www.example.com/blog/files/398e042ea42b7ee9d1678b3c53132fc3-31.php" rel="nofollow">http://www.example.com/blog/files/398e042ea42b7ee9d1678b3c53132fc3-31.php</a></p>
<p>I'm pretty new to jQuery, and still have a lot to learn, so please keep your answer simple.</p>
<p>Jeroen</p>
| jquery | [5] |
1,274,594 | 1,274,595 | How to hide other application Shortcut icons on android desktop from my android application | <p>I am in the finally stage of developing my android application and what i am left with is to hide all other application icon on the phone´s desktop with my application.
Now I found this code here and I have tried to modify it and even add the proper permission but seem not to be getting the desired result.
Kindly help me modify it or suggest how i can modify it to do what i want.
Here is the code</p>
<pre><code>Intent myLauncherIntent = new Intent();
myLauncherIntent.setClassName("your.package.name", "YourLauncherActivityName");
myLauncherIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, myLauncherIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Application Name");
intent.putExtra
(
Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
Intent.ShortcutIconResource.fromContext
(
getApplicationContext(),
R.drawable.app_icon
)
);
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
getApplicationContext().sendBroadcast(intent);
</code></pre>
<p>I would appreciate all the help i can get.
Cheers guys.</p>
| android | [4] |
5,183,168 | 5,183,169 | How can I display random activity when click button | <p>I used following code in main activity</p>
<pre><code>public void button(View v){
//Create an intent to start the new activity.
// Our intention is to start secondActivity
Intent intent = new Intent();
intent.setClass(this,Activity.class);
startActivity(intent);
}
</code></pre>
<p>How can I display random activity when click button? Please help me! </p>
| android | [4] |
1,210,624 | 1,210,625 | flush out buffer into file | <pre><code>int main()
{
string line;
char buff[10];
for(int i=0; i<10;i++)
{
cin.get(buff[i]);
cout.put(buff[i]);
if(i==10)
{
ofstream file;
file.open("TEXT",ios::out);
for (i=0 ; i<10 ;i++)
file << buff[i] << endl;
file.close();
}
}
}
</code></pre>
<p>this code is not flushing the data from array to file and even file is also not created...</p>
| c++ | [6] |
3,028,953 | 3,028,954 | Java Arraylist printing every other number in a list | <p>This is my code for printing the random numbers in an arraylist:</p>
<pre><code>public void printList()
{
System.out.println("The numbers on the list: ") ;
for (int i = 0 ; i < aList.size() ; i++)
{
System.out.print( aList.get(i) + " ") ;
}
System.out.println("\n") ;
}
</code></pre>
<p>How would I print every other number of this same list? By using a do-while loop?</p>
| java | [1] |
5,308,549 | 5,308,550 | configuration of asp.net mailmessage | <p>Can someone help me pls. I am ready to deploy my web application. I have a contact form that i want users to send me a message. Ive created the smtp when i click on submit, i get the error message cannot be sent.
The application is still on my local machine maybe thats why. But i just want to know if this code is good for my form:</p>
<pre><code>Imports System.Net.Mail
Partial Class contact
Inherits System.Web.UI.Page
Protected Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate
If txtComments.Text.Length > 300 Then
args.IsValid = False
Else
args.IsValid = True
End If
End Sub
Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.FinishButtonClick
SendMail(txtEmail.Text, txtComments.Text)
End Sub
Private Sub SendMail(ByVal from As String, ByVal body As String)
Dim mailServerName As String = "SMTP.relay-hosting.secureserver.net"
Dim message As MailMessage = New MailMessage(from, "collins@collinsegbe.com", "feedback", body)
Dim mailClient As SmtpClient = New SmtpClient
mailClient.Host = mailServerName
mailClient.Send(message)
message.Dispose()
End Sub
End Class
</code></pre>
<p>The error is indicated on this line of code: mailClient.Send(message)
I will appreciate help from anyone </p>
| asp.net | [9] |
389,583 | 389,584 | jQuery nested call returning server error 500 | <p>I am not sure why this is happening, but the second jQuery call is giving a 500 error. Is that because nested calls are not allowed? Or something else? Thanks! Below is the whole code:</p>
<pre><code><script type="text/javascript" >
$(function()
{
$('#add_comment').bind('submit',function()
//$("input[type=submit]").click(function()
{
var problem_id = $("#problem_id").val();
var problem_comment = $("#problem_comment").val();
var dataString = 'problem_id='+ problem_id + '&problem_comment=' + problem_comment;
if( problem_id == '' || problem_comment == '' )
{
$('.comment_success').fadeOut(200).hide();
$('.comment_error').fadeOut(200).show();
}
else
{ alert ("2");
// Now check if the person is logged in.
$.ajax({
type: "POST",
url: "/auth/check_login.php",
dataType: "json",
success: function(data)
{
alert ("3");
// Now add the comment!
$.ajax({
type: "POST",
url: "/problems/add_problem_comment_ajax.php",
dataType: "json",
data: dataString ,
success: function(data)
{
$('.add_message_success').fadeIn(200).show();
$('.add_message_error').fadeOut(200).hide();
// Here can update the right side of the screen with the newly entered information
alert ("success");
},
error: function(data)
{
alert ("error");
}
});
},
error: function(json)
{
alert ("error 2");
$("#loginpopup").dialog();
return false;
}
});
}
return false;
});
});
</script>
</code></pre>
| jquery | [5] |
283,017 | 283,018 | Removing different instances in a list | <p>Hi guys!</p>
<p>I have a small problem, i can't verbally explain the problem, so i'll just try to illustrate it in code:</p>
<pre><code>class move(object):
def __init__(self, number):
self.number = number
list1 = [move(1), move(2), move(3), move(4)]
list2 = [move(3), move(7)]
list1.remove(list2[0])
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
list1.remove(list2[0])
ValueError: list.remove(x): x not in list
</code></pre>
<p>As you can see, list1[2] and list2[0] are both derived from the same class and have the exact same attributes, they are only two different instances of this class</p>
<p>What is the optimal solution to this problem?</p>
<p>Thank you very much for your help!</p>
| python | [7] |
5,667,300 | 5,667,301 | why can we declare static object of a class inside the same class? | <pre><code>class A
{
static const A a;
}
</code></pre>
<p>Why we can do this , while we cannot do this without the word static?</p>
| c++ | [6] |
493,730 | 493,731 | Android server data fetch | <p>I want to fetch some data from a server protected with an username and password . I know both the username and password . Since the server is live , the data is continuing changing I need to fetch data every minute to update the application's status . The only function I know that can fetch data and turn it to a string is : </p>
<pre><code>private String getPage() {
String str = "***";
try
{
HttpClient hc = new DefaultHttpClient();
HttpPost post = new HttpPost("http://mywebsite.me");
HttpResponse rp = hc.execute(post);
if(rp.getStatusLine().getStatusCode() == HttpStatus.SC_OK)
{
str = EntityUtils.toString(rp.getEntity());
}
}catch(IOException e){
e.printStackTrace();
}
return str;
}
</code></pre>
<p>Since the server has a logon screen I don't know how to get pass it . So , i'd like help with 2 thigs :<strong>1.</strong> getting the data from the server and <strong>2.</strong> every 1 or 2 minutes I need to refresh my app and fetch again the data .</p>
| android | [4] |
5,576,697 | 5,576,698 | Non-standard library placement new with user-defined allocators | <p>A non-standard library placement new calls a user defined operator new:</p>
<pre><code>class T {};
void* operator new(std::size_t s, T*) {
return new char[s];
}
int main() {
T* t;
new(t) T(); // calls operator new above
return 0;
}
</code></pre>
<p>However, if I am not wrong, the standard placement new does not call the default operator new. This separation allows the standard allocator to use operator new in <code>allocate()</code> to get the memory and placement new to initialize it, with either std::initialize_fill() or <code>construct()</code></p>
<p>Now I don't understand how can I keep the allocation separated from the initialization in a custom allocator when a non-standard placement new is used, since the non-standard placement new always calls a user-defined operator new. Should always force the use of the standard placement new with a static_cast in any allocator?</p>
| c++ | [6] |
3,753,038 | 3,753,039 | Java Finding Elements in Array | <p>I have five arrays where I store incoming int numbers like:</p>
<pre><code>int array1 = {1,6,..}
int array2 = {2,7,..}
.
.
int array5 = {5,10,..}
</code></pre>
<p>Now, what I have to do, search for next numbers in another arrays.</p>
<p>Like, </p>
<pre><code>for(i = 0, i < array1.size ; i++){
int element = array1[0] ;
//here array2, array3, ..., array5 can have different size
search for array2 to find element+1
search for array3 to find element+2
.
.
search for array5 to find element+5
}
</code></pre>
<p>What I am doing right now is:</p>
<pre><code>Run for loop for 0 to array2 size, to find element+1 (so for others)
</code></pre>
<p>However, it is quite slow. Can anybody give me some idea, how to make it faster (I can change array to any-other data-structure also).</p>
<p>Sorry, I make two mistakes while asking, what I should mention:</p>
<pre><code>1) Arrays are sorted (incremental elements always).
2) Array elements are very few (2-3) so Binary Search will be expensive.
3) I have to perform the search for thousand times means when channel input pause, I have to perform search, then again channel start and I have to perform search ... so on.
</code></pre>
| java | [1] |
734,489 | 734,490 | Passing references type variable as method parameter | <p>After running the code below I get this output:
Eve
1200</p>
<p>Could anyone explain me why the value of Person type variable is being changed and value of Integer type variable is not?
I have already read this:</p>
<ol>
<li>www.javaworld.com/javaworld/javaqa/2000-05/03-qa-0526-pass.html</li>
<li>www.yoda.arachsys.com/java/passing.html#formal</li>
</ol>
<p>but I don't get why with Person and Integer types it works different.</p>
<pre><code>public class Test {
public static void main(String[] args) {
Object person = new Person("Adam");
Object integer = new Integer("1200");
changePerson(person);
changeInteger(integer);
System.out.println(person);
System.out.println(integer);
}
private static void changeInteger(Object integer) {
integer = 1000;
}
private static void changePerson(Object person) {
((Person)person).name="Eve";
}
}
</code></pre>
| java | [1] |
3,120,406 | 3,120,407 | how to change landscape mode | <p>hi i am new to iphone.what i am doing is displaying the images grid view. what i need is i have to change my simulator to landscape mode from portrait mode. while rotating the simulator the images are not rotated. how can i rotate images along with simulator.pls post some code for all mode </p>
| iphone | [8] |
574,005 | 574,006 | jQuery: Count specific character in a table column | <p>I have a HTML table where each row has two columns. First column is a capital letter and the second one is a brand name, like so:</p>
<p>A | Amazon</p>
<p>A | Apple</p>
<p>B | BMW</p>
<p>C | Chanel</p>
<p>etc. But whenever there are two brand names that has the same first capital letter I would like the table to look like this:</p>
<p>A | Amazon</p>
<p> | Apple</p>
<p>B | BMW</p>
<p>C | Chanel</p>
<p>In other words, if there are more than one instance of each capital letter I would like to display only the first one. If I applied a class to the first column, is there a way I could achieve this using jQuery?</p>
| jquery | [5] |
1,495,272 | 1,495,273 | how to slove Out of memory problem in android | <p>I need help for out of memory error in android application. In
my application, only
support for portrait mode and i am using background images and icons
images for layout. Theses images are
directly set in layouts for my
application.even, I got out of memory
issues at some time. how to solve this
problem? please give solutions for me.</p>
<p>Thanks and love.</p>
| android | [4] |
4,942,670 | 4,942,671 | Preg match problem | <p>I try to "validate" a date field. I only want to allow, numeric chars and - character.</p>
<pre><code> $born_date=$_POST['date'];
$goodchars = array("1","2","3","4","5","6","7","8","9","0","-");
$char_re_good = '/['.preg_quote(join('', $goodchars), '/').']/';
if (!(preg_match($char_re_good, $born_date))) {
echo "not ok, contain INVALID chars"
}else{
echo "ok, contain valid chars"
}
</code></pre>
<p>If i try to search for "1960" then OK. If i try to search for " asdfg" then NOT OK.
But if i search for "1960/" then the output is OK. I dont understand why. </p>
<p>Could you help me modify to check if user only "0-9" and "-" chars fill out the field.</p>
<p>Thank you</p>
| php | [2] |
1,232,338 | 1,232,339 | How to save timestamp and user in comments column | <p>I have a textarea, where the user can add their comments. Now after adding the comments and clicking submit, it needs to save the comments along with user name and timestamp.</p>
<pre><code><tr><font size="2" face="tahoma" color="black">
<b>Comments </b></br></br>
</tr>
<textarea name="comments" id= "comments" ROWS="10" Cols = "130"> </textarea>
<br/><br /><br /><br />
</code></pre>
<p>Above is my HTML markup for comments and I save the session login username in a variable <code>$user</code>.<br>
Now how can I save it along with timestamp and user?</p>
| php | [2] |
1,255,332 | 1,255,333 | How can i use two different methods in jQuery? | <p>I am trying to have append and show methods if a check box is checked, problem is that both the methods do not work at the same time.It shows either the div or append the table.How can i have both the table and div if the check box is checked?</p>
<p>here is the code:</p>
<pre><code><input type="checkbox" name="want_nl" id="want_nl" value="newsletters" />age
<div id="div1" class="tb" style="background-color:#0099CC">your img here</div>
<table cellpadding="0" cellspacing="0" border="1" width="100%" id="newsletters"></table>
$(function(){
$("input[name=want_nl]").click(function(){
if ($(this).is(":checked"))
{
$('#newsletters').append('<table id="newsletter_types"></table>');
$('#newsletter_types').append('<tr><td colspan="3" ><strong>Optioneel</strong></td></tr>');
$('#newsletter_types').append('<td valign="top">Zoet-houdertje Chocolade lollys</td>');
$('#newsletter_types').append('<td valign="top" >15 stuks a &euro; 22,50</td>');
$('#newsletter_types').append('<td valign="top">uuu</td></tr>');
$('.tb').show();
}
else
$("#newsletter_types").remove();
$('.tb').hide();
});
});
</code></pre>
| jquery | [5] |
5,108,431 | 5,108,432 | Copy part of table with jQuery | <p>I have a large table with data.</p>
<p>The table has a header.</p>
<p>I need to copy exactly the header of that table, from <code><thead></code> to <code></thead></code>, into another section within the same document. How can I do that?</p>
<pre><code><table id="myTbl">
<thead>
<tr>
<th></th>
...
</tr>
</thead>
<tbody>
...
</tbody>
</table>
</code></pre>
| jquery | [5] |
3,887,587 | 3,887,588 | Determine which app store my application was downloaded from? | <p>is it possible to determine the specific country app store my application was downloaded from? I would like to distinguish if a user downloaded my application from the us app store vs. the canada app store?</p>
<p>Not interested in locale settings but the actual store the app came from.</p>
| iphone | [8] |
2,050,470 | 2,050,471 | How to identify iphone , ipad ,ipod touch, iphpne simulator while programming in 3.2 version? | <p>Am unable to identify the device models (iphone , ipad ,ipod touch, iphpne simulator) while programming (in 3.2 version). Alreay am tried with UIDevice Class and some other means, but am unable to get model as ipad when connected to ipad. every time it is giving model other than ipad. So can any one please help me out. Thank you.</p>
| iphone | [8] |
4,802,134 | 4,802,135 | ArrayList or LinkedList | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5846183/arraylist-vs-linkedlist">ArrayList Vs LinkedList</a><br>
<a href="http://stackoverflow.com/questions/8069370/arraylist-vs-linkedlist-which-one-is-better-for-sorting">ArrayList vs. LinkedList which one is better for sorting</a> </p>
</blockquote>
<p>Suppose we have 100 strings(names) and want to sort them, which one is preferred out of ArrayList and LinkedList
And reason(s) for the preference is ?</p>
| java | [1] |
4,713,500 | 4,713,501 | Iphone stop an ASIFormDataRequest | <p>i have a problem in my viewController when i have a pending ASIFormDataRequest (started as an asynchronous task) that is still executing and the user presses the back button (in order to pop the view).</p>
<p>Is there any way to stop that asynchronous task?</p>
<p>I have read that is a method called "clearDelegatesAndCancel" but i don't know if it is what i'm looking for. </p>
<p>Thanks</p>
| iphone | [8] |
5,200,450 | 5,200,451 | java.util.Scanner#findWithHorizon throws OutOfMemory exception on 32Mb input stream | <p>Search string '4914904' exists at the tail of the stream.</p>
<p>Here's the code </p>
<pre><code> Scanner sc = new Scanner(xmlInputStream, "UTF-8");
if(sc.findWithinHorizon('4914904', 0) != null) { // <--- exception is thrown here
}
</code></pre>
<p>Any suggestions would be highly appreciated.</p>
| java | [1] |
5,017,707 | 5,017,708 | Python newbie question - I can't figure out what my problem is exactly | <p>I'm completely new to Python and I've been trying to make a fibonacci program with it.</p>
<pre><code>def fib(n):
print 'n =', n
if n > 1:
return n * fib(n - 1)
else:
print 'end of the line'
return 1
n = raw_input('Input number: ')
int(n)
fib(n)
</code></pre>
<p>When I try to run this program, I get the following error after entering the number:</p>
<blockquote>
<p>Input number: 5</p>
<p>n = 5</p>
<p>Traceback (most recent call last):</p>
<p>File "fibonacci.py", line 11, in
</p>
<pre><code>fib(n)
</code></pre>
<p>File "fibonacci.py", line 4, in fib</p>
<pre><code>return n * fib(n - 1)
</code></pre>
<p>TypeError: unsupported operand type(s)
for -: 'str' and 'int'</p>
</blockquote>
<p>If I run the interpreter and import just the function (without the code after it), supply the value for n and call the function with the value as the parameter, it works.</p>
<p>I tried converting the input to int since I thought it was a string problem but no dice. I don't really know where I went wrong so if you could please shed some light on the subject, it'll be much appreciated. </p>
<p>I'd love to change the problem title to something specific but I don't really know what the problem is.</p>
| python | [7] |
2,356,513 | 2,356,514 | In programming what is OR,And and No-Proximity when searching for keywords in a doc? | <p>this question is related to this site but unfortunately there is no code, i just need an explanation.</p>
| java | [1] |
4,290,697 | 4,290,698 | Is C++ (one of) the best language to learn at first nowdays? | <p>C++ is one of the <a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html" rel="nofollow">most used programming language in the world</a> since like 25+ years.</p>
<p>My first job as programmer was in C++ and I coded in C++ everyday for nearly 4 years. Now I do mostly PHP, but I will forever cherish this C++ background.</p>
<p>C++ has helped me understand many "under the hood" features/behaviors/restrictions of many other (and different) programming languages like PHP and Delphi.</p>
<p>I'm a full time programmer for 7+ years now and since I have a quite varied programming background I often get questions by "newbies" as where to start to become a "good" programmer.</p>
<p>I think C++ is one of the best language to start with because it gives you a real useful experience that will last and will teach you how things work under the hood. It's not the easier one to learn for a newbie, but in my opinion it's one that will reward in the long term. I would like to know your opinion on this matter to add to my arguments when I guide "newbies".</p>
<p>After this introduction, here's my question :</p>
<p><strong>Is C++ (one of) the best language to learn at first nowadays?</strong></p>
<p>Since it's subjective, I've marked this question as community wiki.</p>
<p><strong>EDIT:</strong> This question is not about why Java (or C# or any other language) is better than C++ to start with, it's about what's make C++ a good choice or not a good choice to learn as <strong>one of</strong> your firsts languages. For example, for me C++ made me understand how the memory works. Now today in many languages everything is managed by the garbage collector and some people don't even know that. I'm glad I know how it works underneath and I think it can help you to write better code.</p>
| c++ | [6] |
2,707,151 | 2,707,152 | how to implement login,search,download and install app from Google play programmatically? | <p>I want to develop one application in android which can search,download and install a particular app from Google play.When user provides app name using my application, it should search only free version of app in Google play and once found then download and install the app automatically on the device.</p>
<p>SCENARIO:
1. When user launch app, it should ask for app name (assume gmail id and password are already configured in the device).
2. once successfully login, it should search the free version of app, download and install to the device.</p>
<p>Can anybody provide some valuable inputs about how to achieve it in android? Please share some source code (if available).</p>
<p>Regards,
Piks</p>
| android | [4] |
2,143,839 | 2,143,840 | How can I reduce jQuery? | <p>I'm using just a few basic jQuery functions on my site.<br>
How can I remove unused jQuery code?<br>
Knowing only the basics, I looked at the code and was not sure where to start.
If you could point me in the right direction, that would be appreciated.</p>
<p>Thanks.</p>
| jquery | [5] |
5,312,315 | 5,312,316 | How to get the displaying image on a ImageView | <p>I have this scenario.
The app allows me to take a pic of something and save it to a sqlite db.
By now this app captures the image from the camera device and displays it on an ImageView.
The problem is how to obtain this image from the ImageView and parse it to a byte array</p>
| android | [4] |
4,189,239 | 4,189,240 | C# get text out of HTML and compare them to a string | <p><strong>I don't know if this is possible, but i want to take a certain word out of a HTML webpage (online) for instance the word "Content" and i want to compare it to a string. And this must be all done in C#</strong></p>
<p>First i want to take out a word out of a webpage then compare it to a string. </p>
<p>I hope you understand this question.</p>
<pre><code>HtmlDocument doc = webBrowser1.Document;
HtmlElementCollection col = doc.GetElementsByTagName("Register");
if (col.Equals("Register"))
{
label5.Text = "You are logged out";
}
</code></pre>
| c# | [0] |
1,089,201 | 1,089,202 | android Intent received to onCreate multiple times | <p>hi
I have added an app to the Gallery share menu.
Selecting and sharing one image works fine and this code:</p>
<pre><code>if (Intent.ACTION_SEND.equals(action)) {
</code></pre>
<p>in my onCreate is executed. </p>
<p>The problem is when i press back(destroy) and open the app again
The same Intent is received in the onCreate.</p>
<p>I use the :</p>
<pre><code> android:launchMode="singleTop">
</code></pre>
<p>and the </p>
<pre><code> protected void onNewIntent(Intent intent)
</code></pre>
<p>The onNewIntent is not firing.
I suspect i must clear out the Intent somehow.
and been trying to find and answer but im stuck</p>
| android | [4] |
2,509,939 | 2,509,940 | Crawl Images, Whole Web Pages and cache them | <p>I am starting a project and wonder the relationship between the characters in images and the whole web page where the images reside.</p>
<p>I want to crawl some images and their web pages. I need to save the crawl result in local disk for further analysis. I wonder if there is any open source for this issue? </p>
| python | [7] |
5,382,175 | 5,382,176 | jquery fadein for all images, should be simples? | <p>I thought this would be a simple things to do, but been searching about an hour...</p>
<p>I'm trying to use jquery fadein for all images on a WP site.</p>
<p>I've got as far as loading jquery</p>
<p>but then all the things I find online are really complex, is there a simples .js I can load to apply fadein unilaterally to any image loaded? </p>
<p><em>update: I've worked around the problem: by ditching the WP enqueue and going with the google url. so the problem here is WP specific</em></p>
| jquery | [5] |
4,602,522 | 4,602,523 | Capturing email and password info | <p>I have a screen which displays 3 editText for email address, password and password confirmation. Pressing on the first editText brings up the soft keyboard which necessarily covers the other editTexts. Complete the email address entry and press next and a multiline entry box appears. Complete the entry and press next and a multiline entry box appears. complete the entry - now a done button is shown but pressing it doesnt do anything. I assume it should close the keyboard.</p>
<p>Questions:
Is there some way to indicate what the entry box is for when it appears?
How do I get the done button to work?
Is there a better way to capture email and password info?</p>
| android | [4] |
4,320,114 | 4,320,115 | How do I change the position of a view in a Linear Layout.? | <p>So I have a Linear Layout already populated with children. Is there a way to change the position at which one of the children is located? </p>
<p>I'm trying to swap to views between them if that's of any help.</p>
<pre><code>final LinearLayout parrent = (LinearLayout)findViewById(R.id.llWidgetScreen);
final LinearLayout Delailah = new LinearLayout(this);
Delailah.setLayoutParams(new android.widget.LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
AppWidgetHostView wedgy = attachWidget(mAppWidgetHost.createView(this, appWidgetId, appWidgetInfo));
Delailah.addView(wedgy);
final Button btn = new Button(this);
btn.setLayoutParams(new android.widget.LinearLayout.LayoutParams((int)(20*scale +0.5f), android.view.ViewGroup.LayoutParams.FILL_PARENT, 0f));
btn.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
parrent.removeView(Delailah);
return false;
}
});
btn.setBackgroundColor(mainColor);
btn.setText(parrent.getChildCount()+1+"");
btn.setTextColor(textColor);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(ReadyForDrag==0)
{
btn.setBackgroundColor(actiColor);
ReadyForDrag++;
DragPosition1=Integer.parseInt(btn.getText().toString());
}
else if(ReadyForDrag==1)
{
btn.setBackgroundColor(actiColor);
ReadyForDrag=0;
LinearLayout v1 = (LinearLayout)parrent.getChildAt(DragPosition1);
LinearLayout v2 = (LinearLayout)parrent.getChildAt(Integer.parseInt(btn.getText().toString()));
//move view 2 to position 1
//move view 1 to position 2
}
}
});
Delailah.addView(btn);
parrent.addView(Delailah);
</code></pre>
| android | [4] |
5,116,548 | 5,116,549 | plain text display with vert. scrolling? | <p>Is there an example that would allow a few hundred or thousand words, with paragraphs and CRs, to be displayed in a basic Hello World-style text display, complete with a vert. scroll bar (or vertical grab and move up or down)?</p>
<p>Thanks.</p>
| android | [4] |
1,158,131 | 1,158,132 | Removing 3 nested if-then-else | <p>I'm seeing this code as the equivalent of a mathematical permutation. It tries to set the value of <code>$d</code> based on a combination of <code>$a, $b, $c</code>. Right now it's being done with 3 nested if/then/else. Any other way the same thing can be done more efficiently?</p>
<pre><code>if ($a === true) {
if ($b > 0) {
if ($c === true) {
$d = 6;
} else {
$d = 2;
}
$e = $b;
} else {
if ($c === true) {
$d = 4;
} else {
$d = 0;
}
}
} else {
if ($b > 0) {
if ($c === true) {
$d = 5;
} else {
$d = 1;
}
$e = $b;
} else {
if ($c === true) {
$d = 7;
} else {
$d = 3;
}
}
}
</code></pre>
<p>Notice there's <code>$e = $b;</code> at the end of</p>
<pre><code>if ($a === true) {
if ($b > 0) {
} else {
if ($b > 0) {
</code></pre>
<p>I think I will just remove it out of the whole look and say</p>
<pre><code>if ($b > 0) {
</code></pre>
<p>Any error with that logic for <code>$e = $b;</code>?</p>
| php | [2] |
4,991,288 | 4,991,289 | Reset Class Instance Variables via Method | <p>Does anyone know how to reset the instance variables via a class method. Something like this:</p>
<pre><code>class someClass
{
var $var1 = '';
var $var2 = TRUE;
function someMethod()
{
[...]
// this method will alter the class variables
}
function reset()
{
// is it possible to reset all class variables from here?
}
}
$test = new someClass();
$test->someMethod();
echo $test->var1;
$test->reset();
$test->someMethod();
</code></pre>
<p>I know I could simply do $test2 = new SomeClass() BUT I am particularly looking for a way to reset the instance (and its variables) via a method.</p>
<p>Is that possible at all???</p>
| php | [2] |
4,272,022 | 4,272,023 | Keydown event codes | <p>In a KeyDown event of a textbox, can i check for a range of keyCode</p>
<p>For eg: </p>
<pre><code>if (e.keyCode == 90 to 97 || e.keyCode == 104 to 110)
</code></pre>
<p>How do it write this the correct way?</p>
| jquery | [5] |
1,293,303 | 1,293,304 | How to do mathematical calculation in java based on user input string? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/962778/converting-inserted-string-to-a-compilable-expression">Converting inserted string to a compilable expression</a><br>
<a href="http://stackoverflow.com/questions/3260532/how-can-i-evaluate-a-mathematical-function-in-java">How can I evaluate a mathematical function in Java?</a> </p>
</blockquote>
<p>The user enters some math syntaxes and the program should evaluate the string and the print the result. I know, this is going to be very long, <strong>so I just want to know how should I start doing this program</strong>, assuming the user input string is a validate mathematical syntax - e.g. "23+2*4"</p>
<p>I just started writing java program from few months ago, so I am fairly new to these kind of things in java.</p>
<p>So, how should I evaluate this (example) string, "23+2*4" ? - which should be "31".
I am not asking anyone to write the WHOLE code for me. I just want to know how I should get started so any examples are most welcomed.</p>
<p>Thank you,</p>
| java | [1] |
5,169,110 | 5,169,111 | Having trouble downloading and displaying inputstream in Android | <p>I'm trying to grab an inputStream from a secure website, convert it to a bitmap, and display it. The way I have my code set up (with the Logs displaying length of the byte array etc.) right now is because my error is </p>
<p>01-25 10:29:44.857: D/skia(13452): --- SkImageDecoder::Factory returned null</p>
<p>However that byte array length check responds:</p>
<p>01-25 10:29:44.834: W/bytes length(13452): 21844</p>
<p>I think this must mean that my byte array isn't being downloaded correctly, but I can't figure out how to check that/how I would fix it anyways.</p>
<p>I included my defaultHttpClient code because I want to make sure the way I'm dealing with security isn't somehow affecting the data.</p>
<pre><code>HttpPost post = new HttpPost("https://my.patlive.com//mailbox/messages/get.aspx?MsgID=" + messageId + "&format=bmp");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(3);
nameValuePairs.add(new BasicNameValuePair("username", username));
nameValuePairs.add(new BasicNameValuePair("password", password));
post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
InputStream is = httpclient.execute(post).getEntity().getContent();
byte[] bytes = readFully(is);
Log.w("bytes length", "" + bytes.length);
bmp = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
</code></pre>
<p>Thanks in advance, this has been stumping me for a few days.</p>
| android | [4] |
4,843,845 | 4,843,846 | java...based on Collections | <pre><code>import java.util.ArrayList;
import java.util.*;
class Employee1 implements Comparable<Employee1> {
int empno;
String name;
Employee1(int i,String j) {
empno=i;
name=j;
}
public int compareTo(Employee1 e1) {
Employee1 e2=this;
Integer i1=e1.empno;
Integer i2=e2.empno;
return i1.compareTo(i2);
}
}
public class Employee {
public static void display(ArrayList<Employee1> i) {
for(Employee1 o:i){
System.out.println(o.empno);
}
}
public static void main(String[] args) {
ArrayList<Employee1> ob=new ArrayList<Employee1>();
Employee1 e1=new Employee1(1001,"A");
Employee1 e2=new Employee1(1002,"B");
ob.add(e2);
ob.add(e1);
Collections.sort(ob);
display(ob);
}
}
</code></pre>
<p>The output should be <code>1001 1002</code> but instead the output is <code>1002 1001</code>.</p>
<p>First I passed the <code>e2</code> object with <code>empno</code> to the List and then
<code>e1</code> with <code>empno</code> of 1001</p>
<p>Due to the <code>compareTo</code> method in <code>Employee1</code> - <code>e1.compareTo(e2);</code> should be the same as <code>1001.compareTo(1002);</code> So why are they showing in the wrong order?</p>
| java | [1] |
3,436,992 | 3,436,993 | how replace a character in a string in javascript | <p>i have a string :</p>
<pre><code>var s="here_we_go";
</code></pre>
<p>how can i replace all occurrence of '_' by '$' so the string will become: </p>
<pre><code>s="here$we$go";
</code></pre>
| javascript | [3] |
5,976,850 | 5,976,851 | Wrote warnings in file in Windows from during execution | <p>How to start .jar application from command line and wrote errors ( exceptionsand warnings, all what is in Console in eclipse during execution ) in errors.text on Windows ?</p>
| java | [1] |
4,012,738 | 4,012,739 | Asp.net webforms generated code not well formatted | <p>Hi I recently started to learn asp.net webforms and I noticed that the code it generates is very messy when you check the source code of the page.Here is what I mean:
<img src="http://i.stack.imgur.com/HhgLG.png" alt="enter image description here"> </p>
<p>Is there a way to make the code look better formated or is this the way that webforms should generate code?</p>
| asp.net | [9] |
2,576,443 | 2,576,444 | exception (ab)use in web development | <p>I find myself using exception in web development even for conditions that are not really errors, let alone exceptional ones - just logic decisions, validations...</p>
<p>in a web page, I often write code like so:</p>
<pre><code>try
{
int id;
if(!int.TryParse(txtID.Text, out id))
throw new Exception("ID must be an integer");
if(IdAlreadyExists(id))
throw new Exception("ID already exists in database");
//and so on...
}
catch(Exception ex)
{
SetErrorLine(ex.Message);
}
</code></pre>
<p>I was wondering if this is really the correct way of using exceptions and enforcing Business Logic in web development.</p>
<p>P.S.: I am using asp.net, and obviously I could use ASP.NET validators for some of these and also seperate UI from logic, but I'm trying to make a point on the general idea.</p>
| asp.net | [9] |
1,561,470 | 1,561,471 | Mail sending error from the IIS and Shared Server in asp.net | <p>Im doing a project where i have to send a link to my user/clients. The mail will be sent to them once they register their account. Now there will be a link in their mail when clicked on that link the users will be redirected once again to my website and they will be shown a pdf.</p>
<p>When i did this from my system and localserver it worked fine.</p>
<p>But now my project has been put up in the development server from where its not possible for me to send mail. </p>
<p>I get the following errors</p>
<p>Message: Sys.WebForms.PageRequestManagerServerErrorException: AspPDF.NET 2.0.0.14045 has generated error #46: [ Opening output file failed: Access to the path 'C:\inetpub\wwwroot\Myesign\UploadedFiles\Signed\Support2(1).pdf' is denied. ]</p>
<p>Im not clear that what might be the possible reason for this error. The same project worked when i used the localserver and from my pc also worked fine but from the production server the same project is not working.</p>
<p>Also the link that i get in my mail id is</p>
<p>"http://localhost/ScriptResource.axd?d=n3csX8loR-nh3aSKQ4FNi7Vth7ZBerv1fa-7sJrneEaqqdsyYs5M1zxZ6mXbdwJ0oPXtyofmMkG8z9SZaK8qgo6xYZPs72x4Icy0pXeiYtTxb_JCbdFLZmwvpEToNB0tY6mtEQ2&t=2939b118"</p>
<p>in the above link dont need the "http://localhost/" is there anything i can do about. Im sure there might be some way but im not able to find it.</p>
| asp.net | [9] |
951,325 | 951,326 | Calling Parent class method, from an object pointer? | <p>Assuming I have a class B derived from A</p>
<p>A defined foo() and also, B defines foo()</p>
<p>I have a method in another class that receives a B* (pointer to B). In that function, can I call the A::foo(), just by using the pointer to B the function received?</p>
| c++ | [6] |
3,607,962 | 3,607,963 | url rewriting in php htaccess | <p>1) I want to create a clean url web site. My server is CGI/FastCGI. I know how this does in apache. But how I will do this in CGI server, does any one give me the details?</p>
<p>2) I want to create the clean url like
<code>mydomain/index.php?id=1&sort=a</code> to</p>
<p><code>mydomain/index/id/1/sort/a</code>
Is it possible?</p>
<p>Does any one help me? </p>
| php | [2] |
3,445,173 | 3,445,174 | jQuery Load default image if other fails | <p>I have been asking around but I dont seem to be getting any answers.</p>
<p>I want to load a default image which will be "/images2/no-avatar.png" if another image fails. The img id will be "avatar".</p>
<p>I have the latest version of jQuery so that wont be an issue.</p>
<p>The image will look something like this:</p>
<pre><code><img src="http://www.website.com/the-image.jpg" height="100" width="100" id="avatar" />
</code></pre>
<p>and if it fails look like this</p>
<pre><code><img src="/images2/no-avatar.png" height="100" width="100" id="avatar" />
</code></pre>
<p>I have been trying to find this for a while with no answers, so if you help thanks in advanced.</p>
| jquery | [5] |
5,072,183 | 5,072,184 | Android finish() Activity Not working | <p>I got this error in my codes when i use <code>finish();</code> "The method finish() is undefined for the type SaveImageTask" . Am I missing some declarations or anything. Can someone please guide me on this. </p>
<pre><code> public class SaveImageTask extends AsyncTask<String , String , String> {
private Context context;
private ProgressDialog pDialog;
boolean bCancelled=false;
public SaveImageTask(Context context) {
this.context = context;
}
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
pDialog = new ProgressDialog(context);
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.setOnCancelListener(cancelListener);
pDialog.show();
}
@Override
protected String doInBackground(String... args) {
// TODO Auto-generated method stub
// MY STUFF
return null;
}
@Override
protected void onPostExecute(String args) {
// TODO Auto-generated method stub
pDialog.dismiss();
}
OnCancelListener cancelListener=new OnCancelListener(){
@Override
public void onCancel(DialogInterface arg0){
bCancelled=true;
SaveImageTask.this.finish(); // <<----"The method finish() is undefined for the type SaveImageTask"
}
};
}
</code></pre>
| android | [4] |
3,880,724 | 3,880,725 | Is there an easy way in Python to wait until certain condition is true? | <p>I need to wait in a script until a certain number of conditions become true?</p>
<p>I know I can roll my own eventing using condition variables and friends, but I don't want to go through all the trouble of implementing it, since some object property changes come from external thread in a wrapped C++ library (Boost.Python), so I can't just hijack <code>__setattr__</code> in a class and put a condition variable there, which leaves me with either trying to create and signal a Python condition variable from C++, or wrap a native one and wait on it in Python, both of which sound fiddly, needlessly complicated and boring.</p>
<p>Is there an easier way to do it, barring continuous polling of the condition?</p>
<p>Ideally it would be along the lines of</p>
<pre><code>res = wait_until(lambda: some_predicate, timeout)
if (not res):
print 'timed out'
</code></pre>
| python | [7] |
379,786 | 379,787 | How to identify particular component from tablerow | <p>For EditText I have hard coded as mention code below but how can I check for Button, Spinner and other component...</p>
<pre><code>for(int i=0; i< tbl.getChildCount(); i ++) {
LinearLayout ll= (LinearLayout)tbl.getChildAt(i);
TableRow tbr =(TableRow)ll.getChildAt(0);
EditText edttxt = (EditText)tbr.getChildAt(1);
}
</code></pre>
| android | [4] |
1,116,453 | 1,116,454 | Non SMTP email with Python | <p>I want to send emails with custom 'FROM' field, like *noreply@example_company.com*, it's easy to do in PHP, but I don't know how to do that in python and can't find any good documentation. </p>
<p>in other words, what is the python equivalent of the following php code?</p>
<pre><code>$to = "user@gmail.com";
$subject = "Weekly news";
$message = "Hello, you've got new Like";
$from = "noreply@example_company.com";
$headers = "From: WeekNews" . '<'.$from.'>';
mail($to,$subject,$message,$headers);
</code></pre>
<p>Note that there is no need to setup SMTP server connection, you just give it a custom $from address.</p>
| python | [7] |
5,840,993 | 5,840,994 | threading and getting COM port of attached phone | <p>i have the following code:</p>
<pre><code>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public class ThreadWork
{
public static void DoWork()
{
}
}
private void Form1_Load(object sender, EventArgs e)
{
ThreadStart myThreadDelegate = new ThreadStart(ThreadWork.DoWork);
Thread myThread = new Thread(myThreadDelegate);
myThread.Start();
// Begin communications
serialPort1.Open();
serialPort1.Write("AT+CMGF=1\r\n");
//Thread.Sleep(500);
serialPort1.Write("AT+CNMI=2,2\r\n");
//Thread.Sleep(500);
serialPort1.Write("AT+CSCA=\"+4790002100\"\r\n");
//Thread.Sleep(500);
}
private void serialPort1_DataReceived_1(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
string response = serialPort1.ReadLine();
this.BeginInvoke(new MethodInvoker(() => textBox1.AppendText(response + "\r\n")));
}
}
}
</code></pre>
<p>what i am trying to do is send AT COMMANDS to my phone which is attached to the computer through USB</p>
<ol>
<li><p>how do i know how to configure the properties of the serial port? (like which COM is the phone on [it's attached through USB], what about baudrate and databits?)</p></li>
<li><p>when i run the program nothing really happens, i would like to send AT COMMANDS to my phone and the textbox is there to receive the response from my phone</p></li>
<li><p>this is my first time using threads. am i using them correctly? what is the purpose of it in the current example? is it to just have a delay between send a response?</p></li>
</ol>
<p>what am i doing wrong?</p>
| c# | [0] |
1,663,615 | 1,663,616 | jquery detect change in class assignment | <p>Does anyone know a way to detect when a given element's class has changed using JQuery?</p>
<p>I'm using the "simply countable" JQuery plug-in to notify the user of the number of characters entered into a text area. When the user exceeds the allowed number of characters, I would like to disable the "post" button.</p>
<p>Since simply countable changes the assigned CSS class when the limit is reached, my idea was to capture that event so that I could disable the post button, but perhaps there is a better way?</p>
<p>Any suggestions are welcome.</p>
<p>Thanks.</p>
| jquery | [5] |
4,819,185 | 4,819,186 | Recommendation for Free PHP basic auction script | <p>I need the most simple auction script you can imagine.<br>
I dont need categories, just a listing of items in a single page. </p>
<p>It needs to have a description with pictures.<br>
I have mysql, php, cgi, perl, ruby .. and a lot of other stuff installed on my server, but I prefer PHP.<br>
Can anyone please give me an idea of such a basic script ? Free/GPL is preferred of course :)</p>
| php | [2] |
1,769,684 | 1,769,685 | Creating single instance of HTTPClient Object | <pre><code>var SingletonClass = (function(){
function SingletonClass() {
var JsonClient = Titanium.Network.createHTTPClient();
return JsonClient ;
}
var instance;
return {
getInstance: function(){
if (instance == null) {
instance = new SingletonClass();
// Hide the constructor so the returned objected can't be new'd...
instance.constructor = null;
}
return instance;
}
};
})();
</code></pre>
<p>Will my SingletonClass return me only one instance of my <code>JsonClient</code>? I want to resume my JsonClient instance across the application without creating new instances for each request.</p>
| javascript | [3] |
5,276,854 | 5,276,855 | Any way to catch ACTION_UP in a view that did not intercept ACTION_DOWN? | <p>I'm trying to implement a drag-drop functionality for pre-honeycomb devices. I'd like to touch an item in one frame layout, drag it over another frame layout, and have the second frame see the ACTION_UP event. Unfortunately haven't found a way to do that, it seems only the view hierarchy that saw the original ACTION_DOWN gets notified of the ACTION_UP.</p>
<p>I've got the drag part working, but when I release my finger, the view underneath the ACTION_UP gets no notification at all. Is there any way to workaround this?</p>
| android | [4] |
4,285,477 | 4,285,478 | How do I list the libraries that exist in python? | <p>For example, in rails you can do a 'gem list' and it will show all of the gems that you have installed. </p>
<p>Any clue how I can do this in python? Also, I am using virtualenv, not sure if that helps?</p>
| python | [7] |
1,374,942 | 1,374,943 | why does the subclass have to invoke the no args constructor in the super class? | <p>On the piece of code below, I understand super(t) in the subclass is explicitly invoking a no-args constructor in its superclass (class B). What I seem to be having problems understanding is why does the subclass have to invoke the no-args constructor in the superclass? I can't seem to work out the purpose of this?</p>
<pre><code>public class Test {
public static void main(String[] args) {
B b = new B(5);
}
}
class A extends B {
public A(int t) {
super(t);
System.out.println("A's constructor is invoked");
}
}
class B {
public B(int k) {
System.out.println("B's constructor is invoked");
}
}
</code></pre>
| java | [1] |
711,606 | 711,607 | Adding a new string to the last line of a file | <p>Like the tittle says, I would like to add a new string on the bottom of the file, but somehow, its not working.
Hope someone can help me out x___x</p>
<pre><code> private string add(string asd){
{string filename = "asd.txt";
StreamReader reader = new StreamReader(filename);
StreamWriter write = new StreamWriter(filename);
string input = null;
while ((input = reader.ReadLine()) != null)
{
write.WriteLine(input);
}
reader.Close();
write.WriteLine(asd);
write.Close();}
</code></pre>
| c# | [0] |
1,175,430 | 1,175,431 | Contacts not appear in list of Android Phone | <p>I made this code to insert contacts. First name is inserted and then a phone.</p>
<p>The problem is: I do not know if entered. Each time you debug the code, the rawcontactid is incremented (like the time before that right).</p>
<p>But not on the list of default android - phonebook.</p>
<p>Could anyone help me? The following codes:</p>
<pre><code>public static long addNewNameToContact(Context context, String nome) {
long rawContactId = 0;
ContentValues values = new ContentValues();
values.put(RawContacts.ACCOUNT_TYPE, "");
values.put(RawContacts.ACCOUNT_NAME, "");
Uri rawContactUri = context.getContentResolver().insert(RawContacts.CONTENT_URI, values);
rawContactId = ContentUris.parseId(rawContactUri);
values.clear();
values.put(Data.RAW_CONTACT_ID, rawContactId);
values.put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE);
values.put(StructuredName.DISPLAY_NAME, nome);
context.getContentResolver().insert(Data.CONTENT_URI, values);
return rawContactId;
}
public void putPhoneInContact(String phone, long id, int phonetipo) {
Uri contact = ContentUris.withAppendedId(Contacts.CONTENT_URI, id);
ContentValues values = new ContentValues();
values.clear();
// Selecionando o tipo.
switch (phonetipo) {
case 0:
values.put(ContactsContract.CommonDataKinds.Phone.TYPE,
ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE);
break;
case 1:
values.put(ContactsContract.CommonDataKinds.Phone.TYPE,
ContactsContract.CommonDataKinds.Phone.TYPE_HOME);
break;
case 2:
values.put(ContactsContract.CommonDataKinds.Phone.TYPE,
ContactsContract.CommonDataKinds.Phone.TYPE_WORK);
break;
}
values.put(ContactsContract.CommonDataKinds.Phone.NUMBER, phone);
context.getContentResolver().update(contact, values, null, null);
}
</code></pre>
<p>Thanks for the help!</p>
| android | [4] |
773,046 | 773,047 | Passing date with backslashes in a URL: Android | <p>Just a simple quick question. I want to pass a date in my HTTP request. The date format is like this <code>22\July\2012</code>. Here's the URL which I am trying to pass. Where <code>dateChat =22\July\2012</code></p>
<pre><code>if(this.dateChat!="") {
this.dateChat.replace("\\", "\\\\");
}
httpclient= new DefaultHttpClient();
httpget = new HttpGet("http://10.116.27.107/php/Chat/xmlManipulator.php?" +
"action="+this.action+"&username="+this.userName+
"&chatText="+this.chatText+"&email="+this.email+
"&callfrom="+this.callFrom+"&dateChatToRetrieve="+this.dateChat);
</code></pre>
<p>The logcat is giving the following error:</p>
<pre><code> 07-15 20:26:40.165: E/AndroidRuntime(2000): FATAL EXCEPTION: main
07-15 20:26:40.165: E/AndroidRuntime(2000): java.lang.IllegalArgumentException:
Illegal character in query at index 146:
http://10.116.27.107/php/Chat/xmlManipulator.php?action=ReturnUserAdminChats&username=You&chatText=a&email=You&callfrom=admin&dateChatToRetrieve=5\July\2012
</code></pre>
| android | [4] |
2,308,334 | 2,308,335 | Simple PHP Shopping Cart without SQL | <p>I'm trying to create a simple PHP shopping cart with prices, products, registration, and a checkout area. I've searched Google for tutorials but all of them incorporate SQL which is not within my skill set yet. Anyone have any examples or other tutorial resources you could refer to a PHP novice?</p>
<p>Again just trying to create simple PHP shopping cart (no SQL) using arrays for products, functions for various program tasks, form validation, cookies/sessions for cart continuity, template files, and confirmation/receipt emails.</p>
<p>Thanks in advance for any help!</p>
| php | [2] |
5,382,571 | 5,382,572 | jscript converter | <p>Does anyone know of a good jscript converter. Trying to take a windows environment page (asp) to nix (php) Was able to convert the asp but having trouble with the jscript. Thanks.</p>
| javascript | [3] |
5,716,500 | 5,716,501 | C# how to wait for a webpage to finish loading before continuing | <p>I'm trying to create a program to clone multiple bugs at a time through the web interface of our defect tracking system. How can I wait before a page is completely loaded before I continue?</p>
<pre><code>//This is pseudo code, but this should give you an idea of what I'm trying to do. The
//actual code uses multi-threading and all that good stuff :).
foreach (string bug in bugs)
{
webBrowser.Navigate(new Uri(url));
webBrowser.Document.GetElementById("product").SetAttribute("value", product);
webBrowser.Document.GetElementById("version").SetAttribute("value", version);
webBrowser.Document.GetElementById("commit").InvokeMember("click");
//Need code to wait for page to load before continuing.
}
</code></pre>
| c# | [0] |
4,785,534 | 4,785,535 | what does mean with AccountExpirationDate? | <p>what does mean with AccountExpirationDate ?does this mean that accolunt will be deleted after this period?i want to delete the account programaticlly after a specific period.</p>
<p>here my code snippet :</p>
<pre><code> void _createUserAccount(String User, String Pass, DateTime expirationDate)
{
PrincipalContext pc = new PrincipalContext(ContextType.Machine);
System.DirectoryServices.AccountManagement.UserPrincipal u = new UserPrincipal(pc);
u.SetPassword(Pass);
u.Name = User;
u.Description = "New User";
u.UserCannotChangePassword = true;
u.PasswordNeverExpires = false;
u.AccountExpirationDate = expirationDate;
u.Save();
}
</code></pre>
<p>and in page_load ;i am calling this method:</p>
<pre><code>_createUserAccount(Request.QueryString["UserName"].ToString(), Request.QueryString["Password"].ToString(), Convert.ToDateTime(Request.QueryString["ExpireDate"].ToString()));
</code></pre>
<p>but after the period ended ;i checked the users account on my PC and found the account still exists.</p>
<p>any idea??</p>
| asp.net | [9] |
1,602,051 | 1,602,052 | PHP errors localization | <p>I had updated PHP to 5.3.10 on my workstation. PHP began to show all error in russian language (CP1251 encoding). I can't find a way to change encoding of error messages or language back to english.</p>
| php | [2] |
2,547,802 | 2,547,803 | rerun javascript on callback | <p>I have a page which shows a map (PolyMap - polymaps.org) within a Devexpress CallbackPanel. When the page initially loads, the map loads just fine, but when a callback is performed within the CallbackPanel, the map does not load. I think that I have narrowed it down to the fact that the javascript is not being reinitialized on the callback, and I know that I need to handle this through the CallbackPanel-EndCallback event.</p>
<p>What I don't know, is how to actually accomplish this in my JS function. I am REALLY new to javascript, and I know how to call specific functions from another function, but I run a complex series of functions within a separate javascript file to load the map using the following tag at the bottom of the page:</p>
<pre><code><script type="text/javascript" src="../js/PolyMaps/DiseaseMap.js" id="MapLoad"></script>
</code></pre>
<p>I would really like to avoid having to completely re-write everything into the EndCallback function, and I know that this has to be a really simple answer, but how do I reinitialize the entire script within another javascript function? i.e.</p>
<pre><code>Function ReRun() {
//Re-Initialize MapLoad Script
}
</code></pre>
| javascript | [3] |
999,106 | 999,107 | Is there a quicker way of writing this simple jQuery command? | <p>I would prefer to use .slideToggle and 3 lines of code but not sure how to get the script to 'refresh' itself after it's slid open and return to it's orginal state when it's slid back up (it doesn't slide back up when I use 3 lines and a .slideToggle). Sorry for the bad technical explanation. </p>
<pre><code>$('#showHide').hide();
$('a#slickShow').click(function() {
$('#showHide').show(400);
$('.archiveText2 a').replaceWith('<a id="slickShow" href="#">View less Blog Entries<span class="archiveLink2">{</span></a>');
$('a#slickShow').click(function() {
$('#showHide').hide(400);
$('.archiveText2 a').replaceWith('<a id="slickShow" href="#">View more Blog Entries<span class="archiveLink2">}</span></a>');
</code></pre>
<p><strong>This is the code that eventually got it working</strong></p>
<pre><code>$('#showHide').hide();
$('#slickShow').click(function(){
$('#showHide').slideToggle(400, function() {
if ($('#showHide').is(':visible')){
$('.archiveText2 a').html('View less Blog Entries<span class="archiveLink2">{</span>');
}
else{
$('.archiveText2 a').html('View more Blog Entries<span class="archiveLink2">}</span>');
}
});
return false;
});
</code></pre>
| jquery | [5] |
75,900 | 75,901 | How to get an objects string and add this to a string array | <p>I have an <code>ArrayList</code> of my own class <code>Case</code>. The class case provides the method <code>getCaseNumber()</code> I want to add all of the cases casenumber to a <code>String[] caseNumber</code>. I've tried this</p>
<pre><code>public String[] getCaseNumberToTempList(ArrayList<Case> caseList) {
String[] objectCaseNumber = null;
for(int i = 0; i < caseList.size(); i++) {
objectCaseNumber[i] = caseList.get(i).getCaseNumber();
}
return objectCaseNumber;
}
</code></pre>
<p>But my compiler complaints about that the <code>objectCaseNumber</code> is null at the point insid the for-loop. How can I manage to complete this? </p>
| java | [1] |
3,975,635 | 3,975,636 | Android: How to use a Android Pad as a customer information Terminal | <p>I want to us an Android-powered Pad as an information terminal for my customers.</p>
<p>The only thing it has to to is to show a HTML5 Webpage.</p>
<p>Therefore,
1. it should not be posiible to show another website (only the local one), should be no problem</p>
<ol>
<li><p>it should be only possible to leave the app with a password (how?)</p></li>
<li><p>and all buttons should be disabled (that´s hard).</p></li>
</ol>
<p>I found out how to set the target for the home button, but maybe there is an existing solution.</p>
<p>Thanks</p>
<p>Christian</p>
| android | [4] |
4,397,773 | 4,397,774 | move part of a string to another part of the string | <p>I have a very simple textbox given to a user.</p>
<pre><code><textarea name="text">ENTER YOUR TEXT, DUDE!</textarea>
</code></pre>
<p>Sometimes, users could input something like this:</p>
<pre><code>blablablatext blablabla $ 10 blablabla blablablatext
</code></pre>
<p>Which is fine but what I want to do is take the dollar symbol and automatically place it after the number (or vice versa):</p>
<pre><code>blablablatext blablabla 10 $ blablabla blablablatext
</code></pre>
<p>Basically, what I want to do is:</p>
<ol>
<li>Detect if there is a currency symbol</li>
<li>Detect if numbers appear right after the symbol</li>
<li>Detect if, for example, a letter (or nothing) appears right after the numbers</li>
<li>Take the currency symbol and place it inbetween the numbers and letters (or just after the numbers if there is nothing afterwards)</li>
</ol>
<p>What is the best way to do it? Is something like that possible?</p>
| php | [2] |
3,634,575 | 3,634,576 | Javascript getElementById null error | <p>I posted quite recently about an issue with javascript in firefox, and it was denoted the problem was likely document.write() overwriting the script somehow. <a href="http://stackoverflow.com/a/12028845/1433767">It was suggested I use IDs to solve the problem of both overwriting the script and to avoid stacking of the information</a>.</p>
<p>However, on trying to implement the IDs into my javascript and html code, I found that firebug reports that:</p>
<pre><code>"TypeError: document.getElementById("author_container") is null"
</code></pre>
<p>Despite the fact, that, once again, the ID is already defined under:</p>
<pre><code><p id="author_container"></p>
</code></pre>
<p>And there are clearly no typos, <strong>and re-arranging the script</strong> into the head section or altering it so the p occurs before the script <strong>makes absolutely no difference</strong>. (Note the other example runs fine despite the script occurring first).</p>
<p>If I use a pre-existing example of an ID and getElementById and run it in firefox, it runs fine:</p>
<p><a href="http://pastebin.com/FTEX1HGE" rel="nofollow">http://pastebin.com/FTEX1HGE</a></p>
<p>But if I try to run my code, which doesn't seem that majorly different, I run into issues:
<a href="http://pastebin.com/XfGUpZAS" rel="nofollow">http://pastebin.com/XfGUpZAS</a></p>
<p>Am I missing something here? How do I alter the code to make it work in firefox? Will firefox allow me to ever run my code correctly? (Find out next week?)</p>
| javascript | [3] |
562,636 | 562,637 | Why does TheyWorkForYou (TWFY) web API always returns '{}' | <p>I'm calling a web API exposed by TheyWorkForYou (TWFI).
<a href="http://www.theyworkforyou.com/api/" rel="nofollow">http://www.theyworkforyou.com/api/</a></p>
<p>I'm using the Python bindings provided by twfython:
<a href="http://code.google.com/p/twfython/" rel="nofollow">http://code.google.com/p/twfython/</a></p>
<p>I wrote some code to call this API a few months ago, at which time it worked fine. But now I dig it out to run it again, no matter what query I ask of the API, it always returns '{}' (an empty dictionary). For example the following code, which should return a list of all MPs:</p>
<pre><code>from twfy import TWFY
API_KEY = 'XXXXXXXXXXXXXXXXXXXXXX'
twfy = TWFY.TWFY(API_KEY)
print twfy.api.getMPs(output='js')
</code></pre>
<p>Am I being really dumb? What else should I check?</p>
| python | [7] |
3,193,067 | 3,193,068 | How to change the progress drawable of SeekBar dynamically from the program? | <p>I would like to change the color of the progress (not the <code>SeekBar</code> background) of a <code>SeekBar</code> dynamically from the program.</p>
<p>Using <code>seekbar.setProgressDrawable(Drawable drawable)</code> only changes the background of the <code>SeekBar</code>. All the examples I've seen make use of drawables from XML which are static at runtime.</p>
<p>The color changes according to some user activity and I need to set this to the progress drawable of the seekbar. So I'm programming my own drawable in my code.</p>
<p>In XML, we can specify the item IDs (such as background, progress, etc.) to get a drawable? How to achieve this in program?</p>
| android | [4] |
5,014,920 | 5,014,921 | Page refreshes immediately after draw (x3Dom) | <p>I would like the "Add Cone" button to draw a cone, but it seems the code below refreshes the browser immediately after the cone is drawn. What I would like would be for the page to stay on the cone page after each button click, without the refresh. Any help would be much appreciated. </p>
<pre><code> <script>
function addCone() {
var scene = document.getElementsByTagName("scene")[0];
var cone = document.createElement("cone");
var shape = document.createElement("shape");
var appearance = document.createElement("appearance");
var material = document.createElement("material");
appearance.appendChild(material);
shape.appendChild(appearance);
shape.appendChild(cone);
scene.appendChild(shape);
return true;
}
</script>
<div id="content">
<form>
<button onclick="addCone()">Add Cone</button>
</form>
</div>
</code></pre>
| javascript | [3] |
4,283,992 | 4,283,993 | Please Let me know, How to enable Two-Finger rotation on Apple Map using MKMapView | <p>I am new in iPhone, as per customer requirement i want to enable Two-Finger rotation using MKMapView, How can i enable Two-Finger rotation as we can see in Apple Maps in iOS6 ? If any one has done yet please help.</p>
<p>Please help me to come out.</p>
<p>thank you in advance.</p>
| iphone | [8] |
3,430,173 | 3,430,174 | Is there any way to Intercept incoming calls/sms to either block/unblock it?..Android | <p>hi
Is there any way to intercept incomming calls/sms (to block or unblock it) on the basis of mobile numbers which are added to screening list.
Thanks in Advance...</p>
| android | [4] |
3,534,525 | 3,534,526 | PHP - Please help me to complete my project | <p>How to link the code to smtp. And how to link smtp to my localhost. and how to substitute this with my ISP details and the email id to the email id which i use for sending.</p>
<p><strong>Below is the Code for your reference</strong></p>
<pre><code><?php
ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);
include('config.php');
// table name
$tbl_name="temp_members_db";
// Random confirmation code
$confirm_code=md5(uniqid(rand()));
// values sent from form
$name=$_POST['name'];
$email=$_POST['email'];
$country=$_POST['country'];
// Insert data into database
$sql="INSERT INTO $tbl_name(confirm_code, name, email, password, country)VALUES('$confirm_code', '$name', '$email', '$password', '$country')";
$result=mysql_query($sql);
// if suceesfully inserted data into database, send confirmation link to email
if($result){
// ---------------- SEND MAIL FORM ----------------
// send e-mail to ...
$to=$email;
// Your subject
$subject="Your confirmation link here";
// From
$header="FROM: your email";
// Your message
$message="Your Comfirmation link \r\n";
$message.="Click on this link to activate your account \r\n";
//$message.="http://www.yourweb.com/confirmation.php?passkey=$confirm_code";
$message.="http://localhost/confirmation.php?passkey=$confirm_code";
// send email
$sentmail = mail($to,$subject,$message,$header);
}
// if not found
else {
echo "Not found your email in our database";
}
// if your email succesfully sent
if($sentmail){
echo "Your Confirmation link Has Been Sent To Your Email Address.";
}
else {
echo "Cannot send Confirmation link to your e-mail address";
}
?>
</code></pre>
| php | [2] |
5,193,044 | 5,193,045 | file browser in iphone? | <p>I am new to Iphone.How to create file browser in iphone ?
I wish to show all the files and folders in the iphone.How to do this?</p>
| iphone | [8] |
859,201 | 859,202 | Setting variable and counting | <pre><code>$counter = "";
if($sWall>1){
$counter = $counter + $sWall;
}
if($sWC>1){
$counter = $counter + $sWC;
}
if($sOther>1){
$counter = $counter + $sOther;
}
if(!(empty($counter))){
echo "(".$counter.") ";
}
</code></pre>
<p>This is what I have that does not work.
<code>$sOther</code>, <code>$sWC</code>, <code>$sWall</code> is <code>mysql_num_rows</code>. I wish to echo out e.g (3) if you have 1 in <code>$sOther</code>, 1 in <code>$sWC</code> and 1 in <code>$sWall</code>.</p>
<p>How can I do that, what I did is just something I tried.</p>
| php | [2] |
1,631,025 | 1,631,026 | System retval for returning | <p>If there a way of avoiding the <code>$retval == 0</code>, so I can quickly call a system program for a test?</p>
<pre><code><?php
function test() {
system("grep -q foobar " . __FILE__, $retval);
if ($retval == 0) { return true; } else { return false; }
}
if (test()) { echo "true\n"; } else { echo "false\n"; }
?>
</code></pre>
| php | [2] |
4,582,909 | 4,582,910 | return by reference - which of the two is the correct one | <p>i have the function: const A& f(...) {...}</p>
<pre><code>a. const A a1 = f(..);
b. const A &a2 = f(...);
</code></pre>
<p>which of the is the better one to use? in both cases, if i understand correctly, i prevent the possibility of modifying the returned object.
in the first option, the copy constructor of A will be called - am i correct?</p>
| c++ | [6] |
5,970,908 | 5,970,909 | Best practice - How to test if a string exists in Java? | <p>I render some data based on a condition. The backing method performs a check if a string exists. But I don't know if I can be happy with the compare to <code>null</code>?</p>
<pre><code>public boolean isString(MyClass var) {
return null != var.getMyString();
}
</code></pre>
<p>Could it be done better?</p>
| java | [1] |
5,165,952 | 5,165,953 | Jquery Determine which button by keyup | <p>Hi have some buttons labeled A-G. The id's on the buttons are as follows.</p>
<pre><code>"btn_A"
"btn_B"
"btn_C"
etc...
</code></pre>
<p>I am running a keyup function as follows.</p>
<pre><code>$(document).keyup(function (event) {
var theButton = "btn_"+String.fromCharCode(event.keyCode);
alert(theButton)
});
</code></pre>
<p>That gets me the correct buttons "id", but how can I then do something wit the button. Like get the <code>text()</code> from it or <code>hide()</code> it etc.</p>
<p>The buttons are defined as follows:</p>
<pre><code><button id="btn_A">A</button>
<button id="btn_B">B</button>
<button id="btn_C">C</button>
</code></pre>
<p>What I am trying to do is when someone presses the correct key on the keyboard the corresponding button would hide(). For example if they pressed "A" the the A button would hide.</p>
| jquery | [5] |
5,164,193 | 5,164,194 | problem in recording the video and saving that video in sd card in android application | <p>I am developing an android application which involves recording video and saving the video in sd card of android emulator,Can anyone tell how should i pursue</p>
<p>Thanks in advance
Tushar</p>
| android | [4] |
2,299,168 | 2,299,169 | Javascript: how can I append variables to the url? | <p>how can I append variables to an URL with javascript without navigating to the url ?</p>
<p>thanks</p>
| javascript | [3] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.