Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
4,150,327
4,150,328
how to stop activity recreation on screen orientation?
<p>how i can stop the restarting or recalling of on create() on screen orientation ,i want to stop the recreation of activity on screen orientation. thanks in advance please tell me any better solution its really creating a problem. like in my program i am selecting some picture but on screen orientation the image goes off so thats why i want to stop the recreation of activity on screen orientation.</p> <pre><code>enter code here public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mainwindow); Toast.makeText(getApplicationContext(),"a", 1).show(); bitmap = (Bitmap)getLastNonConfigurationInstance(); //Toast.makeText(getApplicationContext(),"a1", 1).show(); if (savedInstanceState != null) { bitmap=BitmapFactory.decodeFile(mImageCaptureUri.getPath()); Toast.makeText(getApplicationContext(),"preview have value", 1).show(); preview.setVisibility(View.VISIBLE); From_Folder.setVisibility(View.GONE); From_Camera.setVisibility(View.GONE); preview.setImageBitmap(bitmap); } </code></pre>
android
[4]
4,221,253
4,221,254
Using a Seekbar declared in one activity in a class that extends application
<p>I am currently trying to find a way of using a seekbar I created a tab host activity i.e <code>seekBar1 = (SeekBar) findViewById(R.id.seekBar1);</code></p> <p>in a class that extends application, as I need to add it to a singleton object in the class. (So the singleton object can listen for it) Currently I am trying to do it statically but it only takes the current value of the seekbar and does not update as the slider is moved. i.e I make the SeekBars static in the activity</p> <p>I have to do my code this way as the software I am building for a college internship is designed for other programmers that don't know android to be able to easy customise the code, hence i am trying to keep the class that extends application away from them, so they make simple edits to the activity classes and call methods on the application class.</p> <p>Sorry if I missed something in my post this is my first time posting on this forum.</p>
android
[4]
711,312
711,313
Extracting last two characters from a numeric string
<p>Okay. Say I have string</p> <pre><code>'193' </code></pre> <p>And I want to remove the last numbers and store them in an array so I can do operations with them. I know substr can delete the 2 characters, but I'm not sure how to store them after they've been removed..</p>
php
[2]
4,101,740
4,101,741
How to Refresh GridView in C#.Net Windows Form?
<p>I'm trying to Refresh GridView after data inserted. In ASP.Net GridView1.DataBind().That's work. But I don't know how to do that in C#.Net Windows Form. Please answer me if you know. Thanks.</p>
c#
[0]
2,311,063
2,311,064
operator delete standard behavior
<p>I can't understand what standard need to do with calling operator delete for void* == nullptr.</p> <p>Something like this:</p> <pre><code>void foo(void* ptr) // ptr == nullptr here { delete ptr; } </code></pre> <p>On the one hand, we have the following statement in standard:</p> <p><strong>ISO/IEC 14882:2011</strong></p> <p>5.3.5 Delete [expr.delete]</p> <blockquote> <p>1 ... The operand shall have a pointer to object type, or a class type having a single non-explicit conversion function (12.3.2) to a pointer to object type. The result has type void.78</p> <p>78) <strong>This implies that an object cannot be deleted using a pointer of type void* because void is not an object type</strong>.</p> </blockquote> <p>which makes code with deleting void* ill-formed. On the other hand, we have another statement about nullptr in delete:</p> <p><strong>ISO/IEC 14882:2011</strong></p> <p>5.3.5 Delete [expr.delete]</p> <blockquote> <p>2 ... In the first alternative (delete object), <strong>the value of the operand of delete may be a null pointer value</strong>, a pointer to a non-array object created by a previous new-expression, or a pointer to a subobject (1.8) representing a base class of such an object (Clause 10). If not, the behavior is undefined. In the second alternative (delete array), <strong>the value of the operand of delete may be a null pointer value</strong> or a pointer value that resulted from a previous array new-expression.79 If not, the behavior is undefined.</p> </blockquote> <p>What implementation need to do in such kind of situation?</p>
c++
[6]
2,207,699
2,207,700
Javascript: [] = 5, No Syntax Error? Why?
<p>Yeah, it works in my firebug console. Why does something like this present no syntax error?</p> <pre><code>[] = 5; [] = doThis(); [] = (function() {})(); </code></pre> <p>Just curious about why it's allowed.</p>
javascript
[3]
4,707,927
4,707,928
Is there a way to preserve duplicate keys in python dictionary
<p>is there any way to store duplicate keys in a dictionary?</p> <p>I have a specific requirement to form pairs of requests and responses. </p> <p>Requests from a particular node to another particular node form same keys. I need to store both those.</p> <p>But if I tried to add them to dictionary, first one is being replaced by second. Is there any way?</p>
python
[7]
757,329
757,330
Android create custom IM type
<p>In my android application I want to create a custom type of IM that should be editable via standard contacts editing application. There are several built-it IMs that user can select from: Aim, Windows Live, Yahoo, etc. I want to add "My Very Best IM" to the list, so that user can pick it quickly without the need to enter the "custom" text and value by hand. Any ideas on how to do this?</p>
android
[4]
5,570,467
5,570,468
println(char), characters turn into Chinese?
<p>Please help me to troubleshoot this problem.</p> <p>A have an input file 'Trial.txt' with content "Thanh Le".</p> <p>Here is the function I used in an attempt to read from the file:</p> <pre><code> public char[] importSeq(){ File file = new File("G:\\trial.txt"); char temp_seq[] = new char[100]; try{ FileInputStream fis = new FileInputStream(file); BufferedInputStream bis = new BufferedInputStream(fis); DataInputStream dis = new DataInputStream(bis); int i = 0; //Try to read all character till the end of file while(dis.available() != 0){ temp_seq[i]=dis.readChar(); i++; } System.out.println(" imported"); } catch (FileNotFoundException e){ e.printStackTrace(); } catch (IOException e){ e.printStackTrace(); } return temp_seq; } </code></pre> <p>And the main function:</p> <pre><code>public static void main(String[] args) { Sequence s1 = new Sequence(); char result[]; result = s1.importSeq(); int i = 0; while(result[i] != 0){ System.out.println(result[i]); i++; } } </code></pre> <p>And this is the output.</p> <p>run:</p> <pre><code> imported 瑨 慮 栠 汥 BUILD SUCCESSFUL (total time: 0 seconds) </code></pre>
java
[1]
2,520,641
2,520,642
Alert Dialog in android
<p>In my application I used an alert dialog box to show 'connection error' message if API call fails. API calls are written with in an AsyncTask. While API is called 'loading' dialog is shown, onPostExecute I will dismiss this 'loading' dilaogue , after that if the API call fails I will show the 'connection error' message.</p> <p>My problem is while the 'loading' dialog is shown if I press the home button and when I come back to the app, app is in freezed state.</p> <p>I think the problem is with the 'Connection Error' AlertDailog box,if I remove alertDailog.show,we will not get this issue.</p> <p>How to solve this?</p>
android
[4]
1,018,991
1,018,992
Input String was not in correct format in asp.net
<p>We've been facing an issue while saving our page. It throws "Input String was not in correct format". After trying so many time, we found there was no problem with the code, but with the "Cache (Temporary Internet File"). After Cache was cleared, it saved without any error. Does anyone knew the reason behind it?</p>
asp.net
[9]
3,801,591
3,801,592
how can i fix this Javascript with to document write on multiple location.href.indexOf
<p>how can i fix this JavaScript with to document write on multiple <code>location.href.indexOf</code></p> <pre><code>if (location.href.indexOf( "/smispage""/tpfpage""/client_images_new""/client_images_list" ) &gt; -1) { document.write( '&lt;base target="_blank" /&gt;' ); } </code></pre> <p>It only seems to work on the <strong>smispage</strong> page regardless of how I lay out the list so:</p> <pre><code>"x","y" or "x";"y" or "x""y" or "x, y" or "x: y" or "x,y" or "x;y" </code></pre>
javascript
[3]
751,173
751,174
sqlite3 connection and holding onto it during the lifetime of the app
<p>I am following the 'SQLiteBooks' sample to understand how to work with sqlite3 for the iPhone and am wondering if the connection to the database should be closed immediately after you do a query and reopened each time you need to talk to the db or should the connection be kept open at the start of the app and close on 'appWillTerminate'? What are the costs associated with reopening the db connection multiple times within an app?</p> <p>Also, the sample shows the reference to sqlite3 object (aka 'database') being passed around but without any reference counting -- is this a good pattern to follow?</p>
iphone
[8]
5,303,529
5,303,530
Submit html form via Window form
<p>I need to automize login process of a widsite. After googling for a while, I wrote this code. But the problem is after running this code, no errors, no output. I am unable to know where I went wrong.</p> <pre><code>private void Form1_Load(object sender, EventArgs e) { WebBrowser browser = new WebBrowser(); string target = "http://authcisco/auth.html"; browser.Navigate(target); browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(Credentials); } private void Credentials(object sender, WebBrowserDocumentCompletedEventArgs e) { WebBrowser b = (WebBrowser)sender; b.Document.GetElementById("userName").SetAttribute("value", "shyam"); b.Document.GetElementById("pass").SetAttribute("value", "shyam"); b.Document.GetElementById("Submit").InvokeMember("click"); } </code></pre> <p>Thank You.</p>
c#
[0]
2,835,577
2,835,578
How pass data to parent window from iframe?
<p>I using 3 .asp pages</p> <p>Page 1 :Parent.asp page 2 :Subparent.asp Page 3 :Child.asp</p> <p>using javascript in the child.asp. I wand to pass data from Child window(iframe) to Parent window</p> <pre><code>&lt;title&gt;parent.asp&lt;/title&gt; &lt;html&gt; &lt;body&gt; &lt;iframe name="I1" frameborder="0" scrolling="no" src="Subparent.asp" width="100" height="100"&gt; &lt;title&gt;subparent.asp&lt;/title&gt; &lt;html&gt; &lt;body&gt; &lt;div id ="parentdata"&gt;&lt;/div&gt; &lt;iframe name="I1" frameborder="0" scrolling="no" src="Subparent.asp" width="100" height="100"&gt; &lt;title&gt;subparent.asp&lt;/title&gt; &lt;html&gt; &lt;body&gt; &lt;iframe name="I1" frameborder="0" scrolling="no" src="Child.asp" width="100" height="100"&gt; &lt;title&gt;subparent.asp&lt;/title&gt; &lt;html&gt; &lt;body&gt; &lt;script language="JavaScript"&gt; { parent.document.getElementById("parentdata").innerHTML="GET DATA, WORKING" } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; &lt;/iframe&gt; &lt;/body&gt; &lt;/html&gt; &lt;/iframe&gt; &lt;/body&gt; &lt;/html&gt; &lt;/iframe&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>In the "Child.asp" i using javascipt. i wand to pass data to the "" of "parent.asp"</p> <p>is it possible, plz help me</p> <p>hoping your support</p>
javascript
[3]
4,312,819
4,312,820
Best online resource to learn Python?
<p>I am new to any scripting language. But, Still I worked on scripting a bit like tailoring other scripts to work for my purpose. For me, What is the best online resource to learn Python?</p> <p>[Response Summary:] </p> <p>Some Online Resources:</p> <p><a href="http://docs.python.org/tut/tut.html" rel="nofollow"> <a href="http://docs.python.org/tut/tut.html" rel="nofollow">http://docs.python.org/tut/tut.html</a></a> - Beginners</p> <p><a href="http://diveintopython3.ep.io/" rel="nofollow"> <a href="http://diveintopython3.ep.io/" rel="nofollow">http://diveintopython3.ep.io/</a></a> - Intermediate</p> <p><a href="http://www.pythonchallenge.com/" rel="nofollow">http://www.pythonchallenge.com/</a> - Expert Skills</p> <p><a href="http://docs.python.org/" rel="nofollow">http://docs.python.org/</a> - collection of all knowledge</p> <p>Some more:</p> <p><a href="http://www.swaroopch.com/notes/Python" rel="nofollow"> A Byte of Python. </a></p> <p><a href="http://rgruet.free.fr/PQR25/PQR2.5.html" rel="nofollow">Python 2.5 Quick Reference</a></p> <p><a href="http://www.edgewall.org/python-sidebar/" rel="nofollow">Python Side bar</a></p> <p><a href="http://www.learningpython.com/" rel="nofollow">A Nice blog for beginners</a></p> <p><a href="http://www.greenteapress.com/thinkpython/thinkpython.html" rel="nofollow">Think Python: An Introduction to Software Design</a></p>
python
[7]
5,461,018
5,461,019
Tightly Encapsulated Class
<p>This is my homework question : Which among the following classes is NOT Tightly Encapsulated?</p> <pre><code>class A { private int x; } class B { private int x; public void setX(int x) { this.x=x; } public int getX() { return x; } } class C { private int x; private void setX(int x) { this.x=x; } private int getX() { return x; } } </code></pre> <p>I spent some time searching on coderanch but was not able to get the required stuff. Can anyone please help me?</p> <p>What I think is Class C is not tightly encapsulated;because the methods are private. And about class A what I feel is it is not encapsulated only. Because basic definition of encapsulation says that "You must hide your members and provide to the class user methods that behave the way you want." Now the class A has no accessor-mutator methods. So A should not be considered encapsulated. I am not sure but. Please correct me if I am wrong.</p>
java
[1]
4,812,032
4,812,033
How to validate a string from a set of permuted values with fixed prefixes in C#
<p>I have a variable which I have to validate at server side. The field should be like Thh, Qhh, Bhh where 'h' is a hex digit in the set {02, 82, 03, 83, 04, 84, 05, 85, 06, 86, 07, 87}</p>
c#
[0]
4,428,037
4,428,038
Strongly typed dataset Adapter.Update not inserting row
<p>I have the following code which (according to a <a href="http://weblogs.asp.net/scottgu/archive/2006/01/15/435498.aspx" rel="nofollow">guide</a>) should insert a record into my strongly typed dataset and in turn my database. However, the record is not entered into the database but is correctly entered into the dataset. Am I missing a command?</p> <pre><code> using (Dataset1TableAdapters.AddressTableAdapter addressAdapter = new Dataset1TableAdapters.AddressTableAdapter()) { using (Dataset1.AddressDataTable addresses = new Dataset1.AddressDataTable()) { // Create a new address. Dataset1.AddressRow address = addresses.NewAddressRow(); // Set some data. address.Address1 = "test1"; address.Address2 = "test2"; address.Address3 = "test3"; address.UserID = 1; // Add new address to address table. addresses.AddAddressRow(address); // Update the database with all the changes. addressAdapter.Update(addresses); } } </code></pre> <p>Cheers, Paul.</p>
c#
[0]
1,657,242
1,657,243
how to assing values into global array inside a function? (php)
<p>I have a function that searches for a string inside a text file. I want to use the same function to assign all lines to an array in case I am going to replace that string. So I will read the input file only once.</p> <p>I have the search function working but I do not know how to deal with the array thing.</p> <p>the code is something like that (I made the code sample much simpler,so please ignore the search function that actually isn't below)</p> <pre><code>function read_ini($config_file_name,$string){ $config_file = file($config_file_name); foreach($config_file as $line) { return_string = trim(substr($line,0,15)); $some_global_array = $line' } } echo read_ini('config.ini','database.db') if ($replaced) {file_put_contents('config.ini', $some_global_array);} </code></pre>
php
[2]
4,770,666
4,770,667
General C++ Performance Improvement Tips
<p>Could someone point me to an article, or write some tips right here about some c++ programming habits that are generally valid (no real drawbacks) and improves performance? I do not mean programming patterns and algorithm complexity - I need small things like how you define your functions, things to do/to avoid in loops, what to allocate on the stack, what on the heap, and so on.</p> <p>It's not about making a particular software faster, also it's not about how to create a clean software design, but rather programming habits that - if you always apply them, you will make your code rather a little bit faster than a little bit slower.</p> <p>Thanks :)</p>
c++
[6]
3,851,815
3,851,816
PHP - Sphinx Search Integration Issues
<p>I have installed sphinx.0.9.9 in my LINUX server, and tested the application in terminal. It is working, when i tried to use the sphinxapi.php, I'm getting the following issue. "Query failed: connection to localhost:9312 failed (errno=111, msg=Connection refused). ". Can anybody help me to figure out this issue</p> <p>Thanks in advance. Raja</p>
php
[2]
4,233,219
4,233,220
using less than calculation in php mysql
<p>i have three dates to compare:</p> <pre><code>$pDate = date("d/m/Y G:i A"); $lDate = new DateTime('last wednesday G:i A'); $cDate = new DateTime('next tuesday G:i A'); </code></pre> <p>if <em>$pDate</em> is in between <em>$lDate</em> and <em>$cDate</em> then mysql table field is updated yes</p> <p>i.e. the 9th is in between the 8th and 14th </p> <p>if <em>$pDate</em> is less than equal to <em>$lDate</em> then mysql table field is updated no</p> <p><em>$pDate</em> cannot be more than <em>$cDate</em></p> <p>how would i write a elseif statement for the above... </p> <p>i.e.</p> <pre><code>elseif ( .... ) { mysql_query("UPDATE ... SET ... WHERE ..."); } </code></pre> <p>any help would be appreciated!</p> <p>many thanks and God bless!</p>
php
[2]
4,064,756
4,064,757
Application Process still around after app is closed
<p>I have an application that I suspect might be leaking a thread or its context. What makes me think so is that after closing the app, the process is still running (visible process monitoring applications). I've cut everything in the code, going as far as calling finish() from the onCreate. The process is still around and annoying me.</p> <p>I've read that (from <a href="http://developer.android.com/guide/topics/fundamentals.html" rel="nofollow">here</a>)</p> <blockquote> <p>An empty process is one that doesn't hold any active application components. The only reason to keep such a process around is as a cache to improve startup time the next time a component needs to run in it. The system often kills these processes in order to balance overall system resources between process caches and the underlying kernel caches.</p> </blockquote> <p>How do I know if my process is still around because of circular reference or context leak or anything else equally bad or if is simply that the process is empty?</p>
android
[4]
2,938,345
2,938,346
Correct syntax for setting object's property to return value of an object-function?
<p>I'm learning javascript and was going through an example here: <a href="https://developer.mozilla.org/en/A_re-introduction_to_JavaScript" rel="nofollow">https://developer.mozilla.org/en/A_re-introduction_to_JavaScript</a></p> <pre><code>function personFullName() { return this.first + ' ' + this.last; } function personFullNameReversed() { return this.last + ', ' + this.first; } function Person(first, last) { this.first = first; this.last = last; this.fullName = personFullName; this.fullNameReversed = personFullNameReversed; } var x = new Person('mickey', 'mouse'); document.write(x.fullName()); </code></pre> <p>Why are the lines of code </p> <pre><code> this.fullName = personFullName; this.fullNameReversed = personFullNameReversed; </code></pre> <p>instead of </p> <pre><code> this.fullName = personFullName(); this.fullNameReversed = personFullNameReversed(); </code></pre> <p>I thought we're setting <code>this.fullName</code> based on the return value of <code>personFullName()</code></p>
javascript
[3]
5,237,806
5,237,807
C# How to detect whether there is a '/' character?
<p>I have three IP addresses from serial port in one string. For example the string is like <code>192.168.1.1/192.168.1.12/192.168.1.118</code>. How do we detect the '/' character so that we can split this string into 3 IP address string and put each one into IP1 string, IP2 string and IP3 string?</p>
c#
[0]
888,903
888,904
How do numbers work in Python?
<p>So, I open terminal.</p> <pre><code>&gt; python &gt; 1 / 3 0 &gt; 1.0 / 3 0.33333333333333331 </code></pre> <p>Could someone tell me what the rules are when it comes to decimals. Does it matter which number when being divided carries the decimal? Is there a best practice?</p> <p>If I want more decimal points, or less for that matter, do I need to use a function?</p>
python
[7]
5,419,718
5,419,719
Rationale for why JavaScript converts primitive values to numbers in == operator comparisons when one is boolean?
<p>I know the rule: </p> <blockquote> <p>If the two operands are not of the same type, JavaScript converts the operands then applies strict comparison. If either operand is a number or a boolean, the operands are converted to numbers if possible; else if either operand is a string, the other operand is converted to a string if possible.</p> </blockquote> <p>So, <code>if("true")</code> passes but <code>if("true" == true)</code> fails because it is handle like <code>if(NaN == 1)</code>. </p> <p>I was wondering what the rational is behind this when one value is boolean. In other weak typed languages like php, this is handle this differently--if one value is a boolean, the other is converted to a boolean for comparisons (and not covert both to numbers as in javascript).</p> <p>I'm assuming this choice was made for the <code>==</code> operator on careful consideration. Can anyone provide rational as to why this was the chosen functionality? Is there a common use case that this was chosen to address? I'm betting is wasn't just a mistake.</p>
javascript
[3]
2,098,634
2,098,635
PHP invoking another script but through http (isolating them)
<p>Let's see if I make myself clear. I have an old set of scripts that run well on PHP4 and better don't thouch em. I have to integrate a new functionality implemented on PHP5, I need just to invoke a script on the new app from the old one.</p> <p>To not have to touch the old stuff I think to somehow "kin of remotely" invoke the new one, need only to pass the $_REQUEST[] data. I can not include it as that would require migrating to another PHP version (and some name clashing). I don't need any output from the new one.</p> <p>What would be the cleaner way to "call" that script passing parameters, fopen("http://theserver.com/thescript.php"....) and then passing all the necessary headers to pass the parameters? or there's somethign more direct?</p> <p>Thanks!</p>
php
[2]
1,401,962
1,401,963
Database.Script Method Throwing - ArgumentOutOfRangeException
<p><strong>Hello, I'm running the following code:</strong></p> <pre><code>database.UserDefinedFunctions[name, schema].Script(dropstoredProcOptions); </code></pre> <p>With this as dropstoreProcOptions:</p> <pre><code> ScriptingOptions dropstoreProcOptions = new ScriptingOptions(); dropstoreProcOptions.IncludeIfNotExists = true; dropstoreProcOptions.ScriptDrops = true; dropstoreProcOptions.IncludeDatabaseContext = false; </code></pre> <p>If you run the .Script() function without any parameters no errors are thrown, however once you pass ScriptingOpstions as a parameter the following error is thrown: <strong>ArgumentOutOfRangeException</strong></p> <p>Any help or suggestions on how I could better debug it would be appreciated. Thank you.</p>
c#
[0]
5,758,875
5,758,876
global keyword outside the function in php
<p>As we know, global keyword makes variable( or object, array) visible inside current function we are dealing with</p> <pre><code>&lt;?php $some_var = 'some string'; function __test(){ global $some_var; echo $some_var; // some string } </code></pre> <p>But some dev's still use the global keyword outside the functions at first look it doesn't make any sense to me.</p> <p>Well, the question is: Does it make any sense to use 'global' keyword outside the function ???</p>
php
[2]
4,551,308
4,551,309
Does an IEnumerable have to use Yield to be deferred
<p>Does an IEnumerable have to use Yield to be deferred?</p> <p>Here is test code which has helped me understand deferred execution and yield.</p> <pre><code> //immediate execution public IEnumerable Power(int number, int howManyToShow) { var result = new int[howManyToShow]; result[0] = number; for (int i = 1; i &lt; howManyToShow; i++) result[i] = result[i - 1] * number; return result; } //deferred but eager public IEnumerable PowerYieldEager(int number, int howManyToShow) { var result = new int[howManyToShow]; result[0] = number; for (int i = 1; i &lt; howManyToShow; i++) result[i] = result[i - 1] * number; foreach (var value in result) yield return value; } //deferred and lazy public IEnumerable PowerYieldLazy(int number, int howManyToShow) { int counter = 0; int result = 1; while (counter++ &lt; howManyToShow) { result = result * number; yield return result; } } [Test] public void Power_WhenPass2AndWant8Numbers_ReturnAnEnumerable() { IEnumerable listOfInts = Power(2, 8); foreach (int i in listOfInts) Console.Write("{0} ", i); } [Test] public void PowerYieldEager_WhenPass2AndWant8Numbers_ReturnAnEnumerableOfInts() { //deferred but eager execution IEnumerable listOfInts = PowerYieldEager(2, 8); foreach (int i in listOfInts) Console.Write("{0} ", i); } [Test] public void PowerYield_WhenPass2AndWant8Numbers_ReturnAnEnumerableOfIntsOneAtATime() { //deferred and lazy execution IEnumerable listOfInts = PowerYieldLazy(2, 8); foreach (int i in listOfInts) Console.Write("{0} ", i); } </code></pre>
c#
[0]
1,785,968
1,785,969
unable to cancel schedule task
<p>hello i am using java.util.Timer for scheduling task and show notification for appointments only one time but if i cancel schedule appointment with help of timer.cancel(); and timer.purge();<br> it's unable to cancel and it performs on a particular time...</p> <p>Please Help....</p>
android
[4]
1,453,270
1,453,271
How to fake time in javascript?
<p>I would like to mock the Date constructor so that whenever I call new Date(), it always return specific time.</p> <p>I found Sinon.js provide useFakeTimers to mock time. But the following code doesn't work for me.</p> <pre><code>sinon.useFakeTimers(new Date(2011,9,1)); //expect : 'Sat Oct 01 2011 00:00:00' , //result : 'Thu Oct 27 2011 10:59:44‘ var d = new Date(); </code></pre>
javascript
[3]
3,517,019
3,517,020
moving images relatively
<p>i have an image that rotates around an arbitrary point. but i need 3 such images to rotate simultaneously this is how i try to implement the same</p> <pre><code>private void rotateLogo(float degrees){ Matrix matrix1 = new Matrix(); //int radius = turntable.getWidth()/2; double radians = degrees* (Math.PI/180); double xcoordinate = 220 * Math.cos(radians)- 60; double ycoordinate = 220 * Math.sin(radians) + 50; matrix1.postRotate((int)radians, 220, 220); // people image FrameLayout.LayoutParams linLay = (FrameLayout.LayoutParams) peopleLogo.getLayoutParams(); linLay.bottomMargin = (int)ycoordinate + 10; linLay.rightMargin = (int)xcoordinate + 10; peopleLogo.setImageMatrix(matrix1); peopleLogo.setLayoutParams(linLay); rotateLogo2(degrees - 2); } private void rotateLogo2(float degrees){ double radians = degrees* (Math.PI/180); double xcoordinate = 220 * Math.cos(radians)- 60; double ycoordinate = 220 * Math.sin(radians) + 50; // people image FrameLayout.LayoutParams linLay = (FrameLayout.LayoutParams) serverLogo.getLayoutParams(); linLay.bottomMargin = (int)ycoordinate + 10; linLay.rightMargin = (int)xcoordinate + 10; serverLogo.setLayoutParams(linLay); } </code></pre> <p>in the above code i reduced the angle and rotate the second image using the same code, but the image doesnt rotate, it just disappears on touch.</p> <p>i also tried to take the layout params of the first image before rotation and apply the same to the second image, but this doesnt work too..</p> <p>the image disappears on rotation though at times it appears and then disappears</p> <p>can anyone help me as to where i could be wrong or suggest any other approaches for the same?</p>
android
[4]
810,304
810,305
Is there software to help with consolidating/combining/deduplicating contacts for the iPhone
<p>I have some contacts on my iPhone that's clearly duplicated. E.g. I have two James Fong contacts, one contains the person's home number and the other the person's mobile. Is there some software that can help me to combine them into one?</p>
iphone
[8]
804,075
804,076
popup window on mozilla
<p>i'm using javascript to open a new window in a html page. It works fine ie whereas mozilla opens a new tab. is there a way to make the mozilla open the popup in a new window instead of new tab using javascript or any parameter?</p> <p>-Vivek</p>
javascript
[3]
662,323
662,324
If I return inside a with block is the file guaranteed to close?
<p>Take the following code</p> <pre><code>with open(path, mode) as f: return [line for line in f if condition] </code></pre> <p>Will the file be closed properly, or does return somehow bypass the context manager?</p> <p>(Python 2.7)</p>
python
[7]
5,718,513
5,718,514
Problem with passing control to Preference activity
<p>i created application in that it will call preference from main activity based on menu option it is done using Explicit intent but it not working . when clicking the menu item calling activity</p> <pre><code>public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, Menu.FIRST+1, Menu.NONE, "Refresh"); menu.add(0, Menu.FIRST+3, Menu.NONE, "Set Preferences"); return true; } public boolean onOptionItemSelected(MenuItem item) { switch(item.getItemId()) { case Menu.FIRST+1: Intent intent =new Intent(this,userpreferences.class); startActivityForResult(intent,this.USER_PREFERENCES); return true; case Menu.FIRST+3: return true; } return false; } </code></pre> <p>preference xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;CheckBoxPreference android:key="AUTO_UPDATE" android:title="update automatically" android:summary="update automatically" android:defaultValue="true" /&gt; &lt;ListPreference android:key="MINIMUM_MARK" android:title="minimum mark" android:summary="enter the minimum mark of the student" android:defaultValue="30" android:entries = "@array/minimumMarks" android:entryValues="@array/minimum_mark_values" android:dialogTitle="Check the minimum mark required" /&gt; &lt;/PreferenceScreen&gt; </code></pre> <p>Preference activity</p> <pre><code>package com.xml.parse; import android.os.Bundle; import android.preference.PreferenceActivity; public class userpreferences extends PreferenceActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences); } } </code></pre> <p>some body plz tell me to do better or correct way</p> <p>Regards,</p> <p>Kariyachan</p>
android
[4]
3,567,051
3,567,052
NullPointerException Android ActionBar Back (but not Menu Bar Back)
<p>I get an error with the ActionBar back button when I'm moving back to a previous activity, but when I use the Menu Button Back, everything works as planned! I think I have an idea of what is going on, because using the Action Bar back button causes a recreation of the previous activity, but I don't want that to happen. How do I override the Action Bar (default) back button to perform like the Menu Bar back button so that OnDestroy() is not called? </p>
android
[4]
2,506,412
2,506,413
android: How can I define custom colors, drawables, etc. in themes?
<p>I hope I can explain what I'm after. In essence, my users have asked me to allow different looks in my application, which I hope I can do with themes.</p> <p>I hoped I could do something like this:</p> <pre><code>&lt;style name="NewTheme" parent="android:Theme.Dark"&gt; &lt;item name="labelColor"&gt;#f90&lt;/item&gt; &lt;item name="buttonColor"&gt;#fff&lt;/item&gt; &lt;item name="buttonBg"&gt;@drawable/button&lt;/item&gt; &lt;/style&gt; &lt;style name="OldTheme" parent="android:Theme.Dark"&gt; &lt;item name="labelColor"&gt;#fa0&lt;/item&gt; &lt;item name="buttonColor"&gt;#88f&lt;/item&gt; &lt;item name="buttonBg"&gt;@drawable/button_old&lt;/item&gt; &lt;/style&gt; </code></pre> <p>And then reference these values in my styles.xml:</p> <pre><code>&lt;style name="labelStyle"&gt; &lt;item name="android:textColor&gt;@labelColor&lt;/item&gt; &lt;/style&gt; &lt;style name="buttonStyle"&gt; &lt;item name="android:textcolor"&gt;@buttonColor&lt;/item&gt; &lt;item name="android:background"&gt;@buttonBg&lt;/item&gt; &lt;/style&gt; </code></pre> <p>I know this syntax is wrong, but what might be the right syntax? Basically, I want to create sets of attributes (color, background, a couple other things) and select them based on theme.</p>
android
[4]
5,316,178
5,316,179
Will I be able to read xml from php file?
<p>I have apps that read online settings, and until now these settings are stored in xml. So my app read it's setting straight forward:</p> <pre><code>"http://foo.net/app/setting.xml" </code></pre> <p>But I want it to be easier to maintain, and store a lot of data in the database, So im thinkink of replacing <code>../app/setting.xml</code> with something like <code>../setting.php</code> where I in the php file would do something like</p> <pre><code>&lt;?php include mysql stuff .. $bookid = $_GET['id']; read database based on $bookid; ?&gt; &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;book&gt; &lt;name&gt;&lt;?php echo $row['name']; ?&gt;&lt;/name&gt; &lt;published&gt;&lt;?php echo $row['published']; ?&gt;&lt;/published&gt; &lt;/book&gt; </code></pre> <p>Is it doable? Do I have to care about header stuff like header expires and cache?</p>
php
[2]
4,230,768
4,230,769
Wait for callback to complete with dialog
<p>I am very new to Android development, so please bare with me. I have a GPS class which returns the current GPS coordinates to the calling activity via a callback.</p> <p>The user either takes a picture or chooses one from the library and then returns to the main activity. After he returns to the main activity, I poll the gps class for the location data. Once the callback return, it updates two class properties, one for Lat and one for Lon.</p> <p>Sometimes it takes several second for the callback to be called and I want the activity to wait for the callback and display some kind of dialog to the user.</p> <p>Currently I am just useing a while loop to wait for the properties to update, but I'm sure there is a more graceful solution to this.</p> <p>Thanks!</p>
android
[4]
1,980,898
1,980,899
Activity does not scroll when rotating screen
<p>when I turn the phone and the screen is rotating I cannot see the whole screen anymore. This is ok but I cannot scroll! Do I have to set some flag or property for scrolling? This is part of my xml...</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:focusable="true" android:focusableInTouchMode="true" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="*"&gt; ... &lt;/TableLayout&gt; &lt;TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" ... &lt;/TableLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>Thanks!</p>
android
[4]
1,035,018
1,035,019
Troubleshooting error when creating array from database values
<p>Can someone see what I'm doing wrong with this php array? I"m trying to create a dynamic array but somehow it not working and get an Server internal error when attempting to access it from a browser</p> <pre><code>$index = 0; $columnIndex = 0 while($row = mysqli_fetch_array($result, MYSQL_NUM)) { $test = array(); $test[$arrayIndex] = $row[$columnIndex]; $coumnIndex = 1; if(is_string($row[$number])) { preg_match("/(?:\d+\.)?(?:\s*)?$stop?(?:\s*)?(.*):(.*)",{$row[$columnIndex]},$match1); $test[$index] = '&lt;p&gt; &lt;strong&gt; . $match1[1] . &lt;/strong&gt; . $match1[2] . &lt;/p&gt;'; } ++$arrayIndex; ++$columnIndex; } $jsonData = json_encode($test); echo $jsonData; </code></pre>
php
[2]
512,540
512,541
Show div on text entry
<p>I have a form and I'd like to show a div based on the entered text in a text field. The script I'm using works just fine on my latest version of chrome but it doesn't work on IE or any of my members browswers. What they heck is wrong with the script?</p> <pre><code> &lt;script&gt; $('document').ready(function(){ $('#gname').change(function() { ($(this).val() == "NBA 2k10") ? $('#number').slideDown('fast') : $('#number').hide(); }) }); &lt;/script&gt; </code></pre>
jquery
[5]
972,200
972,201
Count the prime numbers from 2 to 100 with simpler code than this
<p>It has to be with just functions, variables, loops, etc (Basic stuff). I'm having trouble coming up with the code from scratch from what I've I learned so far(Should be able to do it). Makes me really mad :/. <strong>If you could give me step by step to make sure I understand I'd really really appreciated.</strong> Thanks a bunch in advanced.</p> <p>How could I get the same result with a simpler code than this one:</p> <pre><code>var primes=4; for (var counter = 2; counter &lt;= 100; counter = counter + 1) { var isPrime = 0; if(isPrime === 0){ if(counter === 2){console.log(counter);} else if(counter === 3){console.log(counter);} else if(counter === 5){console.log(counter);} else if(counter === 7){console.log(counter);} else if(counter % 2 === 0){isPrime=0;} else if(counter % 3 === 0){isPrime=0;} else if(counter % 5 === 0){isPrime=0;} else if(counter % 7 === 0){isPrime=0;} else { console.log(counter); primes = primes + 1; } } } console.log("Counted: "+primes+" primes"); </code></pre>
javascript
[3]
1,624,477
1,624,478
How to extract <pre> within <div> using jQuery
<pre><code>&lt;div id='Thirdsamplecodesnippet' class='clearfix'&gt; &lt;pre class='brush:html;'&gt;&amp;lt;html&amp;gt; &amp;lt;body&amp;gt; &amp;lt;p&amp;gt;Hello world.&amp;lt;/p&amp;gt; &amp;lt;/body&amp;gt; &amp;lt;/html&amp;gt;&lt;/pre&gt; &lt;input type='hidden' id='codeid' value='process'&gt; &lt;/div&gt; </code></pre> <p>I would like to extract this from the div:</p> <pre><code>&lt;pre class='brush:html;'&gt;&amp;lt;html&amp;gt; &amp;lt;body&amp;gt; &amp;lt;p&amp;gt;Hello world.&amp;lt;/p&amp;gt; &amp;lt;/body&amp;gt; &amp;lt;/html&amp;gt;&lt;/pre&gt; </code></pre> <p>How is this possible with jQuery?</p>
jquery
[5]
4,113,313
4,113,314
How to make app like Flipboard?
<p>I want to make an application similar like Flipboard on android like <a href="https://play.google.com/store/apps/details?id=flipboard.app&amp;feature=search_result#?t=W251bGwsMSwxLDEsImZsaXBib2FyZC5hcHAiXQ" rel="nofollow">this</a>. I am using gridview for showing Gallery images, but it's not applicable. How can I achieve this? I also want to apply page curl and flip.because page curl and flip.</p> <p>I have to implement curl effect in flipboard please anyone guide me.</p>
android
[4]
3,707,681
3,707,682
Send message to a server from android device without internet connection
<p>Basically I want to create an application on Android device which able to send a message to my third-party server without being connected to internet through wi-fi or 3G service. Is there anyway to achieve this?</p>
android
[4]
266,461
266,462
Intent gallery to save un the same content?
<p>I have trouble with this Intent and Gallery editor</p> <pre><code> //fileURI is a content:// Intent intent = new Intent(Intent.ACTION_EDIT); intent.setDataAndType(fileUri, "image/jpeg"); intent.putExtra("return-data", true); intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString()); </code></pre> <p>With Photoshop App it's ok, I can save and edit but not whith Android Gallery it save in another directory</p> <p>thanks</p>
android
[4]
5,223,883
5,223,884
Is there a discontinuous range class for Python?
<p>I'd like to represent an arbitrarily complex range of real values, which can be discontinuous, i.e.:</p> <pre><code>0--4 and 5--6 and 7.12423--8 </code></pre> <p>Where I'll be adding new ranges incrementally:</p> <pre><code>(0--4 and 5--6 and 7.12423--8) | ( 2--7) = (0--7 and 7.12423--8) </code></pre> <p>I don't really know the right language to describe this, so I'm struggling to search, but it seems like a class probably already exists to do what I want to do. Does it?</p>
python
[7]
5,953,180
5,953,181
The correct way to limit results in jquery ui autocomplete with map
<p>What is the correct way to limit results of ui.autocomplete when used with map?</p> <p>I found similar issue with solution which works for simple array here: <a href="http://stackoverflow.com/questions/7617373/limit-results-in-jquery-ui-autocomplete">limit results in jquery ui autocomplete</a> But my array is a bit nested, apart from the fact that the source is external.</p> <p>I have also tested another solution here to undefined error: <a href="http://stackoverflow.com/questions/8921269/jquery-autocomplete-limit-results">jquery autocomplete limit results</a></p> <p>Below is what I adapted from the link, but to no success.</p> <p><strong>My test:</strong></p> <pre><code>var sourceUrl = '/path/to/products.json'; $("#auto").autocomplete({ source: function (request, response) { $.getJSON(sourceUrl, {term: request.term}, function (result) { response($.map(result.products, function (item) { var myarray = item.product; console.log(myarray); // the returns look expected (Product One, Product Two, etc) var results = $.ui.autocomplete.filter(myarray, request.term); results.slice(0, 10); })); }); } }); </code></pre> <p><strong>products.json:</strong></p> <pre><code>{"products": [{"label": "Product One", "product": "Product One", "sku": "12345"}, ... </code></pre> <p>It will be easier to simply output all the products, but they are are just to many/heavy to hold in dropdowns. Thats why I need to limit the result.</p> <p>Any hint is very much appreciated. Thanks.</p>
jquery
[5]
991,157
991,158
Get MS-Windows Installed Applications from Java
<p>Is it possible to get a list of installed applications (like the list from the un-install programs) from a windows vista computer with java?</p>
java
[1]
4,475,023
4,475,024
Execute python program without having specific packages in system
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/49146/how-can-i-make-an-exe-file-from-a-python-program">How can I make an EXE file from a Python program?</a> </p> </blockquote> <p>I am looking for a method in which i can run python program without having packages installed in the system. Is there any way by which we can directly run any python code as an *exe. or Should I make a executable file which has all packages in it.</p> <p>The main reason behind this is, able to run python program on system which is not having python/packages in it. </p>
python
[7]
1,815,056
1,815,057
How can I fix this screen > php > No screen session found
<p>I send screen command for php but</p> <p>for example</p> <pre><code>&lt;?php system("screen -S screen444 -X -p0 eval 'stuff \"restart\"^m'") ?&gt; </code></pre> <p>I send this command</p> <p>Error: No screen session found.</p> <p>But screen is running</p> <p>with any idea?</p> <p>Thanks</p>
php
[2]
2,137,797
2,137,798
How to get the previous page url using js
<p>how do I get URL of previous page in js.</p> <p>say , I go from page A to B, and use browser back button to go back to page A.</p> <p>I've tried history.previous, but am not getting it to work.</p>
javascript
[3]
1,657,836
1,657,837
Javascript function is not working properly in Master pages
<p><code>document.getelementbyid('txtbox')</code> is not working when I used in content page as it is working in the normal web page. The value is null when it is used in contentpage. Plz anybody help me</p>
asp.net
[9]
4,171,498
4,171,499
printing data from phone in android
<p>In my android application i would like to allow the user to print the data on phone to the nearest printer on click of print button.</p> <p>Is it possible in android.How could i get the printers nearby?</p> <p>Please share your valuable suggestions.</p> <p>Thanks in advance :)</p>
android
[4]
154,718
154,719
Have occured error in the following given code in the below website
<p><a href="https://developers.facebook.com/docs/mobile/android/build/" rel="nofollow">https://developers.facebook.com/docs/mobile/android/build/</a></p> <p>Have occurred error in the following given code in the below website </p> <pre><code> package com.greatapp; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import com.facebook.android.*; import com.facebook.android.Facebook.*; public class MyGreatActivity extends Activity { Facebook facebook = new Facebook("YOUR_APP_ID"); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); &lt;i&gt; setContentView(R.layout.main); &lt; i&gt; I have gotten error here facebook.authorize(this, new DialogListener() { @Override public void onComplete(Bundle values) {} @Override public void onFacebookError(FacebookError error) {} @Override public void onError(DialogError e) {} @Override public void onCancel() {} }); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); facebook.authorizeCallback(requestCode, resultCode, data); } } </code></pre> <p><code>setContentView(R.layout.main);</code> The error tells us to create a field <code>main</code> in type <code>layout</code>. I tried it but <code>R.java</code> file cannot be modified manually. How can I solve this error?</p>
android
[4]
2,425,340
2,425,341
Smart String Replacements
<p>This works well for case insensitive replacements:</p> <pre><code>str = str.replace(new RegExp(phrase, 'gi'), '&lt;span style="color:red;"&gt;' + phrase + '&lt;/span&gt;'); </code></pre> <p>But what I do want is to not change case when replaced which above-mentioned does. </p>
javascript
[3]
760,110
760,111
Open Spinner while touching a TextField
<p>I have an EditText and a spinner and I want to open the spinner when I gets focus on the Edittext. How to do that in android.? Please help.</p>
android
[4]
4,879,434
4,879,435
In Python, When yield cost over the return an list?
<p>In many case, people all ways say "use the <code>yield</code> to lazily create element." but I think everything have cost, include the <code>yield</code> and its iterator.</p> <p>In effective nord eyes, I think it's nice question. so,for example, when I get an function.</p> <pre><code>def list_gen(n): if n &gt; MAGIC_NUM: return xrange(n) else: return range(n) </code></pre> <p>How much dose the MAGIC_NUM is?</p> <p><strong>UPDATE</strong> sorry for this mistake, I'm origin meaning is compare the iterator's cost and list cost.</p> <p><strong>UPDATE AGAIN</strong> Please imaging an case. Whether have an condition, that the memory so limit that it's can't create an iterator. </p> <p>ha, this question is more funny now.<br> <strong>UPDATE AGAIN</strong> Why does create an iterator and save the yield context are less then create a list? or How much does iterator cost ?(sorry for my insult) How many bytes?</p>
python
[7]
1,143,887
1,143,888
building a dom tree reading html using java
<p>I am trying to build the dom tree using the scanner class in java to read a give html. Below is my implementation using a stack. for some strange reason when i try to print my tree only the root is showing up and nothing else</p> <pre><code>public void build() { root = new TagNode("", null, null); TagNode ptr = null; Stack&lt;TagNode&gt; tags = new Stack&lt;TagNode&gt;(); while (sc.hasNextLine()) { String tag = sc.nextLine(); if (tag.equals("&lt;html&gt;")) { ptr = new TagNode("html", null, null); tags.push(ptr); root.tag = "html"; } else if (tag.charAt(0) == '&lt;') { if (tag.charAt(1) == '/') { tags.pop(); continue; } else if (tags.peek().firstChild == null) { String temp = tag.replaceAll("&lt;", ""); temp = temp.replaceAll("&gt;", ""); ptr = new TagNode(temp, null, null); tags.peek().firstChild = ptr; tags.push(ptr); } else { TagNode temp = tags.peek().firstChild; while (temp.sibling != null) { temp = temp.sibling; } String a = tag.replaceAll("&lt;", ""); a = a.replaceAll("&gt;", ""); ptr = new TagNode(a, null, null); temp.sibling = ptr; tags.push(ptr); } } else { if (tags.peek().firstChild == null) { tags.peek().firstChild = new TagNode(tag, null, null); } else { TagNode temp = tags.peek().firstChild; while (temp.sibling != null) { temp = temp.sibling; } temp.sibling = new TagNode(tag, null, null); } } } } </code></pre>
java
[1]
1,907,189
1,907,190
Java thread question
<p>I'm taking Java lessons. We're now into threads. It is the first time I'm experiencing multithreading so please excuse me if the question is very dumb :)</p> <p>I've the following program:</p> <pre><code>public class Foo extends Thread { private int x = 2; public static void main(String[]args) { new Foo().fun(); } Foo () { x = 5; start(); } public void fun() { x = x - 1; System.out.println(x); } public void run() { x = x * 2; } } </code></pre> <p>When I run the program I get 4 as output. Will the output of the above program always be 4?</p>
java
[1]
3,941,631
3,941,632
How can I check my banner application on my actual android device that is it working correctly or not?
<p>I have developed a simple application using SDK(Android: 3.2[API-13]) for, to display Google banners. I have tow problems in this application.</p> <p>Problem No.1: I have checked the application it runs on emulator but how can i check it that it working correctly or not?</p> <p>Problem No.2: I want to run the application on my physical Android device using Android version 2.3.3. What changes I need to do in the application to run it on my Android device using Android version 2.3.3.?</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.farman.banner" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="10"/&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" &gt; &lt;activity android:name=".MyBannerActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/&gt; &lt;/application&gt; &lt;uses-permission android:name="android.permission.INTERNET"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt; &lt;/manifest </code></pre> <p>></p>
android
[4]
2,686,880
2,686,881
HTTP Error 500.0 - Internal Server Error. Error Code 0x00000000
<p>I have a php page of ContactUs form when i submit the form a error page displayed with following error.I am not sure about my code.Please let me know cause of this error so that i can improve it. Waiting for early response.</p> <p><em><strong>Error:</em></strong></p> <p>"Server Error in Application "GIST.IN" Internet Information Services 7.0</p> <p>Error Summary HTTP Error 500.0 - Internal Server Error The page cannot be displayed because an internal server error has occurred. Detailed Error Information Module IsapiModule Notification ExecuteRequestHandler Handler PHP Error Code 0x00000000 </p> <p>Requested URL <a href="http://gist.in:80/contactus_submit.php" rel="nofollow">http://gist.in:80/contactus_submit.php</a> Physical Path D:\WEBDATA\gist.in\contactus_submit.php Logon Method Anonymous Logon User Anonymous "</p>
php
[2]
1,824,704
1,824,705
Validation of File Upload Control using jquery
<p>How to validate asp.net FileUpload control using jquery. I need to validate two things, FileUpload should not be empty when user clicks ok button and it should contain only excel and csv files. </p> <p>please help.</p>
jquery
[5]
1,766,775
1,766,776
How to get local variable by its name in JS?
<p>Working example with global var:</p> <pre> var example_var = 'global var example'; var x = function(){ var var_name = 'example_var'; alert('Global var value is: ' + window[var_name]); } </pre> <p>How can I do same thing with a local variable? Like this (not working example):</p> <pre> var x = function(){ var example_var = 'Local var example'; var var_name = 'example_var'; alert('Local var value is: ' + window[var_name]); } </pre>
javascript
[3]
987,983
987,984
Record 44KHz audio from bluetooth?
<p>Assuming I am using an A2DP-compatible bluetooth headset and that the headset is properly paired and connected, how can I record to an audio file using the bluetooth headset as the source?</p> <p>In this case, when there isn't a Bluetooth headset, I record from the microphone to an M4A file containing AAC data with a sample rate of 44100 and a bit rate of 160,000, then proceed to manipulate the audio data--changing the format is not an option.</p> <p>I have read <a href="http://stackoverflow.com/questions/4026002/how-to-record-sound-using-bluetooth-headset">How to record sound using bluetooth headset</a> and tried the approach indicated--but cannot get it to work.</p>
android
[4]
1,583,137
1,583,138
Error converting parameter in C++
<p>Header file</p> <pre><code>#include &lt;iostream&gt; #include &lt;cstring&gt; const unsigned MaxLength = 11; class Phone { public: Phone(const char *phone) { setPhone(phone); } void setPhone(const char Phone[ ]); const char* getPhone(); private: char phone[MaxLength+1]; }; </code></pre> <p>Cpp file</p> <pre><code>#include "Phone.h" #include &lt;iostream&gt; #include &lt;ctype.h&gt; #include &lt;cstring&gt; #include &lt;cstdlib&gt; using namespace std; bool checkNum(const char* num); void Phone::setPhone(const char Phone[ ]) { strncpy(phone, Phone, MaxLength); phone[MaxLength] = '\0'; } const char* Phone::getPhone() { return phone; } int main() { Phone i1("12345678901"); cout &lt;&lt; i1.getPhone() &lt;&lt; endl; if (checkNum(i1.getPhone())) cout &lt;&lt; "Correct" &lt;&lt; endl; else cout &lt;&lt; "Invalid Wrong" &lt;&lt; endl; } bool checkNum(const char* num) { bool flag = true; if (atoi(num[0]) == 0) flag = false; return flag; } </code></pre> <p>When I tried to compile, I get this error:</p> <blockquote> <p>error C2664: 'atoi' : cannot convert parameter 1 from 'const char' to 'const char *' 1> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast</p> </blockquote> <p>I am trying to read the first element of the array as an int so I can compare it using the atoi function. I am having a parameter mismatch but I can't find where it is. Any idea what's wrong?</p>
c++
[6]
2,329,267
2,329,268
How do I get an overview and a methodology for programming in Python
<p>I've started to learn Python and programming from scratch. I have not programmed before so it's a new experience. I do seem to grasp most of the concepts, from variables to definitions and modules. I still need to learn a lot more about what the different libraries and modules do and also I lack knowledge on OOP and classes in Python.</p> <p>I see people who just program in Python like that's all they have ever done and I am still just coming to grips with it.</p> <p>Is there a way, some tools, a logical methodology that would give me an overview or a good hold of how to handle programming problems ?</p> <p>For instance, I'm trying to create a parser which we need at the office . I also need to create a spider that would collect links from various websites. </p> <p>Is there a formidable way of studying the various modules to see what is needed ? Or is it just nose to the grind stone and understand what the documentation says ?</p> <p>Sorry for the lengthy question..</p>
python
[7]
5,294,060
5,294,061
Why isn't my date parsing correctly?
<p>I'm having issues parsing dates after 01/01/2000. The results are being returned incorrectly. 1999 is getting parsed as the year 1999, when it gets to 2000 it is parsing it as 0100, and then 2001 as 0101, etc. Here is the test code to illustrate this issue:</p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; // functions incorrect changes year from 2010 to 0101 var d = (new Date("12/01/2009")); if (d.getMonth() &lt; 11) { d = new Date(d.getYear(), d.getMonth() + 1, 1); } else { d = new Date(d.getYear() + 1, 0, 1); } document.write(d); // Result: Sat Jan 01 0101 00:00:00 GMT-0500 (Eastern Standard Time) document.write('&lt;br /&gt;'); document.write(Date.parse(Date()) &lt; Date.parse(d)); // // Result: false today should definitely be &lt; 01/01/2010 document.write('&lt;br /&gt;'); // Functions correctly if year is before 2000 var d = (new Date("12/01/1998")); if (d.getMonth() &lt; 11) { d = new Date(d.getYear(), d.getMonth() + 1, 1); } else { d = new Date(d.getYear() + 1, 0, 1); } document.write(d); // Result: Fri Jan 01 1999 00:00:00 GMT-0500 (Eastern Standard Time) document.write('&lt;br /&gt;'); document.write(Date.parse(Date()) &lt; Date.parse(d)); // false &lt;/script&gt; </code></pre>
javascript
[3]
1,739,738
1,739,739
Can I post-back <asp:HiddenField>'s value modified with JS
<p>As title, would this raise the same problem like <a href="http://stackoverflow.com/questions/228969/asp-net-invalid-postback-or-callback-argument-event-validation-is-enabled-usi">http://stackoverflow.com/questions/228969/asp-net-invalid-postback-or-callback-argument-event-validation-is-enabled-usi</a> ?</p> <p>Thank you</p>
asp.net
[9]
2,346,197
2,346,198
Enforcing Values Supplied Are Changed
<p>Hoping someone can assist. Within my web app, I allow the user to create a record stored in a temporary table via an iframe and then allow them to clone/copy the same record just created but with three fields within the cloned record substituted with dummy values, that need to be changed.</p> <p>Just to elaborate further, let's say that initially the user creates the following record:</p> <pre><code>record 1: F1:A F2:B F3:C F4: System One F5: Active </code></pre> <p>User can then clone record 1, which would then be created as follows:</p> <pre><code>record 2: F1:A_COPY F2:B_COPY F3:C_COPY F4: System One F5: Active </code></pre> <p>So based on record 2, the cloned record, I now need to ensure and enforce that the user has to change the first three fields that contain the string "_COPY" to actual values.</p> <p>Now, with jQuery, what is the best way to ensure that these three fields within the web app are actually changed, i.e. mandatory?</p> <p>Thanks.</p>
jquery
[5]
5,174,325
5,174,326
How can i show correct last login date time in website?
<p>I have created a asp.net website, that we are going to deploy at India. All client of this website would be from SWEDEN.</p> <p>This site have option (last login date time) at user's dashboard after successfull login.</p> <p>Now my problem is that if application is deploy at India and user loggedin from SWEDEN then user is able to show only server date time which is of India.</p> <p>My Steps are as following</p> <pre><code>1. User logged into site first time at 10 AM(server time), surfing starts... 2. Logged out at 10:30 (server time) 3. Application store server datetime in database. 4. Next time user come, application will store same date and time from database as last loggin datetime. </code></pre> <p>How can i store SWEDEN date time in database when user logged out from site, it will in future grow to other country also.</p> <p>Please help?</p>
asp.net
[9]
3,740,141
3,740,142
To disable Clear button while all input fields are null
<p>In the form that I am developing, I need to implement a screen rule which is - Clear button is greyed out until atleast one input field is not null. For this, I have added a js function which checks all input fields and gets called during "onmousemove" event. I have added this to body tag. I does work, but I suspect if this is the best way it can be done. Are there better ways to implement this? </p>
javascript
[3]
1,193,319
1,193,320
Tab bar appearing below the edge of the screen
<p>I'm creating an application that, when the user selects a project in a table, displays a view with a tab bar at the bottom. I'm using this code:</p> <pre><code>- (id)init { [super initWithNibName:nil bundle:nil]; tabController = [[UITabBarController alloc] init]; // Create all view controllers to be included in the tab bar SummaryViewController *summaryController = [[SummaryViewController alloc] init]; ImagesViewController *imagesController = [[ImagesViewController alloc] init]; // Make an array containing the view controllers NSArray *viewControllers = [NSArray arrayWithObjects:summaryController, imagesController, nil]; [summaryController release]; [imagesController release]; // Attach them to the tab bar controller [tabController setViewControllers:viewControllers]; [self.view addSubview:tabController.view]; return self; } </code></pre> <p>With the end result being the tab bar at the bottom appearing cut off around half its height. I'm guessing it's somehow related to the navigation controller at the top (<a href="http://www.ixagon.se/tabbarproblem.png" rel="nofollow">link to image</a>).</p> <p>Any help in solving this mystery would be greatly appreciated!</p>
iphone
[8]
2,772,118
2,772,119
Handling the different results from parsedatetime
<p>I'm trying to learn python after spending the last 15 or so years working only in Perl and only occasionally.</p> <p>I can't understand how to handle the two different kinds of results from the parse method of Calendar.parse() from parsedatetime</p> <p>Given this script:</p> <pre><code>#!/usr/bin/python import parsedatetime.parsedatetime as pdt import parsedatetime.parsedatetime_consts as pdc import sys import os # create an instance of Constants class so we can override some of the defaults c = pdc.Constants() # create an instance of the Calendar class and pass in our Constants # object instead of letting it create a default p = pdt.Calendar(c) while True: reply = raw_input('Enter text:') if reply == 'stop': break else: result = p.parse(reply) print result print </code></pre> <p>And this sample run:</p> <blockquote> <p>Enter text:tomorrow<br> (time.struct_time(tm_year=2009, tm_mon=11, tm_mday=28, tm_hour=9, tm_min=0, tm_sec=0, tm_wday=5, tm_yday=332, tm_isdst=-1), 1) </p> <p>Enter text:11/28<br> ((2009, 11, 28, 14, 42, 55, 4, 331, 0), 1) </p> </blockquote> <p>I can't figure out how to get the output such that I can consisently use result like so:</p> <pre><code>print result[0].tm_mon, result[0].tm_mday </code></pre> <p>That won't work in the case where the input is "11/28" because the output is just a tuple and not a struct_time. </p> <p>Probably a simple thing.. but not for this newbie. From my perspective the output of Calendar.parse() is unpredictable and hard to use. Any help appreciated. Tia.</p>
python
[7]
423,621
423,622
Dismissing DialogFragment programatically
<p>How does one programatically dismiss a DialogFragment? I am currently creating dialogs by:</p> <pre><code>void showDialogWithId(int id){ FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog"); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); if (id == SEARCHING_DIALOG){ // Create and show the dialog. DialogFragment newFragment = MyDialogFragment.newInstance(SEARCHING_DIALOG,"TEST"); newFragment.show(ft, "dialog"); } if (id == CONNECTING_DIALOG){ // Create and show the dialog. DialogFragment newFragment = MyDialogFragment.newInstance(CONNECTING_DIALOG,"TEST"); newFragment.show(ft, "dialog"); } if (id == CONNECTIVITY_DIALOG){ // Create and show the dialog. DialogFragment newFragment = MyDialogFragment.newInstance(CONNECTIVITY_DIALOG); newFragment.show(ft, "dialog"); } } </code></pre> <p>And I expect to dismiss them by:</p> <pre><code>public void dismissDialog(){ getFragmentManager().popBackStack(); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog"); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); } </code></pre> <p>However, the dialogs are not being dismissed...</p>
android
[4]
5,871,129
5,871,130
PHP rounding function not working for rounding up
<p>For the code below, sometimes the value <strong>$endorsepoints</strong> is not a whole number. I want it to be rounded off, up or down, depending on normal math rules. </p> <p>Then, I want to input the rounded number into two MySQL tables, <strong>comment</strong> and <strong>submission</strong>. </p> <p>I want the number rounded up or down per normal math rules.</p> <p>When the number is supposed to be rounded down (i. e. 5203.25), the correct rounded number (i. e. 5203.00) gets added to both <strong>comment</strong> and <strong>submission</strong>.</p> <p>When the number is supposed to be rounded up (i. e. 5151.74), the correct rounded number (i. e. 5152.00) gets added to <strong>submission</strong>. However, in this situation, the rounded down number (i. e. 5151.00) is added to <strong>comment</strong>. How can I make the rounded up number go into <strong>comment</strong> in this situation?</p> <pre><code> $endorsepoints = $endorsepoints * .01; $endorsepoints2 = ( $endorsepoints &lt;= 10 ) ? 10 : $endorsepoints; $endorsepoints2 = round($endorsepoints2); $query1 = sprintf("INSERT INTO comment VALUES (NULL, %d, %d, '%s', %d, NULL)", $uid, $submissionid, $comment, $endorsepoints2); mysql_query($query1) or die(mysql_error()); $query2 = sprintf("UPDATE submission SET points = (points + '$endorsepoints2') WHERE submissionid = '$submissionid'"); mysql_query($query2) or die(mysql_error()); </code></pre> <p>EDIT: I want the same number inserted into both tables at all times. My question is: why is it not?</p>
php
[2]
4,128,241
4,128,242
Programatically Generating WebControls
<p>I have a page that, depending on input from a previous page, lists a varying number of different questions pulled from a database. I can't seem to find an example of this online: For each question that is displayed, I need to programatically generate a DropDownList so that the user can select yes or no for each of these questions. Hoping someone here can give me some direction on where to look. Thanks.</p>
asp.net
[9]
2,214,918
2,214,919
encoding from .txt file to string using php
<p>I'm doing this project where I receive a .txt file from a MATLAB program in a PHP server. I would like to extract the data in the .txt file and encode it to a string to be sent by the server to an android. Any ideas on how to do that?</p>
php
[2]
5,140,439
5,140,440
file_get_contents() failed to open stream:
<p>I'm trying to use file_get_contents() to grab a twitter feed, however I'm getting the following warning: </p> <pre><code>failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request </code></pre> <p>My code:</p> <pre><code>$feed = 'http://twitter.com/statuses/user_timeline.rss?screen_name=google&amp;count=6'; $tweets = file_get_contents($feed); </code></pre> <p>I'm using google just for the sake of testing. allow_url_fopen is enabled in my php.ini file.</p> <p>Any idea what could be wrong?</p>
php
[2]
1,156,409
1,156,410
onkeypress event not working in firefox ? how to fix it?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4496910/onkeypress-event-not-working-in-firefox">onKeyPress event not working in Firefox</a> </p> </blockquote> <pre><code>&lt;div&gt;&lt;textarea maxlength="1000" rows ="5" cols ="5" style="width:398px; height: 175px; overflow: auto; padding: 4px !important" name="body" value="" id="body" onkeypress="imposeMaxLength(this, 10);" onPaste="imposeMaxLength(this, 10);" /&gt;&lt;/textarea&gt;&lt;/div&gt; &lt;script&gt; function imposeMaxLength(field, MaxLen){ if (field.value.length &gt; (MaxLen-1)) { alert("It cannot exceed " + MaxLen + " characters."); field.value= field.value.substr(0, (MaxLen); } } &lt;/script&gt; </code></pre>
javascript
[3]
4,881,038
4,881,039
Function argument as filename
<p>Addig a file to MediaPlayer is easy:</p> <pre><code>mp = MediaPlayer.create(Myctivity.this, R.raw.sound); </code></pre> <p>But what if I have the filename as an argument coming from a function like this?</p> <pre><code> public void CreateSound(String filename, float volume) { mp = MediaPlayer.create(Myctivity.this, R.raw.???); mp.setVolume(volume, volume); try { mp.prepare(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } mp.start(); } </code></pre>
android
[4]
3,715,421
3,715,422
Removing white spaces from string using loops
<p>Hi guys I'm trying to remove white spaces using loops specifically. Heres what I've come up with so far</p> <pre><code> import java.util.Scanner; public class Q2 { public static void main(String[] args) { String input = ""; char noSpace = ' '; Scanner scan = new Scanner(System.in); input = scan.nextLine(); System.out.println(input); for (int i = 0; i &lt; input.length(); i++) { //search from right to left for (int j = input.length(); j != -1; j--) { //search from left to right if (input.charAt(i) == noSpace) { //if there is a space move position of i and j i++; j--; } } System.out.println(input); </code></pre> <p>I am still quite new to java, any suggestions would be great thanks!</p>
java
[1]
2,496,581
2,496,582
Cannot set property of innerHTML
<p>I have a small script which grabs a file and outputs in Javascript. Then after that output i want to edit the innerHTML. </p> <p>But its saying it cannot set it. "Uncaught TypeError: Cannot set property 'innerHTML' of null"</p> <p>This is what i have:</p> <pre><code>function call_file(file,div_id){ var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200) { document.getElementById(div_id).innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET",file,true); xmlhttp.send(); } call_file('test.php','main'); //main = div_id to display content in document.getElementById('total').innerHTML = 'test'; </code></pre> <p>My test.php has:</p> <pre><code>&lt;div id="total"&gt;&lt;/div&gt; </code></pre> <p>I'm wondering why it cannot set? </p>
javascript
[3]
2,858,508
2,858,509
How do i get count of an unknown attribute in a JSON object without a loop
<p>eg. </p> <pre><code>var myObject = { 'item_123': { 'id': 1, 'name': 'Some name' }, 'item_789': { 'id': 2, 'name': 'Another name' } }; </code></pre> <p>The number part of the item attribute/object is not known before hand since they are unique ids and are auto generated. Is it possible to get item count from myObject without looping through it?</p>
javascript
[3]
3,738,499
3,738,500
access the outer div using an element inside it
<pre><code>&lt;div class='container'&gt; &lt;a href="#"&gt;Click&lt;/a&gt; &lt;/div&gt; </code></pre> <p>How can I access the outer div using the anchor as a starting point in jQuery?</p>
jquery
[5]
1,064,387
1,064,388
Bad value from AttributeSet.getAttributeValue()
<p>I have a custom SeekBarPreference, which extends DialogPreference. I'm building my own layout, yet still using the parent's attributes.</p> <pre><code>&lt;com.example.preference.SeekBarPreference android:key="key" android:title="title" android:summary="summary" android:dialogMessage="diag message" android:text="text" android:max="60" android:defaultValue="30" /&gt; </code></pre> <p>In the code section, I'm retrieving the attr.getAttributeValue(androidDns, attrKey), like so</p> <pre><code>mText = attrs.getAttributeValue(androidns, "text"); mMax = attrs.getAttributeIntValue(androidns, "max", 30); ... </code></pre> <p>The thing is that in the 'mText' member I'm getting something like "@12341234" kind of text, but 'mMax' is being set right.</p> <p>How is this possible ?</p>
android
[4]
3,379,582
3,379,583
Android: How to optimize ListView with ImageView + 3 TextViews?
<p>I've been looking everywhere to see if there is a standard way of achieving this but I find a different solution everytime. Basically, I am trying to build a Custom ListView with an image and two-three lines of text besides it. In order to optimize it, I understand that the following have to be used:</p> <ol> <li>convertView: Basically if the view was already inflated, use it</li> <li>Lazy-Loading: Do not load the content of the rows until they are called for</li> <li>Background Downloading &amp; Caching: Download images in their own threads and then update the row (and possible cache them?)</li> </ol> <p>I could manage 1 and 2 but the third one is really confusing me. Is there a best practice for this?</p> <p>Thanks</p>
android
[4]
2,180,661
2,180,662
Java objects created inside main method and created outside main
<p>//Test.java</p> <pre><code>class Example { public int size = 5; } public class Test{ public static void main(String[] args) { Example eg = new Example(); System.out.printlin(eg.size); } } </code></pre> <p>//Person.java</p> <pre><code>public class Person { public Person(){ private Test ex = new Test(); System.out.println(ex.size); } } </code></pre> <p>Person.java will not give me any output but my question is where all i can create a object. For eg: Here I've created in constructor,in above Test class, I've created in main() method.</p> <p>In Person class,if I've a main method for eg, like below</p> <pre><code>public static void main(String[] args) { private Test ex = new Test(); //If i use private ecllipse is showing error, Why is it ? System.out.println( ex.size); //This is also showing as error I've created a object for Test class so i can access it objects here right. } </code></pre> <p>Thanks</p>
java
[1]
5,219,210
5,219,211
Required Minimum Distribution Calculation not working
<p>I am trying to make an app for the Android that does RMD calculations. The program, however, keeps giving 0.0.</p> <p>I think that my problem lies in this code:</p> <pre><code>package com.MinDis.android; import java.util.*; import java.text.*; public class RMD { double balance; double rmd; long age; String bdate; SimpleDateFormat sd = new SimpleDateFormat("MM/dd/yyyy"); Date current = new Date(); public void setBalance(double i) { balance = i; } public double getBalance() { return balance; } public void setBDate(String h) { bdate = h; } public long getAge() throws Exception { Date birthd = sd.parse(bdate); long cur; long birth; long diff; cur = current.getTime(); birth = birthd.getTime(); diff = cur - birth; age = (diff/(24*60*60*1000))/365; return age; } public double getRMD() { if (age == 70) { rmd = balance/27.4; } if (age == 71) { rmd = balance/26.5; } if (age == 72) { rmd = balance/25.6; } if (age == 73) { rmd = balance/24.7; } if (age == 74) { rmd = balance/23.8; } return rmd; } } </code></pre> <p>I tried using .equals(), but it complained that I was trying to dereference the long value. Also, I am aware that java.util.Date is deprecated, but I don't want to try the other classes. From my first Android app, I figured out the "==" does not work, but I am not sure what to do here.</p> <p>I have verified that the input for a balance and the birthdate values were accepted, so that is how I limited it to this particular class.</p>
android
[4]
3,758,753
3,758,754
If-then-else statement doesn't work
<p>I have a main class, what looks like this: </p> <pre><code>class Main { public static void main (String[] args) { Mobil one = new Mobil ("xxxxxx", "yyyyyy", 00000001, true); Mobil two = new Mobil ("yyyyyy", "xxxxxx", 10245624, false); one.touchcontrol(); two.touchcontrol(); } } </code></pre> <p>And I have this Mobil class:</p> <pre><code>class Mobil { String type; String manufactureat; int modellnumber; boolean touchtype; public Mobil (String manufacturer, String inittype, int number, boolean touch) { manufacturer = manufactureat; inittype = type; number = modellnumber; touch = touchtype; } public void touchcontrol() { if (touchtype == false) { System.out.println("This model, has not got Touchscreen!"); } else { System.out.println("This model, has Touchscreen!"); } } </code></pre> <p>But when I run the program and invoke the <code>one.touchcontrol();</code> and <code>two.touchcontrol();</code> it shows that no model has got Touchscreen. I don't know what I missed.</p>
java
[1]
139,280
139,281
Best way to send data to aspx page in ASP.NET 2.0/3.5?
<p>Which is Best way to send data to aspx page, and <strong>why</strong>?</p> <ul> <li>using query string</li> <li>using session</li> <li>using cross page postback </li> <li>Something else</li> </ul> <p>Thanks.</p> <hr> <blockquote> <p>What are you trying to achieve? More info. please</p> </blockquote> <p>For example search form and advanced search form or multi step user registration.</p>
asp.net
[9]
3,892,332
3,892,333
PHP form not working on new server
<p>I have created a form for my website by following a tutorial at tutorialzine</p> <p>I have this form working nicely on one of my websites but when I tried to install the form on a new website the form fields are full of script and it doesn't work. I have put the same form on both servers to demonstrate the problem.</p> <p>Working form: <a href="http://lagunapools.com.au/crowntest/contact.php" rel="nofollow">http://lagunapools.com.au/crowntest/contact.php</a></p> <p>Not working: <a href="http://crowndoor.com.au/crowntest/contact.php" rel="nofollow">http://crowndoor.com.au/crowntest/contact.php</a></p> <p>Any help would be appreciated.</p>
php
[2]
2,579,553
2,579,554
Jquery data attributes as selectors
<p>I have input with either some given or empty "data-file":</p> <pre><code>&lt;input type="text" value="path/to/file.gif" name="some_file" data-fileid=".selector" data-file="/path/to/file.gif"&gt; </code></pre> <p>The cancel:</p> <pre><code>&lt;button class="cancel" type="button" accesskey="c"&gt;Cancel&lt;/button&gt; </code></pre> <p>I am manipulating the textfield to insert images which is fine, but when it comes to manipulating via data attributes, the button do not work:</p> <pre><code> var inputBg = $('fieldset:visible input[name*="file"]'); var dataOld = inputBg.data('file'); var dataSel = inputBg.data('fileid'); $('.cancel').click(function() { $(inputBg).val(dataOld); // revert to old stored value if any $(dataSel).css('background', 'none'); // remove background from .selector }); </code></pre> <p>I am using a jquery.ui.tabs, thats why I have: "fieldset:visible".<br> But the cancel button do not work. Any idea whats missing? Thanks </p> <p>UPDATE: Problem identified, I have to do binding to ui.tabs, but still looking for suggestions on other route, because my binding is not bullet-proof. I have to do duplication :( I also have to change relative path to absolute path on "data-file".</p>
jquery
[5]
5,192,424
5,192,425
Bi-directional ScrollView
<p>I'm curious if anyone has run into the same problem as me. I have an image that I can manipulate with pinch zooming. I'd like to be able to scroll horizontally and vertically when the image is too large for the screen. I've accomplished this with a ScrollView and HorizontalScrollView combo. But this implementation leads to clunky behavior. Has anyone solved a similar problem? </p>
android
[4]
3,845,627
3,845,628
how to get request in JSON Web service with C#
<p>How to handle, request and response in JSON Webservice Using C# Coding? I need to get request from client and processing after that i return the response to client.. I dont know how i do it..Any one please help me.. I am beginner to webservice and .Net.. It is very urgent.. Please Help me</p>
asp.net
[9]