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,684,581 | 3,684,582 | jquery slideshow want to remoev white screen displayed while changing images | <p>I have used the following slideshow on my site. but i don't want the blank white screen that is displayed while changing(fading image). can anyone help me on this?</p>
<p><a href="http://www.serie3.info/s3slider/demonstration.html" rel="nofollow">http://www.serie3.info/s3slider/demonstration.html</a>
http://www.serie3.info/s3slider/</p>
<p>thanks in advance</p>
| jquery | [5] |
3,892,736 | 3,892,737 | Displaying jsp page on same location using javascript | <p>How to display jsp page on same location using javascript.I tried below ways,but no luck:</p>
<pre><code>location.href='./start.do';
self.location.href='./start.do';
</code></pre>
<p>chaitu</p>
| javascript | [3] |
5,767,269 | 5,767,270 | Display last modified time of JavaScript file | <p>I am developing a webapp and the browser doesn't consistently empty the cache each time I refresh, so sometimes I'm not getting the latest version of my JavaScript file loaded.</p>
<p>I would like to have a console message indicating if I'm using the latest version of the JavaScript file each time I refresh. I'm thinking that displaying the "last modified" time of the JavaScript file will do the job!</p>
<p>Any thoughts? Is there a standard solution to my problem that I've missed?</p>
| javascript | [3] |
4,582,302 | 4,582,303 | find out if an android device has physically moved, not it's location or speed | <p>I spent the last 12 hours investigating the possibilities of doing indoor, small distance navigation based on accelerometer and compass readings. Things aren't looking good, measurement quality is terrible and unreliable.</p>
<p>I was wondering if there is any other method of finding out whether the player (its for a game, or some interactive experience platform) has moved his location a significant amount (> 1m).</p>
<p>I don't need accurate readings (although that would be great), just knowing whether the player is moving or standing still would be a great help. I wouldn't even know where to begin to look for this, and I haven't been able to come up with any brilliant ideas myself.</p>
| android | [4] |
4,137,421 | 4,137,422 | iPhone SDK: Avoid Blank screen while launching my application | <p>I am retrieving some data from server when launching my application itself. So whenever launch my application it shows a blank screen for few seconds(means it is downloading data from server) and then launches the first view. I don't want to show the blank screen to user. I want to add an image and activity indicator there.
Please route me into right direction to capture this task.</p>
<p>I appreciate your helps.</p>
<p>thanks.</p>
<p>Clave/</p>
| iphone | [8] |
3,699,515 | 3,699,516 | Java application launcher | <p>I have written a very simple Java application. Can anyone tell me how to create a launcher like icon to run that application both in Ubuntu and Windows ??</p>
<p>Thanks in advance..!!</p>
| java | [1] |
5,045,764 | 5,045,765 | jQuery size() method vs length attribute | <p>Is there any difference between <code>$(".selector").size()</code> and <code>$(".selector").length</code> ?</p>
| jquery | [5] |
5,079,909 | 5,079,910 | change the images using runOnUiThread | <p>Hi i am displaying the 2 imageViews if one image contain number 1(number1 image) second image show 2(image 2)
and again first image displayt the 2 image(number2) then second imageview display the 3 image(number 3 image)
second image view is displayed after some time of first image dispalying.for this i am using runOnUiThread concept.Please give me some suggestions to how two threads are write in runOnUiThread method .Give some sample code.Thanks in advance.</p>
| android | [4] |
4,898,165 | 4,898,166 | Python: Execute multiple Scripts simultaneously from same Interpreter | <p>I have a <strong>python script</strong>, which is executing again <strong>4-5 python scripts</strong>.
For performance reasons i want to use same interpreter for executing all the script.</p>
<p>How could I handle this issue?</p>
| python | [7] |
2,061,657 | 2,061,658 | some CATransition string types do not work | <p>I tested CATransition string types as below</p>
<pre><code>@"suckEffect"
@"spewEffect"
@"genieEffect"
@"unGenieEffect"
@"rippleEffect"
@"twist"
@"tubey"
@"swirl"
@"charminUltra"
@"zoomyIn"
@"zoomyOut"
</code></pre>
<p>I found that only @"suckEffect",@"rippleEffect" DO work.
All others are replaced by Fade Effect.</p>
<p>Even the effect of type @"suckEffect",@"rippleEffect", it looks like subtype has no function.</p>
<p>I do not know if what I got is right or not?</p>
<p>Welcome any comment.</p>
<p>Thanks</p>
<p>interdev</p>
| iphone | [8] |
813,486 | 813,487 | Generating 10 digits unique random number in java | <p>I am trying with below code to generate 10 digits unique random number. As per my req i have to create around 5000 unique numbers(ids). This is not working as expected. It also generates -ve numbers. Also sometimes one or two digits are missing in generated number resulting in 8 or 9 numbers not 10. </p>
<pre><code>public static synchronized List generateRandomPin(){
int START =1000000000;
//int END = Integer.parseInt("9999999999");
//long END = Integer.parseInt("9999999999");
long END = 9999999999L;
Random random = new Random();
for (int idx = 1; idx <= 3000; ++idx){
createRandomInteger(START, END, random);
}
return null;
}
private static void createRandomInteger(int aStart, long aEnd, Random aRandom){
if ( aStart > aEnd ) {
throw new IllegalArgumentException("Start cannot exceed End.");
}
//get the range, casting to long to avoid overflow problems
long range = (long)aEnd - (long)aStart + 1;
logger.info("range>>>>>>>>>>>"+range);
// compute a fraction of the range, 0 <= frac < range
long fraction = (long)(range * aRandom.nextDouble());
logger.info("fraction>>>>>>>>>>>>>>>>>>>>"+fraction);
int randomNumber = (int)(fraction + aStart);
logger.info("Generated : " + randomNumber);
}
</code></pre>
| java | [1] |
1,394,058 | 1,394,059 | Gathering iPhone 3g status | <p>There is a sample code of apple named "reachability" which tells us the network status of the device, wifi or edge/gprs, but I couldn't see any documentation or sample code regarding gathering if the device is on 3g or not while accessing to internet. I also googled, but no hope. Is it possible to do that, if so how?</p>
| iphone | [8] |
1,515,678 | 1,515,679 | Multiple Screen Issue | <p>I have my application running in Android Tab. But when I am delpoying in Nexus One or some other smaller device, my UI getting out of bound.
I have gone through documentaion I have found I have to use
I applied in my manifest file But not getting output.
Can anyone help me here.</p>
<p>Thanks in advance</p>
| android | [4] |
3,859,830 | 3,859,831 | android gallery circular view | <p>how can i make gallery view as circular.i am able to done left to right infinite when i drag right to left.it is showing end point.Please help me its very urgent to me</p>
<p>Thanks in advance</p>
<p>Aswan</p>
| android | [4] |
4,341,515 | 4,341,516 | Passing the Object Type dynamically | <p>I have this code that has the [Ent] inside the using</p>
<pre><code> public static void Retion()
{
using (Ent entitiesContext = new Ent())
{...}
{
</code></pre>
<p>I need to pass the [Ent] dynamically, like this:</p>
<pre><code> public static void Retion(Type ds)
{
using (ds entitiesContext = new ds())
{...}
{
</code></pre>
<p>This of course does not work. How to I change this so that I can pass it dynamically?</p>
| c# | [0] |
5,316,328 | 5,316,329 | Javascript loop continue,or break to display? | <p>Javascript loop continue,or break to display?</p>
<p>This is my code use for show or hide some data in <code>table</code></p>
<pre><code>if (type=='SHOW') {
for(var i = 0; i<list_tr.length; i++) {
document.getElementById(list_tr[i]).style.display = '';
}
else if (type=='SHOW_EXCEPT'){
document.getElementById(list_tr[0]).style.display = 'none';
document.getElementById(list_tr[1]).style.display = '';
for(var i = 2; i<list_tr.length; i++) {
document.getElementById(list_tr[i]).style.display = 'none';
}
}else{
for(var i = 0; i<list_tr.length; i++) {
document.getElementById(list_tr[i]).style.display = 'none';
}
}
</code></pre>
<p>In <code>else</code> case:</p>
<p>I want to hidden all but show <code>list_tr[2]</code> if<code>type=='SHOW_EXCEPT'</code></p>
<p>How can I do in this case?</p>
<p>thanks</p>
| javascript | [3] |
4,045,365 | 4,045,366 | how does C# search for best match overloaded method | <p>I got several questions about calling overloaded(or maybe I should call them hidden) methods in C#. Suppose I have classes as following:</p>
<pre><code>class ParaA {}
class ParaB : ParaA {}
class ParaC : ParaB {}
class TheBaseClass
{
public void DoJob (ParaA a){Console.WriteLine ("DoJob in TheBaseClass is being invoked");}
}
class TheDerivedClass : TheBaseClass
{
public void DoJob (ParaB b){Console.WriteLine ("DoJob in TheDerivedClass is being invoked");}
}
class Test
{
//Case 1: which version of DoJob() is being called?
TheDerivedClass aInstance= new TheDerivedClass ();
aInstance.DoJob(new ParaA ());
//Case 2: which version of DoJob() is being called?
TheBaseClass aInstance= new TheDerivedClass ();
aInstance.DoJob(new ParaA ());
//Case 3: which version of DoJob() is being called?
TheBaseClass aInstance= new TheDerivedClass ();
aInstance.DoJob(new ParaB ());
//Case 4: which version of DoJob() is being called?
TheBaseClass aInstance= new TheDerivedClass ();
aInstance.DoJob(new ParaC ());
}
</code></pre>
<p>I hope that I have made myself clear about what I am trying to do. I want to know how will C# search for the 'matched' version of method to invoke, when the parameters provided by the invoker do not perfectly match any signature but are compatible with some signatures. It makes me even more confused when methods are not just overloaded within a class, but also hidden, or overrided, or overloaded by derived classes. The example above does not cover every possible scenario. Is there any term for this?</p>
<p>Thank you guys in advance!</p>
<p>Matthew</p>
| c# | [0] |
162,934 | 162,935 | error handling on browser | <p>Presently I'm developing my own website named <a href="http://justclickme.com" rel="nofollow">http://justclickme.com</a> . This website which is everything works fine but am getting this error</p>
<pre><code>Notice: Undefined variable: body in E:\wamp\www\jcme\email-order-form.php on line 60
</code></pre>
<p>Here is my code</p>
<pre><code>$to = sendmail_single_field_orderform($sessionid,'emailid');
$subject = just click me.';
$body .= "<html><title>SPS Mobile Services</title></body>";->here only am getting error
$body .= "<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
</code></pre>
<p>What could be causing this error?</p>
| php | [2] |
3,143,065 | 3,143,066 | Will this piece of code for binary tree cause any issue? | <p>I have written a piece of code and it runs fine on my system. I am not having any issue, but I have a few concerns, which I am listing below. I would like to know if there is a real issue.</p>
<pre><code># include <iostream>
# include <stdio.h>
# include<conio.h>
using namespace std;
struct tree
{
int data;
struct tree * left;
struct tree * right;
};
struct tree * insert(struct tree * root,int value)
{
if(root==NULL)
{
struct tree *node=(struct tree *)malloc(sizeof(struct tree));
node->data = value;
node->left=NULL;
node->right=NULL;
return node;
}
else if(root->data > value)
root->left=insert(root->left,value);
else {
root->right=insert(root->right,value);
/*return root;*/ // code works fine for me without this return
}
}
void display(struct tree * root)
{
if (root!=NULL)
{
display(root->left);
cout << "value is : " << root->data << " \n";
display(root->right);
}
}
int main()
{
struct tree* root=NULL;
root=insert(root,8);
insert(root,6);
insert(root,5);
insert(root,2);
insert(root,1);
insert(root,7);
insert(root,15);
display(root);
delete root;
getch();
}
</code></pre>
<p>My code works fine without the <code>return root</code> statement in the insert function. The thing that worries me is that I am not returning anything during the recursive calls between the creation of the root and the insertion of the final element in this recursive function. But things are still all fine for me.</p>
<p>Can this become a problem in the future in more complex coding scenarios? </p>
| c++ | [6] |
4,286,561 | 4,286,562 | C++ character to int | <p>what happens when you cin>> letter to int variable? I tried simple code to add 2 int numbers, first read them, than add them. But when I enter letter, it just fails and prints tons of numbers to screen. But what causes this error? I mean, I expected it to load and use ASCII code of that letter. </p>
| c++ | [6] |
3,961,122 | 3,961,123 | Disabling keyboard/mouse in Java | <p>I am working on a program, which allows the user to lock the computer, so no one else can use it. Is there anyway, I can disable the mouse, and specific keys on the keyboard? Thanks.</p>
| java | [1] |
3,788,723 | 3,788,724 | PHP: use id to another column | <p>Ok, so i have a normal query that inserts to the database.</p>
<pre><code>mysql_query("INSERT INTO users_pm_in (uID, msg) VALUES ('$uID', '$msg')");
</code></pre>
<p>Now this table has also a column called "id" with auto_increment & primary key.</p>
<p>When it inserts it auto makes number for the column in the row. Now I want this number, and put it in column dialog, in the same row. So the inserted row have the same number/id in "id" and "dialog". How can i do that?</p>
| php | [2] |
1,248,586 | 1,248,587 | How can I access a shared dictionary with multiprocessing? | <p>I think I am following the python documentation correctly but I am having trouble getting the result I am looking for. I basically have a list of numbers, that are being passed to a function of nested for loops and the output is saved in a dictionary.</p>
<p>Here's the code:</p>
<pre><code>from multiprocessing import Pool, Manager
list = [1,2,3,10]
dictionary = {}
def test(x, dictionary):
for xx in range(100):
for xxx in range(100):
dictionary[x]=xx*xxx
if __name__ == '__main__':
pool = Pool(processes=4)
mgr = Manager()
d = mgr.dict()
for N in list:
pool.apply_async(test, (N, d))
# Mark pool as closed -- no more tasks can be added.
pool.close()
# Wait for tasks to exit
pool.join()
# Output results
print d
</code></pre>
<p>Here's the expected result:</p>
<pre><code>{1: 9801, 2: 9801, 3: 9801, 10: 9801}
</code></pre>
<p>Any suggestions of what I'm doing wrong? Also, I haven't convinced myself that shared resources are the best approach(thinking of using a database to maintain state) so if my approach is completely flawed or there's a better way to do this in python please let me know.</p>
| python | [7] |
5,088,259 | 5,088,260 | Set Masterpage from Global.asax in ASP.NET | <p>I want to set the Masterpage property in Global.asax.</p>
<p>This is what I have done but I get a <code>NullReferenceException</code> on the first line. Any ideas how to do this?</p>
<pre><code>protected void Application_PreSendRequestContent(Object sender, EventArgs e)
{
System.Web.UI.Page page = System.Web.HttpContext.Current.Handler as System.Web.UI.Page;
if (Session["lang"] == "eng")
{
page.MasterPageFile = "SideMasterPageEng.master";
}
}
</code></pre>
| asp.net | [9] |
5,454,989 | 5,454,990 | nth selector jquery displaying nth value | <p>I want to be able to choose an nth child from a list of spans and display their nth value (or position) on button click.</p>
<p>So if I have:</p>
<pre><code>item a
item b
item c
item d
item e
</code></pre>
<p>on button press I want it to display: </p>
<pre><code>1 item a
2 item b
3 item c
4 item d
5 item e
</code></pre>
<p>is this possible and if so how? </p>
<p>The HTML (from answer below)</p>
<pre><code><div class="items">item a</div>
<div class="items">item b</div>
<div class="items">item c</div>
<div class="items">item d</div>
<div class="items">item e</div>
</code></pre>
| jquery | [5] |
4,642,647 | 4,642,648 | PHP preg_match get the last item | <p>I have a string with a list of items, and I would like to get the last one.
The reality is much more complex, but it boils down to:</p>
<pre><code>$Line = 'First|Second|Third' ;
if ( preg_match( '@^.*|(?P<last>.+)$@', $Line, $Matches ) > 0 )
{
print_r($Matches);
}
</code></pre>
<p>I would expect Matches['last'] to contain 'Third', but it does not work. Rather, I get Matches[0] to contain the full string and nothing else.
What am I doing wrong?
Please no workarounds, I can do it myself but I would really like to have this working with preg_match</p>
| php | [2] |
3,193,638 | 3,193,639 | How do I used values declared in XML on my custom layout? | <p>Im creating a custom layout and I want to use the text declared in the <code>layout.xml</code> file in my layout.</p>
<p>Like when I create a <code>TextView</code> in XML and set <code>android:text=@string/text1</code> when I run the app text view automatically loads the text from android:text. So how can I access attributes declared in the layout XML file in my custom component.</p>
| android | [4] |
272,337 | 272,338 | How to make variable in method global? | <p>For example I have a method like this. If you see the String 'tablenumber' I want to be able to use it in a later function such as a onclick button so I can send the contents of it to a different activity. But if I use this variable outside the method it's not recognised. How do I go about this.</p>
<pre><code>{
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
String tablenumber = (String) arg0.getSelectedItem();
}
public void onNothingSelected(AdapterView<?> arg0) {
}
});
</code></pre>
| android | [4] |
2,998,523 | 2,998,524 | How to change view using Actionsheet in iphone? | <p>Can anyone please tell me how to change view from current view using actionsheet in iphone with sample code </p>
<p>I have three button index. I use action sheet to determine which button is pressed. So if buttonindex 2 is pressed i want to switch view. The switched view will have viewcontroller with image on it and its GPS coordinates. Can u pleasse tell me how to do it.</p>
| iphone | [8] |
133,588 | 133,589 | "|" pipe operator not working in command line in C++ | <p>I am having a windows application interacting with DB2 database. In my application i have code to execute some DB2 commands through command line interface. I have used windowsAPI "ShellExecuteEx()" to execute those DB2 commands through command line.</p>
<p>Following is the code written to execute DB2 command through command line.</p>
<pre><code> string command = "/c /w /i DB2 UNCATALOG NODE DB_DATABASE ">>" test.log | echo
%date% %time% >> test.log";
SHELLEXECUTEINFO shellInfo;
ZeroMemory(&shellInfo, sizeof(shellInfo));
shellInfo.cbSize = sizeof(shellInfo);
shellInfo.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOCLOSEPROCESS;
shellInfo.lpFile = "db2cmd";
shellInfo.lpParameters = command.c_str();
if (ShellExecuteEx(&shellInfo))
{
WaitForSingleObject(shellInfo.hProcess, INFINITE);
CloseHandle(shellInfo.hProcess);
bStatus = true;
}
else
{
bStatus = false;
}
</code></pre>
<p>The code is executed successfully , however if test.log is observered i only get result of DB2 command and not date and time. If you see the above command there is "|" pipe operator and echo command to log date and time in test.log</p>
<p>Please note that if I execute above DB2 command through separately command line i.e. not through code. I am able to view date and time log along with DB2 command result in test.log. Following is the full command which i executed through command line.
DB2CMD /c /i /w DB2 UNCATALOG NODE DB_DATABASE ">>" test.log | echo %date% %time% >> test.log</p>
<p>According to me since DB2 command is executed successfully through code, there is problem with only usage of "|" pipe operator or echo command.</p>
| c++ | [6] |
4,180,552 | 4,180,553 | Interesting--a GridView does not databind/refresh upon postback unless the postback is called by itself? | <p>Anyone with similar conclusion?</p>
| asp.net | [9] |
2,834,243 | 2,834,244 | Android: launch same instance | <p>I am creating a Home shortcut with the following code:
I would like to get the same opened instance (if exist) of the app launched and not a new instance.</p>
<pre><code> public void createShortcut() {
if (app.prefs.getBoolean("prefs_ShortcutCreated", false) == false) {
Intent shortcutIntent = new Intent();
shortcutIntent.setClassName(this, this.getClass().getName());
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
Intent addIntent = new Intent();
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "test");
addIntent.putExtra("duplicate", false);
File image = new File(app.DEFAULT_APP_FOLDER_MAIN, "icon.png");
AssetManager assets = app.getApplicationContext().getResources().getAssets();
try {
copy(assets.open("icon.png"), image);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Bitmap theBitmap = BitmapFactory.decodeFile(app.DEFAULT_APP_FOLDER_MAIN + "icon.png");
Bitmap scaledBitmap = Bitmap.createScaledBitmap(theBitmap, 128, 128, true);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON, scaledBitmap);
addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
sendBroadcast(addIntent);
theBitmap.recycle();
scaledBitmap.recycle();
Editor editor = app.prefs.edit();
editor.putBoolean("prefs_ShortcutCreated", true);
editor.commit();
}
}
</code></pre>
| android | [4] |
3,073,254 | 3,073,255 | jquery - best way of finding if select box option is unselected | <p>Whats the best way to check a select box to find out if the selected options value is empty?</p>
<p>i have tried the following and other variations but no luck so far:</p>
<pre><code>if($('.mySelectBox').val('').length) { alert('not selected'); }
</code></pre>
| jquery | [5] |
662,709 | 662,710 | Making user defined Map | <p>I have a pojo named Employee, now I want to make a user defined collection that I want to put on a map. Please advise me how to achieve this.</p>
<pre><code>public class Employee {
String name,job;
int salary;
public Employee(String n , String j, int t) {
this.name= n;
this.job=j;
this.salary= t;
}
@Override
public int hashCode() {
return name.hashCode()+job.hashCode()+salary;
}
@Override
public boolean equals(Object obj) {
Employee e = (Employee) obj;
return this.name.equals(e.name) && this.job.equals(e.job)
&& this.salary == e.salary;
}
}
</code></pre>
| java | [1] |
3,225,772 | 3,225,773 | Executing a function to each item on a Nodelist in Javascript | <p>I want to add an <code><img></code> to every <code><td></code> tag with a certain CSS Class in my page.
I used "querySelectorAll" to look them up, like this:</p>
<pre><code>var painted = document.querySelectorAll('.painted');
</code></pre>
<p>Now I would like to add to each one of them a specific image with a unique ID. I assume I need to loop through the list somehow and edit each element's innerHTML, could anyone provide the syntax for that?</p>
<p>Thanks</p>
| javascript | [3] |
2,589,910 | 2,589,911 | Marking method parameter final, value of | <p>In this example, what value does declaring <code>Object final</code> offer?</p>
<pre><code>private void doSomethingClever(final Object o) {
}
</code></pre>
| java | [1] |
4,610,916 | 4,610,917 | What is the correct way to make a SELECT in PHP and MYSQL? | <p>How can i do a select from a variable received from a form? </p>
<p>I have the following code but i think that i cannot do this : '%'.$texto.'%' </p>
<pre><code>$busqueda=$_POST['texto'];
$tipo=$_POST['tipo'];
if($tipo='titulo')
$res=mysql_query("SELECT * FROM LIBRO WHERE LI_TITULO like '%'.$texto.'%'",$conexion);
</code></pre>
<p>What should i do? Thank you for your time.</p>
| php | [2] |
3,929,623 | 3,929,624 | Action Bar Home Logo/Button/Icon | <p>In my app, the user should be able to tap on the app icon on the action bar to go back to the very first activity. I have tried to implement the following code but it doesn't seem to work. Anybody has any suggestions to make it work?</p>
<pre><code>@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.result_details);
ActionBar actionBar = getActionBar();
actionBar.show();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
new MenuInflater(this).inflate(R.layout.menu, menu);
return (super.onCreateOptionsMenu(menu));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
Intent intent = new Intent(this, First.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
return true;
case R.id.feedback:
Intent intent1 = new Intent(ResultDetails.this.getApplicationContext(), feedback.class);
ResultDetails.this.startActivity(intent1);
return (true);
case R.id.about:
Intent intent2 = new Intent(ResultDetails.this.getApplicationContext(), about.class);
ResultDetails.this.startActivity(intent2);
return (true);
}
return (super.onOptionsItemSelected(item));
}
</code></pre>
| android | [4] |
4,828,575 | 4,828,576 | Issue with a php form | <p>I've created a very basic php form for a website and the form mostly works - only problem is that when the form is emailed to the gmail account, only one line (the "college" line) shows up in the email, with the rest blank. The sender's name ($field_name) appears in the subject line of the message (along with the xxx.Org TShirt Order part of the message), but the only line that appears in the body of the message is the "college part".</p>
<p>Here's the code (I'm aware that it's not sterilized... I'm really new to php and I don't feel like I've got a handle on the language yet, so I'm starting really basic):
<pre><code>$mail_to = 'xxx@gmail.com';
$subject = 'xxx.Org TShirt Order - '.$field_name;
$body_message = 'From: ' . $field_name . "\n";
$body_message .= 'E-mail Address: '.$field_email."\n";
$body_message .= 'Quantity of Shirts: '.$field_quantity."\n";
$body_message = 'Shirt Style(s): '.$field_which."\n";
$body_message .= 'Size(s): '.$field_size."\n";
$body_message .= 'School: '.$field_school."\n";
$body_message = 'College: '.$field_college."\n";
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for placing an order with xxx.Org. We will contact you shortly.');
window.location = 'contact_page.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please send an email to xxx@gmail.com');
window.location = 'contact_page.html';
</script>
<?php
}
?>
</code></pre>
| php | [2] |
4,915,824 | 4,915,825 | Getting a RotateDrawable from XML results in crash | <p>I'm trying to retrieve a RotateDrawable defined in XML but it causes an excetion when I call getDrawable(). Here are my XML and java files:</p>
<p>square.xml</p>
<pre><code> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
android:id="@+id/mysquare">
<solid android:color="#0000f8"/>
<size android:height="200dp" android:width="200dp"></size>
<padding android:top="0dp"></padding>
</shape>
</code></pre>
<p>myrotate.xml</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://android.com/apk/res/android"
android:drawable="@drawable/square"
android:fromDegrees="0"
android:toDegrees="45"
android:pivotX="50%"
android:pivotY="50%">>
</rotate>
</code></pre>
<p>Indicator.java (only relevant code shown)</p>
<pre><code>public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
setContentView(R.layout.drawablelayout);
Button b = (Button)findViewById(R.id.btnAnimate);
b.setOnClickListener(this);
r = getResources();
/* this is where the exception happens */
RotateDrawable rt = (RotateDrawable) r.getDrawable(R.drawable.myrotate);
}
</code></pre>
<p>Can anyone tell me how I'm supposed to get a RotateDrawable from XML?</p>
| android | [4] |
2,391,270 | 2,391,271 | How can i use web cookies in android app | <p>I want to use webCookie in in android app. how can i use it?
Situation like this when I were open gmail from my browser and then logged in it . then in my app webview i want to use same cookies if i opened gmail in webview in app and in app user will be automatically logged in.</p>
| android | [4] |
3,451,183 | 3,451,184 | Stripping out < and > in javascript doesn't quite work | <pre><code> function SanitizeInput(input) {
input = input.replace(/</g, "&lt;");
input = input.replace(/>/g, "&gt;");
return input;
}
document.write(SanitizeInput("Test!<marquee>bibble</marquee>"));
</code></pre>
<p>If you pop this into jsfiddle.net the result is <code>Test!<marquee>bibble</marquee</code> without the trailing ></p>
<p>Can anyone explain what I'm doing wrong?</p>
<p>Edit: Replacing it with ( and ) seems to work perfectly</p>
| javascript | [3] |
2,058,974 | 2,058,975 | My Android emulator won't launch and there are no errors, any ideas? | <p>When I try to run my application as an Adroid App this is what my console reports:</p>
<p>[2011-10-22 15:21:32 - HelloWorldAndroid] ------------------------------<br>
[2011-10-22 15:21:32 - HelloWorldAndroid] Android Launch!<br>
[2011-10-22 15:21:32 - HelloWorldAndroid] adb is running normally.<br>
[2011-10-22 15:21:32 - HelloWorldAndroid] Performing Hello.World.MyHelloWorld activity launch<br>
[2011-10-22 15:21:32 - HelloWorldAndroid] Automatic Target Mode: launching new emulator with compatible AVD 'Android_1.5_Emulator'<br>
[2011-10-22 15:21:32 - HelloWorldAndroid] Launching a new emulator with Virtual Device 'Android_1.5_Emulator'</p>
<p>When I open the AVD Manager says that it is valid. When I click start I get a quick loading screen and then it closes and thats it. I have changed the launch action in the configuration. I have deleted and recreated the emulator and the Android project. I am also using Ubuntu 11.10. Does anyone have ideas on the problem? </p>
| android | [4] |
5,968,191 | 5,968,192 | How to solve this error "String was not recognized as a valid DateTime " | <p>Hello
I am using datetime datatype in sql sever but whenever i save this form i am getting this error "<strong>String was not recognized as a valid DateTime</strong>" . In my code i am using ajax code on textbox to select date . But same error i am getting . I am specify date format into it but still it get error . What we do now.</p>
| asp.net | [9] |
1,527,875 | 1,527,876 | PHP not updating select boxes correctly | <p>Here is another one. Twice in the same day. I'm trying to set up 4 select boxes that shows a option selected based the values in Target1-4 if they are equal to the value of enSlot.</p>
<pre><code>echo "<select id='target".$row['paSlot']."' size='1' style='width:90px;'>";
$query = "SELECT * FROM enemy WHERE enChar = ".$_SESSION['chNum']." ORDER BY enSlot";
$result1 = mysql_query($query, $_SESSION['connect']) or die('Error 150: '.mysql_error());
while ($row1 = mysql_fetch_array($result1)) {
$s = "";
if ($_GET['Target1'] == $row1['enSlot']) {
$s = "selected='selected'";
}
if ($_GET['Target2'] == $row1['enSlot']) {
$s = "selected='selected'";
}
if ($_GET['Target3'] == $row1['enSlot']) {
$s = "selected='selected'";
}
if ($_GET['Target4'] == $row1['enSlot']) {
$s = "selected='selected'";
}
echo "<option value=".$row1['enSlot']." ".$s.">".$row1['enSlot'].". ".$row1['enRace'];
}
echo "</select>";
</code></pre>
<p>I run it with this:</p>
<p>Target1 = 1, Target2 = 2, Target3 = 3, Target4 = 4
Enemy has 4 records, enSlot = 1 - 4</p>
<p>When it executes I get all 4 select boxes show the last value of Target4 being selected.</p>
| php | [2] |
494,858 | 494,859 | Disable backspace and delete key with javascript in IE | <p>Anyone know how can I disable backspace and delete key with Javascript in IE? This is my code below, but seems it's not work for IE but fine for Mozilla.</p>
<pre><code>onkeydown="return isNumberKey(event,this)"
function isNumberKey(evt, obj)
{
var charCode = (evt.which) ? evt.which : evt.keyCode
if (charCode == 8 || charCode == 46) return false;
return true;
}
</code></pre>
| javascript | [3] |
153,918 | 153,919 | Command Line Speech Recognition event handler issue | <p>I have this command line software that listens for speech recognition for couple of words.</p>
<p>In the main function I have this event handler:</p>
<pre><code>speechRecognitionEngine.SpeechRecognized +=
new EventHandler<SpeechRecognizedEventArgs>(engine_SpeechRecognized);
</code></pre>
<p>and the function:</p>
<pre><code>public static void engine_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
Console.WriteLine("\r" + getKnownTextOrExecute(e.Result.Text));
}
</code></pre>
<p>What can I do in the main function to keep the command line open and printing the words from the event handler ?</p>
<p>Thanks.</p>
| c# | [0] |
4,775,856 | 4,775,857 | Jquery - Any idea where to find an already made plugin for sliding images? | <p>I can't think of what to even search for in google (not sure what you would call this plugin). So I've been using this:</p>
<p><a href="http://coffeescripter.com/code/ad-gallery/" rel="nofollow">http://coffeescripter.com/code/ad-gallery/</a></p>
<p>But literally I only use it for the bottom sliding navigation.</p>
<p>The things is, I'm not using a lot of the functionality, so in reality it's pretty bloated.</p>
<p>What would you call that part of a plugin, or better yet, where would I find one?</p>
| jquery | [5] |
396,521 | 396,522 | echo text if .php extentin exists in a folder using a php script | <p>im trying to make a php script that if a .php extention exists in a folder it says check mail, if no .php files exist no mail either one or the other results show up not both.</p>
<pre><code><?php
$directory = "http://server1.bioprotege-inc.net/roleplay_realm_online/contact_us_files/";
if (glob($directory . "*.php") != true) {
echo 'Check Mail:';
}
else {
echo 'No mail Today';
}
?>
</code></pre>
<p>that what I got but it aint working it only shows the same result if there is a .php file in the folder or not</p>
| php | [2] |
1,581,675 | 1,581,676 | Creating and saving image from byte[] | <p>I am storing an array of bytes into SQL Server. I want to create and save an image from a byte[] but several attempts seem unreliable and result in intermittent exceptions.</p>
<p>What is the best way to go about this?</p>
<p>EDIT: I got exceptions such as incorrect parameter and GDI exception. I don't have the code as this is on my machine at work.</p>
<p>Thanks</p>
| c# | [0] |
5,761,249 | 5,761,250 | Split a string in to words and numbers | <p>I have a string as below.</p>
<blockquote>
<p><code>sil(0.14,0.25) in(0.25,0.82) order(0.82,1.03) to(1.03,1.17) entertain(1.17,1.94) the(1.94,2.04) people(2.04,2.41) who(2.41,2.54) are(2.54,2.6) listening(2.6,3.13) to(3.13,3.29)</code> you, ..........</p>
</blockquote>
<p>I have split the string as follow.</p>
<blockquote>
<pre><code>sil
0.14
0.25
in
0.25
0.82
order
0.82
1.03
to
1.03
1.17
</code></pre>
</blockquote>
<p>What I want is to find the difference between the two numbers after each word.
eg : sil = 0.25 - 0.14
in = 0.82 - 0.25</p>
<p>Please let me know how to do this task.</p>
<p>Thaks a lot.</p>
| java | [1] |
5,297,576 | 5,297,577 | TextView multiline clipping in TableRow | <p>I have searched for couple of hours about this problem, but found no helping solution.
Here is the problem</p>
<p><img src="http://i.stack.imgur.com/zda5n.png" alt="enter image description here"></p>
<p>The textview at [0, 0] got clipped when using multiline. And here is xml code.</p>
<pre><code> <TextView
android:id="@+id/testtextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="2"
android:text="Line 1\nLine2"
android:textAppearance="?android:attr/textAppearanceSmall" />
</code></pre>
<p>I've tried adding padding and margin, but nothing seems to be working, what could be the problem ? Thanks :)</p>
<p>PS : Doesn't happen in Android 1.6 and I also tried setting text programmatically, even with <code>HTML.fromHtml</code> using <code><br/></code>, seems like bad measuring of View.</p>
<p>Edit:
Wow adding BottomMargin works now, It didn't work last time, really sometimes Eclipse doesn't builds and uploads last built version. Quite annoying, specially when testing something like this.</p>
| android | [4] |
466,830 | 466,831 | Javascript Showing Image | <p>Can someone please tell me how to display an image instead of this showing as text. I am using this part of a html table script. Thanks!</p>
<pre><code> cell.appendChild(document.createTextNode("<img src='menubar/ico_delete16.gif' width='16' height='16'>"));
</code></pre>
| javascript | [3] |
1,929,248 | 1,929,249 | Adapt an iterator to behave like a file-like object in Python | <p>I have a generator producing a list of strings. Is there a utility/adapter in Python that could make it look like a file?</p>
<p>For example,</p>
<pre><code>>>> def str_fn():
... for c in 'a', 'b', 'c':
... yield c * 3
...
>>> for s in str_fn():
... print s
...
aaa
bbb
ccc
>>> stream = some_magic_adaptor(str_fn())
>>> while True:
... data = stream.read(4)
... if not data:
... break
... print data
aaab
bbcc
c
</code></pre>
<p>Because data may be big and needs to be streamable (each fragment is a few kilobytes, the entire stream is tens of megabytes), I do not want to eagerly evaluate the whole generator before passing it to stream adaptor.</p>
| python | [7] |
5,864,414 | 5,864,415 | jquery addclass and radio button handling | <p>I'm having some trouble. I'm trying to add a class according to what value the option selected has.</p>
<p>I thought this would work.</p>
<pre><code> if ($("input#field_24").val() == "patient") {
$("div[id*='-form'] input#field_25").addClass(" required");
}
</code></pre>
<h2>EDIT</h2>
<p><a href="http://jsfiddle.net/AlienWebguy/C7Gg3/1/" rel="nofollow">Solution</a></p>
<p>Sorry to have added a similar question. This answered mine.</p>
<p>Thanks!</p>
| jquery | [5] |
1,589,560 | 1,589,561 | Is there a way to change PHP core value (allow_url_fopen) inside PHP script? | <p>Is there a way to change PHP core value "allow_url_fopen" in the PHP script?</p>
<p>On my hosting it is set to 'off' and I need it 'on'.</p>
| php | [2] |
289,404 | 289,405 | Why not True == True: | <p>The last point of the style guide <a href="http://www.python.org/dev/peps/pep-0008" rel="nofollow">http://www.python.org/dev/peps/pep-0008</a></p>
<p>reads ...</p>
<p>Don't compare boolean values to True or False using ==.</p>
<p>Why?</p>
<p>Edit
Just to make it clear what im asking (and it's indicative of the problem itself), when you write </p>
<pre><code>if something:
print "something is true"
</code></pre>
<p>You are doing an implicit conversion to a boolean which may or may not work depending on what true means. IMHO this form of programming is discouraged because of the side effects it can cause.</p>
<pre><code>numberOfApples = -1
if numberOfApples:
print "you have apples" # is not what is intended.
if numberOfApples == True:
print "you have apples" # is also not what is intended.
iHaveApples = numberOfApples > 0
if iHaveApples is True: # Edit: corrected this.. the "is" is better than the ==
print "you have apples" # is correct.
</code></pre>
<p>Implicit conversions disguise logical errors. So why does the style guide encourage this? </p>
| python | [7] |
2,209,980 | 2,209,981 | help in creating schedule generator | <p>I'm looking to create a schedule generator but I'm not sure how (I'm a beginner at C#).</p>
<p>-16 weeks, 32 teams, 8 divisions</p>
<p>-Team must play other teams in its division twice (total of 6 games), no more.</p>
<p>----Division is a property of the team class. (league > team > Division)</p>
<p>-Team's schedule must alternate weekly between a home game and an away game</p>
<p>-Result of each game ought to add to the winning team's W column in their W-L record and the losing team's W-L record would receive an L.</p>
| c# | [0] |
4,408,752 | 4,408,753 | Is it possible to declare an array as constant | <p>We can define a constant like <code>define("aconstant','avalue');</code>. Can't we define array in this fashion like <code>define("months",array("January", "February", ---); ?</code></p>
| php | [2] |
3,812,513 | 3,812,514 | context menu android | <p>i have a listactivity in android. A context menu open when i press an item of my listview.</p>
<p>The problem occurs when i close this context menu and i back to press the same item (the other items have no problems)</p>
<p>if i press into the text, the context menu doesn't open, but if i press in white area then the contextmenu appears.</p>
<p>¿what's the problem?</p>
<p>oncreate method:</p>
<pre><code>lv = getListView();
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
TextView text = (TextView) view.findViewById(R.id.label);
if (!text.getTag().toString().equals("-1"))
{
registerForContextMenu(text);
openContextMenu(text);
}
}
});
</code></pre>
| android | [4] |
432,318 | 432,319 | Stack overflow when overloading << operator | <pre><code>#include<iostream>
using namespace std;
class aClass
{
public:
char *message;
aClass(const char *message);
~aClass(){delete[] message;}
};
aClass::aClass(const char* newmessage)
{
message = new char[strlen(newmessage) +1];
strcpy(message,newmessage);
}
const ostream& operator<<(const ostream& o, const aClass &a)
{
o << a.message;
return o;
}
int main()
{
aClass b("Hello");
cout << b;
}
</code></pre>
<p>Can someone explain to me why the code above produces an infinite loop?</p>
| c++ | [6] |
3,241,466 | 3,241,467 | JQuery - Hide/Show with logic | <p>I am novice when it comes to JQuery. To put it simply, I have four divs, of class "portlet-topper". Each div has a sibling of the class "portlet-content". This content is hidden, until an instance of portlet-topper is clicked. Once it is clicked, it's sibling content is displayed. I use the following code: </p>
<pre><code>$(".portlet-topper").click(function(e){
e.preventDefault();
$(this).siblings(".portlet-content").toggle();
});
</code></pre>
<p>To clarify before a click:</p>
<p>|----portlet-topper-A----|</p>
<p>|----portlet-topper-B----|</p>
<p>After A is clicked:</p>
<p>|----portlet-topper-A----|</p>
<p>Portlet Content of A</p>
<p>|----portlet-topper-B----|</p>
<p>If I click B, the content of B displays, and A's is left displayed as well. If A has been clicked, I would like the clicking of B to display B while hiding A. How would I go about coding in this logic? I would need this to work for any number of divs, not just two. Essentially, allow only one set of portlet-content to be displayed at once. I figure I'd make explicit calls to show and hide, rather than toggle. Even still, I'm not really sure where to start...</p>
<p>Also, I am using Liferay, so I have little control over the class and id's of each div. I can only manipulate the css or the javascript</p>
| jquery | [5] |
4,555,507 | 4,555,508 | Which technology should I use to implement a Java-written WebService, to consume with the apache HttpClient in android? | <p>I would like to create a Java-written RESTFul Web Service, possibly using an eclipse plugin.</p>
<p>This service should be consumed by an android application, using the apache HttpClient.</p>
<p>But my question is, which is the best/ideal technology (server side) to implement this kind of web service?</p>
| android | [4] |
1,936,091 | 1,936,092 | scripting subtlties | <blockquote>
<p><strong>Possible Duplicates:</strong><br>
<a href="http://stackoverflow.com/questions/6223050/when-to-use-anonymous-javascript-functions">When to use anonymous JavaScript functions?</a><br>
<a href="http://stackoverflow.com/questions/2932186/is-there-any-difference-between-var-name-function-function-name-in">Is there any difference between var name = function() {} & function name() {} in Javascript?</a> </p>
</blockquote>
<p>in javascript (and other scripting languages) what is the 'real' difference between these two syntax:</p>
<p>a) <code>function myFun(x) { yadda yadda }</code></p>
<p>b) <code>myFun(x) = function { yadda yadda }</code></p>
<p>to a casual observer - no 'real' difference - you still call either as myFun()...and they still return the same thing, so if reference and return are identical - is it a preference or is there some difference in the code parsing engine that treats these two differently - and if so - when would you use one over the other???</p>
| javascript | [3] |
3,446,621 | 3,446,622 | Error Message function | <p>I am trying to insert messages to a function</p>
<pre><code>function addMessage($item) {
if ($result) {
$message = '<p class="ok">
<span> Item added </span>
</p>
';
header("Refresh: 2; url=?page=$item");
}
else{
$message = '<p class=not><span>There is an error blah blah</span></p>';
}
return $message;
</code></pre>
<p>}</p>
<p>When I use it : addMessage('contents') it only returns to second condition. How can I fix this?</p>
| php | [2] |
1,140,279 | 1,140,280 | how to send MMS without GUI | <p>I am using <a href="http://stackoverflow.com/questions/2972845/i-want-send-image-through-using-mms-in-android">i want send image through using mms in Android</a> this post write the MMS without GUI...
but I am unable replace the code..</p>
<pre><code> HttpUtils.httpConnection(context, 4444L, MMSCenterUrl,
bytesToSendFromPDU, HttpUtils.HTTP_POST_METHOD, !TextUtils
.isEmpty(MMSProxy), MMSProxy, port);
</code></pre>
<p>"HttpUtils" class is depricated now.. so I can't use this class..
can anyone suggest me what will be the alternative for this..
providing code will be more helpful..</p>
| android | [4] |
1,299,377 | 1,299,378 | for and do...while looping in c++ | <p>//i wrote the following code to shuffle a deck of cards (fig 8.26 deitel&deitel) </p>
<pre><code>int i,j;
for(int x=1;x<53;x++) {
i=rand()%4;
j=rand()%13;
if(deck[i][j]=0)
deck[i][j]=x;
else
x--;
}
</code></pre>
<p>//this didn't produce any result whereas the following code produced results </p>
<pre><code>int i,j;
for(int x=1;x<53;x++) {
do {
i=rand()%4;
j=rand()%13;
} while(deck[i][j]!=0);
deck[i][j]=x
}
</code></pre>
<p>//plz tell me what is the difference </p>
| c++ | [6] |
1,292,358 | 1,292,359 | jQuery: Dropdown option based off the previous dropdown selection | <p>I am trying to populate the second dropdown box based on the selection of the first.
I did my research and found that most of the suggestions/solutions provided are pre loaded with dropdown values.</p>
<p>I am trying to access the database and get the values. I was able to pull this off in Javascript but i found that the Jquery solution would be effective as i have lot of items in the database. </p>
<p>So here is what i have so far. Any suggestions on how I can use MySQL queries to retrieve data from the database and autopopulate ?</p>
<pre><code><script type="text/javascript">
jQuery(document).ready(function($) {
$(".countryDropDown").change(function() {
var country = $(this).val();
function fillStateDropDown(countryStateOption) {
$.each(countryStateOption, function(val, text) {
$('.stateDropDown').append(
$('<option></option>').val(val).html(text));
});
}
function clearStateDropDown() {
$('.stateDropDown option:gt(0)').remove();
}
if (country == 'INDIA') {
clearStateDropDown();
var indiaStateOption = {
RAJASTHAN: 'Rajasthan',
GUJRAT: 'Gujrat',
MAHARASTRA: 'Maharastra'
};
fillStateDropDown(indiaStateOption);
}
else if (country == 'UK') {
clearStateDropDown();
var ukStateOption = {
LONDON: 'London',
LIVERPOOL: 'Liverpool',
DERBY: 'Derby'
};
fillStateDropDown(ukStateOption);
}
else if (country == 'USA') {
clearStateDropDown();
var usaStateOption = {
CALIFORNIA: 'California',
TEXAS: 'Texas',
NEWYORK: 'New York'
};
fillStateDropDown(usaStateOption);
}
var stateOptions = {
val1: 'text1',
val2: 'text2'
};
});
});
</script>
</code></pre>
| jquery | [5] |
5,746,390 | 5,746,391 | How to select standard Android menu icons? | <p>I want to select the a standard Android menu icon based on the current Android version the phone is running.</p>
<p>Example icons:</p>
<p><img src="http://i.stack.imgur.com/kSPB5.png" alt="enter image description here"></p>
<p><strong>Remember!</strong> I do not want <strong>drawables</strong> for this purpose, I do want the correct icon based on the devices API.</p>
<p>Is this possible?</p>
| android | [4] |
1,646,423 | 1,646,424 | SimpleJsCart - Adding 2 title tafs | <p>I'm trying to setup SimpleJSCart and I'm struggling with 1 little point.</p>
<p>When I'm adding an item into the cart for some reason its duplicating it.</p>
<p>For instance if I add 1 "Awesome T-Shirt" it adds to the cart:</p>
<ul>
<li>1 x Awesome T-Shirt, Awesome T-Shirt £2.99</li>
</ul>
<p>Can anyone shed any light on why it's doing this?</p>
| jquery | [5] |
352,073 | 352,074 | What are different ways to develop application in android? | <p>Can anybody help me to know , in how many ways we can develop application for Android platform.The only one way that i know is through Java.Somewhere i read that other than Java like Python , Rails and Native C are also used to develop android application.Please help me if anybody knows it, in terms of how these languages are used to create application with any tutorials ,documents or books.</p>
| android | [4] |
5,973,908 | 5,973,909 | How to assign an php array to a javascript array? | <p>I have an array $lines in php. Currently I want to assign the $lines value to a javascript variable(i.e. chartLines).</p>
<p>The way I assigned the php array to javascript is not correct. </p>
<p>Can anyone help me? Thanks in advance!</p>
<pre><code><?php
$line1 = array(array("08:00","20"),array("08:00","16"),array("08:00","19"),array("08:00","17"));
$line2 = array(array("08:00","45"),array("08:00","47"),array("08:00","49"),array("08:00","47"));
$lines= array($line1,$line2);
?>
<script type="text/javascript">
$(function () {
var chartLines = <?php echo $lines; ?>
});
</code></pre>
| jquery | [5] |
3,809,380 | 3,809,381 | Variable holding a number constantly without being able to edit the value | <p>How do I make so a interger type of variable holds a number constantly through the whole time the game is running, without being able to edit the value inside?</p>
| c# | [0] |
3,613,769 | 3,613,770 | How do I set EOF on an istream without reading formatted input? | <p>I'm doing a read in on a file character by character using istream::get(). How do I end this function with something to check if there's nothing left to read in formatted in the file (eg. only whitespace) and set the corresponding flags (EOF, bad, etc)?</p>
| c++ | [6] |
5,469,084 | 5,469,085 | java open directory | <p>I would like to be able to open up directories using java code, directory being a "folder" that contains folder which in term contains files. This is the part of the code that I have now: </p>
<pre><code> public void listFiles(String folder){
File directory = new File(folder);
File[] contents = directory.listFiles();
System.out.println(contents);
</code></pre>
<p>For some reason, if I point the folder to the directory level, it returns this line to me: </p>
<pre><code> [Ljava.io.File;@67d07b41
</code></pre>
<p>But if I point it one level down (at the folder level, which directly contains the files) then it will list out the file names in the folder just fine. Can someone give me pointers as to why this is not working for me?</p>
| java | [1] |
873,056 | 873,057 | how to add links to google pie chart slices | <p>this is the code I've been working, I need to redirect to another page by clicking the slices. its really urgent someone help pls...
Thanks in advance</p>
<p>https://www.google.com/jsapi'>
</p>
<pre><code> // Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
['Cleaning Completed', $co1],
['Denied At Client Place', $co2],
['Denied', $co3],
['Postponed', $co4],
['Careless Driver', $co5],
['Cleaning Started', $co6],
['Emptyspace', $co22],
['Assigned to Vehicle', $co23],
['Select', $co24],
['Call Not Picked', $co25],
['Asked to Call Back', $co26],
]);
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</code></pre>
| javascript | [3] |
2,310,011 | 2,310,012 | key($data) not working as expected when value = 0? | <p>i have a while loop, it goes like so....</p>
<pre><code> while ($fruit_name = current($data)) {
$string1 .= "'".key($data)."',";
next($data);
}
</code></pre>
<p>this works perfectly, and echos:</p>
<pre><code>'derp','test'
</code></pre>
<p>when the array data = </p>
<pre><code>Array ( [derp] => 68 [test] => 1 )
</code></pre>
<p>but, if the array data =</p>
<pre><code>Array ( [derp] => 0 [test] => 0 )
</code></pre>
<p>it echos</p>
<pre><code> nothing,
</code></pre>
<p>what do?</p>
| php | [2] |
5,866,899 | 5,866,900 | USB Connection notification | <p>can we receive notification if user connected there phone through USB cable. </p>
| android | [4] |
5,488,663 | 5,488,664 | Possible to turn an ifarme's parent's filename into a PHP Variable? | <p>Is it possible to pass the filename of an iframe's parent to a PHP variable?
I am trying to dynamically generate an iframe that contains information that depends on the parent's filename. The iframe will be placed into multiple pages and it will be generate info based on what page it is in.</p>
| php | [2] |
2,188,759 | 2,188,760 | C# Casting Performance Implications | <p>When using the 'as' keyword in C# to make a cast which fails, null gets returned. What's going on in the background? Is it simply suppressing an exception so I don't have to write handling code for a failure?</p>
<p>I'm interested in the performance characteristics of it compared to a typical cast wrapped in a try-catch.</p>
| c# | [0] |
5,955,815 | 5,955,816 | How do symbolic links affect the way Python finds modules? | <p>The environment variable <code>PYTHONPATH</code> is set to <code>$HOME/lib/python</code>.</p>
<p>The file tree in <code>$PYTHONPATH</code> looks like this</p>
<pre><code>foo/
__init__.py
bar.py
</code></pre>
<p>both files are empty.</p>
<p>Now I create a simple script containing </p>
<pre><code>#!/usr/bin/env python
print __file__
import bar
</code></pre>
<p>and save it as <code>baz.py</code>. If I run the script anywhere other than
in <code>$PYTHONPATH/foo</code> it fails to locate module <code>bar</code>.</p>
<p>However if I move the file to <code>$PYTHONPATH/foo</code> and create a symbolic link
to that file, I can run it from anywhere. For example:</p>
<pre><code>$ cd /tmp
$ ln -s $PYTHONPATH/foo/baz.py baz
$ ./baz
./baz
$
</code></pre>
<p>Yet <code>__file__</code> is set to <code>./baz</code>. So how does Python find module bar?</p>
| python | [7] |
1,189,726 | 1,189,727 | To have `removeID` for jQuery like `removeClass` | <p><strong>How can you remove the attribute <code>id</code> by jQeury?</strong></p>
<p><strong>My jQuery code</strong></p>
<pre><code>jQuery('a.no_flag_question').live('click', function(){
jQuery.post('/codes/handlers/no_flag_question.php',
{ question_id: jQuery(this).attr('rel') });
$(".question_box").removeClass("yellow"); // problem here
alert ("Question is now not spam.");
});
</code></pre>
<p>This code should remove the following yellow -attribute in</p>
<pre><code><div id="yellow" class="question_box">
</code></pre>
<p>However, this does not work. The reason is very likely the function <code>removeClass</code>.
I apparently use wrong function, since I want to use the ID.</p>
| jquery | [5] |
4,938,376 | 4,938,377 | How can I programmatically disable 'settings' option in android? | <p>How can I <strong>disable</strong> <em><strong>settings</em></strong> option in android, I dont want user to get into it. I have launched home intent when settings process is running but its not seems to be good. Any other way to do it ? </p>
| android | [4] |
3,273,996 | 3,273,997 | How to optimize the updating of values in an ArrayList<Integer> | <p>I want to store all values of a certain variable in a dataset and the frequency for each of these values. To do so, I use an <code>ArrayList<String></code> to store the values and an <code>ArrayList<Integer></code> to store the frequencies (since I can't use <code>int</code>). The number of different values is unknown, that's why I use <code>ArrayList</code> and not <code>Array</code>.</p>
<p>Example (simplified) dataset:</p>
<pre><code>a,b,c,d,b,d,a,c,b
</code></pre>
<p>The <code>ArrayList<String></code> with values looks like: <code>{a,b,c,d}</code> and the <code>ArrayList<Integer></code> with frequencies looks like: <code>{2,3,2,2}</code>.</p>
<p>To fill these <code>ArrayLists</code> I iterate over each record in the dataset, using the following code.</p>
<pre><code>public void addObservation(String obs){
if(values.size() == 0){// first value
values.add(obs);
frequencies.add(new Integer(1));
return;//added
}else{
for(int i = 0; i<values.size();i++){
if(values.get(i).equals(obs)){
frequencies.set(i, new Integer((int)frequencies.get(i)+1));
return;//added
}
}
// only gets here if value of obs is not found
values.add(obs);
frequencies.add(new Integer(1));
}
}
</code></pre>
<p>However, since the datasets I will use this for can be very big, I want to optimize my code, and using <code>frequencies.set(i, new Integer((int)frequencies.get(i)+1));</code> does not seem very efficient.</p>
<p>That brings me to my question; how can I optimize the updating of the <code>Integer</code> values in the <code>ArrayList</code>?</p>
| java | [1] |
5,022,245 | 5,022,246 | Is it possible to reuse a connection when accessing multiple tables in C#? | <p>I am new to C#. I have a program which reads multiple tables in single database. Suppose if i am reading table A so before reading this I have to connect to database in C#. after this I have to fetch some information from table B. Do I have to give the server info, userid and password again to connect to database?</p>
| c# | [0] |
3,102,838 | 3,102,839 | Get pixel value from an Android display? | <p>I'm not even concerned with the camera per se. I want at the closest thing to the display screen. Meaning: it could even be the desktop the user is looking at, completw w/ the background and the icons she moves back and forth. </p>
<p>Let's say, at time t=1 sec, the app goes to pixel (78, 300) on that display and obtains its value. What may be at (78, 300) could be a portion of the icon or some speck of tree leaf on the photo being used as desktop background.</p>
<p>I'm familiar with BitmapFactory.decodeFile() for getting at the pixel contents of a file. But what about the display?</p>
<p>Thank you for any assistance.</p>
| android | [4] |
4,182,827 | 4,182,828 | PHP save source data image to up level domain and show it | <p>I have an sub domain, in there I make a PHP function to save source data image to database.</p>
<pre><code>http://mobile.example.com
</code></pre>
<p>and this is the file source</p>
<pre><code>public_html/mobile/index.php
</code></pre>
<p>Now I want the source data image can be save to </p>
<pre><code>public_html/images/
</code></pre>
<p>and this is the function source data image:</p>
<pre><code>$filename = "/images/". $_FILES['file']['name'];
</code></pre>
<p>I have tried with the $filename function, but the image can't be show.</p>
<p>The error is :</p>
<pre><code>Warning: imagejpeg() [function.imagejpeg]: Unable to open '/images/wallpaper_need_for_speed_prostreet_05_1024.jpg' for writing: No such file or directory in /home/hapshou1/public_html/mobile/profile.php on line 135
</code></pre>
| php | [2] |
427,165 | 427,166 | PHP code execution time | <p>How to find my code execution time?</p>
<p>I am using the below snippet.</p>
<p>I am not happy with that?</p>
<pre><code>list ($msec, $sec) = explode(' ', microtime());
$microtime = (float)$msec + (float)$sec;
</code></pre>
| php | [2] |
2,752,263 | 2,752,264 | How do you convert object 'this' to a string? | <p>I am trying to convert a string to an array, while the string is the object <code>this</code>. The function doing this is below:</p>
<pre><code> function reverseString() {
// uses Prototype Javascript Framework function 'toArray()'
return this.toArray().reverse().join('');
}
</code></pre>
<p>Is it possible to convert object <code>this</code> to a string, or is there a different/better way of doing this?</p>
| javascript | [3] |
1,134,124 | 1,134,125 | jQuery drag-and-drop demo works. Now how to make it a form that can be submitted? | <p><a href="http://plugins.scbfolio.com/jquery_drag_drop_select/#Events" rel="nofollow">This</a> is exactly the behaviour I want: dragging items from a list to another.</p>
<p>Now, I would like to add a "submit" button so that I can save the chosen items on the server side.</p>
<p>How to do this?</p>
<ul>
<li>Create a hidden form, and update the input values in an <code>after_drop_action</code> method I would write in the page.</li>
<li>AJAX-call the server at each <code>after_drop_action</code> (I would rather avoid it unless absolutely necessary)</li>
<li>Something else? What is the usual way to do? It is basic but I have no experience with jQuery.</li>
</ul>
| jquery | [5] |
2,118,176 | 2,118,177 | Strongly typing ID values in C# | <p>Is there a way to strongly type integer ID values in C#?</p>
<p>I've recently been playing with Haskell and can immediately see the advantages of its strong typing when applied to ID values, for example you would never want to use a <em>PersonId</em> in place of a <em>ProductId</em>.</p>
<p>Is there a nice way to create an <em>Id</em> class/struct that can be used to represent IDs of a given type?</p>
<p>I had the following idea but unfortunately it <strong>isn't legal</strong> on many levels. You can't have an abstract struct and the implicit/explicit cast operators wouldn't be inherited.</p>
<pre><code>public abstract struct Id
{
int _value;
public Id(int value)
{
_value = value;
}
// define implicit Id to int conversion operator:
public static implicit operator int(Id id)
{
return _value;
}
// define explicit int to Id conversion operator:
public static explicit operator Id(int value)
{
return new Id(value);
}
public bool Equals(object obj)
{
if(GetType() == obj.GetType())
{
Id other = (Id)obj;
return other._value == _value;
}
return false;
}
public int GetHashCode()
{
return _value.GetHashCode();
}
}
struct PersonId : Id { public PersonId(int value) : base(value) {} }
struct ProductId : Id { public ProductId(int value) : base(value) {} }
</code></pre>
<p>Are there any valid ways to perform something similar? How else can we prove that integer IDs type aren't being confused across a large application?</p>
| c# | [0] |
2,680,135 | 2,680,136 | UIWebview :: Text :: HTML :: JS | <p><br>
1- i load a text from a txt file<br>
2- i show it into a html "file"
3- problem :<br>
3-a : this code works :<br>
i create my page by code and i insert my text</p>
<pre><code>myText = ... loaded from an array of texts ...;
NSString *myDescriptionHTML = [NSString stringWithFormat:@"<html> \n"
"<head> \n"
"<style type=\"text/css\"> \n"
"body {font-family: \"%@\"; font-size: 1.0f + 'em'; color:#FFF;}\n"
"</style> \n"
"</head> \n"
"<body id=\"myid\">%@</body> \n"
"</html>", @"Arial", myText];
[self.myWebView loadHTMLString:myDescriptionHTML baseURL:nil];
</code></pre>
<p>3-b but this one does not work :<br>
i load a html page already created and i inject my text into using JS :</p>
<pre><code>myText = ... loaded from an array of texts ...;
[self.myWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementById(\"myid\").innerHTML = \"%@\";", myText]];
</code></pre>
<p>3-c but this one working :<br>
same as 3-b but i init my text with a string in the code itself : </p>
<pre><code>myText = @"hello all";
[self.myWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementById(\"myid\").innerHTML = \"%@\";", myText]];
</code></pre>
<p>any help to understand what's wrong with 3-b ?</p>
<p>thank you</p>
| iphone | [8] |
2,295,886 | 2,295,887 | Jquery date picker Next and previous button images are not showing | <p>Jquery Date picker prev and next button images are not showing.</p>
| jquery | [5] |
3,498,719 | 3,498,720 | I want to specify the image filename with EXTRA_OUTPUT but I don't want the full size image | <p>so, the way I read the documentation, using EXTRA_OUTPUT tells the camera to save the file in a specific location. That's great, but it also says to get a full size image. That's not so great.
How can I get just a small image but still specify the filename?</p>
| android | [4] |
4,235,002 | 4,235,003 | jQuery watermark StackOverflow like? | <p>I'm trying to implement something like StackOverflow's watermark functionality.</p>
<p>I'm using <a href="http://code.google.com/p/jquery-watermark/" rel="nofollow">jquery-watermark</a> for this. The problem I'm having is namely that the watermark text disappears as the input element gains focus, which doesn't happen here in SO (and I don't want it in my implementation either)</p>
<p>Is there some quick fix I could do for this, or perhaps a more SO-like watermarking library?</p>
| javascript | [3] |
4,808,962 | 4,808,963 | How do you protect yourself from missing comma in vertical string list in python? | <p>In python, it's common to have vertically-oriented lists of string. For example:</p>
<pre><code>subprocess.check_output( [
'application',
'-first-flag',
'-second-flag',
'-some-additional-flag'
] )
</code></pre>
<p>This looks good, readable, don't violate 80-columns rule... But if comma is missed, like this:</p>
<pre><code>subprocess.check_output( [
'application',
'-first-flag' # missed comma here
'-second-flag',
'-some-additional-flag'
] )
</code></pre>
<p>Python will still assume this code valid by concatenating two stings :(. Is it possible to somehow safeguard yourself from such typos while still using vertically-oriented string lists and without bloating code (like enveloping each items inside <code>str()</code>)?</p>
| python | [7] |
2,357,789 | 2,357,790 | how to set default value for array(php) | <p>e.g:</p>
<pre><code>$arr = array('k1'=>1,'k2'=>2,'k3'=>3);
</code></pre>
<p>If i want get $arr['k4'] (unexpect index),there is a notice:</p>
<pre><code>Notice: undefined index......
</code></pre>
<p>so,can i set a dufalut value for array,like as ruby's hash:</p>
<pre><code>h = {'k1'=>1,'k2'=>2,'k3'=>3}
h.default = 'default'
puts h['k4']
</code></pre>
<p>then,i'll get 'default';</p>
| php | [2] |
5,522,048 | 5,522,049 | Keystroke detection using Python | <p>How is keystroke detection done using Python?</p>
| python | [7] |
1,241,324 | 1,241,325 | How to find Location near by my Current location? | <p>I need some idea about "How to find Hospital,School,Restaurant near by my location" using android,How is possible?</p>
| android | [4] |
4,107,362 | 4,107,363 | How do I profile memory usage in my project | <p>Are there any good, <strong>free</strong> tools to profile memory usage in C# ? </p>
<p>Details:<br>
I have a visualization project that uses quite large collections. I would like to check which parts of this project - on the data-processing side, or on the visualization side - use most of the memory, so I could optimize it.<br>
I know that when it comes to computing size of the collection the case is quite simple and I can do it on my own. But there are also certain elements for which I cannot estimate the memory usage so easily.<br>
The memory usage is quite big, for example processing a file of size 35 MB my program uses a little bit more than 250 MB of RAM.</p>
| c# | [0] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.