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
2,428,625
2,428,626
Mysql query issue
<p>My database table (<strong>Name:Wall</strong>) structure is bellow:</p> <pre><code>----------------------------------------------------- id(type = int) like(type = int) wall_id(type =int) ----------------------------------------------------- 1 0 1 2 0 2 ----------------------------------------------------- </code></pre> <p>In wall.php file there are a text button name "<strong>Like this</strong>". So is there any way send a query to Mysql database after click on this text(<strong>Like this</strong>).</p> <p>Actually i want to create a like system. If anyone like user wall post then he/she can click on this text (<strong>Like this</strong>) to like user wall. So after every click, mysql database <strong>like</strong> field value should be increase by 1.</p> <p>Normally I can send a query to datbase with:</p> <pre><code>$sql = mysql_query("INSERT INTO wall VALUES('', '1')"); </code></pre> <p>Can anyone give me solution :-)</p>
php
[2]
121,606
121,607
Are multiple sequential array access optimised?
<p>Will C++ compilers automatically optimise the following code to calculate 3*i only once, and increment the result, or must the programmer code this?</p> <pre><code>void writeToArray(int i, int a, int b, int c) { array[3*i][1]=a; array[3*i][2]=b; array[3*i][3]=c; } </code></pre>
c++
[6]
1,446,195
1,446,196
Image being resized automatically when using BitmapFactory
<p>did you find a solution on this. I am facing the same problem. Would be nice if you could share your solution.</p> <p>Thanks, Sandro</p>
android
[4]
2,172,383
2,172,384
c# how to check if a text box has one digit?
<p>at the moment, my program crashes if only one digit exists inside a textbox. E.g. User puts '6' into a Day textbox (which it should be two digits), and the program will crash when he/she clicks the 'Convert' button. It has to be two digits or else the program crashes...</p> <p>my application is a time converter, by the way.</p> <p>thanks in advance :)</p>
c#
[0]
4,637,280
4,637,281
How do I add and subtract a number in a jQuery .click function?
<p>I will use jQuery to perform the following:</p> <p>Upon click of elements with the class "checkbox":</p> <ul> <li>add class "checkmark"</li> <li>remove class "checkbox"</li> <li>update a div with "You have x apps in your request list" where x is the number that have been clicked</li> <li>When a class with "checkmark" has been clicked, it will subtract from the number that is displayed</li> </ul> <p>My example code does not show all of this function, but I am able to accomplish this except for updating the number that have been clicked / "unclicked".</p> <p>`</p> <pre><code>$("span.checkbox").click(function() { if(!oldVal) { var oldVal = "0"; } var newVal = parseFloat(oldVal) + 1; var oldVal = newVal; $("#wishlistapps").html('&lt;li&gt;You have ' + newVal + ' apps in your request list&lt;/li&gt;'); }); </code></pre> <p>`</p>
jquery
[5]
4,359,824
4,359,825
C# Explicity throw an error on Process.Start()
<p>I'm a C# beginner and I have made a little launcher for a game and to start it, I'm using this button event:</p> <pre><code>private void button5_MouseClick(object sender, MouseEventArgs e) { Process.Start("engine.exe", "/load /config debug"); Application.Exit(); } </code></pre> <p>As you can see this also uses Application.Exit() to close the launcher when the game starts, because they are separate.</p> <p>What I want to know is if my method is good to start the game + close launcher and also, </p> <p>I would like to know how to make a pop up message saying "Engine.exe not found" when I'm clicking the button and engine.exe is missing.</p> <p>Thanks!</p>
c#
[0]
4,114,774
4,114,775
Using #if and #define to specify an accessor
<p>For a cross platform library in C#, I wish to have a certain set of methods marked <em>protected</em> for extensibility purposes. These methods are later accessed by reflection, using meta-programming with attributes</p> <p>However, on Windows Phone 7 accessing <em>protected</em> methods by reflection isn't allowed, and instead I wish for them to be marked internal.</p> <p>So what I'm wondering, is if I could do something like this, in C#, or if there's a better workaround for it?</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; #if WINDOWS_PHONE #define ACCESSOR internal #else #define ACCESSOR protected #endif namespace Example { public class MyTestClass { [MyAttribute] ACCESSOR void MyMethod() { } } } </code></pre>
c#
[0]
1,333,336
1,333,337
How can I configure how the header of an alert dialog
<p>Is there a way to configure how the header of an alert dialog looks? It nows has an icon (on the left) with text as title. Is there a way to add view on the same line?</p> <p>Thank you.</p>
android
[4]
4,295,534
4,295,535
How can we access windows service in webapplication using dot net
<p>I need to read the data from the COM port in a web application, so I have written a Windows Service for reading data from serial ports. Now I need to access that data in a web application. Can anyone tell me how to access it? Is using threads the best way to do this or not? What other possible ways are there?</p> <p>upendra</p>
asp.net
[9]
3,038,682
3,038,683
How i can do Post back in HTML button ASP.net
<p>I need it in this way -because that i not sure the button will be built , because he will build only if some conditions will....</p>
asp.net
[9]
3,414,880
3,414,881
polynomial ADT class
<p>I have trouble understanding use of high level ADT in a polynomial class. What i was given is</p> <pre><code>typedef struct term{ double coef; unsigned deg; struct term * next; }term_t; typedef struct term * Term; typedef struct term * Poly; </code></pre> <p>So this is said to be low level ADT, but i have to use high level ADT which means that I have to make a class. What I am starting doing is</p> <pre><code>class Polynomial{ private: typedef struct term{ double coef; unsigned deg; struct term * next; }term_t; typedef struct term *Term; typedef struct term *Poly; public: Polynomial(); //Constructor ~Polynomial(); //Destructor } </code></pre> <p>My problem is an understating the change of low level to ADT to high level ADT. Should the function be private but then accessed through a public functions? Is this basically like a polynomial linked list polynomial class? Is my start good? So term and poly will be a pointers to the coef and deg?</p>
c++
[6]
3,308,732
3,308,733
When pressing enter inside TextView, click button?
<p>I have a text view (and possibly 1 or 2 Spinners after it) and a Button. When a user presses the enter key (soft or hard keyboard), I want to Click the <strong>Search</strong> button, which is next.</p> <p>Is it only possible to do this by overriding the onKey event of the TextView and when Enter is pressed, performClick() the Button? </p> <p>I can't find much information from Google, but i could be searching for the wrong term.</p> <p>Cheers, D</p>
android
[4]
3,157,906
3,157,907
How to find all downloaded items information?
<p>I am developing one application related to downloads.</p> <p>For that i am searching.I got some examples,but these examples are not full fill my requirement.</p> <p>My requirement is getting the information about all downloaded items.</p> <p>If any one know the solution,please help me</p> <p>Thanks in advance</p>
android
[4]
879,410
879,411
gayadesign's slideContent:function(obj) not working
<p>I have used <a href="http://www.gayadesign.com/diy/animated-tabbed-content-with-jquery/" rel="nofollow">http://www.gayadesign.com/diy/animated-tabbed-content-with-jquery/</a></p> <p>tab control, </p> <pre><code>var TabbedContent = { init: function () { $(".tab_item").mouseover(function () { var background = $(this).parent().find(".moving_bg"); $(background).stop().animate({ left: $(this).position()['left'] }, { duration: 300 }); TabbedContent.slideContent($(this)); }); }, slideContent: function (obj) { var margin = $(obj).parent().parent().find(".slide_content").width(); margin = margin * ($(obj).prevAll().size() - 1); margin = margin * -1; $(obj).parent().parent().find(".tabslider").stop().animate({ marginLeft: margin + "px" }, { duration: 300 }); } } $(document).ready(function () { TabbedContent.init(); }); </code></pre> <p><br /></p> <pre><code>slideContent: function (obj) </code></pre> <p>doesnt work, while mouseover works fine,</p> <p>can you please help me out </p>
jquery
[5]
5,960,328
5,960,329
Redirect to specific page when a gridview buttonfield is clicked
<p>I have two fields in my gridview. One is a field with a date range and one of them is a buttonfield. I want to make it so that when a button is clicked, it will redirect them to a specific page with a formatted string similar to how it's done when a hyperlinkfield is clicked as such:</p> <p><code>DataNavigateUrlFormatString="ProductInfo.aspx?ProductID={0}"</code></p> <p>However, I don't want to use the other field's value(the date range). I want to use the primary key of the record which is "SundayOfWeek". The user wants a button rather than a hyperlink. Is there a way I can do the same thing with a button?</p>
asp.net
[9]
3,281,613
3,281,614
cannot map from one entity to another automapper exception throwing?
<p>I have tried to get from resources from database and tried to map to another model class but was unable to do .and it is showing an automapper exception.</p> <blockquote> <p>Trying to map RM.Easicreate.Data.Entities.Resource to RM.Easicreate.Core.DataContracts.ResourceDataContract. Exception of type 'AutoMapper.AutoMapperMappingException' was thrown.</p> </blockquote> <p>My code looks like this.</p> <pre><code>Resource res= resources.FirstOrDefault(); ResourceDataContract r = Mapper.Map&lt;Resource, ResourceDataContract&gt;(res); </code></pre> <p>and i have configured automapper in my bootstaper like this</p> <pre><code> Mapper.CreateMap&lt;Resource, ResourceDataContract&gt;(); Mapper.AssertConfigurationIsValid(); </code></pre> <p>but it seems to be not working? why is that so?</p>
c#
[0]
5,726,004
5,726,005
Javascript Modules
<p>I have the following code. It's a JavaScript module.</p> <pre><code>(function() { // Object var Cahootsy; Cahootsy = { hello: function () { alert('test'); }, }; (Cahootsy.scope = (function() { return this; })()).Cahootsy = Cahootsy; return Cahootsy; }).call(this); </code></pre> <p>I don't understand the section: </p> <pre><code> (Cahootsy.scope = (function() { return this; })()).Cahootsy = Cahootsy; </code></pre> <p>I think it is creating an object referencing 'this' module and then assigns the Cahootsy variable to a global Cahootsy variable. What I don't understand is why 'this' needs to be assigned to Cahootsy.scope</p>
javascript
[3]
5,206,910
5,206,911
how to update existing date and insert new date in php MYSQL
<p>hello i have little problem in updating date</p> <p>my first table is</p> <pre><code>DONOR donor-nic----username-----status 111----------ali----------available 222---------usman--------notavailable </code></pre> <p>my second table is</p> <pre><code>DONATION donation_id------donor_nic-----date--- 1----------------111----------2012/03/04 2---------------111-----------2012/06/07 3----------------111---------2012/07/08 4----------------222---------2012/03/03 </code></pre> <p>now i am editing profile like change date: 2012/07/07 change status: available/not available</p> <p>i want to do that.. if donor that is editing profile/status.. select the date that already exists in donation table with his donor_nic then it will update his date.. if donor select new date that does not exist in donation table then it will insert this date..</p> <p>anyone plz help me.. i dunt knw how to select all the dates of donor (111) and then match this date from the new date.. plzz helpp mee</p>
php
[2]
5,173,154
5,173,155
defaults of method python
<p>Is there a cleaner way to get the defaults of a method than using the <code>inspect</code> module? I'd like to do this:</p> <pre><code>class C(object): def __init__(self,Type='generic',X=5,Y=500): defaults=getDefaults() #not sure about this line typeDefaults_X={'short':'1','long':'10'} typeDefaults_Y={'large':2000,'small':100} if X == defaults['X']: X = typeDefaults_X.get(Type, defaults['X']) if Y == defaults['Y']: Y = typeDefaults_Y.get(Type, defaults['Y']) </code></pre> <p>I know that I could do this by: </p> <pre><code>defaults=dict(zip(inspect.getargspec(C.__init__).args[1:],inspect.getargspec(C.__init__).defaults)) </code></pre> <p>but it seems so terribly un-pythonic.</p>
python
[7]
2,727,685
2,727,686
How is this algorithm working?! Can someone explain it to me please..have an interview tomorrow
<pre><code>def sum_in(numbers, sum_): """whether any two numbers from `numbers` form `sum_`.""" return any((sum_-n) in numbers for n in numbers) </code></pre> <p>It basically takes a list, and checks if any two numbers from it form a sum equalling sum_. I can't seem to get how that sum_-n verifies that TWO numbers equal the sum. Wouldn't it just be checking with one n each loop?!</p>
python
[7]
1,985,738
1,985,739
Does UILabel have a horizontal padding?
<p>Does UILabel have a horizontal padding?</p>
iphone
[8]
1,219,908
1,219,909
how change int to binary. on python 2.5
<pre><code>print 077777#how can i get binary </code></pre> <p>thanks</p> <p>i use python2.5</p>
python
[7]
1,701,907
1,701,908
PHP: declare variable with global scope from inside a function
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5355644/declaring-a-global-variable-inside-a-function">Declaring a global variable inside a function</a> </p> </blockquote> <p>Is it possible to declare variable with global scope from inside a function?</p> <p><strong>NOTE: I don't want to receive the value of a previously declared variable outside the function. But to have the values of the variables declared inside the function working outside the function scope.</strong></p> <p>I a way that if I have these variables declared inside a function:</p> <pre><code>function variables($n){ $a=1+$n; $b="This is number +$n"; } </code></pre> <p>I could echo them outside the function:</p> <pre><code>variables(1); echo $a; echo '\n'; echo $b; 2 This is number 1 </code></pre> <p>I know I could achieve it returning an array from the function but... I'd like to be sure I could otherwise.</p> <p>I saw nothing here: <a href="http://php.net/manual/en/language.variables.scope.php" rel="nofollow">http://php.net/manual/en/language.variables.scope.php</a></p> <p>Thanks.</p>
php
[2]
1,810,462
1,810,463
Is it always safe to cast Context to Activity within View
<p>May I know, is it safe for me to always cast <code>Context</code> to <code>Activity</code> within a <code>View</code>?</p> <pre><code>View { Activity activity = (Activity)this.getContext(); } </code></pre> <p>So far, it works fine all the moment. I was wondering, is there any edge cases that the above code will fail?</p>
android
[4]
5,414,777
5,414,778
How to increment the folder number if folder already exist in a directory
<p>Ex. If I created a folder with a folder name of IMG10001 but it was already exist in the target directory. The code below will make the folder name to IMG10001-1 but what I like to accomplish is to increment the folder name to IMG10002 if IMG10001 already exist in the target directory. </p> <pre><code>string destinDir = dirPath + "\\" + this.Batch.BatchName; int x = 0; if (Directory.Exists(destinDir)) { do { x++; destinDir = dirPath + "\\" + this.Batch.BatchName + "-" + x.ToString(); } while (Directory.Exists(destinDir)); } System.IO.Directory.Move(root,destinDir); </code></pre>
c#
[0]
1,478,832
1,478,833
how can i insert a break line after a ul element - using Jquery
<p>I would like to insert a br after the first UL element I have used both after and insertAfter but it inserts it multiple times. thanks in advance</p> <pre><code> &lt;div id="usual1"&gt; &lt;ul class="tabs1"&gt; &lt;li&gt;&lt;a href="#Home" class="selected"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#NewPages" class=""&gt;NewPages&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div id="NewPages" style="display: none;"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
jquery
[5]
1,054,063
1,054,064
distance between paragraphs in TextView
<p>I use TextView to display text, which consists of several paragraphs. Something like this:</p> <pre><code>&lt;TextView android:text="@string/foo" /&gt; &lt;resources&gt; &lt;string name="foo"&gt;Great Gauss! - cried Klapaucius - And where are the gruncheons? Where my dear, favorite pritons? Where now the gentle zits?!\nThey no longer are, nor ever will exist again - the machine said calmly - I executed, or rather only began to execute, your order...&lt;/string&gt; &lt;resources&gt; </code></pre> <p>How can I change the distance between paragraphs without affecting interline (distance between many lines of one paragraph)?</p> <p><strong>Edit:</strong> Maybe I was not precise enough. Yes, I know that since I made linebreak with "\n" I could - by analogy - make two linebreaks with "\n\n". Or do these two linebreaks using HTML. But I am looking for a way to decide, for instance, that space between paragraphs shold be exactly 17 dip. Like I can (as example) do in CSS:</p> <pre><code>p { margin-bottom: 21px; } </code></pre>
android
[4]
286,383
286,384
jQuizMe - Multilist answers arrange
<p>I am using jQuizMe to prepare a questionnaire, one problem I have is that listing the answers for Multilist questions if the correct answer is all of the above.<br> Here is my script:</p> <pre><code>multiList: [ { ques: "The answer is:", ans: "All of the above", ansSel: [Answer 1","Answer 2","Answer 3","Answer 4" ] } </code></pre> <p>The answers are displayed as:</p> <pre><code>Answer 1 Answer 2 All of the above Answer 3 Answer 4 </code></pre> <p>I would like to display it as:</p> <pre><code>Answer 1 Answer 2 Answer 3 Answer 4 All of the above </code></pre> <p>I would appreciate your suggestions.</p>
jquery
[5]
1,576,613
1,576,614
Modify `input` value
<p>HTML:</p> <pre><code>&lt;div class="mydiv"&gt; My Div &lt;ul&gt; &lt;li&gt;&lt;input type="submit" value="first"/&gt;&lt;/li&gt; &lt;li&gt;&lt;input type="submit" value="second (blah blah)"/&gt;&lt;/li&gt; &lt;li&gt;&lt;input type="submit" value="third . blah blah"/&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>How can I retrieve the value of the <code>input</code> and replace any '(' or '.' with a '\n'? The result would appear like:</p> <pre><code>second (blah blah) </code></pre>
jquery
[5]
5,790,401
5,790,402
Learning Python Exercise
<p>I have taken it upon myself to learn python. As it is my second language is has not been that hard to get the hang of. I am looking for some simple python projects to undertake so I can better learn the syntax of the language in general. I would specifically like to learn the syntax of arrays, lists, and dictionaries.</p> <hr> <p>Edit: I cant say that one of your answers are right or wrong but between all of you i have alot of material! Thanks everyone :D</p> <p>ps I particularly liked <a href="http://code.google.com/edu/languages/google-python-class/">Google's Python Class</a></p>
python
[7]
3,225,497
3,225,498
List Files of Remote Directory
<p>I have to dynamically select a file from a remote location based on the regular expression. </p> <p>I used</p> <pre><code>FileUtils.listFiles(fileDirectory ,new RegexFileFilter("(" A.*")"),DirectoryFileFilter.DIRECTORY) </code></pre> <p>to list the files , this fails as it says that the parameter directory is not a directory. </p> <p>I understand that the it is looking on the local system for the directory , Can anybody tell me as to how can I connect to the remote machine and list the files at that location</p> <p>If it is a complex task , can anybody please suggest a simple way to search for a file present on the remote location using regex. </p> <p>Thanks Vivek</p>
java
[1]
2,889,721
2,889,722
Java using overriden methods
<p>I am a noob and I need some help.</p> <p>So I have this abstract class with a private variable. I also have a method named getThing() to return that.</p> <p>I have a class that extends that abstract class, and it too has a private variable and a method that overrides the original to get the value from the abstract class.</p> <p>Well the only way to be able to access both values is by creating a second method in the subclass called getSuperThing, and using the super in that. Well I was just wondering out of curiosity if there was some easier way to do that and be able to access the abstract classes method by doing something like objectNae.super.getThing().</p> <p>Thanks ;)</p>
java
[1]
3,050,030
3,050,031
black header when transition an activity
<p>I have the following slide affect from bottom to top:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/decelerate_interpolator"&gt; &lt;translate android:fromYDelta="100%p" android:toYDelta="0%p" android:duration="300" /&gt; </code></pre> <p></p> <p>I'm calling "overridePendingTransition" to activate this transition when starting the new activity.</p> <p>The problem is that I see a small black header on top of the new activity (it's black, not red): <a href="http://imageshack.us/photo/my-images/171/devices.png/" rel="nofollow">Screenshot</a></p> <p>Any idea why?</p>
android
[4]
3,070,880
3,070,881
Parse error in code: expected ' ; ' before ' { ' token -- what is causing this?
<p>The error I'm getting is <code>error: expected ' ; ' before ' { ' token</code></p> <p>I tried fixing the code by adding <code>;</code> after <code>if (thisisanumber==5)</code> as well as after <code>else (thisisanumber!=5)</code>. While this solves the first error it creates another error that says <code>error: ' else ' without a previous ' if '</code>. I'd really love to know what error I've made in writing the code, thanks.</p> <p>Here is my code:</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main() { int thisisanumber; cout&lt;&lt;"Whats the Password?: "; cin&gt;&gt; thisisanumber; cin.ignore(); if (thisisanumber==5) { cout&lt;&lt;"You've discovered the password! Wow, you're a genious you should be proud./n"; } else (thisisanumber!=5) { cout&lt;&lt;"You've failed in knowing the password and therefore cannot enter, leave and do not come back. Goodbye!/n"; } cin.get(); } </code></pre>
c++
[6]
2,771,024
2,771,025
Is it possible to make file name with .html extension where php codes are included in the file?
<p>I want to that if it is necessary to make files with <code>.php</code> extension or it is possible to add php codes into a file wiht <code>.html</code> extension.</p>
php
[2]
2,744,086
2,744,087
Dictionaries and For Loops
<p>say that the following is our code:</p> <pre><code>d = {"Happy":"Clam", "Sad":"Panda"} for i in d: print(i) </code></pre> <p>now <code>print(i</code>) will print out just the keys, but how could I change it so that it printed the values? </p>
python
[7]
4,768,740
4,768,741
Clean allocation and construction of one object with the standard C++98/03
<p>In my code I need to allocate and construct an object dynamically and push the pointer to it into a vector. Is there a cleaner way to this than the code below without using all those ugly try-catch blocks? I cannot use non-standard libraries. There is no C++11. I only have the standard C++98/03. </p> <pre><code>void insert() { //...do something... MyType* obj = 0; try { obj = alloc.allocate(1); // yes, even the allocation must be inside one try-catch in my case, since I need to undo something alloc.construct(obj, default_obj); try { v.push_back(obj); } catch (...) { alloc.destroy(obj); throw; } } catch (...) { //..undo something.. if (obj) alloc.deallocate(obj, 1); throw; } } </code></pre> <p>EDIT: alloc is an allocator passed as argument somewhere to avoid raw new/delete. v is a vector.</p>
c++
[6]
3,561,819
3,561,820
Get rid of a AlertView that pops up when a webpage is loaded.
<p>When I load a URL in UIWebView, an Alert pops up that prompts the user to download their app from the app store(presumably, the creators of the website were able to instantiate a UIAlertView using javascript or HTML5. I have no idea how though). I don't want the alerts to show up. Anyone know how to disable such a feature in the UIWebView? </p>
iphone
[8]
2,162,286
2,162,287
jQuery: I cannot modify an element's CSS color after using append()
<p>I have used jQuery's append() command to create a set of DIVs from an array.</p> <p>After doing a simple JSON request, I would now like to change the color of the text within the DIV using the css() command. However, I cannot seem to get it to work.</p> <p>Here is a cross-section of the code I have written:</p> <pre><code>function createList(myArray){ $.each(myArray,function(index,item){ $("#results_panel").append('&lt;div id="result_'+item+'"&gt;'+item+'&lt;/div&gt;'); doSomeStuff(item); }); } function doSomeStuff(item){ var urlJSON="file_upload.php?ip_address="+item; $.getJSON(urlJSON,function(json){ if (json.result == "true") { $("#result_"+item).css("color","#00FF00"); } else { $("#result_"+item).css("color","#FF0000"); } }); } </code></pre> <p>If I use document.getElementByID.("result_"+item).style.color this will work, however.</p> <p>Can anyone tell me what I am doing wrong here? I'm fairly new to jQuery, so apologies if this is a really obvious question.</p>
jquery
[5]
1,610,495
1,610,496
Application priority
<p>An application that is running for a long time in foreground will acquire more priority in time? I explain my problem. I ported a software for communication with a fixed infrastructure in Android. I'm making some tests. Each test makes 5 experiments (the mobile node sends some queries to the infrastructure and evalutes the number of query successful and the mean time) and the result of the test is the mean of the results of these experiments. During the test the application is always in foreground. In the experiments the result improve e. g. (10% 15% 30% 40% 55% of query ok). I implemented the system as activity and not yet as service. For the test the app aquire the locks SCREEN_DIM_WAKE_LOCK and WIFI_MODE_FULL. Thanks</p>
android
[4]
4,989,034
4,989,035
How do i use a searchbar to obtain data from database instead of nsdictionary.?
<p>as above.. for your info, i'm using the sqlite</p> <p>any kind soul?</p>
iphone
[8]
2,549,544
2,549,545
Validate multiple inputs on Submit
<p>Can anyone help I'm trying to validate multiple inputs to ensure that they aren't empty at the point I submit. And then add some text into #error.</p> <p>My form looks like this :</p> <pre><code>&lt;div class="span12"&gt; &lt;form method="post" name="bdayInputFormMain" action="/bdayremind_maininput/" class="form-inline"&gt; {% csrf_token %} &lt;input name="name" type="text" class="input-medium" placeholder="Name"&gt; &lt;input name="dob" type="text" class="input-small datepicker" placeholder="Date of Birth"&gt; &lt;input name="addr" type="text" class="input-xlarge" placeholder="Address"&gt; &lt;button type="submit" class="btn"&gt;Update&lt;/button&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>Thanks,</p>
jquery
[5]
5,273,633
5,273,634
How to get session value into an ASP Parameter tag?
<p>I have following code</p> <pre><code>&lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" UpdateCommand="UPDATE [gMeter] SET ... [userId] = @userId ... </code></pre> <p>I need to parametr @userId assign session variable <code>Session["userId"]</code>, any ideas? I tried </p> <pre><code>[userId] = &lt;%= Session["userId"]%&gt; </code></pre> <p>But it does not works.</p>
asp.net
[9]
5,475,472
5,475,473
Any shortcut to initialize all array elements to zero?
<p>In <code>C/C++</code> I used to do </p> <pre><code>int arr[10] = {0}; </code></pre> <p>to initialize all my array elements to 0.<br>Is there a similar shortcut in Java? <br>I want to avoid using the loop, is it possible?</p> <pre><code>int arr[] = new int[10]; for(int i=0;i&lt;arr.length;i++) arr[i] = 0; </code></pre>
java
[1]
1,517,386
1,517,387
Override vs Overwrite
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4738315/c-overriding-overwriting">C++ Overriding&hellip; overwriting?</a> </p> </blockquote> <p>What's the difference between <code>override</code> and <code>overwrite</code>? I've heard them used interchangeably but I suspect that's incorrect.</p>
c++
[6]
4,462,503
4,462,504
calling method with two object and store in array of objects
<p>I want to call a method where two parametres are objects (one retrieve Person, one added Person). Then store in array of Person objects and then I can work with both object separatelly.</p> <p>In method:<br> I do create object Person and store data in it from retrieve data from database where firstName is "Mediterranean".<br> And add other row(Person features) and do want to pass it back as well. But doesn't return objects and straight fail.</p> <p>Can somebody help me please?</p> <p>I have something like this:</p> <pre><code>public Person [] retrievePerson(Person somePerson, Person addRowPerson) { ....... findedPerson = new Person(title, firstName, secondName, city, nationality, letter); myTableCreatedPerson = new Person(title, firstName, secondName, city, nationality, letter); return retrievePerson(findedPerson, myTableCreatedPerson); } //and calling function in different class like that public void retrievePersonTest() //Create Person in DB directly then Retrieve Person and compare retrieve features with create features then directly delete him from DB { Person expected = null; Person actual = null; Person addRowPerson = null; Person [] twoPersonArray; DBConnect target = new DBConnect(); try //retrieve Person { twoPersonArray = target.retrievePerson(expected, addRowPerson); //do not return twoPersonArray = (Func&lt;Person, Person&gt;)target.retrievePerson(expected, addRowPerson).CreateDelegate(typeof(Func&lt;Person, Person&gt;)); //do not return either } } </code></pre>
c#
[0]
5,965,562
5,965,563
Javascript Simple Calculation giving NAN or 0
<p>Can anyone work out why this does not work. Produces NAN and if reset for a Number(document on var inputs produces 0. The script is supposed to add up an indefinite number of fields starting with an ID of product_total_price_PRI_ ... .</p> <p>Obviously I've missed something and have got a headache from trying to see it. </p> <pre><code>function getFields() { var inputs = document.getElementsByTagName('input'); var result = 0; for( var i = 0; i &lt; inputs.length; i++ ) { if( inputs[i].id.indexOf('product_total_price_PRI_') == 0 ); result += parseFloat(inputs[i].value); } alert(result); } </code></pre>
javascript
[3]
5,945,187
5,945,188
Unresolved external symbol referenced in function
<p>I realise this is a hard one to answer without providing you with huge amounts of code (which I'll try to spare you).</p> <p>Essentially i'm getting this error in class X, which #includes the class Y header. The class Y header has three definitions for getters</p> <pre><code>// Getters static ID3D10Device* PDevice(); static ID3D10Buffer* PBuffer(); static ID3D10Buffer* IBuffer(); </code></pre> <p>I get three identical errors, all occur in class X. so essentially the error is: Unresolved external symbol ID3D10Device* PDevice() referenced in function (constructor of class X)</p> <p>sorry if that's a bit vague. Any idea why this might be happening? I've googled it but I can only really make an educated guess as to what this error is. </p>
c++
[6]
5,318,469
5,318,470
How to read predefined (#define) across projects?
<p>I have 2 projects in the same solution: A is static library and B is exe. B depends on A</p> <p>In B I do a declaration for a DEBUG mode. Something like <code>#define DEBUG</code></p> <p>Then I went to check if DEBUG is defined in A, if it does then do some debug printing:</p> <pre><code>// Code in A #ifdef DEBUG cout&lt;&lt;"debug message"; #endif </code></pre> <p>But this doesn't seem to work. I guess when A is built it doesn't have knowledge about B. How do we go about doing this? Basically because I have different executable project relying on A, and some of them need to print debug messages, and some don't. And yet I don't want to rebuilt A everytime I switch from B to another executable project.</p>
c++
[6]
5,328,510
5,328,511
Spaces, line breaks, tabs ; are they affect server performance?
<p>Spaces, line breaks, tabs ; are they affect server performance ?</p> <p>I'm in the road of learning PHP and before I go further with my current coding style, i want to make sure : Are line breaks and spaces affect the performance of the server ? Usually, I always add them for readibility. for example in the following code :</p> <pre><code>import('something') ; $var = 'A' ; $varb = 'B' ; switch($var) { case 'A' : doSomething() ; doAnotherThing() ; break ; } if ($var == $varb) { header('Location: somewhere.php') ; } </code></pre> <p>Summary, </p> <ol> <li>I add space before a semicolon</li> <li>I add space after and before variable value assignment and comparison</li> <li>I add space between ) and {</li> <li>Usually I add a line break after { if the code following it consist of multiple statements.</li> <li>Inside the curly bracket, I always start with a space before the first statement and ended it with another space after the last statement's semicolon</li> <li>I always give a 2-space-width tab for every child elements</li> <li>I always add a space after 'Location:' inside header function.</li> <li>I always add space before semicolon for each case condition</li> </ol> <p>This style is cool for me, I like it, its tidy and it makes me easier to debug, what i wonder is, will this kind of coding style hurt/burden the system ? Will it makes server slower by re-formatting my codes ? So far i got no formatting error.</p> <p>Thank you for your kind answers</p>
php
[2]
39,794
39,795
Horizontal slideshow like Firefox 4's tech demo
<p>I want to create a content slider that works similarly to Firefox 4's showcase site: <a href="http://demos.mozilla.org/" rel="nofollow">http://demos.mozilla.org/</a></p> <p>I'd like the inactive slider-items to actually be outside the browser, and to slide across to the centre when called. If I call an item that is 2 items back, I'd like to show the item in between scroll across and then off the screen, to reinforce the idea that they really are in a specific order.</p> <p>Would anyone be willing to help me on my way with this? Any help would be <em>greatly</em> appreciated!</p>
jquery
[5]
5,726,458
5,726,459
draw a trail of a ball which i move on ontouch in android
<p>i am new to android and trying to build a maze game. i am able to draw the ball and maze but i also want a trail of ball to be draw as the player moves the ball...</p> <p>i am getting touch coordinates by event.getx() and event.gety() till now i am storing startX,startY and current ball coordinates in an array for drawLines method but it is not working......</p> <p>plz help....what to do </p> <pre><code>protected void onDraw(Canvas canvas) { //maze generator code //draw ball code int sx= maze.getTouchXcoordinate(); int sy=maze.getTouchYcoordiante(); pts.add((float)sx); pts.add((float)sy); pts.add((float)nowX); pts.add((float)(now); float[]cords=new float[pts.size()]; for(int i=0;i&lt;pts.size();i++) { float f= pts.get(i); cords[i]=f; } canvas.drawLines(cords, line); } </code></pre> <p>and my touchlistner</p> <pre><code>public boolean onTouchEvent(MotionEvent event) { float x= event.getX(); float y= event.getY(); int nowX= maze.getnowX(); int nowY= maze.getnowY(); switch (event.getAction() &amp; MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: //check if ball is touched if(x == currentX &amp;&amp; y == currentY) { maze.setTouchCordinates(x,y); touched =true; } case MotionEvent.ACTION_UP: touched= false; return true; case MotionEvent.ACTION_MOVE: if(touched) { invalidate(); } </code></pre>
android
[4]
2,591,224
2,591,225
Why was the array type of formal parameter of a function converted to pointer?
<p>The output of the following function is "int *", which means the formal parameter is converted to a integer pointer. Is there any necessary reason for this design? Why can't we reserve the array type?</p> <pre><code>// the output is "int *" #include&lt;typeinfo&gt; void Func(int ar[5]) { printf("%s\n", typeid(ar).name(); } int main() { int ar[5]; Func(ar); return 0; } </code></pre>
c++
[6]
1,876,737
1,876,738
sharing variable between two aspx c sharp files
<p>in my website I have two files home.aspx and tab.aspx with code behind files home.aspx.cs and tab.aspx.cs</p> <p>I have a table variable in tab.aspx.cs which needs to be sent to home.aspx.cs when I click a button on home.aspx</p> <p>how can this be done?</p>
asp.net
[9]
5,390,193
5,390,194
how to get the number in a python string
<p>this is my code :</p> <pre><code>print int('adw第五代222') </code></pre> <p>it show error :</p> <pre><code>Traceback (most recent call last): File "a.py", line 5, in &lt;module&gt; print int('adw第五代222') ValueError: invalid literal for int() with base 10: 'adw\xe7\xac\xac\xe4\xba\x94\xe4\xbb\xa3222' </code></pre> <p>what can i do ,</p> <p>thanks</p>
python
[7]
2,844,606
2,844,607
{ } mark in echo "{$e->getMessage()}"
<p>I read about this <a href="http://net.tutsplus.com/tutorials/php/the-ins-and-outs-of-php-exceptions/comment-page-1/" rel="nofollow">Article</a> I wondering about this part: </p> <pre><code>try { //First try getting our user numero uno $user = new User(1); //Then, let's try to get the exception $user2 = new User('not numeric'); } catch( Exception $e ) { echo "Donkey Kong has caught an exception: {$e-&gt;getMessage()}"; } </code></pre> <p>why <code>{$e-&gt;getMessage()}</code> must be covered in bracket?<br> Is there any link explanation on php manual about this?</p> <p>i know if we don't put bracket it will show error, but want i want is to get the explanation why bracket is needed.</p> <blockquote> <p>Notice: Undefined property: Exception::$getMessage</p> </blockquote>
php
[2]
3,102,871
3,102,872
beginner question about php. how to get back multiple values after submitting form
<p>I am new to php. </p> <p>I want to have a form such as this:</p> <pre><code> Name &lt;TextField&gt; Corresponding pic: &lt;dropdown&gt; hiddenID (not shown to user) Name &lt;TextField&gt; Corresponding pic: &lt;dropdown&gt; hiddenID (not shown to user) Name &lt;TextField&gt; Corresponding pic: &lt;dropdown&gt; hiddenID (not shown to user) Name &lt;TextField&gt; Corresponding pic: &lt;dropdown&gt; hiddenID (not shown to user) Name &lt;TextField&gt; Corresponding pic: &lt;dropdown&gt; hiddenID (not shown to user) Update Values (button) </code></pre> <p>After the button is clicked (form submitted) how will I get all those values. I want to update a database table for each of those values. query would be like</p> <pre><code>update user_tables name=&lt;newnameSubmitted&gt;, pic=&lt;valueFromDropDown&gt; where id=&lt;hiddenIdGottenBack&gt; </code></pre> <p>In this example I have 5 values...how will I be able to run the above update statement 5 times with corresponding values. </p> <p>Please clear my confusion or guide me to a tutorial that will help me out a little. </p>
php
[2]
55,020
55,021
Javascript Arrays - removing array Elements
<p>I have the following array setup, i,e:</p> <pre><code>var myArray = new Array(); </code></pre> <p>Using this array, I am creating a breadcrumb menu dynamically as the user adds more menu items. I am also allowing them to removing specific breadcrumb menu items by clicking on the cross alongside eatch breadcrumb menu item.</p> <p>Array may hold the following data:</p> <pre><code>myArray[0] = 'MenuA'; myArray[1] = 'MenuB'; myArray[2] = 'MenuC'; myArray[3] = 'MenuD'; myArray[4] = 'MenuE'; </code></pre> <p>My questions are:</p> <p>a) In javascript, how can I remove element [1] from myArray and then recalculate indexes or is this not possible?</p> <p>b) If I don't want menu option MenuB, do I need to splice it to remove it?</p> <p>My problem is, if the user removes menu items as well as create news one at the end, how will the indexes to these elements be spreadout?</p> <p>I just want to be able to remove items but don't know how the array indexes are handled.</p> <p>Thanks. Tony.</p>
javascript
[3]
593,696
593,697
Algorithm to generate all letter combinations using recursion
<p>I remember this having a specific name, and there were example codes on various websites - but I can't remember what it was actually called so can't find anything...</p> <p>Basically, I want to generate all the possible letter combinations in a loop. The output would be something like this:</p> <pre><code>A B C ... Z AA AB AC --- AZ BA BB BC </code></pre> <p>etc...</p>
java
[1]
5,325,479
5,325,480
Getting particular contents from an array using PHP?
<p>This is from drupal 7 settings.php file.</p> <pre><code>$databases = array ( 'default' =&gt; array ( 'default' =&gt; array ( 'database' =&gt; 'drupal', 'username' =&gt; 'user name will be saved here', 'password' =&gt; 'password will be saved here', 'host' =&gt; 'host name will be saved here', 'port' =&gt; '', 'driver' =&gt; 'mysql', 'prefix' =&gt; '', ), ), ); </code></pre> <p>How can I get saved user name,password and host name from this array using PHP ?</p>
php
[2]
5,568,360
5,568,361
Is it safe to to use template for primitive / class and pointer to primitive / class?
<pre><code>template&lt;class T&gt; class stack { T arr[5]; }; class item{}; stack &lt;int&gt; obj1; stack &lt;int *&gt; obj2; stack &lt;item&gt; obj3; stack &lt;item *&gt; obj4; </code></pre> <p>Is it a correct template implementation?</p>
c++
[6]
4,323,238
4,323,239
calling view methods from a view controller
<p>This is a simple question, and I'm sure I got it work in the past. I'm trying to call a method in a view </p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface View : UIView { } -(void)spinAction; @end </code></pre> <p>from a view controller</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import "View.h" @interface layers3ViewController : UIViewController { IBOutlet View *view; } -(IBAction)spinButton:(id)sender; @end </code></pre> <p>via the method</p> <pre><code>-(IBAction)spinButton:(id)sender{ [view spinAction]; } </code></pre> <p>but cannot get to it work. Everything is put together using the Interface Builder. Am I doing something fundamentally wrong here? A previous code worked by putting</p> <pre><code>[self.view spinAction] </code></pre> <p>albeit with error messages but not even that works here. Any hints / suggestions more than welcome.</p>
iphone
[8]
3,182,638
3,182,639
how can we unzip a file in objective c?
<p>i have a zip file in my document directory and i want to unzip that file using objective c code in xcode how can we do that ? is that possible to do that</p> <p>thanks balraj </p>
iphone
[8]
5,950,123
5,950,124
how to activate my iphone device when itunes connect is mot suitable for SIM card
<p>I have restored my iphone device,now its showing that the sim card you have inserted is not supported to your iphone device.Please insert the sim card that came with your device or visit a supported carrier's store to receive a replacement sim id.</p> <p>Now what would i do to activate my iPhone device?</p> <p>Thank You.</p>
iphone
[8]
3,571,747
3,571,748
Add precision by one to the BigDecimal number?
<p>I have a requirement as below.</p> <p>I have a number of BigDecimal type : 100</p> <pre><code>i need a method which will take input(100 here) and gives output as 100.1 if 100.1 is passed it should return 100.2 if 100.2 is passed it should return 100.3....etc </code></pre> <p>Is there any simplest solution?</p> <p>Thanks!</p>
java
[1]
606,011
606,012
Quotient of two table cells
<p>I have a short question that you may be able to help me with. I'm relatively new to JQuery, but am fairly familiar with HTML, for what it's worth.</p> <p>I'm trying to find a way to automatically calculate the quotient of two table cells and then display it in a third table cell, preferably rounded off to the first decimal. So something like this:</p> <pre><code> &lt;table&gt; &lt;tr&gt; &lt;td class='divisor'&gt;2&lt;/td&gt; &lt;td class='dividend'&gt;4&lt;/td&gt; &lt;td class='quotient'&gt;2&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>I don't want this data to be put in by the user, but it would be great if I don't have to do the calculation every time I change the data. Is there an easy way to do this? </p> <p>Thanks in advance! </p>
jquery
[5]
1,314,694
1,314,695
How to get file extension of online file having no extension in url
<p>I wanted to get the file extension of online file but problem is that some files are not having extension in their url. For Example <a href="http://www.example.com/page?=10" rel="nofollow">http://www.example.com/page?=10</a></p>
c#
[0]
1,236,725
1,236,726
Timestamp variation on Android devices
<p>My android application is fetching some json data from my server. The json file contains a timestamp value representing the current date which is calculated as follows in PHP:</p> <pre><code>mktime(0,0,0,date('m'),date('d'),date('Y')) </code></pre> <p>ie, I get the unix timestamp at 00:00 Hrs and use it to represent a particular day.</p> <p>Now, on the android end, the file is parsed and the file timestamp is compared with Java timestamp which is calculated as:</p> <pre><code>GregorianCalendar aDate = new GregorianCalendar(); GregorianCalendar tDate = new GregorianCalendar(aDate.get(Calendar.YEAR),aDate.get(Calendar.MONTH), aDate.get(Calendar.DAY_OF_MONTH)); today = (tDate.getTimeInMillis())/1000; </code></pre> <p>As evident, I am trying to calucate the timestamp in Java the same way as I did in PHP. But, strangely, Java takes into account the current time as well. For example, on the Android emulator, the time zone is different(one hour behind than my local time) and I am getting a value for timestamp which is exaclty 3600 sec different than the one calculated in PHP.When I changed the timezone on Android emulator, I had no problem. Is this a Java bug?</p>
android
[4]
5,685,920
5,685,921
On to Jquery Ajax call , getting the whole HTM content as response
<p>This is my Server side coding on to the JSP </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;% int number = 10; out.println("The Returned response as per the hardcoded values is "+number); %&gt; &lt;/html&gt; </code></pre> <p>As you can see that , i am returrning an number as the response for an AJAX call </p> <p>And on to the Script.js file , i am handling it in this way :</p> <pre><code> $.ajax({ type : "post", url : "calculate.jsp", dataType: "html", success : function(msg) { var pinNumber = msg; alert(pinNumber); } }); </code></pre> <p>As a result of this , i am getting the whole HTMl content as response as shown in the figure <a href="http://tinypic.com/view.php?pic=vy431w&amp;s=5" rel="nofollow">http://tinypic.com/view.php?pic=vy431w&amp;s=5</a></p>
jquery
[5]
2,501,563
2,501,564
regex to replace @[name](type:id) to username
<p>i have this</p> <pre><code>text @[Kenneth Hulthin](contact:9) and more text @[kenneth@auchenberg.dk](contact:7) </code></pre> <p>by php i want to replace using <a href="http://php.net/manual/en/function.preg-replace.php" rel="nofollow">preg_replace</a> from <code>@[name](type:id)</code> to <code>&lt;a href='?type=type&amp;id=id'&gt;name&lt;/a&gt;</code></p>
php
[2]
4,811,722
4,811,723
How to copy a python class?
<p><code>deepcopy</code> from <code>copy</code> not copies class:</p> <pre><code>&gt;&gt;&gt; class A(object): &gt;&gt;&gt; ARG = 1 &gt;&gt;&gt; B = deepcopy(A) &gt;&gt;&gt; A().ARG &gt;&gt;&gt; 1 &gt;&gt;&gt; B().ARG &gt;&gt;&gt; 1 &gt;&gt;&gt; A.ARG = 2 &gt;&gt;&gt; B().ARG &gt;&gt;&gt; 2 </code></pre> <p>Is it only way?</p> <pre><code>B(A): pass </code></pre>
python
[7]
2,333,025
2,333,026
jquery ajax passing information using load
<p>I have an associative array and I'm trying to pass it to the parameters section of the jquery load method. However it is not showing up as a post on the server side. How can I accomplish this? </p> <p>Here is my code:</p> <pre><code>var selectcustomerpopup = null; $(document).ready(function() { // Find customer $('.CustomerSelectBtn').click(function() { var uniqueid = $(this).attr('id'); var customerSelectURL = $('#ajax_customer_select_url').val() + "/" + uniqueid; var custselectdata = new Array(); custselectdata["fname"] = "TestFirst"; custselectdata["lname"] = "TestLast"; if (! ($('#selectCustomerDialog').length)) { $('body').append( $('&lt;div id="selectCustomerDialog" style="display: none;"&gt;&lt;/div&gt;') ); } var $findCustomerDialog = $('#selectCustomerDialog').load (customerSelectURL, custselectdata) .dialog({ autoOpen: false, title: 'Select Customer', width: 630, height: 450, position: 'center', resizeable: true, modal: true, draggable: true, closeOnEscape: true, closeText: 'close' }); $findCustomerDialog.dialog('open'); selectcustomerpopup = $findCustomerDialog; return false; }); } ); </code></pre> <p>Additional Info: I got a good answer, but I did some more research and found a great link explaining associative arrays in javascript very well: <a href="http://blog.xkoder.com/2008/07/10/javascript-associative-arrays-demystified/" rel="nofollow">http://blog.xkoder.com/2008/07/10/javascript-associative-arrays-demystified/</a></p>
jquery
[5]
2,896,990
2,896,991
How to write an image into xls sheet through PHP code?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4040602/insert-image-in-xls-sheet-throgh-php-code">Insert image in xls sheet throgh php code.</a> </p> </blockquote> <p>I have to insert a logo(image) on the row[0],column[0].I am using <strong>"Spreadsheet_Excel_Writer"</strong> for that.i tried its <strong>insertBitmap()</strong> method, program working fine but it doesn't show the bitmap image on xls sheet,instead blank row. </p> <p>What could be reason? Can you please let me know the exact string format for the argument. Is there any other way to insert image on xls sheet using PHP5.</p> <p>I am very new to php ,it will be a great help .I am using 24bit bitmap image.Or is there any way to insert images into excel sheet throught PHP.</p> <p><strong>Cheers !!</strong></p>
php
[2]
841,728
841,729
How to set time duration for an operation in android app?
<p>I am developing flashlight app. I want to set time like 2mins, 3mins and unlimited for the flashlight to be on. How can I do that? First of all I am checking whether flashlight is available or not. If it is, I want to set the brightness to maximum.</p> <p>My code contains the following.</p> <pre><code>if (flashcheck) { camera = Camera.open(); parameters = camera.getParameters(); parameters.setFlashMode(Parameters.FLASH_MODE_TORCH); camera.setParameters(parameters); } else { WindowManager.LayoutParams localLayoutParams = getWindow() .getAttributes(); localLayoutParams.screenBrightness = 1F; getWindow().setAttributes(localLayoutParams); } </code></pre>
android
[4]
2,065,969
2,065,970
jQuery text fade/transition from one text to another?
<p>jQuery can obviously fadeIn/fadeOut text easily. But what if you want to change the text from one thing to another? Can this happen with a transition?</p> <p>Example:</p> <pre><code>&lt;div id='container'&gt;Hello&lt;/div&gt; </code></pre> <p>Can one change the text <em>Hello</em> to <em>World</em> but have it change with a transition (like a fade or some effect) instead of changing instantly?</p>
jquery
[5]
2,546,453
2,546,454
search an item in a array
<p>i have the String str="abc"; and i want to search if there is the letter "b" in it.I convert it to char[] and i create a for loop.this is my code [code] </p> <pre><code> String str="abc"; char c[] = str.toCharArray(); for(int k=1;k&lt;c.length;k++){ if(c[k]=='b') { System.out.println("yes"); } else { System.out.println("no");} } </code></pre> <p>why does it print 'no'??</p>
java
[1]
5,887,652
5,887,653
Am I using the webbrowser.open() wrong, or does it not work as advertised? (Python)
<p>Given this python code:</p> <pre><code>import webbrowser webbrowser.open("http://slashdot.org",new=0) webbrowser.open("http://cnn.com",new=0) </code></pre> <p>I would expect a browser to open up, load the first website, then load the second website <em>in the same window</em>. However, it opens up in a new window (or new tab depending on which browser I'm using).</p> <p>Tried on Mac OSX with Safari, Firefox and Chrome and on Ubuntue with Firefox. I'm inclined to believe that <em>new=0</em> isn't honored. Am I just missing something?</p> <p>tia,</p>
python
[7]
2,816,010
2,816,011
How to use onSaveInstanceState with a lot of data and objects
<p>When my application became sophisticated and main activity started holding in memory a lot of data (loaded and parsed from files in response to user actions) I have (mistakenly) switched from <code>onSaveInstanceState</code> to <code>onRetainNonConfigurationInstance</code> without noticing that <code>onRetainNonConfigurationInstance</code> is not called when application is killed to save device memory. So as now I has to switch back to <code>onSaveInstanceState</code> I want to as what is the proper way to handle a huge amount of data distributed by tens of objects? Do I have to implement serialization for all these objects (<code>Parcelable</code>?) or may be put all the data into <code>Service</code> thread hoping it would not be killed? What is the best practice?</p>
android
[4]
4,273,217
4,273,218
Running a java file using command prompt
<p>How can i run a java file in command prompt. I have already installed a Java development kit and i have my compiler JCreator. But I would like to know on how to open my java file using command prompt.</p>
java
[1]
534,750
534,751
How do I add an OR function to a PHP code?
<p>Firstly, dont laugh, I know it is basic.</p> <p>I have this code: <code>if ($pageid == '9') { echo...</code> and I want to add an OR to it, so I tried: <code>if ($pageid == '9' or '5') { echo...</code> but it didnt work. How do I add an OR function to this?</p>
php
[2]
5,700,742
5,700,743
how to make items load on drop down based on the radio button
<p>i have req in my Application. where i have 3 radio button with option like<br /> option 1 :5, option 2: 10, option 3: 15, by default value option 1 would be selected , </p> <p>if user clicks on option 2 then the items in the dropdown should show 10 values in dropworn, if it has more than 10 items we can give div tag inside it so that all th items ,</p> <p>if user clicks on option 3 then the items in the dropdown should show 15 values in dropworn, if it has more than 15 items .we can plcae th items with div tag</p>
asp.net
[9]
3,084,855
3,084,856
Android WebView
<p>Hi my application using a webview ,when the webpage contain a particular text i want to start a new activity,is it possible?</p>
android
[4]
5,082,240
5,082,241
How to output current user's AD sAMAccountName to a textbox
<p>I'm designing an eform that submits information into a CSV. I need to display the current user's <code>sAMAccountName</code> and the <code>Datetime.Today</code> in two of the text fields.</p> <p>Any idea of how this would be done?</p> <p>I've been trying: c#</p> <pre><code>public string UserName { get { return Session["UserName"]; } } </code></pre> <p>to:</p> <pre><code> &lt;asp:TextBox ID="UserName" runat="server" Width="44px" ReadOnly="true"&gt;&lt;/asp:TextBox&gt; </code></pre>
asp.net
[9]
3,775,534
3,775,535
Java - Custom Linked List Issue
<p>I have created my own custom Linked List (code is below). Now, I can't understand how to create an array of that Linked list like <code>LinkedList[] l = new LinkedList[10]</code>. Can anyone help me.</p> <pre><code>class Node { public int data; public Node pointer; } class LinkedList { Node first; int count = 0; public void addToEnd(int data){ if(first == null){ Node node = new Node(); node.data = data; node.pointer = null; first = node; count = 1; return; } Node next = first; while(next.pointer != null){ next = (Node)next.pointer; } Node newNode = new Node(); newNode.data = data; newNode.pointer = null; next.pointer = newNode; count++; } public Node getFirst(){ return first; } public Node getLast(){ Node next = first; while(next.pointer != null) next = next.pointer; return next; } public int[] get(){ if(count != 0){ int arr[] = new int [count] ; Node next = first; int i = 0; arr[0]= next.data; while(next.pointer != null){ next = next.pointer; i++; arr[i] = next.data; } i++; return arr ; } return null ; } public int count(){ return count; } } </code></pre>
java
[1]
3,663,028
3,663,029
Using live() - benefits - similar to bind()
<p>I have been doing some reading up on jquery live event and am still kind of confused? What is the benefit to using it?</p> <p><a href="http://docs.jquery.com/Events/live" rel="nofollow">http://docs.jquery.com/Events/live</a></p> <p>I know it is similar to bind but both of those events still seem off to me.</p> <p>Just looking for some pointers.</p>
jquery
[5]
3,588,656
3,588,657
Instruct the browser not to wait for more content while processing continues
<p>How do I instruct the browser not to expect any more content to be coming down the line? Kinda like the server saying “I got what I need, you don’t need to wait while I finish the processing of the page”.</p> <p>I have a server-side task, which is initiated when a certain page is hit. The task may be time-consuming, but the rendered HTML will always be the same, i.e. like a “Thank you for starting the task” message.</p> <p>I’m considering starting a new thread to handle the task, but I believe there must be a more elegant solution, where you just send the right headers/instructions to the browser and then continue processing.</p> <p>Any ideas?</p>
asp.net
[9]
2,838,834
2,838,835
jquery Toggling between two interface states
<p>Need your help. I'm trying to create a page that has two UI states. want I want is a function that when called toggles between them?</p> <p>hopefully that's clear enough for some guidance.</p> <p>Thanks</p> <pre><code>function toggleUIChange () { jquery stuff for inital state, { jquery stuff for other state} } </code></pre>
jquery
[5]
4,113,793
4,113,794
Change drawable color programmatically
<p>I'm trying to change the color on a white marker image by code. I have read, that the code below should change the color, but my marker remains white.</p> <pre><code>Drawable.setColorFilter( 0xffff0000, Mode.MULTIPLY ) </code></pre> <p>Did i miss something? Is there any other way to change colors on my drawables located in my res folder? Thanks</p>
android
[4]
5,788,546
5,788,547
String input in program
<p>I can't find the answer in my book and it's an easy one but I'm missing something simple here. </p> <p>I have a program where I ask the user "choose customer or employee C or E" Then after that I need to say if they picked C then do this or if they picked E do that. I'm new and struggling so I know this is probably an easy thing but I'm not getting it.</p> <pre><code> Scanner in = new Scanner(System.in); system.out.println("choose c or e: "); if (in.equalsIgnoreCase("c")) { //do something } if (in.equalsIgnoreCase("e")) { // do something } </code></pre> <p>what am I doing wrong here?</p>
java
[1]
4,651,406
4,651,407
android launch modes
<p>In my android application i am using standard launch mode for all activities.In my application i have a footer bar with home icon to navigate to homescreen from any application activity.the home screen is getting created that many times.If i place the launch mode as single instance the same activity is popped up but even if the data i am expecting is different it is popping up the same data with initial data. </p> <p>Please let me know as how can i get new activity created only if there is change of data. </p> <p>Please forward me your valuable suggestions </p>
android
[4]
1,737,923
1,737,924
Android app works on simulator but gives black screen on device
<p>I just tested my app on a samsung galaxy note but it shows just a black screen. I just copied the apk file from the bin folder of my project on my device.</p> <p>I noticed that the launcher icon is missing on device and that the app takes 48 KB space on device but 148 KB space on simulator. On the simulator the app runs just fine.</p> <p>I retrieved the log from device but it has no significant information. It just says</p> <pre><code>12-26 16:27:36.270 I/ActivityManager( 2774): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.foo.bar/.mdjActivity } from pid 3020 </code></pre> <p>Any ideas whats wrong? How can I fix this?</p>
android
[4]
3,554,479
3,554,480
how to convert seconds in min:sec format
<p>how to convert seconds in Minute:Second format</p>
c#
[0]
1,371,235
1,371,236
Using $this->key with overloaded __get() in PHP
<p>I have a dynamically loading class as a variable within another class. I have implemented it as follows:</p> <pre><code>public function &amp;__get($key) { if (array_key_exists($key, $this-&gt;values) { return $this-&gt;values[$key]; } if ($key == "dr") { if (!$this-&gt;dr) { $this-&gt;dr = new DR(); } return $this-&gt;dr; } } </code></pre> <p>When I utilize this function from outside the class it works as expected:</p> <pre><code>echo $p-&gt;dr-&gt;name; </code></pre> <p>Seamlessly creates DR and returns its name. When I use the same technique from inside the class the <code>__get()</code> function does not get called, and I receive NULL:</p> <pre><code>function drname() { return $this-&gt;dr-&gt;name; } </code></pre> <p>I think I understand why (otherwise PHP would create infinite loop in my first example), but how do I solve this? I figured out a solution using: <code>$this-&gt;__get('dr')-&gt;name</code> but is this really the best/only way? It seems hacky.</p>
php
[2]
5,551,843
5,551,844
Advice for developing an mini project in java
<p>i need create an gui based mini project using java ..can any one suggest some project that should be useful in real time also using java .....</p>
java
[1]
3,089,599
3,089,600
How do I get the web page contents from a WebView?
<p>On Android, I have a <code>WebView</code> that is displaying a page.</p> <p>How do I get the page source without requesting the page again?</p> <p>It seems <code>WebView</code> should have some kind of <code>getPageSource()</code> method that returns a string, but alas it does not.</p> <p>If I enable JavaScript, what is the appropriate JavaScript to put in this call to get the contents?</p> <pre><code>webview.loadUrl("javascript:(function() { " + "document.getElementsByTagName('body')[0].style.color = 'red'; " + "})()"); </code></pre>
android
[4]
4,404,337
4,404,338
Can I make a button appear disabled and still listen for clicks?
<p>I'd like to gray out a button so it appears disabled to the user, but still listen for clicks so that I can display a message to the user that explains why the button isn't applicable.</p> <p>I'd like to ensure that the Android API is the one configuring whatever is the appropriate standard disabled appearance as opposed to manually setting the button color to gray, etc. What's the best way to do this? </p> <p>Related: <a href="http://stackoverflow.com/questions/9016015/android-listen-to-a-disabled-button">Android - Listen to a disabled button</a></p>
android
[4]
1,348,133
1,348,134
unexpected T_REQUIRE_ONCE that should be expected
<pre><code>&lt;?php /* * userprofile.php * bshades.com * Coded by Orgy * rrawbb[at]gmail[dot]com */ require_once("inc/_top.php"); </code></pre> <p>That's my code that's having a problem.</p> <p>Here's the error message: </p> <p><code> Parse error: syntax error, unexpected T_REQUIRE_ONCE in /home/blacksha/public_html/userprofile.php on line 1</code></p> <p>As you can see, the require_once isn't even on line 1, so I have no idea what the problem could be.</p>
php
[2]
1,998,835
1,998,836
Why does incrementing a Java int eventually result in a negative number?
<p>I was trying to check different inputs and creating infinite loops in java and I found that once the <code>int</code> is getting incremented over the maximum limit it turns in to negative <code>-2147482958</code>. I am just increasing the int in infinite loop...</p> <h3>Code:</h3> <pre><code>public static void infiniteLoop(){ for(int i=0;i&gt;-1;i++){ i = i + 1000; System.out.println(i); } } </code></pre> <p>The last to value gets printed out is,</p> <pre><code>2147483337 -2147482958 </code></pre> <p>Now, Why does it goes to negative?</p>
java
[1]
3,655,501
3,655,502
getting an error while uploading the file
<p>I am trying to upload a 305968 kb file, I keep getting an error that file is too big, maximum file size exceeded. I did the below changes in web.config file , but I keep getting an error</p> <pre><code> &lt;httpRuntime requestValidationMode="2.0" executionTimeout="7200" maxRequestLength="102400" minFreeThreads="88" minLocalRequestFreeThreads="76" appRequestQueueLimit="200"/&gt; &lt;compilation debug="true" targetFramework="4.0"&gt; </code></pre> <p>I also made this change in web.config file</p> <pre><code>&lt;security&gt; &lt;requestFiltering&gt; &lt;requestLimits maxQueryString="10000" maxUrl="10000" maxAllowedContentLength="3072000000"&gt;&lt;/requestLimits&gt; &lt;/requestFiltering&gt; &lt;/security&gt; </code></pre>
asp.net
[9]
1,184,196
1,184,197
Someone help me understand the square bracket in the following Python code?
<pre><code>import xlrd book = xlrd.open_workbook("univ_list.xls") sh = book.sheet_by_index(0) for r in range(sh.nrows)[1:]: # line 4 print sh.row(r)[:4] # line 5 </code></pre> <p>What does <code>[1:]</code> mean in line 4? What does <code>[:4]</code> mean in line 5?</p>
python
[7]