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,967,161 | 1,967,162 | Is something like this valid at all- div.find and input id | <p>Hello I have something like </p>
<pre><code> div.find("input").autocomplete({
</code></pre>
<p>.....</p>
<p>and am wondering if I can add an input id to the element...</p>
<p>ie. </p>
<pre><code> div.find("input#good")
</code></pre>
<p>thanks!</p>
| jquery | [5] |
5,522,516 | 5,522,517 | Cant figure out how to code this in php | <p>I am trying to <code>$_GET</code> some variables that a user may enter (busy making a basic web-server):</p>
<pre><code>$users= strval($_GET['user']);
$price= intval($_GET['price']);
$productID= intval($_GET['productid']);
</code></pre>
<p>This is my query:</p>
<pre><code>$query = "SELECT * FROM `table` WHERE `user` = '" . $user . "' AND `price` <= " . $price . " AND `productID` = " . $productID;
</code></pre>
<p>(something like this)</p>
<p>Given this theoretical link:</p>
<pre><code>www.example.com/api.php?price=300
</code></pre>
<p>And don't use the rest of the GET (user and productID) will automatically be filled with either 0 or '' (int/string).</p>
<p>So I thought I could use an <code>if</code> statement:</p>
<pre><code>if(price == 0){
// change the query without the price as WHERE
}
</code></pre>
<p>But what if I have combinations of price and productID or productID and user as variables.</p>
<p>What is the best way to handle this? Maybe it's a stupid question but I can't figure it out. </p>
| php | [2] |
1,138,768 | 1,138,769 | jquery ID starts with | <p>I am trying to get all elements with an id starting with some value. Below is my jquery code . I am trying to use a javascript variable when searching for items. But it does not work. What Am I missing below? So the id 'value' am searching is the value of the clicked element</p>
<pre><code>$(document).ready(function() {
$('input[name$="_chkmulti"]').click(function(){
var value = $(this).val();
$("td[id^= + value +]").each(function(){
alert("yes");
});
});
});
</code></pre>
| jquery | [5] |
2,796,867 | 2,796,868 | Php generate url and content | <p>i have a form with a few inputs and a submit button, when user clicked the submit and it will generate a page that save the data specific for that content and next time when user comeback to that url it will show that content. how can i do that?</p>
| php | [2] |
1,956,533 | 1,956,534 | Warning: stream_socket_enable_crypto(): this stream does not support SSL/crypto in C:\xampp\htdocs\12work\class.smtp.php on line 197 | <p>i am using xampp i am try to send the email through local host
but i got warning
warning: stream_socket_enable_crypto(): this stream does not support SSL/crypto in C:\xampp\htdocs\12work\class.smtp.php on line 197
and my code is
$mail = new PHPMailer();</p>
<pre><code> $mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "smtp.gmail.com"; // specify main and backup server
$mail->SMTPAuth = true;
$mail->Port = 25;
$mail->SMTPSecure = "tls";
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "sheikh.abm@gmail.com"; // SMTP username
$mail->Password = "mypassword"; // SMTP password
$mail->From = "sheikh.abm@gmail.com"; //do NOT fake header.
$mail->FromName = "MailMan";
$mail->AddAddress("sheikh.abm@gmail.com"); // Email on which you want to send mail
$mail->IsHTML(true);
$mail->Subject = "Just a Test";
$mail->Body = "Hello. I am testing <b>PHP Mailer.</b>";
if(!$mail->Send())
{
echo $mail->ErrorInfo;
}else{
echo "email was sent";
}
</code></pre>
| php | [2] |
5,916,299 | 5,916,300 | input:text Alert Parent Class? | <p>My hover target is "#Font-Size input:text" of which in in my HTML code as seen below;</p>
<pre><code><div id="Font-Type">
<input type="text" name="Size-Input" maxlength="2" value="12">
</code></pre>
<p>Upon hovering over my text input field, I would like JQuery to open up an alert box with it's parent ID of "#Font-Type". I've tried the following, but even without the ".parent()" section, the alert box just shows "OBJECT";</p>
<pre><code>var thisParent = $(this).parent();
alert(thisParent);
</code></pre>
<p>Has anyone got any ideas as I'm trying to minimize the code required for my page as there'll be more than one "input:text" of which I'll need to find the parent for.</p>
<p>Best Regards,</p>
<p>Tim</p>
| jquery | [5] |
706,815 | 706,816 | I can not config Content Flow Auto rotate delay in 3 second | <blockquote>
<p>I using website about Content Flow from</p>
</blockquote>
<pre><code>http://www.jacksasylum.eu/ContentFlow/
</code></pre>
<p>I want config this Content Flow with auto delay in 3s</p>
<pre><code><script type="text/javascript" src=js/contentflow.js"></script>
<script type="text/javascript">
var cf = new ContentFlow('contentFlow', {
reflectionColor: "#000000",
loadingTimeout : 3000
});
</script>
</code></pre>
<p>Help me</p>
| javascript | [3] |
1,523,880 | 1,523,881 | How to get interactive input from user and to be able to use arrowkeys while entering input? | <p>When I do a raw_input() and enter values, I am not able to use my arrow-keys to change stuff... is there any way for doing that?</p>
<p>Thanx readline module helps in line editing features. How to use the readline module?
Just importing the readline module works!</p>
| python | [7] |
584,510 | 584,511 | How to get a list of file names in a directory in Python | <p><strong>Problem:</strong></p>
<p>In my "D:/collection" folder, I have two types of files, that are "8-digit-number_type.dbf" and "character_type.dbf" as follows: 00093282.dbf, 00345602.dbf, 69209340.dbf, 69806980.dbf, 92406482.dbf, 93609360.dbf,..., aaa.dbf, bbb.dbf,.... </p>
<p><strong>Objective:</strong></p>
<p>I want to take only the "8-digit-number_type.dbf" files, and exclude the "character_type.dbf" files from my analysis. I don't care about the "character_type.dbf" files. Then, I'd like to split the 8 digits into two 4-digit values. So, a listing file(say,list.txt) with two columns should look like the following:</p>
<pre><code>0009 3282
0034 5602
6920 9340
6980 6980
9240 6482
9360 9360
....
</code></pre>
<p>And these values should be stored as character type.</p>
<p>How can I implement that in Python? Thank you.</p>
<p>Sincerely,
Bill TP</p>
| python | [7] |
55,691 | 55,692 | Why android:installLocation="internalOnly" is not working? | <p>In my manifest file I have given <code>installLocation="internalOnly"</code> in the manifest tag and below in my upper part of manifest: </p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.flexsin.classified"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="internalOnly" >
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:debuggable="true"
android:icon="@drawable/logo_new_icon"
android:label="@string/app_name"
>
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</code></pre>
<p>I have send a mail with APK and when i clicked on Install button, it shows me,
" The attachment could not be downloaded because the SD card is missing or not
mounted".
My question is why it is showing this message, when I want my apk to install on Phone
memory.</p>
<pre><code>Phone mem available space=50Mb
Phone model: Samsung GT-S5570
</code></pre>
<p>PS: device does not have SD card. </p>
| android | [4] |
776,077 | 776,078 | What is the difference between php.ini and .htaccess? | <p>Assume if I want to change the value of </p>
<pre><code>php_value post_max_size 20M in .htaccess
post_max_size 20M in php.ini
</code></pre>
<p>Both will do same operation. So what is the difference between <code>php.ini</code> and <code>.htaccess</code>?</p>
| php | [2] |
5,899,704 | 5,899,705 | how to get the current position of image view during animation in iphone | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4422500/how-to-get-uiview-frame-origin-and-size-while-animation">How to get UIView frame origin and size while animation</a> </p>
</blockquote>
<pre><code> -(void)anothertarget1
{
UIImage *uranus=[UIImage imageNamed:@"red-ball1.png"];
imagev=[[UIImageView alloc]initWithFrame:CGRectMake(5, 10, 100, 100)];
imagev.alpha=0.6;
imagev.image=uranus;
[self.view addSubview:imagev];
CGPoint goal = CGPointMake(self.view.center.x+70,self.view.center.y+24);
CGPoint center=imagev.center;
NSLog(@"center=%f",center);
UIViewAnimationOptions opt = UIViewAnimationOptionAllowUserInteraction;
[UIView animateWithDuration:20 delay:0 options:opt animations:^{
//forimageview1;
imagev.center = goal;
} completion:^(BOOL f) {
imagev.hidden=YES;
}];
}
</code></pre>
<p>i want to make an object which get the current position of <code>UIImageview</code> during animation
please help me</p>
| iphone | [8] |
1,324,751 | 1,324,752 | App Tab Bar Multiple View Crash | <p>I have a tab bar app with multiple views on each tab. A button is pressed in a tab to take you to a different xib view. A button there is pressed to take you back to the first tab in the tab bar. The problem is when i press the button to go back, I don't want to go to the first view for the FirstViewController, I want to go the the mainwindow where the tab bar controller and stuff is. The button takes you to the firstview without the tab bar. If I change the code to initWithNibName@"MainWindow" it crashes when i press the button. What should I do?</p>
<p>Here is the code in question:</p>
<pre><code>-(IBAction)back{
FirstViewController *back = [[FirstViewController alloc] initWithNibName:@"MainWindow" bundle:nil];
[self presentModalViewController:back animated:YES];
} //this is for going back
-(IBAction)forward{
test2 *forward = [[test2 alloc] initWithNibName:@"test2" bundle:nil];
[self presentModalViewController:forward animated:NO];
} //this is for going to the view. by the way there are no errors or warnings, just "Debugging Terminated" when it crashes.
</code></pre>
| iphone | [8] |
1,337,026 | 1,337,027 | Memory crash updating UIActivityIndicatorView | <p>Whenever I am trying to update the <code>UIActivityIndicatorView</code> from a thread, the app is getting crashed by throwing an exception </p>
<blockquote>
<p>modifying layer that is being finalized - 0x7e177fd0
-[CALayer removeAnimationForKey:]: message sent to deallocated instance 0x7e177fd0</p>
</blockquote>
<p>When I try tracking the memory leaks form the mallocDebugger tool, this crash is not happening at all the time happening 1 out of 10 </p>
<p>please help me out from this memory issue </p>
<p>Thread implementation:</p>
<pre><code>NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
[autoRechargeCell addSubview:activityIndicator];
[self.activityIndicator startAnimating];
if( [PennyTalkAPI getBalanceInfoForAccount:appDelegate.accountNumber withPIN:appDelegate.pinNumber])
{
[autoRechargeCell.switchField setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@"AutoRecharge"]];
[self.activityIndicator stopAnimating]; <<<<<<<<<<<<<<<<<<<<<<
}
else
{
[self.activityIndicator stopAnimating];
}
[pool release];
</code></pre>
<p>This is the code I have written.</p>
| iphone | [8] |
3,511,135 | 3,511,136 | Hoisting between different files | <p>Is there a way to do functions and variable hoisting between source code present in different files? That is, something like</p>
<pre><code>//Inside firstfile.js
foo === "bar" //should return true
</code></pre>
<p>and</p>
<pre><code>//Inside secondfile.js
function bar() {
this.foo = "bar";
}
</code></pre>
<p>I guess this is not possible, as different files as parsed and executed separately and in order by most javascript engines, but I do not know for sure.</p>
<p>I don't know even if this is in the spec from ECMA, as the parsing of different files is not really part of the language.</p>
| javascript | [3] |
2,120,272 | 2,120,273 | How to reading input (grades) from a text file and make a histogram in quickdraw? | <p>I need help writing a program that reads about 300 lines from a text file and takes the grades from a specific assignment (column A1) and then uses the grades from that assignment to plot a histogram in quickdraw. Please help!</p>
<p>Sample lines</p>
<pre><code>ID , Last, First, Lecture, Tutorial, A1, A2, A3, A4, A5
8959079, Moore, Maria, L01, T03, 9.0, 8.5, 8.5, 10.0, 8.5
4295498, Taylor, John, L00, T04, 10.0, 6.5, 8.5, 9.5, 7.0
9326386, Taylor, David, L00, T00, 9.5, 8.0, 8.0, 9.0, 10.0
7223234, Taylor, James, L01, T03, 8.5, 5.5, 10.0, 0.0, 0.5
7547838, Miller, Robert, L01, T09, 7.0, 8.0, 8.5, 10.0, 0.5
0313453, Lee, James, L01, T01, 10.0, 0.5, 8.0, 7.0, 5.0
3544072, Lee, Helen, L00, T03, 10.0, 9.0, 7.0, 9.0, 8.5
</code></pre>
| python | [7] |
575,987 | 575,988 | How can I figure out whether a C# app was launched from the desktop or the cmd shell? | <p>How can i find out if a C# App has been started from the desktop or the cmd shell?</p>
<p>The msdn documentation is a bit fuzzy on this part. Perhaps someone can help me out here :)</p>
<p>Thx a lot!</p>
| c# | [0] |
3,356,860 | 3,356,861 | A question related to iphone book | <p>Can u give me name of books necessary for basic knowledge of making software on iphone with it's indian price?</p>
| iphone | [8] |
1,774,404 | 1,774,405 | Android : How to create new EditText onClickListener | <p>I am new here, sorry if I am not so good in the explainаtion. ;)
I want to add and remove a dynamic EditText fields?</p>
<pre><code> private final View.OnClickListener addRowListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
//HERE????
};
</code></pre>
<p>Thank you in advance</p>
| android | [4] |
547,500 | 547,501 | Android BroadcastReceiver Register Problem | <p>I am trying to register a broadcastreceiver in a small Android app that I am playing around with. I think I am doing what I am supposed to do, but still the receiver doesn't register. It must be something small that I am missing and it is driving me crazy.</p>
<pre><code>public class CreateReceiver extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}//end of onCreate
BroadcastReceiver myreceiver = new BroadcastReceiver()
{
@Override
public void onReceive(Context recvc, Intent recvi)
{
}
};
@Override
public void onResume()
{
super.onResume();
IntentFilter intentFilter = new IntentFilter(Intent.ACTION_CAMERA_BUTTON);
if (this.registerReceiver(myreceiver, intentFilter) == null)
{
Toast.makeText(this, "Could not register receiver", Toast.LENGTH_LONG).show();
}//end of if
}//end of onResume
@Override
public void onPause()
{
this.unregisterReceiver(myreceiver);
super.onPause();
}//end of onPause
}//end of CreateReceiver
</code></pre>
<p>Can anyone tell me what I am doing wrong? Thanks.</p>
| android | [4] |
5,260,831 | 5,260,832 | Marker bar for C# application? | <p>Is there a marker bar component for a C# application what i could use in my application? As marker bar i mean something like <em>ReSharper</em> adds to Visual Studio:<img src="http://i.stack.imgur.com/062fy.png" alt="enter image description here"></p>
<p>Another example for something similar (the bar on the left):
<img src="http://i.stack.imgur.com/kLXA7.png" alt="enter image description here"></p>
<p><strong>EDIT</strong>: I found non-free component for java <a href="http://www.sideofsoftware.com/marker_bar/doc/sos/marker/JMarkerBar.html" rel="nofollow">http://www.sideofsoftware.com/marker_bar/doc/sos/marker/JMarkerBar.html</a> what does exactly what i want to do. It doesnt suite for me but maybe it helps someone.</p>
| c# | [0] |
2,902,245 | 2,902,246 | Java: need help determining the end of a line with a scanner | <p>I have a scanner in my program that reads in parts of the file and formats them for HTML. When I am reading my file, I need to know how to make the scanner know that it is at the end of a line and start writing to the next line.</p>
<p>Here is the relevant part of my code, let me know if I left anything out, thanks!!</p>
<pre><code> //scanner object to read the input file
Scanner sc = new Scanner(file);
//filewriter object for writing to the output file
FileWriter fWrite = new FileWriter(outFile);
//Reads in the input file 1 word at a time and decides how to
////add it to the output file
while (sc.hasNext() == true)
{
String tempString = sc.next();
if (colorMap.containsKey(tempString) == true)
{
String word = tempString;
String color = colorMap.get(word);
String codeOut = colorize(word, color);
fWrite.write(codeOut + " ");
}
else
{
fWrite.write(tempString + " ");
}
}
//closes the files
reader.close();
fWrite.close();
sc.close();
}
</code></pre>
<p>Ok, I found out about the sc.nextLine();, but I still don't know how to determine when I am at the end of a line.</p>
| java | [1] |
4,731,766 | 4,731,767 | How to detect errors from compileall.compile_dir? | <p>How do I detect an error when compiling a directory of python files using compile_dir?</p>
<p>Currently I get something on stderr, but no way to detect it in my app.
py_compile.compile() takes a 'doraise' argument, but nothing here.</p>
<p>Or is there a better way to do this from a python script?</p>
<p>Edit:</p>
<p>I fixed it with os.walk and calling py_compile.compile for each file. But the question remains.</p>
| python | [7] |
1,128,086 | 1,128,087 | PHP function can return different & multi-values at first sight, but it can not | <pre><code><?php
function some_func(){
return 'some_str_type' && 'another_str_type';
}
function another_func(){
return '123' || '456';
}
print some_func(); //1 - the same as true
print another_func(); //again prints 1, as true
</code></pre>
<p>The clean style of coding of any language dictates, to drop non-small function into small ones - because one function SHOULD return single value.</p>
<p><b>BUT</b>, i saw this approach in source of some popular php-template langs (smarty, dwoo).
So what is that? When to code this way? (mean any real-world situation)</p>
| php | [2] |
5,011,589 | 5,011,590 | Cakephp Update div | <p>I have a view listing something with some hidden div elements. The hidden div have some data.
While showing the hidden div i need to update the div element's text or label? how to do this?</p>
| php | [2] |
2,490,453 | 2,490,454 | Variable scope in javascript | <p>This is a simple question, but I can't work it out.</p>
<p>The specifics aren't important, but here's the gist. I have some code like this:</p>
<pre><code>var lat = 0;
var lon = 0;
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
lat = position.coords.latitude;
lon = position.coords.longitude;
});
}
</code></pre>
<p>What I think it's doing is:</p>
<ol>
<li>Set lat and lon to 0</li>
<li>If the browser has geolocation, overwrite those variables with real values</li>
</ol>
<p>However, at the end of that chunk, lat and lon are still 0. I've tried adding <code>var</code>s, passing lat and lon to the function etc but with no success...</p>
<p>How do I make this work?</p>
| javascript | [3] |
4,741,344 | 4,741,345 | Overriding non-parameterized classes nested in a parameterized outer class in Java | <p>Can someone please help with the syntax of subclassing a non-parameterized nested class inside a parameterized outer class, like the following?</p>
<pre><code>public abstract class Foo<T> {
public class Bar {
Set<T> aSet;
}
abstract class Baz {
abstract void doSomething(Map<? extends Bar, T> aMap);
}
}
</code></pre>
<p>Then in a separate file, I'm not entirely sure how to define the type variable <code>S</code> here without parameterizing <code>ConcreteBaz</code>. And I can't use a wildcard variable like <code>extends Foo<?>.Baz</code> (I think) because I need access to that generic type variable in the <code>doSomething</code> method:</p>
<pre><code>public class ConcreteBaz extends Foo<S>.Baz { // compilation error
public ConcreteBaz(Foo<S> foo) { foo.super(); }
public void doSomething(Map<? extends Foo<S>.Bar, S> aMap) { ... }
}
</code></pre>
<p>Can someone please help me figure out a way around this? Thanks.</p>
| java | [1] |
1,539,306 | 1,539,307 | Android scheduled files to server | <p>Ok i know how to send a file to the server...What i am looking for is code which looks in a folder on the sd card and then sends all the text files in there and then deletes them..However it needs to keep looking in there until there is internet connection so that it completes the job, otherwise it keeps looking in there every 30 seconds..? hope i explained correctly</p>
| android | [4] |
5,558,406 | 5,558,407 | Does it make sense to have a PHP class just for cleaning/escaping user input? | <p>My application persists a large amount of data into a MySql database, and I'm wondering if I should handle the cleaning/escaping with a separate class, or if this is overkill? Also, I'm using prepared statements with PDO, so I'm not exactly sure how much cleaning or escaping data I should be doing in combination with binding parameters.</p>
<p>I'm aware of the old Perl adage, "There's more than one way to do it," so I'm not asking for an actual solution. I'm just trying to weigh the benefits of calling in another class to handle the escaping, or if the simplicity of this process would better be handled locally.</p>
| php | [2] |
1,781,931 | 1,781,932 | ASP.net: Efficient ways to convert DataSets to GenericCollection (Of ObjectType) | <p>I currently have a function that gets some data from the database and puts it into a dataset. The return type on my function is GenericCollection (Of CustomerDetails)</p>
<p>If I do this:</p>
<pre><code>Dim dataset As DataSet = Read(strSQL.ToString) 'Gets Data from DB
</code></pre>
<p>What's the most efficient way to map the dataset results to an collection of objects. More importantly, since I'm using GenericCollection, is there a way to do this in which I can call a function from the ObjectType class (CustomerDetails) that would have a means to converting that specific object. </p>
<p>Or is there a way in which I can use a function that would handle all types?</p>
<p>Is there a way to do something like:</p>
<pre><code>Return returnedResults.TransformDataSet(dataset)
</code></pre>
<p>In which returnedResults is an object collection Of CustomerDetails, or would it simply be easier to have TransformDataSet return an object collection Of CustomerDetails by itself?</p>
<p>Thanks for any help.</p>
| asp.net | [9] |
3,571,984 | 3,571,985 | Can I somehow "compile" a python script to work on PC without Python installed? | <p>So I have a Python script:</p>
<pre><code>myscript.py
</code></pre>
<p>I am executing it like this:</p>
<pre><code>python D:\myscript.py
</code></pre>
<p>However, I must have Python installed and included in the PATH environment variable for that to work.</p>
<p>Is it somehow possible to "bundle" Python executable with a Python script so other people will be able to run it on their PCs without Python?</p>
<p>It is ok if it will work only in Windows.</p>
<p>EDIT:</p>
<p>After trying the compile.py I get this error:</p>
<pre><code>Traceback (most recent call last):
File "D:\stuff\compile.py", line 4, in <module>
import py2exe
ImportError: No module named py2exe
</code></pre>
| python | [7] |
935,624 | 935,625 | How to dismiss a dialog from another method | <p>I have created a dialog which can be called from anywhere by supplying a title and message as follows:</p>
<pre><code>public void alertbox(String title, String mymessage)
{ new AlertDialog.Builder(this)
.setTitle(title)
.setMessage(mymessage)
.setNeutralButton(android.R.string.cancel,
new DialogInterface.OnClickListener()
{ public void onClick(DialogInterface dialog, int whichButton) {}
})
.show();
}
</code></pre>
<p>But I get a lockup when I try to dismiss the dialog from another method:</p>
<pre><code>private void doCheck() {
alertbox("status", getString(R.string.checking_license));
mChecker.checkAccess(mLicenseCheckerCallback);
alertbox.dismiss();
}
</code></pre>
<p>It is the alertbox.dismiss(); statement that causes the crash. Any ideas how to properly do this?</p>
| android | [4] |
2,011,837 | 2,011,838 | Store the User information in a object on each load or grab the info when action is made | <p>I have a Session which contain the "user id"</p>
<p>I have some information stored in the user table (that I need to grab)
The question is If I should grab all data and put it in a object on each request or just make the query when an action is made?</p>
<p>Example #1</p>
<pre><code>//Update Password
//a user object contain all data from users table...
if ($user->password == $new_password) {
$errors[] = 'You can\'t choose the same password!';
}
</code></pre>
<p>Example #2</p>
<pre><code>//Update Password
//$current_password = query password and fetch
if ($current_password == $new_password) {
//...
}
</code></pre>
<p>Etc...</p>
| php | [2] |
125,748 | 125,749 | Android MediaPlayer SDK | <p>I have a program with a function copied below it plays a sound upon clicking a button. If you click the button 10 times 10 different media players play the same sound that is the way i want it but how can i assign a button to stop all 10 media players at a time like a "STOP ALL BUTTON"</p>
<pre><code>public void onClick(View v){
int resId = 0;
int stopped = 0;
switch (v.getId()){
case R.id.Wail:
resId = R.raw.fedsigwail;
break;
case R.id.Yelp:
resId = R.raw.fedsigyelp;
break;
case R.id.HiLow:
resId = R.raw.hilow;
break;
case R.id.FederalQ:
resId = R.raw.federalq;
break;
case R.id.Horn:
resId = R.raw.fedsignhorn;
break;
case R.id.STOPALL:
mp.stop();
mp.release();
stopped = 1;
break;
}
if (stopped != 1){
mp = MediaPlayer.create(this, resId);
mp.start();
}
}
</code></pre>
<p>The code above only stops the last instance of mp.</p>
<p>Any Input would be appreciated</p>
| android | [4] |
3,837,618 | 3,837,619 | How to create an alert dialog with radio button on the side? | <p>How to create an alert dialog with radio button on the side?
I can create a dialog with 3 selection strings using AlertDialog.Builder, but how can I create the one with radio button on the side (i.e. allow only 1 selection)?</p>
<p>Thank you.</p>
| android | [4] |
5,138,472 | 5,138,473 | Iframe scrollbar controlling another Iframe scrollbar | <p>I have looked through all examples of finding Iframe scroll bar positions, but they all seem to be div related, or are in the iframe src page.</p>
<p>I have a single html page with two IFRAME, frame1 and frame2.</p>
<p>I'm trying to monitor frame1 using jquery on the parent page, so that I can manipulate frame2, specifically what I need to do is, when I scroll frame1 I need frame2 to scroll exactly the same.</p>
<p>Help, Please? </p>
| jquery | [5] |
2,010,787 | 2,010,788 | Adding check box to grid view for each row | <p>I am filling a <code>GridView</code> with the data table but on each row I want a check box how can I achieve this?</p>
| asp.net | [9] |
4,645,059 | 4,645,060 | Is it possible to exclude a certain string from .length in a String[]? | <p>I'm working on a command-based modification for Minecraft in which you are allowed to use flags (-[a-z]) to specify certain values. However, I'm slightly confused on how I should go about parsing regular arguments. Here's an example of a command: <code>/tp fist -h</code>. Of course, it's relatively simple to what string[0] equals, but if I were to try <code>/tp -h fist</code>, I'm afraid I would confuse the modification and it would throw an exception.</p>
<p>So, my question is: is it possible to create a String[ ] which removes a specific type of string from an existing list so I can do <code>if(args[0].equalsIgnoreCase("text")</code> and it would do the same thing for <code>/command text [text-to-remove]</code> as if I did <code>/command [text-to-remove] text</code>?</p>
<p>Thanks in advance!</p>
<p>Sincerely,</p>
<p>afistofirony</p>
<p>PS: I know I can use a for loop to check each individual argument, but normally the variables will change for each execution (since they are usually used to specify players that don't all share a name).</p>
| java | [1] |
474,037 | 474,038 | delete row i uitableview working but cant reflect always on iphone | <p>i can successfuly delete data from tableview , but when i go to main menu and come back then i see all the old data,</p>
<p>how to make data consistent , i.e once deleted it will be gone forever</p>
<pre><code>- (void)viewDidLoad
{
[super viewDidLoad];
appDelegate = (DatabaseTestAppDelegate *)[[UIApplication sharedApplication] delegate];
{
appDelegate.favDetail = [[NSMutableArray alloc] initWithObjects:@"1", @"2",@"4",nil];
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
appDelegate = (DatabaseTestAppDelegate *)[[UIApplication sharedApplication] delegate];
NSString *cc=[appDelegate.favDetail objectAtIndex:indexPath.row];
NSLog(@" vale is %d",indexPath.row);
// Configure the cell...
NSArray *theParameters = [cc componentsSeparatedByString:@","];
NSLog(@"array is %@",cc);
NSLog(@"arraytheParameters is %@",theParameters);
cell.text=cc;//theParameters;
return cell;
}
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{ NSLog(@"matrix is her%@",appDelegate.favDetail);
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[appDelegate.favDetail removeObjectAtIndex: indexPath.row];
[tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject: indexPath] withRowAnimation:UITableViewRowAnimationFade];
[tableView endUpdates];
}
/*
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
} */
}
- (void)viewWillAppear:(BOOL)animated
{ [tableView reloadData];
[super viewWillAppear:animated]; // no use , it shows old data
}
</code></pre>
<p>thanks</p>
| iphone | [8] |
1,353,612 | 1,353,613 | count number of property available for member according to there zip code | <p>i have two table</p>
<p>1) member</p>
<ul>
<li>member_id</li>
<li>name</li>
<li>address</li>
<li>zip</li>
</ul>
<p>2) property</p>
<ul>
<li>property_id</li>
<li>property_name</li>
<li>property_zip</li>
</ul>
<p>i want to list all the member zip (without duplicate) and show the count of property for each zip code in a table</p>
<hr>
<h2>Member Zip | Property Count</h2>
<h2>95674 | 50</h2>
<h2>95852 | 90</h2>
<h2>95614 | 0</h2>
<h2>95070 | 5</h2>
<p>its have multiple member with same zip code and also multiple property with same zip code </p>
<p>i don't want any repeat on the Member Zip output column. </p>
<p>i have 5 member with 92550 & 10 member with 82475, i have to show </p>
<p>92550<br>
82475</p>
<p>& on property table i have 10 with zipcode 82475 and 4 with zip code 92550. </p>
<p>Final O/P </p>
<p>92550 (4)<br>
82475 (10)</p>
<p>can anyone help me to find it ?</p>
| php | [2] |
114,856 | 114,857 | Next/Previous buttons on iPhone MPMoviePlayerController | <p>When using the MPMoviePlayerController, the play button is surrounded with "Next" and "Previous" buttons. </p>
<p>How do I get notifications when they are clicked?
is there a way to feed MPMoviePlayerController with a list (array) of content?</p>
<p>Thanks.</p>
| iphone | [8] |
5,737,154 | 5,737,155 | accessing array values across classes | <p>I have an activity which includes a declaration of </p>
<pre><code>public String progressArray[][] = new String[3][3]
</code></pre>
<p>In another file (a service) I want to access the values of this array. I code:</p>
<pre><code>ListViewLoader lvl = new ListViewLoader
</code></pre>
<p>Now I find that <code>lvl.progressArray[0][0]</code> returns null although I know that data has been put in it in its own class. Is this because a new instance doesnt contain the values of the original, if so how can I access the values in the original? </p>
| android | [4] |
1,266,494 | 1,266,495 | How to bind object's property to another object's property? (C#) | <p>I'm making a graphic control class <code>Info</code> which should display some text on screen. The text is some object's string. I'd like to be able to get that object's latest value from within an instance of <code>Info</code> class.</p>
<pre><code>class Info
{
public string Text;
}
void Program()
{
ClassA obj = new ClassA();
obj.name = "Instance of ClassA";
Info wind1 = new Info();
wind1.Text = obj.name; // this just copies current value, but should be a reference or something
/* obj.name value changes several times before it's time to display it again */
// Info window drawing method
foreach (var item in Windows) // Windows is List<Info>
Draw(item.Text); // this doesn't get the latest value
}
</code></pre>
<p>How should I change the code so I can get the latest string value from within the drawing section?</p>
| c# | [0] |
2,578,569 | 2,578,570 | Should I treat my own single underscored attributes as private? | <p>If I use a single leading underscore for an attribute in a class, would it be wrong of me to access it from a different object? Is a single underscore saying "I will use this as I please but you the user shouldn't touch it" or should even the developer treat it as though it were private?</p>
| python | [7] |
653,390 | 653,391 | How to hide the soft keyboard after hitting the search dialog box | <p>I'm trying to use Android's built-in search dialog, and it's working fine except when I try to use it with a ProgressDialog. The basic chain of events it this:</p>
<ul>
<li>User press the search button, enters a query and submits it.</li>
<li>The SearchManager calls the search Activity's onCreate method.</li>
<li>In the onCreate method, I call an AsyncTask that runs a query and shows a ProgressDialog in the onPreExecute method and hides it in the onPostExecute method.</li>
<li>This all happens fine except as soon as I submit the query the screen looks like this:</li>
</ul>
<p>... which is pretty ugly. How can I prevent this from happening?</p>
| android | [4] |
1,403,739 | 1,403,740 | Picker for numbers | <p>ok so im making a lovely little app for my phone that will let me convert bases. This would make my APCS homework much better and provide me some practical and useful coding experience.</p>
<p>I see lots of questions concerning the time and date pickers but that is not what i am looking for. For example, on iOS, if you press on something that is almost like a dropdown menu you can scroll through the selections and choose which one you want. Any ideas?</p>
| android | [4] |
2,758,409 | 2,758,410 | Error while accessing proxy from emulator 2.2 | <p>08-19 00:20:45.512: ERROR/System(51): java.lang.SecurityException
08-19 00:20:45.512: ERROR/System(51): at android.os.BinderProxy.transact(Native Method)
08-19 00:20:45.512: ERROR/System(51): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
08-19 00:20:45.512: ERROR/System(51): at android.os.ServiceManager.addService(ServiceManager.java:72)
08-19 00:20:45.512: ERROR/System(51): at com.android.server.ServerThread.run(SystemServer.java:176)</p>
<p>This is the error log from logcat.</p>
<p>The AndroidManifest.xml file has internet access permission.</p>
<p>What am I missing? Please help I am going nuts!</p>
<p>I am trying to connect to a proxy server from the emulator. I have specified the proxy server in the emulator with the ip address. But everytime I try to access anything from the emulator I get the error above.</p>
| android | [4] |
1,991,810 | 1,991,811 | How to change dynamically a ListView's item layout | <p>I want to know how to change dynamically a ListView's item layout.</p>
<p>To be exact, i want to know the method that the ListView's bindView method is called at runtime.</p>
<p>if the bindView method is artificially called by a other method. then i will change a ListView's item layout.</p>
<p>Please let me know.</p>
| android | [4] |
1,396,355 | 1,396,356 | adding percentage to calculated form | <p>hope someone here can help. I need a form javascript that auto calculates totals. I have been messing around with a form script I downloaded (hats off to Paul McFedries) The totals are working fine but I need it to also calculate tax (at 10%) and add that to a sub total. I have the basic form working here:
<a href="http://www.onsiite.com/html/onsiite_calc.html" rel="nofollow">http://www.onsiite.com/html/onsiite_calc.html</a></p>
<p>I'm a complete javascript beginner and don't have a clue where to begin. Can anyone help or show me the way?</p>
| javascript | [3] |
823,010 | 823,011 | How to know perticular package/application exist in the device | <p>I want to know if particular package name say "com.android.abc" exist in my device or not.</p>
<p>I just want to get the information like that package exist or not..</p>
<p>Thanks. </p>
| android | [4] |
4,516,903 | 4,516,904 | How to pass the JQuery "this" selector as a parameter | <p>For a class, I have to make a Drag and Drop interface using only CSS, HTML 4.01, and Javascript with the JQuery library; no plugins allowed. I figure the best way to do this was aler the CSS position of the div I'm supposed to drag on mousedown and then on mouseup</p>
<pre><code> $(document).ready(function(){
$(".draggable").mousedown(Dragging(this));
function Dragging(draggableObject)
{
draggableObject.live("mousemove", function(){draggableObject.css(/*alters the position of the div*/)});
};
});
</code></pre>
<p>My trouble is that draggableObject doesn't seem to have any CSS properties, I tried calling up an alert with its properties and apparently they're null. What am I doing wrong with passing the object, or anywhere else?</p>
| jquery | [5] |
3,484,843 | 3,484,844 | Load the div content when that div is seen/reached while scrolling | <p>On the jQuery documentation pages, I notice that the Disqus comments do no open until I scroll to that part of the page.</p>
<p>Scroll down the bottom of this page and you'll notice the affect: <a href="http://api.jquery.com/child-selector/" rel="nofollow">http://api.jquery.com/child-selector/</a></p>
<p>I was wonder how this was done as I would like to use it on my website as it will help reduce the page loading time.</p>
| jquery | [5] |
2,823,661 | 2,823,662 | Sending an Activity to a non-Android class | <p>I'm pretty much a noob when it comes to Android development. I have an Activity that has a method that pretty much just sets the text of a TextView to whatever text is provided as an argument. I have a second class, which is a Runnable, and I want to be able to give it the Activity (or obtain the Activity somehow), so it can call said method when it needs to.</p>
<p>This Runnable will eventually connect with a server, so it can update the application with information from the server. I've done client/server Java stuff before, so that's not the issue. I just need to figure out how to communicate between this Runnable and the Activity.</p>
<p>Originally, I was going to just pass the Activity itself in, but I read that it would create problems if I did. Instead, I was supposed to pass in an ApplicationContext via getApplicationContext(). I did that, but now I don't know what to do with the ApplicationContext. I tried casting it to the my Activity class, but the program just crashes.</p>
<p>How do I accomplish what I'm aiming at?</p>
| android | [4] |
4,052,652 | 4,052,653 | PHP, MySQL table query syntax error? | <p>I hope someone can help see what's wrong here:
I have a form with two field <code>EMAIL</code> and <code>PASSWORD</code> that opens a php page where I intend to run a simple query on a table.
I get an error message that makes no sense:<br>
<code>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@gmail.com' at line 1</code>.<br>
The email address I entered in this case did end with '@gmail.com'<br>
Here's the code:</p>
<pre><code><?php
$dbhost = 'somewhere.net';
$dbuser = 'someUser';
$dbpass = 'pass';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'medreunten_db1';
mysql_select_db($dbname) or die(mysql_error($conn));
$email = mysql_real_escape_string($_POST['email']);
$query = "SELECT * FROM employee WHERE email = $email";
$result = mysql_query($query, $conn) or die (mysql_error($conn));
extract(mysql_fetch_assoc($result));
while ($row = mysql_fetch_array($result)) {
extract($row);
echo $row['name'];
echo $row['surname'];
echo $row['age'];
}
?>
</code></pre>
<p>Any advice would be appreciated.</p>
| php | [2] |
4,020,454 | 4,020,455 | Is it possible to set drawableLeft programmaticaly? | <p>In XML we can set drawableLeft using this way:</p>
<pre><code> <Button
android:id="@+id/previewBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/white_btn"
android:drawableLeft="@drawable/green_circle"
android:drawablePadding="16dp"
android:text="Button" />
</code></pre>
<p>How to do same thing programmaticaly?</p>
| android | [4] |
1,414,383 | 1,414,384 | Android. How to insert image in text | <p>Actually I have TextView with some text. I need to insert an image insight this text. Please suggest the best way to do that. Should be supported on different display sizes.</p>
| android | [4] |
3,727,468 | 3,727,469 | how to make double quote to accepted by facebook feed post | <p>friend's
I need help on posting the feed in facebook when string contains double quote,at the time facebook haven't accepting..
for example if the content is something like this,
<strong>Help on posting "feed" in facebook for android.</strong></p>
<p>suppose i need to post above at the time the feed title is getting null because of double quotes,how can i replace it with the same i have to post.</p>
<p>thanks in advance.</p>
| android | [4] |
86,133 | 86,134 | What is difference between if($a) and if($a==1)? | <pre><code> function foo($a)
{
if($a) {return "a";}
else if($a==2) {return "b";}
else {return "c";}
}
-----------------------------------------
function foo2($a)
{
if($a==1){return "a";}
if($a==2){return "b";}
if($a==3){return "c";}
}
</code></pre>
<p>when i passed value any number frim 1,2 or 3 ? it will return 1. when i pass value in function foo2 it will return value as value passed .</p>
<p>But why is difference coming ?</p>
| php | [2] |
2,653,033 | 2,653,034 | Passing event data to jQuery live handler | <p>I ran into a problem when I try to pass event data to jQuery live function. Basically, I have a table generated with many rows and each row data is encapsulated by an object, let's just call is "tbRow". I'd like register a live function on each row, and when you click on it, it will act differently based on the row data. The way I am structuring the code is as follows:</p>
<pre><code>MYAPP.prototype.actions = function (tbRow) {
var output = "<div class="select"><a href="#"> Select this row </a></div>"
$('div.select').live('click', {tbRow: tbRow}, function() {
console.log(e.data.tbRow.id + "is selected");
/// do something else
});
return output;
};
</code></pre>
<p>The output returned by this function is used to construct the actual table, and at the same time, a live function is registered for that row to respond to the click action. The print for id (assuming each row has a unique ID) is just for checking I am selecting the right row.</p>
<p>The problem I ran into is that every row I select now carry the ID of FIRST row, it appears only the first one gets registered properly. One way I can think of to resolve it is, to make a concatenated string with row ID, such that:</p>
<pre><code>$('div.select_RowID1").live( .... )
</code></pre>
<p>However, I am not sure if this will work or right approach.</p>
<p>Thanks in advance for help.</p>
<p>Oliver</p>
| jquery | [5] |
2,260,959 | 2,260,960 | How to wrap this into a recursive call | <p>I'm writing a little spider in python. It hits a page, gets all the links on the page according to a pattern, goes to each of those pages, and repeats.</p>
<p>I need to make this recursive somehow. Below are the url patterns:</p>
<pre><code>www.example.com
</code></pre>
<p>Then I get all links based on a regex, then I visit each page.</p>
<p>Recursive part:</p>
<p>Say I am visiting a page with a url like:</p>
<pre><code>www.example.com/category/1
</code></pre>
<p>Now if this page contains links like:</p>
<pre><code>www.example.com/category/1_234
</code></pre>
<p>(basically the same url, except it has an additional "_234234")</p>
<p>I visit that page, then check for a url like:</p>
<pre><code>www.example.com/category/1_234_4232
</code></pre>
<p>(again, same url plus an underscore and a number)</p>
<p>I keep doing this until there are no more links fitting this pattern.</p>
<pre><code>1. visit a category page
2. does it contain links with the same url + "_dddd" if yes, visit that page
3. back to #2 unless no links
</code></pre>
<p>I don't need the regex, I just need help with structuring the recursive call.</p>
| python | [7] |
1,563,720 | 1,563,721 | Input String check | <p>I am writing an ATM program and when the user inputs one of the string values the program should check it an do a method accordingly. The problem code is here:</p>
<pre><code>System.out.println("PRESS");
System.out.println("(D)eposit");
System.out.println("(W)ithdraw");
System.out.println("(C)heck Account Balance");
System.out.println("(Q)uit");
System.out.println("Enter Choice: ");
String choice = scanner.nextLine();
scanner.nextLine();
if(choice == "D"){
currentCustomer.deposit();
}
else if(choice == "W"){
currentCustomer.withdraw();
}
else if(choice == "C"){
currentCustomer.checkBalance();
}
else if(choice == "Q"){
currentCustomer.quit();
}
else{
System.out.println("Invalid choice please reenter: ");
}
</code></pre>
<p>If a user enters in "D" the program skips to the else statement. I know when using <code>.nextLine</code> you have to use two because of the return character but I'm not sure if that is true with this case. Either way if I have the extra <code>.nextLine</code> statement or not it still skips ahead. Any help would be much appreciated!</p>
| java | [1] |
1,750,133 | 1,750,134 | Convert a jQuery set into HTML | <p>Given a jQuery result set, how do you convert that back into plain HTML?</p>
<pre><code><div class="abc">
foo <strong>FOO</strong>
</div>
<div class="def">
bar
</div>
</code></pre>
<p>--</p>
<pre><code>var $mySet = $('div');
</code></pre>
<p>Given <code>$mySet</code>, how would you go about returning to the plain HTML above?</p>
| jquery | [5] |
2,401,377 | 2,401,378 | Python Inline If statements syntax | <p>When I do something like (totally random example dont read into variable names):</p>
<pre><code>variable = read_file() if read_file() else "File was empty"
</code></pre>
<p>In this case does read_file() get excuted twice? If so is there a way to do it to only execute once but keep it within one line? </p>
| python | [7] |
2,048,250 | 2,048,251 | what is UID in android | <p>What is UID in android ? Is it ID of a particular user or of a particular application? I know this is a simple question . But I got confused when I looked at a code.</p>
| android | [4] |
2,046,029 | 2,046,030 | PHP - Can I pass a function name as a function argument? | <p>I have two classes that I use to access two different tables in my db. They both have a similar constructor that looks like that:</p>
<pre><code>function __construct($db) {
$this->db = $db;
$userDAO = DAO_DBrecord::createUserDAO($this->db);
$this->userDAO = $userDAO;
}
</code></pre>
<p>The other class has the same constructor except that it uses <code>createOtherTableDAO($this->db)</code>.</p>
<p>I am planning on having a couple other such classes, and it would be convenient if I could have them all inherit the same constructor, and pass <code>createAppropriateTableDAO</code> as an argument.</p>
<p>To clarify, in the first case above, <code>createUserDAO($this->db)</code> is a static function that calls a constructor in my DAO class. The function in the DAO looks as follows:</p>
<pre><code>public static function createUserDAO($db) {
return new DAO_DBrecord($db, 'users');
}
</code></pre>
<p>I use this method to make sure the <code>user</code> model can only call a DAO on the <code>users</code> table.</p>
<p>I'm somewhat of a beginner, and I don't think I have ever seen anything like what I want.</p>
| php | [2] |
4,953,327 | 4,953,328 | How do I find out if window animations are enabled in settings | <p>I know, I can start the Settings-Activity with</p>
<pre><code>Intent intent = new Intent(Settings.ACTION_DISPLAY_SETTINGS);
startActivityForResult(intent,1);
</code></pre>
<p>But how do I know if the animations are enabled in the first place?</p>
<p>I have an animation inside a custom view and only want to show it, if the animations are enabled in the settings. If they are disabled, I'd like to ask the user to enable them the first time he starts the application.</p>
| android | [4] |
4,654,994 | 4,654,995 | Using set to avoid duplicate processing | <p>I have a part in a code like below where file name is supplied to the loop iteratively. I want that no two file names with same name should
get processed ( to avoid duplicate processing) so I used the approach of "set" as above.</p>
<p>However this does not seem to work as expected. I get an empty processed_set and logic is not executed as expected.</p>
<pre><code>else:
create_folder(filename)
processed_set=set()
if xyz ==1:
if filename not in processed_set:
createdata(name)
processed_set.add(filename)
else:
avoid_double_process(name)
</code></pre>
| python | [7] |
4,001,915 | 4,001,916 | jQuery treeView plugin collapse/expand all | <p>I Would like to have two buttons on my site. Expand All, collapse All </p>
<p>Im using treeView jquery plugin: <a href="http://plugins.jquery.com/project/treeview" rel="nofollow">http://plugins.jquery.com/project/treeview</a></p>
<p>I cant find solution for doing that :/</p>
<p>Also while im generating ul li list dynamically on aspx server side code I would like do determine accorgind to queryString parameter which node should be expanded while others closed. I tried adding to each one class closed while to given one none but it didnt work :/</p>
<p>How can I say which node should be expanded ?</p>
<p>Thanks for any help, bye</p>
| jquery | [5] |
385,401 | 385,402 | Reset table data when click over reset button | <p>I have Two tables each table having some rows. i have functionality to move the selected rows from left to right,right to left ,up and down .</p>
<p>I need to add reset button .when click over reset the it should reset its content</p>
| jquery | [5] |
5,840,542 | 5,840,543 | What is the best way to support multiple android devices when loading images from the web? | <p>I've read a lot about building UI that supports multiple screen resolutions on android. I understand the concept of sp and dp. </p>
<p>Lets say I'm developing a news reader app. I have an list of articles. The list contains small images and titles. Once an item is touched, a bigger version of the image and full article text is visible. The images will be loaded from web. Should I provide biggest available resolution images and rely on the android to scale them when displayed, or should I convert screen densities at runtime to pixels and download images of the appropriate size?</p>
| android | [4] |
5,624,884 | 5,624,885 | How to continue program execution even after throwing exception? | <p>I have a requirement where in program execution flow should continue even after throwing an exception.</p>
<pre><code>for(DataSource source : dataSources) {
try {
//do something with 'source'
} catch (Exception e) {
}
}
</code></pre>
<p>If exception is thrown in the first iteration, flow execution is stopped. My requirement is even after throwing exception for the first iteration, other iterations should continue.
Can i write logic in catch block?</p>
| java | [1] |
1,691,936 | 1,691,937 | Javascript window.scrollBy not working on particular page | <p>window.scrollBy is not working on the following page
<a href="http://www.resident.co.il/aspx/places.aspx?t=4&a=1" rel="nofollow">http://www.resident.co.il/aspx/places.aspx?t=4&a=1</a></p>
<p>Any idea what can be the problem ? </p>
| javascript | [3] |
5,685,747 | 5,685,748 | HttpClient times out when changing from 3G to WiFi | <p>I perform some large downloads. I start a download being connected to 3G, all is fine. Then, I switch to WiFi connection, but the request returns a timeout exception. I have used HttpClient library. I have implemented a retry mechanism, so, when the request returns an exception, it sleeps for 0.5 seconds and tries to execute again and again. I would expect that, after connecting to a WiFi, the Http request could execute. But it seems that the Http execute method returns a null response, all the time after that. Very strange, if I commute again to 3G, the execute method returns again a good response. Can anyone help me please :) ?</p>
| android | [4] |
1,333,020 | 1,333,021 | how to change the look of an image according to the season we like | <p>We are working with Image magik and using python programming language.
We have been able to make some changes to the colours but it does not work for every image and at other times the entire image changes colour not just the required portions .
We only want to change the colours and don't want to add any effects
These are the 2 codes we have used.
first:</p>
<pre><code>import Image
import ImageEnhance
img = Image.open( 'image.jpg')
img = img.convert('RGBA')
r, g, b, alpha = img.split()
selection = r.point(lambda i: i > 100 and 300)
selection.save( "autmask.png")
r.paste(g, None, selection)
img = Image.merge( "RGBA", (r, b, g, alpha))
img.save( "newclr.png")
img.show()
</code></pre>
<p><strong>and the second.</strong></p>
<pre><code>import Image
# split the image into individual bands
im = Image.open('image.jpg')
im.convert("RGB")
source = im.split()
R, G, B = 0, 1, 2
# select regions where red is less than 100
mask = source[B].point(lambda i: i < 100 and 300)
# process the green band
out = source[G].point(lambda i: i * 2.5)
# paste the processed band back, but only where red was < 100
source[G].paste(out, None, mask)
# build a new multiband image
im = Image.merge(im.mode, source)
im.save( "newimage.png")
im.show()
</code></pre>
| python | [7] |
3,182,082 | 3,182,083 | control behavior of jQuery tooltip | <p><br>
I'm looking for a very specific behaviour from a tooltip, which I can't seem to find out of the box.<br>
My requirements are:<br>
1. tooltip should appear when item is hovered over.<br>
2. tooltip should disappear after item is hovered-out.<br>
3. tooltip should remain visible when: mouse is over the tooltip<br>
OR<br>
4. tooltip should remain visible when a user clicks the item<br>
(either option 3 or 4 is acceptable on its own). </p>
<p>the first two are trivial, of course, but the third is tricky- </p>
<ul>
<li><p><a href="http://plugins.learningjquery.com/cluetip/demo/" rel="nofollow">cluetip</a> has an option to leave the tooltip open until closed by the user, but that's not exactly what I want (I want the tooltip to remain open only if the user has clicked the item).</p>
<ul>
<li>perhaps I could change cluetip's behaviour in runtime (i.e- defaultly the behaviour would be 'close normally', but when a user clicks the item - the cluetip behaviour would change to 'close by user')?</li>
</ul></li>
<li><p><a href="http://www.lullabot.com/files/bt/bt-latest/DEMO/index.html" rel="nofollow">beautyTip</a> has a variety of events to configure for show / hide, but I couldn't think of a combination I could use. </p></li>
</ul>
<p>Any thoughts?<br>
Thanks,<br>
Jhonny</p>
| jquery | [5] |
4,220,432 | 4,220,433 | Why am I getting the error operator() cannot be overloaded? | <p>I have two overloads of <code>operator()</code>, one that takes a function reference that takes any type as its parameters and returns any type. And another one which takes a function reference that takes any type as its parameter but returns <code>void</code>. Upon instantiation of my class I get the following errors:</p>
<blockquote>
<p><code>In instantiation of 'A<void, int>':</code><br>
<code>error: 'void A<T, F>::operator()(void (&)(F)) [with T = void, F = int]' cannot be overloaded</code><br>
<code>error: with 'void A<T, F>::operator()(T (&)(F)) [with T = void, F = int]'</code></p>
</blockquote>
<pre><code>template <typename T, typename F> struct A {
void operator()(T (&)(F)) {}
void operator()(void (&)(F)) {}
};
void f(int) {}
int main() {
A<void, int> a;
a(f);
}
</code></pre>
<p>These errors only occur when the first template argument <code>T</code> is <code>void</code>. I would like to know what I'm doing wrong and why I can't overload <code>operator()</code> this way?</p>
| c++ | [6] |
2,939,917 | 2,939,918 | EditTextPreference cannot be set | <p>i have this code to set an EditTextPreference when i tap on a menu item:</p>
<pre><code> case R.id.prochain_vidange:
settings = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
km = settings.getString("km", "");
Log.d("TAG",km);
int x= Integer.valueOf(km);
int y= x+8000;
String z=String.valueOf(y);
SharedPreferences.Editor editor1 = settings.edit();
Log.d("proch1",z);
editor1.putString("prochain_vidange",z);
Log.d("proch2",z);
editor1.commit();
return true;
</code></pre>
<p>I really don't know why when i tap on the menu item nothing happens, the calculated value (y converted to string z) cannot be set to "km" EditTextPreference. (settings and km values i used them before in another menu item.)
What's going on with this code ?
Thank you very much.
EDIT:</p>
<pre><code>08-11 21:32:16.006: DEBUG/TAG(2394): 4000
08-11 21:32:16.016: DEBUG/proch1(2394): 12000
08-11 21:32:16.016: DEBUG/proch2(2394): 12000
</code></pre>
| android | [4] |
5,549,015 | 5,549,016 | binding needs time in selectbox | <p>There are 2 selectbox when selecting the 1st select box option the corresponding option will show in the 2nd selectbox which is taking from db.when giving this <code>$('.optInSrcAccount').val(arr[10]);</code> it selects the option of the 1st selectbox. The 2nd selectbox showing the option after taking form db corresponding to the 1st selectbox option, and when giving this <code>$('#optExBankAccount').val(arr[11]);</code> it is not changing.the 1st oselectbox option is selected but not the 2nd.pls help me</p>
<pre><code> $('.pInfoExp').live('dblclick',function(){
var arr = $(this).attr('class').split( " " );
if(arr[1]=='edit'){
$('.optInSrcAccount').val(arr[10]);
$('.optInSrcAccount').change();
if(arr[10] == 1 && arr[10]){
$('#optExBankAccount').val(arr[11]);
$('#optExBankAccount').change();
}
$("#popExpence" ).dialog({
resizable: true,
height: 500,
width: 1200,
modal: true,
buttons: {
},
close: function() {
}
});
}
</code></pre>
| jquery | [5] |
326,316 | 326,317 | Converting an Array of primatives to and from a single string | <p>I'm writing a plug-in for a program where I can attribute objects in the program by appending "User Strings" to each object that have a key string and a value string. However, in some cases I need to store an array of a primitive type rather then just a single value. So what is the easiest way to convert an array of values into a string, and then later take that same string and convert it back into the original array of values.</p>
| c# | [0] |
280,634 | 280,635 | Problem in Process Run | <p>When I want to create a new process that target my files, It seem that I have problem with new threads ?</p>
<p>Where is my problem ? </p>
<p>When I started My Application with Proces.Run :</p>
<p>Error message is : Controls created on one thread cannot be parented to a control on a different thread .</p>
<p>but when I want to start normally , I got no problem .</p>
| c# | [0] |
614,120 | 614,121 | Reading part of system file contents with PHP | <p>I have a <code>config</code> file, in <code>etc/</code> called <code>1.conf</code></p>
<p>Here is the contents..</p>
<pre><code>[2-main]
exten => s,1,Macro(speech,"hi {$VAR1} how is your day going?")
exten => s,4,Macro(dial,2,555555555)
exten => s,2,Macro(speech,"lkqejqe;j")
exten => s,3,Macro(speech,"hi there")
exten => s,5,Macro(speech,"this is a test ")
exten => s,6,Macro(speech,"testing 2")
exten => s,7,Macro(speech,"this is a test")
exten => 7,1,Goto(2-tester2,s,1)
exten => 1,1,Goto(2-aa,s,1)
[2-tester]
[2-aa]
exten => 1,1,Goto(2-main,s,1)
</code></pre>
<p><br>
<br></p>
<p>How can I read the content in between speech for example..</p>
<pre><code>exten => s,6,Macro(speech,"testing 2")
</code></pre>
<p>Just get <code>"testing 2"</code> from that.</p>
<p>Thank you in advance!</p>
| php | [2] |
2,942,236 | 2,942,237 | EditText problem | <p>I want to get a character of a string from a EditText and at the same time want to show the current location's latitude and longitude.</p>
<p>here shown a part of the code</p>
<pre><code>Button btn=(Button)findViewById(R.id.format);
btn.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
showCurrentLocation();
}
});
protected void showCurrentLocation() {
text=name.getText().toString();
String finalText = "";
finalText = Character.toString(text.charAt(3));
Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (location != null) {
String message = String.format(
"Current Location \n Longitude: %1$s \n Latitude: %2$s",
location.getLongitude(), location.getLatitude()
);
Toast.makeText(GPSLocator.this, message,
Toast.LENGTH_LONG).show();
}
}
</code></pre>
<p>After compiling the code when i give any character and click on the sent button then a message is displayed on the screen like "The application GPSLocator(process com.vetexVervelnc GPSLocator) has stopped unexpectedly. Please try again Forse close " </p>
| android | [4] |
4,387,347 | 4,387,348 | is it possible in android to programatically call a person and then let him/her hear a pre-recorded voice/audio? | <p>I want to know if it is possible using public android API's to call a person programatically and then as soon as she picks up the phone, let her hear a pre-recorded voice message/audio?</p>
<p>Before I get comments like why I want to do that, or its a bad user experience, I just want to clarify that the question is more on the technical front than implementation so please do let me know if you have any pointers.</p>
<p>Thnx for your time!</p>
| android | [4] |
5,515,777 | 5,515,778 | Adding a tapRecognizer to a UIScrollView | <p>Is it possible to add a tapRecognizer to detect single taps on a UIScrollView so that it wont interfere with the paging and scrolling?</p>
<p>If so, hows is this set up?</p>
| iphone | [8] |
225,885 | 225,886 | Response.RedirectToRoute producing exception | <p>I have a simple web forms application. I get the following error:<br/><br/>
<b>Error 310 (net::ERR_TOO_MANY_REDIRECTS)</b>:<br/><br/>
Global.asax:</p>
<pre><code>protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("etusivu", "opas/{name}", "~/opas/etusivu.aspx");
}
</code></pre>
<p><br/>
Pageload:</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
Response.RedirectToRoute("etusivu", new { name = "etusivu" });
}
</code></pre>
<p>Any ideas?</p>
| asp.net | [9] |
2,137,412 | 2,137,413 | PHP data retrial error | <p>I have asked the same question before but didn't get the answer! I hope you people can help me. </p>
<pre><code><?php
session_start();
$unme=$_SESSION['uname'];
include("connection.php");
$query_qt=mysql_query("SELECT * FROM regst WHERE unme='$unme'");
$info = mysql_fetch_array($query_qt);
if($info) {
$qt=$info['points'];
}
echo "Question ".$qt; //here
if(empty($qt))
header("location:question1.php");
else if($qt=='1')
header("location:question2.php");
else if($qt=='2')
header("location:question3.php");
?>
</code></pre>
<p>I need to get the value of the variable <code>$qt</code>. From the database, it's value should be <code>0</code>. But it's not showing any value when I echo'ed it! Please help me.</p>
| php | [2] |
3,622,165 | 3,622,166 | How to find more than one elements with ids in a single iteration | <p>Below is my HTML </p>
<pre><code> <div id='d1'></div>
<div id='d2'>Yes</div>
<div id='d4'></div>
<div id='d3'>No</div>
</code></pre>
<p>My Requirement is to find DIV tags with ids d2,d3 in a single iteration and add radio buttons to it.</p>
<p>Please someone help me.</p>
| jquery | [5] |
391,329 | 391,330 | System.Data.Sqlconnection | <p>in my application when i type sqlconnection it is not showing any intellisence, i added the namespace System.Data.Sqlclient not only sqlconnection even i am not getting Page calss can u help me.
actually i am sharing this application from my company server.</p>
<p>in our company previously there was .net 2.0 frame work when this project was developed(one year back).
yesterday our company installed 3.0 .net frame work is this any problem for previous project which are developed in 2.0 how can i go through this problem</p>
| asp.net | [9] |
3,265,495 | 3,265,496 | Pop view when tapping a button in Iphone? | <p>I have an Iphone application in which i want to add a feture such that when the user tapp a button it will a popup view with some text on it. i need to have another text when he again tapped it.can anybody help me how to do that?</p>
| iphone | [8] |
5,826,929 | 5,826,930 | How to clear the mapview overlay drawing in android? | <p>I am doing one small GPS application. I have to show multiple palces . I can able to show multiple places using custom overlay method.Now i have to show route between two points , while showing route i have to show only that two points. remaining all points should disappear but i dont know how to disappear the other points.</p>
| android | [4] |
2,429,597 | 2,429,598 | change UITableViewCell background color when selected | <p>i have a UItableview and i want to change the cell background when it is seleceted and keep it like that so i tried to use
[cell setBackgroundColor:[UIColor purpleColor]];
but that made other cells get colored at same time and i dont know why
i also tried to use
[cell.textLabel setBackgroundColor:[UIColor purpleColor]];
but when i select another cell the background go back to white color
so any ideas for solving that problem??</p>
| iphone | [8] |
5,844,281 | 5,844,282 | Supress Alerts in android application | <p>Is there any way to suppress all alerts in an android application.
I want to suppress all alerts that appear in my application eventhough it is created by me or it is coming from any other library. Is it possible in android.</p>
| android | [4] |
1,372,894 | 1,372,895 | Python: Regular Expressions | <p>I'm trying to use regular expressions to search through all files in a directory then eventually it will change the name of the files.</p>
<p>Here's what I have so far.</p>
<pre><code>def regExp():
os.chdir("C:/Users/David/Desktop/Test/Files")
files = os.listdir(".")
for x in (files):
inputFile = open((x), "r")
content = inputFile.read()
inputFile.close()
try:
regex_txt = ("\(;;\)")
regex = re.compile(regex_txt)
print (regex.findall(x))
</code></pre>
<p>Getting the following error message</p>
<pre><code>File "<module1>", line 108
print (regex.findall(x))
^
</code></pre>
<p>SyntaxError: unexpected EOF while parsing</p>
<p>Any help is appreciated </p>
| python | [7] |
3,332,042 | 3,332,043 | Does jquery cancel itself out when not in order? | <p>I have been learning jquery and have noticed when putting scripts in the header section of my website they will work great UNTIL I put another jquery script either before or after that first script (like they are canceling out one another) I don't have specific code because I have noticed this while learning it, hoping that my tutorial would get to it sometime but this hasn't happened yet. I will list an example of what I am talking about:</p>
<p>The example below wouldn't work...</p>
<pre><code><script>
$(document).ready(function(){
$(this).doSomething();
});
$(function(){
$(this).doSomethingElse();
});
</script>
</code></pre>
<p>I then would delete the bottom function of the script and then reload the website and then the first script would finally start working again. Here is when i delete the bottom script:</p>
<pre><code> <script>
$(document).ready(function(){
$(this).doSomething();
});
//bottom script deleted, one above works fine
</script>
</code></pre>
<p>So, again I am new to Jquery and am wondering if jquery sort of cancels out if scripts aren't placed in order? </p>
| jquery | [5] |
1,418,195 | 1,418,196 | Dictionary copy problem | <p>I am having a dictionary like as dict1 = { 0 : 0, 1 : 1, 2 : { 0: 0, 1 : 1}} ( which is also having a dictionary as value). I want to keep store these value same for some modification checking purpose. So now i am copy this dictionary content into another dictionary as dict2 = dict1.copy().Now i am changing the values of dict2 like as { 0 : -1, 1 : -2, 2: { 0 : -1, i : -2}}. Now the problem is that my dict1's dictionary value also changing as { 0 : 0, 1 : 1, 2:{ 0 : -1, 1 : -2}}. Here you can see this easily dict1's key 2 values also changing as dict2's key 2 values.</p>
<p>How should i copy the dict2 from dict1 so if change dict2's key 2 value this should not put a impact on the dict1's key = 2 values?</p>
<p>Thanks.</p>
| python | [7] |
1,637,514 | 1,637,515 | How can I skip the current item and the next in a Python loop? | <p>This might be a really dumb question, however I've looked around online, etc. And have not seen a solid answer.</p>
<p>Is there a simple way to do something like this?</p>
<pre><code>lines = open('something.txt', 'r').readlines()
for line in lines:
if line == '!':
# force iteration forward twice
line.next().next()
<etc>
</code></pre>
<p>It's easy to do in C++; just increment the iterator an extra time. Is there an easy way to do that in Python?</p>
<p>I would just like to point, out the main purpose of this question is not about "reading files and such" and skipping things. I was more looking for C++ iterator style iteration. Also the new title is kinda dumb, and i dont really think it reflects the nature of my question.</p>
| python | [7] |
2,937,541 | 2,937,542 | javascript Date or next date based on time of day and if/else | <p>I want to show the my current shipping time on my website. Each day I have a 2:00 pm cut of and would like the date to change to the following week day. Right now I have to manually change it every day</p>
<pre><code>Currently Shipping:
Tuesday, April, 24th
Cut-off Time:
2:00 pm PST
</code></pre>
<p>I have done enough research to believe this is possible but I do not know enough about manipulating the script myself to take the pieces and put it all together. </p>
<p>The two o'clock doesn't usually change so I hope I can use a script to automatically change (just the Day, Month and Date) at the specified time</p>
<p>Please advise Thanks!</p>
<p>What I have tried to put together so far</p>
<pre><code>var currentTime = new Date();
var month = currentTime.getDay();
var month = currentTime.getMonth() + 1;
var date = currentTime.getDate();
var thehour = datetoday.getHours();
if(thehour < 14) { document.write(day + "," + month + "," + date) }
else if (thehour > 14) ...
</code></pre>
| javascript | [3] |
1,229,041 | 1,229,042 | Why following code doesn't work? | <pre><code>fin = open('/abc/xyz/test.txt', 'a+')
def lst():
return fin.read().splitlines()
print lst()
def foo(in):
print lst()
fin.write(str(len(lst()) + in)
fin.flush()
</code></pre>
<p>In above code when <code>print lst()</code> is called outside function it gives correct result, but when trying to call same funtion in function <code>foo()</code> it produces empty list which makes <code>len(lst())</code> value 0. I also tried by commenting last two line but still it gives back empty list. What is wrong in above code?</p>
| python | [7] |
5,748,177 | 5,748,178 | Cloning a div and making it appear on the screen isn't working | <p>Below is my code (don't worry about 'off', it's the offset based on the where the user clicks). In the second line I am trying to clone an existing div and then show the cloned copy? But it doesn't work. However if I remove clone() then the code does work, but of course it simply shows the existing div which isn't what I need.</p>
<pre><code>var off = $(this).offset();
var div = $('#testtt').clone();
div.css({ position: "absolute", top: off.top, left: off.left });
div.show();
</code></pre>
<p>Any tips?</p>
| jquery | [5] |
883,242 | 883,243 | how to view all images in android's built- in gallery from a php page | <p>I am developing an application to display all the images in android's built-in gallery in to a php page. I posted the uri (<code>content://media/extrenal/images/media</code>) of the gallery images to the php page. I was not able to recreate images by using webView's function <code>loadUrl()</code>.</p>
<p>Should I need to upload the whole gallery to another directory and display the images?
Or passing the bitmap itself will do?</p>
<p>Please suggest me an idea to solve the problem.</p>
| android | [4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.