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,083,327
2,083,328
Label production using layout manager or null
<p>I have to create a label to be used for deliveries. At the moment because it is being pushed as needing a quick solution i am creating a JFrame putting all the components on then saving the contents as an image and disposing the frame so it flashes up for an instant and then vanishes, ready to print out. If I know the Label will always be X by Y would it be better to set the layout manager as null and place the components in the positions I need them or would it be better to use a layout manager? </p> <p>I am currently using a flow layout manager and had to set the preffered size of the sender panel to be a bit larger so that it moved down to the next section (under the barcode). Is there a particular LayoutManager that would be good for this?</p> <hr> <p><img src="http://i45.tinypic.com/2agvrz6.png" alt="Target Layout"></p> <p><strong>^^^ The above is the target Layout ^^^</strong></p> <hr> <p><strong>vvv Below is what I have currently achieved vvv</strong></p> <p><img src="http://i47.tinypic.com/ak8t1w.png" alt="current Layout"></p> <hr> <p><strong>^^^ Currently achived Layout ^^^</strong></p> <p>Also is there an easy way to draw lines like in the first picture?</p>
java
[1]
613,638
613,639
SoftReference nulls too early
<p>I have a bitmap cache in my Android app where the bitmaps are referenced via SoftReference. However the bitmaps are nulled too early. There can be 20 bitmaps max in the cache, if I load more, GC starts to null the SoftReferences. Without SoftReferences, I can have about 110 bitmaps in cache. Isn't SoftReference supposed to null just before OutOfMemoryError would happen?</p>
android
[4]
324,390
324,391
serialization and Obsolete
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/331013/obsolete-attribute-causes-property-to-be-ignored-by-xmlserialization">Obsolete attribute causes property to be ignored by XmlSerialization</a> </p> </blockquote> <p>Obsolete prevents a property from being serialiazed, why did MS do that? Obsolete doesn't necessarily mean I don't need it anymore. For example, I mark a property as obsolete because I need to tell other programmers to not use it, but still I need it to be serialized.</p> <p>Is there a way out?</p> <p>Regards</p>
c#
[0]
1,559,422
1,559,423
Difference between >>> and >>
<p>I am asking difference between the operators in java.</p>
java
[1]
2,198,093
2,198,094
does long if else if else blocks fall under any design pattern
<p>for example if have a if else like below , i want to know if this falls under any design patern ,in daily life i come across something like this so many times and don't think its good to write so many if else blocks</p> <p>any guidence is really appreciated</p> <p>sample///</p> <pre><code> if(dotcom){ else if (frenc){} else if (german){} else if (brazil){} else if (someothercountry){} // and the else if block goes on else {} } </code></pre>
c#
[0]
1,567,082
1,567,083
How to block child processes in java and restarting them
<p>I have two questions:</p> <p>1-I need to stop child processes through my main process and then start them again after something happened in my main process.have can I do that?</p> <p>2-can I use a registry connection in a contrary way.I mean to run methods of server on client through the same registry connection which the client uses to run?if I can how should I do that? edit:I don't understand what do you mean by editing my question but what I'm asking is if I have a registry can I bind an object on the client side on the same registry that I made it on server side and use it to invoke methods of server on client side.</p> <p>thanks alot.</p>
java
[1]
1,799,632
1,799,633
How to compile the com.android.sdk package?
<p>I am working on windows with JDK, Android SDK and eclipse set successfully. I download the com.android.sdk package from: <a href="http://android.git.kernel.org/?p=platform/packages/apps/Stk.git;a=summary" rel="nofollow">http://android.git.kernel.org/?p=platform/packages/apps/Stk.git;a=summary</a> But when I import the project to the eclipse, errors happen everywhere. Mostly is about the com.android.internal.telephony.gsm.stk.something cannot be imported. I googled to find the reason. It only says because of the these packages is internal package and cannot import with standard SDK. So the question is: How can I compile this project? Should I make a linux environment and get the whole android source code to do this?</p>
android
[4]
2,129,066
2,129,067
Stream Insertion Operator overloading
<p>Im really unsure how to call the function:</p> <pre><code>friend ostream&amp; operator&lt;&lt;(ostream&amp; out, stack::myItem&amp; theItem); </code></pre> <p>that is public to my stack object:</p> <pre><code>class stack { public: stack(int capacity); ~stack(void); void method1(); ... private: struct myItem { int item; }; ... public: friend ostream&amp; operator&lt;&lt;(ostream&amp; out, stack&amp; s); friend ostream&amp; operator&lt;&lt;(ostream&amp; out, stack::myItem&amp; theItem); }; </code></pre>
c++
[6]
5,566,984
5,566,985
Site Map JQuery Style.. using attr. plus page urls
<p>So I have a looping example of site url string and trying to add pages to the links, but I don't want to have to deal with the domain as it's fixed. Right now it doesn't work.. but I'm trying to fix it.</p> <pre><code> &lt;script&gt; $(document).ready(function() { url = $(this).attr('href', $(this).attr('href')); $('#sitemap a').attr('href','http://site.com/?c=123&amp;p='+url); }); &lt;/script&gt; // trying to get output http://site.com/?c=123&amp;p=page1.html &lt;div id="sitemap"&gt; &lt;a href="page1.html"&gt;test&lt;/a&gt; &lt;a href="page2.html"&gt;test&lt;/a&gt; &lt;a href="page3.html"&gt;test&lt;/a&gt; &lt;/div&gt; </code></pre>
jquery
[5]
455,184
455,185
<asp:TemplateField Boxes Disappearing
<p>I've got a text box that just disappeared. When I add another templateField anywhere on the page, this one bizarelly disappears. Anyone know what might be up?</p> <pre><code>&lt;asp:TemplateField HeaderText="Summary" SortExpression="summary"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lblSummary" runat="server" Text='&lt;%# Bind("summary") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;ItemTemplate&gt; &lt;asp:TextBox ID="txtSummary" TextMode="MultiLine" Width="500" Height="100" runat="server" Text='&lt;%# Bind("summary") %&gt;'&gt;&lt;/asp:TextBox&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre>
asp.net
[9]
2,305,748
2,305,749
c# - Index was outside of the bounds of the array
<p>Unhandled Exception: System.IndexOutOfRangeException: Index was outside of the bounds of the array (at the first if statements)</p> <pre><code> static int arrayRows = 20; static int arrayCols = 20; public void printBoard() { int neighbours; for (y = 0; y &lt; arrayCols; y++) for (x = 0; x &lt; arrayRows; x++) { neighbours = 0; // Count number of neighbours surrounding live cell if (parentGen[x-1, y-1] == 1) // top left neighbours++; if (parentGen[x-1, y] == 1) // left neighbours++; if (parentGen[x-1, y+1] == 1) // bottom left neighbours++; if (parentGen[x, y-1] == 1) // middle top neighbours++; if (parentGen[x, y+1] == 1) // middle bottom neighbours++; if (parentGen[x+1, y-1] == 1) // top right neighbours++; if (parentGen[x+1, y] == 1) // right neighbours++; if (parentGen[x+1, y+1] == 1) // bottom right neighbours++; } } </code></pre> <p>The only thing I can think of is that my program is checking coordinates of &lt; 0? How do I go about fixing this?</p>
c#
[0]
1,626,712
1,626,713
Login page from asp.net is not accessible from Android App
<p>I've created a LoginPage to Authenticate Android Users but I keep getting an </p> <p>IIS 7.0 Detailed Error - 401.1 - Unauthorized</p> <p>In the folder of that aspx page I have a web.config set up as such to allow access</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;configuration&gt; &lt;location path="~/MobileApp/LoginMobile.aspx"&gt; &lt;system.web&gt; &lt;authorization&gt; &lt;allow users="*"/&gt; &lt;/authorization&gt; &lt;/system.web&gt; &lt;/location&gt; &lt;/configuration&gt; </code></pre> <p>Any ideas?</p>
asp.net
[9]
281,248
281,249
Best approach for oldschool 2D zelda-like game
<p>For learning purposes, I would like to code a simple 2D game inspired by Zelda series on the nes/gb.</p> <p><a href="http://www.5min.com/Video/The-Legend-of-Zelda-a-Link-to-the-Past---Walkthrough-Part-3-89824010" rel="nofollow">http://www.5min.com/Video/The-Legend-of-Zelda-a-Link-to-the-Past---Walkthrough-Part-3-89824010</a> is a nice example.</p> <p>The player could move on a scrollable view, and when hits defined map limits, like a house door, dungeon, or new zone, load a new specific map.</p> <p>What would be the best and simplest way to achieve this, specifically for Android devices ? Could you point me to some useful resources, snippets, books.</p> <p>I've read some begginers stuff about OpenGL ES, but it sounds way too much for what i am willing to do : 2D ; however, im not sure i can handle anything that is bigger than a phone screen with Canvas..</p> <p>Thanks.</p>
android
[4]
1,818,650
1,818,651
UIAlert View-for yes/no condition
<p>my app needs alert msg and with yes button click another alert msg which decides the final action. I have used <strong>- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex</strong> this method.</p> <p>Please help me.</p>
iphone
[8]
1,666,748
1,666,749
Jquery testimonial rotator. How can I add next and previous buttons
<p>I am using a testimonial rotator plugin, it works well but I would like to add forward and back buttons but I am not sure where to start. Here is all the code i question: <a href="http://jsfiddle.net/ambiguous/j4MbH/10/" rel="nofollow">code on jsfiddle</a></p> <p>Any help appreciated</p> <p>regards Ash</p>
jquery
[5]
4,303,826
4,303,827
Auto fill out this webpage
<p>I am trying to fill out this form but I am having trouble doing it. Here is the webpage</p> <p><a href="https://docs.google.com/spreadsheet/viewform?formkey=dDViZjNzeWdPS25XZGFhNjF6Z0NnbGc6MQ#gid=0" rel="nofollow">Untitled form</a></p> <p>I tried this but it did not work</p> <pre><code>wb.Document.GetElementById("entry_0").InnerText = textBox1.Text; </code></pre> <p>and I am not sure how to click the submit button</p>
c#
[0]
1,617,361
1,617,362
Timer to a given event
<p>I'm trying to make a shutdown timer. Meaning a start a timer of a given time, and set the computer to shutdown after that. I've searched the internet + stackoverflow of cause, and i can't find anything useful to use both to time my own shutdown event and showing it on the screen.</p>
c#
[0]
3,951,138
3,951,139
Changing string text color
<pre><code>&lt;string name="no_city"&gt;&lt;font color='#FF0000'&gt;&lt;b&gt;Please select your location under Preferences in the menu&lt;/b&gt;&lt;/font&gt; &lt;/string&gt; </code></pre> <pre class="lang-java prettyprint-override"><code>@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.contents); this.setContentView(R.layout.contents); ChangeLog cl = new ChangeLog(this); if (cl.firstRun()) cl.getFullLogDialog().show(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); TextView text1 = (TextView)findViewById(R.id.textview1); Resources res = getResources(); String text = String.format(res.getString(R.string.no_city)); CharSequence styledText = Html.fromHtml(text); text1.setText(prefs.getString("listPref",res.getString(R.string.no_city))); </code></pre> <p>I am trying to change the color of the text in the no_city string. I have the way I have the string entered up top and the java underneath. Ihav etried both the hex and the color name, and neither have worked. I have found this information on Google's developer site on how to reference the changes, it compiles fine, but the text is still white. I am using the string with a list preference as what shows as default if nothing is selected from the list. When a user makes a selection, the text needs to be white, so I can not change the entire text view color in the xml or in the java file. I have a felling I am missing something small or I am overlooking something, but I can not track it down. </p>
android
[4]
1,390,904
1,390,905
Problem in String camparisson ...!
<p>here is my code :</p> <pre><code>NSUInteger f; for (f = 0; f &lt; [appDelegate.books count]; f++) { check = [appDelegate.books objectAtIndex:f]; checkthis = check.LotteryNumber; mystring = check.LotteryNumber; NSLog(@"Dynamic Value: %@",mystring); NSLog(@"Static Value: %@",checkthis); if (checkthis == mystring) { found = YES; break; } printf("In LOOP"); } if ( found ) { // do found NSLog(@"Found"); } else { // do not found NSLog(@"not Found"); } //if (checkthis == mystring) { </code></pre> <p>in above line if i place checkthis on both side , its working , but when i am taking a dynamic value its not working.. i also tried like this </p> <pre><code>if(checthis isEqualToString mystring) </code></pre> <p>same problem here ....</p> <p>Thanks in advance</p>
iphone
[8]
598,459
598,460
Android layout design for many menu options
<p>What is the best way to go about designing an Android application that features quite a bit of formulas and conversions? I was thinking that multiple Activities with ListViews sort of like a tree with the leaves being the actual calculations. However, after reading Android design principles it's better to avoid a pure navigational structure and try to reduce the deepness of the app.</p> <p>For example:</p> <pre><code>Main Menu Conversions Weight Distance Distance - Speed - Time Calculate air speed Calculate distance traveled Weather METAR TAF </code></pre> <p>So by the 3rd or 4th screen we've reached the actual individual calculator. Does this make sense? And if it does, is there a better way of designing this (maybe using action bars or tabs)?</p>
android
[4]
1,129,987
1,129,988
IndexOutOfBoundsException...know what the error means but need help debugging?
<p>Creating a program to generate random numbers and put them in either an even or odd array, but get the same error message above? If anyone knows how to format better please help!</p> <pre><code> import static java.lang.Math.*; import java.util.Random; public class Unit8 { public static void main ( String [ ] args ) { int [ ] randomNum = new int [100] ; for ( int x = 0; x &lt;= randomNum.length; x++ ) { randomNum [ x ] = (int) (Math.random ( ) * 25 ); } int sum = 0; int [ ] oddArray = new int [ 100 ] ; for ( int x = 0; x &lt;= randomNum.length; x++ ) { if (randomNum [ x ] % 2 != 0 ) sum += oddArray [ x ]; } int sum2 = 0; int [ ] evenArray = new int [ 100 ] ; for ( int x = 0; x &lt;= randomNum.length; x++ ) { if (randomNum [ x ] % 2 == 0 ) sum2 += evenArray [ x ] ; } display ( oddArray ); display1 ( evenArray ); } public static void display ( int [ ] oddArray) { System.out.println ( oddArray ); } public static void display1 ( int [ ] evenArray ) { System.out.println ( evenArray ); } } </code></pre>
java
[1]
5,918,897
5,918,898
iPhone - Calculating the Day of Week of any date
<p>I have a NSDate variable "aDate" that represents a date, for example, sunday, August 28, 2011. I have this date on a NSDate variable. This can be any date, but the problem appears when the day is a sunday.</p> <p>I want to obtain the three letter string representing the day of week. In this case, SUN.</p> <p>Then I have this code:</p> <pre><code>NSDateFormatter* theDateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [theDateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4]; [theDateFormatter setDateFormat:@"EEE"]; [theDateFormatter setLocale:currentLocale]; // I have tried to comment this out... no change NSString *dayOfWeek = [theDateFormatter stringFromDate:aDate]; </code></pre> <p>the result I have is MON. Monday?</p> <p>The insanity just goes wilder if I add this code:</p> <pre><code>NSCalendar *gregorian = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease]; NSDateComponents *comps = [gregorian components:NSWeekdayCalendarUnit fromDate:myDate]; int weekday = [comps weekday]; </code></pre> <p>then weekday comes as 2 (MONDAY ??????) WTF? Confirming the problem.</p> <p>I am on a locale that in theory monday is the first day of week. So, independently of my timezone any date just have one day of week. If I want to calculate what day of week was January 1, 1978, I shouldn't need to define any timezone.</p> <p>How do I do that on iPhone?</p> <p>thanks.</p>
iphone
[8]
2,047,399
2,047,400
best way to make an array of 2 child classes in java
<p>First off I am new to java and am teaching my self.</p> <p>my file structure is:</p> <ol> <li>ParentClass.java </li> <li>ChildClass1.java</li> <li>ChildClass2.java</li> <li>MyChildClasses.java </li> </ol> <p>both ChildClass1 and 2 extend the ParentClass. and MyChildClasses has a my main method that works with the child classes</p> <p>In MyChildClasses main looks like this</p> <pre><code> ChildClass1[] myClass1 = new ChildClass1[5] ChildClass2[] myClass2 = new ChildClass2[5] for(int i = 0; i &gt; 5; i++) { //Setting the ClassID #'s myClass1[i] = new ChildClass1((100+i)) myClass2[i] = new ChildClass2((100+i), (i+1)) } </code></pre> <p>I am wanting to see if there is a way to make this into 1 array that can have both child classes in it?...</p> <p>making it much easier to print out on screen.</p>
java
[1]
3,472,722
3,472,723
Why does this code call different template function in vs2005?
<p>The code is:</p> <pre><code>#include &lt;iostream&gt; using namespace std; // compares two objects template &lt;typename T&gt; void compare(const T&amp;, const T&amp;){ cout&lt;&lt;"T"&lt;&lt;endl; }; // compares elements in two sequences template &lt;class U, class V&gt; void compare(U, U, V){ cout&lt;&lt;"UV"&lt;&lt;endl; }; // plain functions to handle C-style character strings void compare(const char*, const char*){ cout&lt;&lt;"ordinary"&lt;&lt;endl; }; int main() { cout&lt;&lt;"-------------------------char* --------------------------"&lt;&lt; endl; char* c="a"; char* d="b"; compare(c,d); cout&lt;&lt;"------------------------- char [2]---------------------------"&lt;&lt; endl; char e[]= "a"; char f[]="b"; compare(e,f); system("pause"); } </code></pre> <p>The result is:</p> <blockquote> <p>-------------------------char* --------------------------</p> <p>T</p> <p>------------------------- char [2]-----------------------</p> <p>ordinary</p> </blockquote> <p>And my question is: Why does compare(c,d) call compare(const T&amp;, const T&amp;) and compare(e,f) call the ordinary function even though the arguments of the two functions are char*s?</p>
c++
[6]
5,245,857
5,245,858
Server Application Error
<p>The server has encountered an error while loading an application during the processing of your request. Please refer to the event log for more detail information. Please contact the server administrator for assistance</p>
asp.net
[9]
5,994,823
5,994,824
how to release memory in java
<p>i create Object of class A. at that time java occupy memory for class A. but when i assign null in object of Class A then it can free memory of that object</p> <pre><code>class A{ public long num = 28115733; } </code></pre>
java
[1]
356,367
356,368
iphone programmatically block caller ID?
<p>Since *67 doesn't work when embedding in phone links is there a way to programmically block caller ID from an application? </p>
iphone
[8]
1,937,203
1,937,204
Android 1.5 api giving wrong output
<p>I am working with android 1.5 api, I know it is deprecated, but its client requirement. I am using following code to read Contacts address but every time it give address count zero. I am not able find out what is the problem</p> <pre><code>private void getAddress(String _Id) { Cursor curAddress=null; try { String addrWhere = Contacts.ContactMethods.PERSON_ID + " = ? AND " + Contacts.ContactMethods.KIND + " = ?"; String[] addrWhereParams = new String[]{_Id, Contacts.ContactMethods.CONTENT_POSTAL_ITEM_TYPE}; curAddress = _resolver.query(Contacts.ContactMethods.CONTENT_URI, null, addrWhere, addrWhereParams, null); int i=0; int aCount = curAddress.getCount(); String[] aType = new String[aCount]; String[] aAddrss = new String[aCount]; while(curAddress.moveToNext()) { aType[i] = curAddress.getString(curAddress.getColumnIndex(Contacts.ContactMethodsColumns.TYPE)); aAddrss[i] = curAddress.getString(curAddress.getColumnIndex(Contacts.ContactMethodsColumns.DATA)); i++; } } catch (Exception e) { Log.e(StaticVariables.TAG, "getAddress: " + e.getMessage()); } finally { if(curAddress!=null) curAddress.close(); } } </code></pre>
android
[4]
5,943,637
5,943,638
find the sum of even number not exceed four million
<pre><code>class fibo { //int firstNumber = 0; public static void main(String args[]){ //int firstNumber = 0; int length = 4000000; int[] series = new int[length]; //long[] sum = new long[4000000]; long sum =0; series[0] = 0; series[1] = 1; for (int i = 2; i&lt;4000000; i++){ //firstNumber = firstNumber + i; //System.out.println("fibo" + i); series[i] = series[i-1] + series[i-2]; if(series[i] %2 == 0) { sum = sum + series[i]; } } for(int j=0;j&lt;length; j++){ System.out.println("fibo Series" + series[j]); } } } </code></pre> <p>I got the answer, but the approach was different. What's wrong with this code?. Can anyone give an insight on this.</p> <p><strong>The same code works when the length is 10.</strong> I am not getting any expection on this, but the answer seems to be different. Its something -92719184589087346 which is incorrect.</p>
java
[1]
5,050,357
5,050,358
Replace a string in table using jquery?
<p>This is my table.</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td&gt;I am Achinna&lt;/td&gt; &lt;td&gt;I am Krish&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>I need to place "Me" instead of "I am" using jquery.</p>
jquery
[5]
85,188
85,189
Android - How to make loading on first starting
<p>Hi it's my first question in stackoverflow sorry if i do something wrong.</p> <p>My problem is that when i start the app for very first time i need to write the SQL data in the database. If i do that in onCreate() while it's writing the sql it's not showing the View so it's like freezing. And if i make loader there it's not showed because first of all ti want's to finish all the oncreate and after that to show the View. Then i made AlertDialog to run if SQL is empty to inform the user that in needs "instalation" and after confirm i wanted to make loading box while it's running inserting the SQL...</p> <p>So my question is : How to make loading onCreate... at running of the activity... can u give me some good idea... here is the code i made:</p> <pre><code>private DatabaseHandler db = new DatabaseHandler(this); Context context; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); context = this; if(db.getWordsCount() == 0) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Instalation needed"); builder.setMessage("Database need to be installed"); builder.setPositiveButton("Ok", dialogClickListener); builder.setNegativeButton("Close", dialogClickListener); builder.show(); } } DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { switch (which){ case DialogInterface.BUTTON_POSITIVE: ProgressDialog progress = new ProgressDialog(context); progress.setTitle("Instalation"); progress.setMessage("Please wait..."); progress.show(); db.insertWords(db); progress.cancel(); break; case DialogInterface.BUTTON_NEGATIVE: finish(); break; } } }; </code></pre>
android
[4]
5,971,629
5,971,630
coding asp page for avoid of hack
<p>all of us know that most of attacks to websites is from their URL. i saw some websites code their page for example we see <code>http:/www.*.com/code/</code> instead of <code>http:/www.*.com/code/code.aspx</code> how do that? every one can give me some tutorials that tell how can i do that in asp.net?</p>
asp.net
[9]
3,379,359
3,379,360
How to bring dialogbox on top all open form
<p>I have three forms Main, Sales and Login.</p> <p>In Main form I have a timer, example after 5 minutes Login form will be fire up.</p> <p>I can Open a Sales form the Main form whitout closing the Main form, so Login form will be fire up.</p> <p>The problem is the Login form does not focus on top of the Sales form, so that the user must login to use the sales form. </p> <p>Some code on Main form :</p> <pre><code>public void timer_Tick(object sender, EventArgs e) { timer.Stop(); LoginDialog loginForm = new LoginDialog(); loginForm.TopLevel = true; loginForm.ShowDialog(); timer.Start() } private void pbSales_Click(object sender, EventArgs e) { Sales salesForm = new Sales(); salesForm .ShowDialog(this); } </code></pre>
c#
[0]
1,590,551
1,590,552
how to detect day light saving in java
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1305350/how-to-get-the-current-date-and-time-of-your-timezone-in-java">How to get the current date and time of your timezone in Java?</a> </p> </blockquote> <p>I have developed a Attendance System and in use for India. Our servers are in US and since they are using PDT. My code reflects time one hour ahead.</p> <p>say its 9:00 am IST ---- I get the time as 10:00 am IST</p> <p>other than detecting one hour from the time, which will be a temporary solution.</p> <p>Pls suggest me some way to overcome this situation</p>
java
[1]
290,995
290,996
How to draw a png image in php?
<pre><code>$image = imagecreatetruecolor(538,616); $black = imagecolorallocate($image,0,0,0); imagefill($image,0,0,$black); </code></pre> <p>I have already draw a black image i want draw a file suppose 3.png on it .. How to do that ?</p>
php
[2]
2,792,695
2,792,696
how to display telugu characters in my android application
<pre><code>Typeface tf = Typeface.createFromAsset(this.getAssets(), "Tikkana.ttf"); System.out.println("8888 "+tf.getStyle()); System.out.println(tf); yourName.setTypeface(tf); </code></pre> <p>I am using above code but it is not working. The text is displaying like some rectangular boxes.</p>
android
[4]
2,350,606
2,350,607
Accessing a class with the exact same name
<p>I have a tricky question and I'm not sure if it is even possible in Java. I'm in the following situation:</p> <p>I got a class A that uses another class, let's call it B. Now, I'm trying to write a third class (and I don't call it C), I call it B again (to be sure which class 'B' I mean, I will call it B1 and B2 in the rest of this post, ok?). All three classes resides in three different JAR-files. So far, so good. </p> <p>Normaly, class A finds class B(1) on the classpath and will use it. But now I'm putting the JAR-file that contains B(2) at the very beginning of the classpath, so class A will find this class instead of the old one. So my class B(2) can act like the old class B(1) (which is a library in reality, that I can't customize in any other way. that's why I am doing that...).</p> <p><strong>And here comes my problem:</strong> In my class B(2) I want to load the real class B(1) and use it. I can do this so far by using reflection. I can even invoke methods via reflection, but I can't cast an instance of the loaded class to B reference. Here is the exception:</p> <pre><code>java.lang.ClassCastException: my.a.ClassB incompatible with my.a.ClassB </code></pre> <p>Has anybody an idea how I can use class B(1) in class B(2)? I am happy with any workarround...</p> <p>Thanx, Thomas.</p>
java
[1]
3,168,621
3,168,622
Java: A design pattern for building a text file from different methods
<p>I'm building a file by appending text based on different parameters.</p> <p>Lets say my file will have 3 paragraphs A, B, C, and you can build each paragraph in 3 different ways</p> <p>At the end you end up with something like A1, B2, C3 or A1, B1, C1 or A2, B1, C2 and so on</p> <p>I already did this with a lot of IFs, and the ugliest part was the fact that each class had parameters of the following ones. For instance A receives 3 parameters and passes 2 to B, then B passes the last one to C</p> <p>This is not extensible or maintainable at all, I really feel everything is chained and I want to break the chain, so how can I implement this neatly?</p>
java
[1]
1,407,746
1,407,747
why prototype need a instance not the function self
<p>When we use prototype . we use like</p> <pre><code>function classA(){ } function classB(){ } classB.prototype = new classA(); </code></pre> <p>why should we write it like that? why isn't it?</p> <pre><code>classB.prototype = classA; </code></pre> <p>after I set the prototype is classA; then I log the classB.prototype. the console log like following</p> <p>function classA(){ }</p> <p>what's that mean? I try to add some method into classA but I can NOT call them by using classB.prototype.BLABLA.</p> <p>my english is not so good. so . I don't know if I explain it well or not.</p>
javascript
[3]
3,559,723
3,559,724
how to get a textbox behind a child program
<p>how to get a textbox behind a child program [closed] c#</p> <p>I've got a program that I'm Making and I have a text box in it ok I've also made a button that brings out a child program within the program ok I am trying to get text box to go behind the child program that opens inside the program the text box is always in the way and I can't find a way to get it to go behind the child program.</p>
c#
[0]
2,706,985
2,706,986
Elegantly handle different parameter types
<p>I have a function that, in the simplest of cases, operates on an iterable of items.</p> <pre><code>def foo(items): for item in items: # do stuff </code></pre> <p>Sometimes, I do not want to pass it an iterable of items directly, but rather an object that provides a method to get the iterable:</p> <pre><code>def foo(obj): for item in obj.iteritems(): # do same stuff as above </code></pre> <p>I can merge these two cases like this:</p> <pre><code>def foo(obj): try: items = obj.iteritems() except ValueError: items = obj for item in items: # do stuff </code></pre> <p>This works just fine. Now I get a third use case that looks like this:</p> <pre><code>def foo(objs): for item in itertools.chain.from_iterable(obj.iteritems() for obj in objs): # do same stuff again </code></pre> <p>I can still use the <code>try-except</code> approach, since the interfaces are incompatible. However, the nested try catch would start to become very ugly. More so when I want to add a fourth use-case. Is there any way to solve this without nesting the <code>try</code>-blocks?</p>
python
[7]
191,229
191,230
aspx.cs need explain to me
<pre><code>using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } } </code></pre> <p>and some1 explain it to me what do all this usings do please?</p> <p>im really struggling to find anything on the internet thanks</p>
asp.net
[9]
1,256,456
1,256,457
jQuery: extend method - how to save/keep/do not break the initial reference?
<p>Here is an example.</p> <p><a href="http://jsfiddle.net/R9V4p/" rel="nofollow">http://jsfiddle.net/R9V4p/</a></p> <p>Is it possible to make <code>s.c==60</code> at the end and do not overlap provided values with default ones? For example i have provided <code>testing</code> function with <code>s.clean=true</code> instead of <code>false</code>.</p> <p>Ofc i can write my own <code>function</code> for this. But maybe it would be nice to post a suggestion topic for this feature on jQuery forum, to be able to select which <code>object</code> to <code>return</code> in <code>extend method options</code>?</p>
jquery
[5]
4,334,067
4,334,068
InvalidOperationException with arrayLists
<p>I am getting this exception:</p> <p><code>Collection was modified; enumeration operation may not execute.</code></p> <p>Directly after this code:</p> <pre><code> else if (count == 0) { partCategory.Add(words[count].ToString()); foreach (string categoryS in partCategory) { if (categoryS != words[count].ToString()) { partCategory.Add(words[count].ToString()); } } } </code></pre> <p>I am taking a guess that it may be the Add method that was used prior to it, but I'm not sure.</p> <p>Call Stack Code:</p> <pre><code>**********.exe!**********m.FileController.readSortText(string fileName = "**********extracted\\PC120701.txt", System.Windows.Forms.ProgressBar newProgress = {Value = 0 Min = 0 Max = 100}) Line 78 + 0x207 bytes C# **********.exe!**********.mainForm.unzipFile(string fileName = "**********") Line 133 + 0x42 bytes C# **********.exe!**********.mainForm.decompress_Click(object sender = {Text = "Unzip"}, System.EventArgs e = {X = 49 Y = 7 Button = Left}) Line 163 + 0x17 bytes C# [External Code] **********.exe!**********.Program.Main() Line 18 + 0x28 bytes C# [External Code] </code></pre> <p>Thanks for your future help!</p>
c#
[0]
4,737,301
4,737,302
How to do read/write file efficiently in python
<p>Hi I am writing to file each time i got the result in my multiple if else statement.Is there any way to save all my result and writing it in one-shot by opening the file and close it? </p>
python
[7]
2,280,343
2,280,344
String Matching For Login Purpose
<p>I want Know some details about login screen.. how to get value from textfield and how to verify that string character.. plz give anyone idea or code..</p>
iphone
[8]
4,126,018
4,126,019
ASP.NET: two ways to access global resource programmatically
<p>i know that i can set a Label's text by using this syntax:</p> <pre><code>lblMessage.Text = (string)GetGlobalResourceObject("resxFile", "message"); </code></pre> <p>but what's the difference(benefit/drawbacks) to using this syntax:</p> <pre><code>lblMessage.Text = Resources.resxFile.message; </code></pre> <p>also, i just found out that this second method doesn't work for local resource files. is there a different syntax used for local resource files?</p>
asp.net
[9]
5,710,106
5,710,107
Is there any method to pause a function in the middle waiting for input in javascript?
<p>I need to pause a JavaScript function execution in the middle and then resume it after a table cell is clicked. For example : I have to put 'A' into a one of the table cells. So, I have to click add() (add() is a function) and then wait for the user to click on the table cell to pass the cell id to function. I have thought of bind a click event to each cell to trigger the add() function. But then I have to do a delete function too. It is the same that I click on the delete button and then wait for the user to click on the table cell to pass the cell id to the function. </p> <p>So how can I pause the function to wait for the input just like C++ : cin>>x which the program waits until user inputs the value of x.</p> <p>Edited: Finally I work it out. Every time when I click on the add button, I bind a addtd function to every td. And after I click on the cell, I unbind the addtd function. So that next time I click on the delete button, I can bind a deltd function on each cell.</p>
javascript
[3]
5,928,861
5,928,862
java arraylist help needed
<p>Have coded in many languages before but new to Java. I want to create an array whose members are of type </p> <pre><code>public class data { String date=""; String time=""; double price=0; int volume=0; }; data data1 = new data(); public ArrayList ftsedata = new ArrayList&lt;data&gt;(); </code></pre> <p>I then get market data which i insert into data1 followed by</p> <pre><code>ftsedata.add(data1); </code></pre> <p>I then wait for fresh data and when i get it I insert it AGAIN into data1 and add it to ftsedata. Although ftsedata seems to be increasing in size correctly it seems that elements of ftsedata are just pointers to data1 and hence all elements of ftsedata seems to have values equal to the last data1 values.</p> <p>I am using arraylist because I do not know how many datapoint will come in during the day so i need something that expands.</p> <p>Could someone please tell me if I should be using arraylist or something else and if arraylist what is my problem.</p> <p>many thanks for your time.</p> <hr> <p>Many Thanks everyone,</p> <p>I actually have four different functions that each fill one part of data1. Taking your views on board, i left data1 alone as a variable that can be seen in all functions. In the particular function that adds data1 to the arraylist i created a dataLocal variable of type Data and copied everything into it like dataLocal.price= data1.price; etc etc I then added dataLocal to the arraylist. This seems to work. I am assuming that each time this function is called a new local variable with the name dataLocal is created. Thanks you all for your help and please let me know if there is somethimng in this way of doing things that can get me in trouble later,eg, some other part of program would write over one instance of dataLocal because as far as the program is concerned the need for the variable is over.</p>
java
[1]
2,722,432
2,722,433
Drag an item underneath a list of div's
<p>I have a draggable : </p> <pre><code>&lt;ul&gt; &lt;li&gt;Option 1&lt;/li&gt; &lt;/ul&gt; &lt;script type="text/javascript"&gt; $(function() { $( "li" ).draggable({ connectToSortable: //I don't where what should be configured here }); }); &lt;/script&gt; &lt;div&gt;&lt;/div&gt; &lt;div&gt;&lt;/div&gt; //add item here </code></pre> <p>I'm attempting to drag 'Option 1' so that it will drag underneath the last div in a list of existing divs, how can this be enabled ? I think I need to somehow keep track of the list of divs?</p>
jquery
[5]
2,418,810
2,418,811
Change text input name based on radio button selected
<p>I have a form with 3 inputs:</p> <ul> <li>name</li> <li>email</li> <li>company</li> </ul> <p>I also have two radio buttons a user must select from:</p> <ul> <li>A</li> <li>B</li> </ul> <p>If the user selects A, leave the form fields as they are. If the user selects B then change the descriptions of the input fields.</p> <p>By default the form loads as A.</p> <p>name = we want your (name), company = we want your (company), email = we want your (email)</p> <p>How do I get the changed radio button value to update the text input fields?</p>
jquery
[5]
3,147,671
3,147,672
Where can I get the source code of module __builtin__ in python?
<p>where can I get the source code for module <strong>builtin</strong> in python ? I am interested in version 2.6.x.</p>
python
[7]
1,238,420
1,238,421
Can we have 2 Application running simultaneously on an android device?
<p>What I wish to have is , one application is running on android main device and displayed on main device. And second application is running on main android device and displayed on another display device connected to main device. This another display would have a touch screen.</p> <p>** What I mean is to have only one main android device . And another would be only a display device which is touch screen (Which will work as an accessory to main device). Both the application will run on main android device only the display would be different. One will be displayed on main device and another application will be displayed on the second display device. Please let me know, if it is feasible or not. And if yes, what changes need to be done ?</p>
android
[4]
616,664
616,665
only edu email address
<p>I want to validate email addresses to make sure they have univeristy edu addresses. For example, for USA only "edu" email holders, for Australia only "edu.au", for Turkey only "edu.tr" etc.. </p> <p>Does anyone have a PHP function that will allow me to do that?</p>
php
[2]
1,414,038
1,414,039
regex in python dealing with curly braces
<p>I have a line which has lots of words and characters. I just want to remove the part which is included in double curly braces </p> <pre><code>{{ }} </code></pre> <p>I tried <code>?={{.*}}</code> but I am not getting anything.</p>
python
[7]
1,495,294
1,495,295
how can i add ctrl+c or ctrl+mouse clik to fetch any word to my winform textbox in c# like wordweb or Concise oxford english dictionary
<blockquote> <p>i am trying to develop a dictionary project. i have already finished most of the work but now i want to give facility like dictionaries like wordweb or Concise oxford english dictionary that is when some one press ctrl+mouse click or ctrl+c on any word that word will set automatically to the winform textbox where words are placed for searching its meaning. i am developing it using C#.NET 3. </p> </blockquote> <p>i am requesting all to give me a solution for the completion of my task.</p>
c#
[0]
5,524,922
5,524,923
Percentage of a Number
<p>So I'm a little frustrated with how many times I've tried this. I'm using # / 100 = % * Balance = Fine here, yet for some reason always results to 0. Note that this uses an external API.</p> <pre><code>double fine = (getConfig().getBoolean("fineispercentage") == true ? getConfig().getInt("fine") / 100 * count * econ.getBalance(event.getPlayer().getName()) : econ.getBalance(event.getPlayer().getName()) - (econ.getBalance(event.getPlayer().getName()) - count * getConfig().getInt("fine"))); </code></pre> <p>When true, always results to 0. When false, it goes the way it's supposed to, which is subtract an amount depending on the count.</p>
java
[1]
3,497,562
3,497,563
how to display multiple images dynamiclly in imageview
<p>hi i am new to iphone. what i need is i have to display only one image in one case, two images in another case like wise and for that i am using a imageview with iboutlet. how can i dispay multiple images in single imageview. pls help me post some code. thank u .</p>
iphone
[8]
4,943,139
4,943,140
How do you host your own egg repository?
<p>Say you're on a team that's maintaining a lot of internal python libraries(eggs), and for whatever reason uploading them to pypi is not an option. How could you host the libraries(eggs) so that easy_install can still work for the members of your team?</p> <p>Basically it would be cool if this worked....</p> <pre><code>(someproj)uberdev@hackmo:~$ easy_install myproprietary.lib-dev user: uberdev password:... fetching...... Searching for myproprietary.lib-dev Reading http://dev.mycompany.corp/myproprietary.lib-dev Reading http://dev.mycompany.corp Reading http://dev.mycompany.corp/dist Best match: myproprietary.lib-dev Downloading http://dev.mycompany.corp/dist/myproprietary.lib-dev </code></pre> <p>I suppose there's some sort of servers out there that can be installed but I'd appreciate some guidance from the experts on this matter.</p> <p>Thanks</p>
python
[7]
4,941,065
4,941,066
How to always start an App from the main activity, even after being closed using the home button from sync settings
<p>The scenario:<br> My app turns toggles the wifi state when a button is pressed and then exits the app. If background data is enabled when the wifi is being disabled, then the app allows the user to disable the bg data by starting the Sync Settings activity startActivity(new Intent(Settings.ACTION_SYNC_SETTINGS));<br> This works great except that when the user returns to the home screen from the sync settings activity by pressing the home button, the app will still show the sync settings when reopened, and not the main activity.</p> <p>What can I do so that anytime my app is opened it starts on the main activity, no matter how or where it was closed?</p>
android
[4]
1,989,168
1,989,169
Android onLongClickListener for view & bubbling up for child event
<p>I've got a View defined with 3-4 items on it (buttons, ImageView, etc.). The View has an onLongClickListener defined:</p> <pre><code>view.setOnLongClickListener(new OnLongClickListener() { ... } </code></pre> <p>As long as I long click on an empty portion of my view, this works great -- but if I long click on my image, for example, the long click doesn't get triggered.</p> <p>Is there anyway in Android to make the child elements "pass up" their events without needing to define an onLongClick listener for each element?</p>
android
[4]
5,834,614
5,834,615
Java Terminology
<p>I am new to Java and would like to know a bit more. I have a current problem that I would like an answer to but I would also like to know what the technique is referred to as so that I can do some further reading.</p> <p>I currently have something like this</p> <pre><code>public class BasicActivityExtension { public Boolean basicExtensionMethod(){} ...} pubic class MyExtension extends BasicActivityExtension {public Boolean myExtensionMethod(){}...} </code></pre> <p>Then in a service method I have (ignore the ( i couldnt work out how to get the &lt; to stay in this)</p> <pre><code>public Class &lt; ? extends BasicActivityExtension&gt; getExtensionByActivity(BasicActivity activity, ExtensionTypes type) throws Exception { .... } </code></pre> <p><strong>My Question is why does this give an error and what is the name for this technique (when done correctly!)</strong></p> <pre><code>MyExtension members = (MyExtension) activityService.getExtensionByActivity(activity, ExtensionTypes.member); </code></pre> <p>The error is Cannot cast from Class to MyExtension;</p> <p>Also if I have an object Class&lt; ? extends BasicActivityExtension> how can I just call the generic methods in BasicActivityExtension without caring what class it is?</p> <p>Cheers,</p> <p>Rob</p>
java
[1]
3,076,470
3,076,471
custom dialog exception
<p>ihave been used the custom dialog and an <code>EditText</code> in it , and i validate the <code>EditText</code> by displaying error message when the user click the <strong>ok</strong> button without entering his/here name , but when i run it and click the ok button either with or not entering a name an exception Occur why is that ? please help me..</p> <p>this is my code</p> <pre><code>final Dialog nameDialog =new Dialog(ProfileView.this); nameDialog.setContentView(R.layout.namedialog); nameDialog.setTitle("please enter your name"); name =(EditText)nameDialog.findViewById(R.id.nameETDialog); Button okButton = (Button) nameDialog.findViewById(R.id.ok); okButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //validate the name if( name.getText().toString()== null) name.setError( " your name is requiered" ); else { EditText nametext=(EditText)findViewById(R.id.name_text); nametext.setText(name.getText().toString()); Toast.makeText(getBaseContext(),"your name has been entered ", Toast.LENGTH_SHORT).show(); } } }); Button cancelButton = (Button) nameDialog.findViewById(R.id.cancel); cancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { nameDialog.dismiss(); } }); nameDialog.show(); } }); } </code></pre> <p>}</p>
android
[4]
1,669,284
1,669,285
Exact age calculation
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/9/how-do-i-calculate-someones-age-in-c">How do I calculate someone&#39;s age in C#?</a> </p> </blockquote> <p>Maybe this could be silly but and I don't have issues with my age but sometimes it is good to calculate the exact age of someone, I have introduced my birthdate in my profile (01/12/1975) "dd/mm/yyyy" and it calculated 33 and I'm 32 actually still, isn't it better to calculate the exact age? </p> <p>Maybe</p> <pre><code>DateTime dt1 = DateTime.Now; TimeSpan dt2; dt2 = dt1.Subtract(new DateTime(1975, 12, 01)); double year = dt2.TotalDays / 365; </code></pre> <p>The result of year is 32.77405678074</p> <p>Could this code be OK?</p>
c#
[0]
4,447,496
4,447,497
Getting Unexpected '<' in simple less than greater than comparison
<p>I feel very very very silly posting this, but I can't find the answer. I've searched google and here.</p> <pre><code>// originally values in a multi dimensional array, but used simple values // to rule out errors. $somenumber = 1; $anotherone=5; if ($somenumber &lt; $res-&gt;shares &lt; $anotherone ) { //blah } </code></pre> <p>Get the error: <code>Parse error: syntax error, unexpected '&lt;'</code></p> <p>Seems pretty simple and straight forward. Is there some weird thing that you can't compare multiple values? Do I have to explicitly type? </p> <p>It works in Perl. Which of course means that it has to work like this in everything else. ;)</p>
php
[2]
3,209,193
3,209,194
Is there a light alternative to jQuery Mobile for just page transitions?
<p>I'm looking for an <b>ULTRA-light</b> framework or snippet which handles <code>-webkit</code> css page transitions in a similar way to JQM or JQTouch. They work fine but I don't want to add almost 200kb of resources just to get some transitions.</p> <p>I'd like it to feature :</p> <p><b>1</b> Page-to-page switching (divs) within a single HTML-doucment.</p> <p><b>2</b> Do a 'flip' and possibly a 'slide' transition.</p> <p>Has anyone seen such a thing?</p> <p>Edit: I'd like to avoid using jQuery all together.</p>
javascript
[3]
5,721,326
5,721,327
Is there a tutorial or open source project for implementing badges like StackOverflow's?
<p>I was trying to implement a badging system or a web reputation feature into my app, and I was wondering how to go about it! I still can't get my head around how it works. Are there any tutorials out there explaining how I can implement one or or some sort of framework that I can use in my app?</p>
php
[2]
5,236,892
5,236,893
Modifying item after addition to List does not update list
<p>I have a member variable which is a list of reference types. In a method I create and item, add it to the list. The item is then updated point to another instance but the instance in the list does not get updated (his is in some unit test code). Example looks like</p> <pre><code>Item localItem = new Item(arg1, arg2); this.itemList.Add(localItem); // Do some testing and assertions localItem = new Item(arg3, arg4); // This does not update the instance of // localItem in this.ItemList // Do some more testing and assertions </code></pre> <p>I can update my tests to fix this but it still caught me by surprise. I supose the List wants to keep the original instance passed through the <code>Add</code> method and cares not if the local variable which was used to pass it in now points to something else. Can anyone maybe confirm this understanding or explain it more clearly?</p>
c#
[0]
3,785,061
3,785,062
key event in Android
<p>The currently key events listener provided by android "onKeyUp", "onKeyDown" are associated to an activity , so they are notified of the key events if the activity's views are focused . What I want is to be able to increase/decrease the volume by pressing some of the device's key , without writing a listener in every activity , especially as my application has a lot of activities . Is there a way to write a "listener/piece of code" for key events that will be called always during the life of an application when a key is pressed, no matter what the user is doing at that time ?</p>
android
[4]
3,165,994
3,165,995
How can we implement pagecurl animation in tableview?
<p>Ha ii every body ,how can we implement a page-curl in tableview,i have a tableview which contains pages of the book and i have implement the touch events in the tableview cell for next chapter and previous chapter,left-swipe for next and right-swipe for previous chapter,when we swipe the tableview it reloads the next chapter and previous chapter content,it really works well but i want it in a page-curl animation,when the user swipe left or right tableview loads content with a page-curl animation.Is that possible to do in a tableview cell?my code for left and right swipe for chapter navigation as follows.</p> <pre><code>-(void) handleSwipeGesture:(UISwipeGestureRecognizer*)recognizer { if(![delegate.selectedChapter isEqualToString:[NSString stringWithFormat:@"%d",[DbHandler mNumberOfChaptersInBook:delegate.selectedBook]]]) { // if the currentChapter is the last then do nothing delegate.selectedChapter = [NSString stringWithFormat:@"%d",[delegate.selectedChapter intValue] + 1]; [delegate reloadVerses]; [self resetReadViewToVerse:1]; [table removeGestureRecognizer:recognizer]; } if (recognizer.state==UIGestureRecognizerStateBegan ) { self.table.scrollEnabled = NO; } else if(recognizer.state==UIGestureRecognizerStateEnded) { self.table.scrollEnabled = YES; } return; } -(void) handleSwipeGestureleft:(UISwipeGestureRecognizer*)recognizer { if(![delegate.selectedChapter isEqualToString:@"1"]) { delegate.selectedChapter = [NSString stringWithFormat:@"%d",[delegate.selectedChapter intValue] - 1]; [delegate reloadVerses]; [self resetReadViewToVerse:1]; [table removeGestureRecognizer:recognizer]; } if (recognizer.state==UIGestureRecognizerStateBegan ) { self.table.scrollEnabled = NO; } else if(recognizer.state==UIGestureRecognizerStateEnded) { self.table.scrollEnabled = YES; } return; } </code></pre> <p>Thanks in advance.</p>
iphone
[8]
2,092,793
2,092,794
How to get only the favourite/starred contacts using ContactsContract
<p>how can I get the favourite contacts (and only the favorite / starred) contacts?</p> <p>I would like to not loop through the entire contacts list checking each contact if it is starred... is there some query I can use to return only favourite/starred contacts?</p> <p>thanks</p>
android
[4]
1,120,218
1,120,219
what is the alternative of HTML's TextArea in Android
<p>what is the view element which gives effect like a HTML's TextArea? I want to create a form to send Email and for the body field I want to create a textarea type of UI element in the form. </p> <p>Can someone suggest what is the way to go for it?</p>
android
[4]
4,311,282
4,311,283
How to shift a linear layout when soft keyboard is ON
<p>I made a similar dialog box (xml layout), that exists in a linear layout. and i want this linear layout to be shifted when soft keyboard is ON.</p> <p><img src="http://i.stack.imgur.com/y2XFW.png" alt="LinearLayout shifted when soft keyboard is ON"> EDIT: I want it to appear just like the WhatsApp dialog box is appearing in the image.</p> <p>SOLVED: </p> <p>The problem was because the PARENT was RelativeLayout ( which was occupying the entire screen ) , therefore, after adding what @Enigma suggested below in the manifest file, and removing the parent layout which is relative layout and making LinearLayout containing the dialog box only, the parent. </p>
android
[4]
5,531,814
5,531,815
How to compile Java into 32 bit?
<p>No 64 bit odbc driver for ms access. Wondering how to compile java source file to 32bit... Any idea. I have searched a lot on google but couldnot able to find the solution. </p> <p>Can anyone help me!</p>
java
[1]
4,068,464
4,068,465
Javascript: replacing newlines with <br/> working in FF and SAFARI and not working in IE
<p>Code in the post has been modified.</p> <p>I was thinking that replacing \n with <br/> with javascript was quite a simple task, but it seems not to be so. Posts in <a href="http://www.bennadel.com/blog/161-Ask-Ben-Javascript-Replace-And-Multiple-Lines-Line-Breaks.htm" rel="nofollow">Ask Ben</a> or <a href="http://stackoverflow.com/questions/784539/replace-all-line-break-in-a-string-with-br-tag-in-javascript">StackOverflow</a> suggest that something as simple as:</p> <pre><code>var myRe = new RegExp(/\r?\n/g); // to avoid the re literal caching problem lDes = $("div.descr").html(); lDes = lDes.replace (myRe, "&lt;br/&gt;"); lDes = lDes.replace (/(http:\/\/\S+)/g, "&lt;a target=\"blank\" href=\"$1\"&gt;$1&lt;/a&gt;"); $("div.descr").html(lDes); </code></pre> <p>will get the job done. Indeed, this work in FF and Safari but not in IE.</p> <p>Or, using <a href="http://pastie.org/948352" rel="nofollow">postie </a> (great hint!)</p> <p>Text has been created in a textarea and then stored in a database, then retrieved without further processing. It works using FF on windows and Safari on Mac. IE on windows, nada. Is it a major bug in my head? Is it a JQuery issue?</p> <p>Have some idea about how to solve this? And possible reason for?</p> <p>Many thanks</p>
javascript
[3]
2,436,050
2,436,051
Removing notification after click
<p>I just started working with notifications and now I'm trying to remove the notification and launch the app once the notification has been tapped in the notificationcenter.</p> <p>I tried to work with the following code:</p> <pre><code>import android.app.NotificationManager; public class ExpandNotification { private int NOTIFICATION = 546; private NotificationManager mNM; public void onCreate() { mNM.cancel(NOTIFICATION); setContentView(R.layout.activity_on); //Toast.makeText(this, "stopped service", Toast.LENGTH_SHORT).show(); } </code></pre> <p>I think this code executes the other class when tapped?</p> <pre><code>PendingIntent contentIntent = PendingIntent.getActivity(this, REQUEST_CODE, new Intent(this, ExpandNotification.class), 0); </code></pre> <p>However the notification doesn't go away, nor does the application launch. But I'm able to swipe it to left or right to remove it but that's not what I want..</p>
android
[4]
5,462,022
5,462,023
I have two Lists of string how can i create a string from each List index with the other one?
<p>For example i have a List:</p> <pre><code>[0] daniel [1] moses </code></pre> <p>Now the second List:</p> <pre><code>[0] hello world [1] hi everyone </code></pre> <p>I want to build a new List of string thats will be:</p> <pre><code>[0] daniel hellow world [1] moses hi everyone </code></pre> <p>How can i do it ?</p>
c#
[0]
3,992,397
3,992,398
Is there a performance advantage to coding this one way or another?
<p>I am using jQuery 1.7.1</p> <p>I am trying to write this code for readability as well as performance. In the two cases below, which one would perform better and why?</p> <pre><code>// BLOCK ONE var DivHeight = 0; $(".PC_SeriesDiv").each(function() { var ThisDivHeight = $(this).height(); if (ThisDivHeight &gt; DivHeight) { DivHeight = ThisDivHeight; } }); DivHeight = DivHeight + "px"; $(".PC_SeriesDiv").animate({height: DivHeight}, 250); // BLOCK TWO var DivHeight = 0; var PC_SeriesDiv = $(".PC_SeriesDiv"); PC_SeriesDiv.each(function() { var ThisDivHeight = $(this).height(); if (ThisDivHeight &gt; DivHeight) { DivHeight = ThisDivHeight; } }); DivHeight = DivHeight + "px"; PC_SeriesDiv.animate({height: DivHeight}, 250); </code></pre> <p>My question really boils down to whether there is any benefit in doing this:</p> <pre><code> var PC_SeriesDiv = $(".PC_SeriesDiv"); </code></pre> <p>Suggestions would be greatly appreciated. Thanks!</p>
jquery
[5]
584,342
584,343
Programming in C# question
<p>After creating this code:</p> <pre><code>Console.WriteLine("Hello, and Welcome to Shell Bomber!\n"); Console.WriteLine("In this game you will calculate the distance\n"); Console.WriteLine("a shell will rise and travel along the ground ^_^\n"); Console.WriteLine("theta = ?"); // initial angle that you will ask for from the user double theta = Double.Parse(Console.ReadLine()); Console.WriteLine("v_o = ?"); // initial velocity that you will ask for from the user double v_o = Double.Parse(Console.ReadLine()); Console.WriteLine("Calculate v_ox"); //Calculate vox = v_ocos(theta double v_ox = v_o * Math.Cos(theta); //Use the Math.Cos(theta) method theta = theta * Math.PI / 180.0; // Converts from degrees to radians Console.ReadLine(); </code></pre> <p>Is the program automatically going to convert the value of double v_ox = v_o * Math.Cos(theta) to a value from the user's input of an angle for theta and an initial value? Because when I run it, the program is not calculating the value? Did I do something wrong or is that just how I made it work?</p>
c#
[0]
1,125,764
1,125,765
Selecting a row in uitableviewcell
<p>how to make a row in uitableview back to white after selecting.</p> <p>My problem is when I select a row in uitableview it shows me blue color and it remains on. It doesn't go off, I mean back to white color. </p> <p>How to do that. any help please..</p>
iphone
[8]
684,956
684,957
Why am I not seeing an error message?
<p>I'm feeling my way around php for the first time in years. I'm trying to perform a simple select statement. I've confirmed the statement works directly against mysql. My php does not complete. I'd like to know why my real_query isn't working, I'd also like to know how to coax an error message out of this scenario. Here's the code:</p> <pre><code>function getRoot($nid) { echo $nid; //displays 0 try { echo "Hello?"; //This displays //Why doesn't this work?! if($mysqli-&gt;real_query("SELECT * FROM gem, bundles WHERE gem.nid = bundles.baseNid AND bundles.nid = " . $nid)) { echo "dafuq?"; //does not display } else { echo "foo"; //doesn't display echo $mysqli-&gt;error; //doesn't display } } catch (Exception $e) { echo "Tralalalala"; //doesn't display } echo "teeheehee"; //doesn't display } </code></pre> <p>Thanks for your help!</p>
php
[2]
3,232,676
3,232,677
encode-decode image data with base64
<p>Hi Guys I am try to make iPhone application to encode-decode an images (NSData format).</p> <pre><code> NSData imageData = UIImagePNGRepresentation(image);` </code></pre> <p>How can I do, please give some source code. Thank you!</p>
iphone
[8]
938,083
938,084
Find an element in a list of tuples
<p>I have a list 'a'</p> <pre><code>a= [(1,2),(1,4),(3,5),(5,7)] </code></pre> <p>I need to find all the tuples for a particular number. say for 1 it will be</p> <pre><code>result = [(1,2),(1,4)] </code></pre> <p>How do I do that. </p> <p>PS - This is not homework</p>
python
[7]
1,076,910
1,076,911
can $_FILES superglobal be accessible in class
<p>Does anyone have experience with this</p> <p>I wanted to use $_files in my class</p> <p>like </p> <pre><code>$Uploadfile= $_FILES['file']; </code></pre> <p>but then the script errors</p> <p>I thought superglobals were acccessible anywhere</p> <p>thanks, Richard</p>
php
[2]
2,651,920
2,651,921
How to implement pure virtual function in C++
<p>I think the implementation of virtual function is talked about a lot. My question is what about pure virtual function? However it is implemented? In virtual table, how to tell it is a pure or non-pure? What the difference between pure virtual function and virtual function with implementation?</p>
c++
[6]
1,016,973
1,016,974
Friends Referral
<p>I want a PHP code to load contact list from Hotmail, Yahoo and Gmail something like a friend referral scripts. If possible, I don't want something ready-made (except for the connection libraries).</p>
php
[2]
5,708,193
5,708,194
Android 4 Drag & Drop horizontally
<p>I am able to drag n drop items successfully with View.startDrag method.</p> <p>But I want to restrict dragging only by X axis with some Y axis offset. Currently when user started dragging he is able to move that view anywhere on the screen so how can I limit appearance of dragging so user will not be able to move it up and down.</p> <p>Thank you.</p>
android
[4]
3,549,508
3,549,509
JavaScript Snappy Page Scrolling
<p>I'm trying to find a way to have a snappy and automated page scrolling. </p> <p>I'd like to use jQuery or equivalent to get something like this:</p> <p><a href="http://www.dezinerfolio.com/wp-content/uploads/smoothscrolldemo/df_smooth_scroll.html" rel="nofollow">http://www.dezinerfolio.com/wp-content/uploads/smoothscrolldemo/df_smooth_scroll.html</a></p> <p>Additionally I'd like to have a snappy feeling to it. </p> <p>When using the scrollbar or mousewheel I'd like the site so snap to a defined section. Can this be somehow done?</p> <p>Cheers,</p> <p>L</p>
javascript
[3]
1,892,768
1,892,769
Javascript : Can't retrieve value from array
<p>I have a code</p> <pre><code>alert(JSON.stringify((this.shop.get('selectedOrder')).get('orderLines'))); </code></pre> <p>The Result look like this </p> <pre><code>[{"cart_weight":0,"total_weight":1,"quantity":1,"list_price":1,"discount":0,"ean13":false,"product_image_small":false,"name":"Watermelon1","pos_categ_id":[1,"Others"],"taxes_id":[],"id":2}] </code></pre> <p>When I run this code</p> <pre><code>alert((this.shop.get('selectedOrder')).get('orderLines').total_weight); </code></pre> <p>The result become</p> <pre><code>undefined </code></pre> <p>Any export can help ?</p> <p>I suspect is the double bracket causing the issue [{ }], but I am new to javascript. Not able to solve the issue.</p> <p>Thank you.</p>
javascript
[3]
3,104,563
3,104,564
Android Layout, displaying Multiple Colums
<p>Hi Im new to android. I want to display text such that it would be like:</p> <ol> <li>TITLE 1.1</li> </ol> <p>text about title 1.1</p> <ol> <li>TITLE 1.2</li> </ol> <p>text about title 1.2</p> <ol> <li>TITLE 2.1</li> </ol> <p>text about title 2.1</p> <blockquote> <blockquote> <p>and so on</p> </blockquote> </blockquote> <p>it would be a scrolling windows, but another problem is text could be lengthy and could span multiple lines. What do you recommend i should breakup my layout with. The length will be more then the screen height so i need scrollbars. Plus need to keep title bold.</p> <p>Basically i would be printing this text from a String Array. Is it possible to display it directly from arrays or i can also work with simple strings but need to know how should i breakup my layout. like scrollview -> table layout or what??</p> <p>Thanks,</p>
android
[4]
1,735,731
1,735,732
how to put password to my application
<p>I have wrote another application, now it is store only my private data. Whenever user click on the application icon, as you know, application will start. I want to put password before the my application is starting up. If user will write password incorrectly, at most 5 times, application will not start.</p> <p>My question is ; how can I put password and do not let my application to start if incorrect pass given ?</p>
android
[4]
4,439,743
4,439,744
SmartCards And Android
<p>I'm a C/C++ programmer with good windows and linux development experience and I also know a bit of java too. Recently, a client asked me to develop an Android app for him, wich, will most likely run on a Samsung Galaxy S or Galaxy S II, with Android 2.3, that basicaly consists in connecting a standard smartcard reader on the USB port of the device and using it to access the smartcard. I have programmed smartcards before, but I have no experience with android. So my questions are:</p> <p>Is it possible to do what I need in this hardware and O.S.?</p> <p>Will I have to write my own driver to interface with the USB?</p> <p>Going into more detail, I need to at least be able to execute APDU commands with the cards. Something like the PC/SC standard. Are there any solutions in this subject already implemented?</p> <p>Any ideas of where to begin?</p> <p>Thanks in advance.</p>
android
[4]
2,497,618
2,497,619
How can I prepend some HTML to an element, then check if the HTML was prepended?
<p>I have a global JS method that puts a * in front of every field marked as having class .fish-label</p> <p>the code is:</p> <pre><code>var fishString = "&lt;span class='fish-label'&gt; * &lt;/span&gt;"; $elements.each(function (index, value) { if ($(this).html().indexOf(fishString) != 0) { $(this).prepend(fishString); } }); </code></pre> <p>This works in all browsers except for IE. IE capitalises injected HTML and also my quotes get mysteriously lost somewhere when I alert the html() value.</p> <p>Is there a better, working way I can implement this? The idea is that if the function gets called twice, it won't add two asterisks.</p>
jquery
[5]
3,339,334
3,339,335
How can I check if a localstorage variable is null or undefined?
<p>I have this code:</p> <pre><code>var sideBar = localStorage.getItem('Sidebar'); </code></pre> <p>I want to check if sideBar is defined and not null in an if statement. I am a bit confused I know there's a: <code>sideBar == undefined</code> and <code>sideBar != null</code> </p> <p>but is there a good way for me to do this test for both of these inside an if:</p> <pre><code>if (??) </code></pre>
javascript
[3]
4,386,740
4,386,741
can you have multiple hashcode and equals
<p>Alright, I need to be pointed in the right direction. I already have a hash code and an equals method with over ride. </p> <pre><code>@Override public int hashCode() { return type.hashCode() ^ type2.hashCode() ^ type3.hashCode() ; } @Override public boolean equals(Object obj) { if (!(obj instanceof MyObject)) { return false; } MyObject mdc = (MyObject) obj; return mdc.type.equals(type) &amp;&amp; mdc.type2.equals(type2) &amp;&amp; mdc.type3.equals(type3); } </code></pre> <p>now what if i want to only compare the first and second type and not the third? Can I have two hash and equal methods for later use?</p> <p>What I want to do is, if type 1 and type2 matches, delete them from the current arraylist and add them to a new list, showing which ones were the same type. This is different from the hash code shown above. </p> <p>Is there another way within an array, I can see which combination of type1 and type2 appears multiple times? </p> <p>Ex:</p> <ul> <li>Shooting Halo</li> <li>Shooting CallofDuty</li> <li>Racing Forza</li> <li>............</li> <li>.........</li> <li>..........</li> <li>Shooting Halo</li> </ul> <p>Shooting Halo appears twice, they need to be removed and added to another list, but problem is that I already have a hashcode for previous use.</p> <p>Edit: I want to thank everyone for their ideas. I have solved this problem by creating another object class with similar getters and setters but with a newer hash code and it worked. Next time I will use a better logic method. My main goal on this post was to know if there was any way to have multiple hashcode and method in one class which apparently isn't possible. :)</p>
java
[1]
4,688,130
4,688,131
What does three semicolons in a javascript expression do?
<p>I've seen a triple semicolon in a few expressions here and there.<br> Does it have any logical effect? </p> <p>The Closest thing I've seen for an explanation is that it tells the Dean Edwards compressor to ignore that line. </p> <pre><code>;;; var someVar = 'Rebel'; </code></pre>
javascript
[3]
5,883,322
5,883,323
Serve multiple pages from 1 PHP file?
<p>So basically i am struggling with the need of optimizing my code for some project of mine. Currently i have pages like <code>add_company.php</code>, <code>view_company.php</code>, <code>edit_company.php</code>.</p> <p>What i would like to do is to serve all content from just 1 PHP file <code>company.php</code>. So to speak <code>company.php?action=view</code>, <code>company.php?action=edit</code> etc. Is the only way to do this with massive if else statements? That would make my <code>company.php</code> like mega huge.</p> <p><strong>Or maybe even better how could I serve all my pages just using index.php ?</strong></p> <p>So what would be the best way to accomplish this? I am not php guru and i don't have much experience with MVC or any other pattern.</p> <p>Thanks.</p>
php
[2]
3,944,406
3,944,407
How to change value of UI items in Thread?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/661561/how-to-update-gui-from-another-thread-in-c">How to update GUI from another thread in C#?</a> </p> </blockquote> <p>I need to create C# application, which can change values of UI items in different threads. So, how can I do it? I try to create simple Thread object, and change TextView text in it, but I have got exception. How can I do it? Thank you. </p>
c#
[0]
1,732,191
1,732,192
Compiler complains about "missing return statement" even though it is impossible to reach condition where return statement would be missing
<p>In the following method, the compiler complains about a <em>missing return statement</em> even though there is only a single path through the method, and it contains a <code>return</code> statement. Suppressing the error requires another <code>return</code> statement. </p> <pre><code>public int foo() { if (true) { return 5; } } </code></pre> <p>Given that the <a href="http://stackoverflow.com/questions/1958563/does-java-recognize-infinite-loops">Java compiler can recognize infinite loops</a>, why doesn't it handle this situation as well? The linked question hints, but doesn't provide details for this specific case.</p>
java
[1]
4,280,522
4,280,523
C++ performance of global variables
<p>For clarification: I know how evil globals are and when not to use them :)</p> <ul> <li>Is there any performance penalty when accessing/setting a global variable vs. a local one in a compiled C++ program?</li> </ul>
c++
[6]