Search Results

Search found 237 results on 10 pages for 'abhishek jain'.

Page 7/10 | < Previous Page | 3 4 5 6 7 8 9 10  | Next Page >

  • Example of ==, equals and hashcode in java

    - by Abhishek Jain
    Given this: String s1= new String("abc"); String s2= new String("abc"); String s3 ="abc"; System.out.println(s1==s3); System.out.println(s1==s2); System.out.println(s1.equals(s2)); System.out.println(s1.equals(s3)); System.out.println(s1.hashCode()); System.out.println(s2.hashCode()); System.out.println(s3.hashCode()); Output is: false false true true 96354 96354 96354 Here == is giving false for each object but hashcode for each String object is same. Why is it so?

    Read the article

  • How to open AsyncTask from a Thread

    - by Abhishek
    In my application I have created a SplashScreen that will b shown for 5 Seconds and after that it executes an if else case depending upon the values stored in the Preference file. If Preference file contains values then the AsyncTask code will run else the Login form will load. When i try to run my application. The thread is going to the Login form with the help of intent but when it comes to AsyncTask my application shows a force close error message. This is my SplashScreen code: public class SplashScreen extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.splashscreen); Thread timer = new Thread() { public void run() { try { sleep(5000); } catch(InterruptedException e) { e.printStackTrace(); } finally { if(GoGolfPref.getEmail(SplashScreen.this)!=null && GoGolfPref.getPass(SplashScreen.this)!=null) { new LoadingScreen(SplashScreen.this, SplashScreen.this).execute("login_page", Login.url+GoGolfPref.getEmail(SplashScreen.this)+"/"+GoGolfPref.getPass(SplashScreen.this)); } else { Intent in = new Intent(SplashScreen.this, Login.class); startActivity(in); finish(); } } } }; timer.start(); } } This is the error I am getting: 08-29 07:25:58.040: E/AndroidRuntime(2365): FATAL EXCEPTION: Thread-10 08-29 07:25:58.040: E/AndroidRuntime(2365): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() 08-29 07:25:58.040: E/AndroidRuntime(2365): at android.os.Handler.<init>(Handler.java:121) 08-29 07:25:58.040: E/AndroidRuntime(2365): at android.app.Dialog.<init>(Dialog.java:101) 08-29 07:25:58.040: E/AndroidRuntime(2365): at android.app.AlertDialog.<init>(AlertDialog.java:63) 08-29 07:25:58.040: E/AndroidRuntime(2365): at android.app.ProgressDialog.<init>(ProgressDialog.java:80) 08-29 07:25:58.040: E/AndroidRuntime(2365): at android.app.ProgressDialog.<init>(ProgressDialog.java:76) 08-29 07:25:58.040: E/AndroidRuntime(2365): at com.pnf.gogolf.LoadingScreen.<init>(LoadingScreen.java:130) 08-29 07:25:58.040: E/AndroidRuntime(2365): at com.pnf.gogolf.SplashScreen$1.run(SplashScreen.java:32) How to get this working? Thanks in advance...

    Read the article

  • Static and overriding in Java

    - by Abhishek Jain
    public class B { static int i =1; public static int multiply(int a,int b) { return i; } public int multiply1(int a,int b) { return i; } public static void main(String args[]) { B b = new A(); System.out.println(b.multiply(5,2)); System.out.println(b.multiply1(5,2)); } } class A extends B { static int i =8; public static int multiply(int a,int b) { return 5*i; } public int multiply1(int a,int b) { return 5*i; } } Output: 1 40 Why is it so? Please explain.

    Read the article

  • Super class variables not printing through sub class

    - by Abhishek Singh
    Can u tell me why this code is not displaying any result on the console. class employee { protected String name; protected double salary; protected String dob; public employee(String name, double salary, String dob) { this.name = name; this.salary = salary; this.dob = dob; } public employee(String name, double salary) { this.name = name; this.salary = salary; } } public class Manage extends employee { String dept1; public Manage(String name, double salary, String dob, String dept1) { super(name, salary, dob); this.dept1 = dept1; } public Manage(String name, double salary, String dept1) { super(name, salary); this.dept1 = dept1; } public static void main(String args[]) { employee e = new employee("Vikas", 122345); employee e2 = new employee("Vikas", 122345, "12-2-1991"); Manage m = (Manage) new Manage("Vikas", 122345, "Sales"); Manage m2 = new Manage("Vikas", 122345, "12-2-1991", "sales"); m.display(); m2.display(); } public void display() { System.out.println("Name " + name); System.out.println("Salary " + salary); System.out.println("Birth " + dob); System.out.println("Department " + dept1); } }

    Read the article

  • Reminder application

    - by Abhishek Mishra
    I am developing a reminder application. I am generating notifications using notification manager class, when the timeline crosses.But if my cell phone is switched off ,I am unable to see these notifications. Not even when i switch it on again. Even if i switch it off and switch on again, i think the pending intents are destroyed and no notification is generated. How do i get it when the phone is switched on again ?

    Read the article

  • Existing Maven Project on Amazon Beanstalk

    - by Abhishek Ranjan
    I am trying to migrate my existing Maven project to Amazon Beanstalk. Looking at amazon's documentation,i don't see any maven project deployment instructions. I tried to upload the war file generated but the application is not coming up on beanstalk. I would like to know if there is any existing documentation to deploy on beanstalk from maven. I have Spring Data JPA,Spring MVC application,do i need to do specific configuration or move configuration files from within the WAR file.

    Read the article

  • Pylons and Facebook

    - by Nayan Jain
    The following is my oauth template top.location.href='https://graph.facebook.com/oauth/authorize?client_id=${config['facebook.appid']}&redirect_uri=${config['facebook.callbackurl']}&display=page&scope=publish_stream'; Click here to authorize this application When I hit the page I am prompted to login (desired), upon login I am redirected in a loop between a permissions page and an app page. My controller looks like: class RootController(BaseController): def __before__(self): tmpl_context.user = None if request.params.has_key('session'): access_token = simplejson.loads(request.params['session'])['access_token'] graph = facebook.GraphAPI(access_token) tmpl_context.user = graph.get_object("me") def index(self): if not tmpl_context.user: return render('/oauth_redirect.mako') return render('/index.mako') I'm guessing my settings are off somewhere, probably with the callback. Not to sure if it is an issue with my code or the python sdk for facebook.

    Read the article

  • How to upload image to remote server in iphone?

    - by Atulkumar V. Jain
    Hi Everybody, I am trying to upload a image which i am clicking with the help of the camera. I am trying the following code to upload the image to the remote server. -(void)searchAction:(UIImage*)theImage { UIDevice *dev = [UIDevice currentDevice]; NSString *uniqueId = dev.uniqueIdentifier; NSData * imageData = UIImagePNGRepresentation(theImage); NSString *postLength = [NSString stringWithFormat:@"%d",[imageData length]]; NSString *urlString = [@"http://www.amolconsultants.com/im.jsp?" stringByAppendingString:@"imagedata=iPhoneV0&mcid="]; urlString = [urlString stringByAppendingString:uniqueId]; urlString = [urlString stringByAppendingString:@"&lang=en_US.UTF-8"]; NSLog(@"The URL of the image is :- %@", urlString); NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:urlString]]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setHTTPBody:imageData]; NSURLConnection *conn=[[NSURLConnection alloc] initWithRequest:request delegate:self]; if (conn == nil) { NSLog(@"Failed to create the connection"); } } But nothing is getting posted. Nothing comes in the console window also. I am calling this method in the action sheet. When the user clicks on the 1st button of the action sheet this method is called to post the image. Can anyone help me with this... Any code will be very helpful... Thanx in advance...

    Read the article

  • Why does Java not have any destructor like C++?

    - by Abhishek Jain
    Java has its own garbage collection implementation so it does not require any destructor like C++ . This makes Java developer lazy in implementing memory management. And Garbage Collection is very expensive. Still we can have destructor along with garbage collector where developer can free resources and which can save garbage collector's work. This might improves the performance of application. Why does Java not provide any destructor kind of mechanism? Developer does not have control over GC but he/she can control or create object. Then why not give them ability to destruct the objects?

    Read the article

  • dangling pointer, reason for value change after free()?

    - by Aman Jain
    In the following code segment, after free(x), why does y becomes 0? As per my understanding, the memory in the heap that was being pointed to by x, and is still being pointed by y, hasn't been allocated to someone else, so how can it change to 0? And moreover, I don't think it is free(x) that changed it to 0. Any comments? #include <stdio.h> int main ( int argc, char *argv[] ) { int *y = NULL; int *x = NULL; x = malloc(4); *x = 5; y = x; printf("[%d]\n", *y); //prints 5 free(x); printf("[%d]\n", *y); //why doesn't print 5?, prints 0 instead return 0; }

    Read the article

  • FF extension: displaying an array of string elements in a sidebar

    - by sujay-jain
    I am developing a ff extension which displays a list of elements from an array (dynamic) in the sidebar. The array is dynamic and needs to be constructed in a function everytime the sidebar is opened (or any other event handler). Later, i will need to implement link functionality on parts of the string. What is the best way to go about this? I have created an empty sidebar and just know the label element as of now. menu, and menuitem dont work. What other elements can i use to display text in a good way which supports dynamic contruction. Is there some good tutorial/sample extension which i can see and learn?

    Read the article

  • firefox sidebar menu or list of elements. resources/help

    - by sujay-jain
    I am struggling to find any resources on firefox extensions which construct a sidebar and put elements into them. plus tyhe other functionalities within a sidebar. I have made a emptysidebar. Now i need to display a dynamic array(which is formed using a JS function). I have absolutely no idea how to go about it. Can someone please help! this is the code of the sidebar page. I need a xul element like the menuitem where i can display a list of items. How do i get that in a sidebar? <page id="sbEmptySidebar" title="emptysidebar" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" > <vbox flex="1"> <label id ="l1"> </vbox> </page>

    Read the article

  • Replacing text node of HTML input in PHP

    - by Aman Kumar Jain
    Hi, I want to replace all the text nodes in a html text. I'll explain with an example: $html = " <div> <p> text2 text2 word text2 <span>abcd</span> text2 text2 word text2 <p> this is a long, very long statement with punctuations. </div> I want to replace "text2 text2 word text2" with "<span>text2 text2 word text2</span>" and "this is a long, very long statement with punctuations." with "<span>this is a long, very long statement with punctuations.</span>" What should be the regular expression for the same?

    Read the article

  • Unexpected Error in Selenium

    - by Abhishek Dixit
    I am getting a Unexpected error in some of the Selenium RC code. Some time it works fine but sometimes it gives the Unexpected error and the scripts stop at that line only. Example: There is script for "Login" than it click on the link than fills some form than press some button. Sometimes its run till Login, sometimes till click of a link sometimes it executes full. Please give me some solution for this its urgent.

    Read the article

  • how to calculate total days from starting date to end date in c#,.net?

    - by Rishabh jain
    i m making a project in which i have to calculate total number of days from starting date to ending date which are inserted in text box by user at run time in asp.net c#.i have to do this on button_click event.how to do this? i tried this- protected void TextBox14_TextChanged(object sender, EventArgs e) { // get date from first text box DateTime dold = Convert.ToDateTime(TextBox1.Text); DateTime dnew = Convert.ToDateTime(TextBox14.Text); TimeSpan daydif = (dnew - dold); double dayd = daydif.TotalDays; Label27.Text = dayd.ToString(); }

    Read the article

  • Javascript callback function does not work in IE8!

    - by Abhishek
    I have a callback function in my open social application which fetches remote date. This works perfect on Crome and Mozila browers but not in IE8. Following is the example for the same, help will be appriciated: This funcation: gadgets.io.makeRequest(url, response, params) makes the callback call and following function process the responce: function response(obj) { var str = obj.text; var offerDtlPg = str.substr(0, str.length); document.getElementById('pplOfrDetls').innerHTML = offerDtlPg; };

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10  | Next Page >