Friday, June 11, 2010

login application in j2me

Here is the code for login application in J2ME..

import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;

public class LoginMidlet extends MIDlet implements CommandListener {
private Display display;
private TextField userName;
private TextField password;
private Form form;
private Command cancel;
private Command login;

public LoginMidlet() {
userName = new TextField("LoginID:", "", 10, TextField.ANY);
password = new TextField("Password:", "", 10, TextField.PASSWORD);
form = new Form("Sign in");
cancel = new Command("Cancel", Command.CANCEL, 2);
login = new Command("Login", Command.OK, 2);
}

public void startApp() {
display = Display.getDisplay(this);
form.append(userName);
form.append(password);
form.addCommand(cancel);
form.addCommand(login);
form.setCommandListener(this);
display.setCurrent(form);
}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
notifyDestroyed();
}

public void validateUser(String name, String password) {
if (name.equals("qm") && password.equals("j2")) {
menu();
} else {
tryAgain();
}
}

public void menu() {
List services = new List("Choose one", Choice.EXCLUSIVE);
services.append("Check Mail", null);
services.append("Compose", null);
services.append("Addresses", null);
services.append("Options", null);
services.append("Sign Out", null);
display.setCurrent(services);
}

public void tryAgain() {
Alert error = new Alert("Login Incorrect", "Please try again", null, AlertType.ERROR);
error.setTimeout(Alert.FOREVER);
userName.setString("");
password.setString("");
display.setCurrent(error, form);
}

public void commandAction(Command c, Displayable d) {
String label = c.getLabel();
if(label.equals("Cancel")) {
destroyApp(true);
} else if(label.equals("Login")) {
validateUser(userName.getString(), password.getString());
}
}
}

Wednesday, June 9, 2010

HIBERNATE SPRING TUTORIAL

DEAR ALL,

I HAVE FOUND THE NEW HIBERNATE SPRING TUTORIAL FOR BEGINNERS..
THE LINK IS HERE,,

PLEASE REFER IT,,

HIBERNATE SPRING TUTORIAL

ADVANTAGES OF ROBOTS.TXT

THE ADVANTAGES OF ROBOTS.TXT ARE:-


1). It saves your bandwidth - the spider won't visit areas where there is no useful information (your cgi-bin, images, etc)

2). It gives you a very basic level of protection - although it's not very good security, it will keep people from easily finding stuff you don't want easily accessible via search engines. They actually have to visit your site and go to the directory instead of finding it on Google, MSN, Yahoo or Teoma.

3). It cleans up your logs - every time a search engine visits your site it requests the robots.txt, which can happen several times a day. If you don't have one it generates a "404 Not Found" error each time. It's hard to wade through all of these to find genuine errors at the end of the month.

4). It can prevent spam and penalties associated with duplicate content. Lets say you have a high speed and low speed version of your site, or a landing page intended for use with advertising campaigns. If this content duplicates other content on your site you can find yourself in ill-favor with some search engines. You can use the robots.txt file to prevent the content from being indexed, and therefore avoid issues. Some webmasters also use it to exclude "test" or "development" areas of a website that are not ready for public viewing yet.

5). It's good programming policy. Pros have a robots.txt. Amateurs don't. What group do you want your site to be in? This is more of an ego/image thing than a "real" reason but in competitive areas or when applying for a job can make a difference. Some employers may consider not hiring a webmaster who didn't know how to use one, on the assumption that they may not to know other, more critical things, as well. Many feel it's sloppy and unprofessional not to use one.

Tuesday, June 8, 2010

INHERITANCE

Different kinds of objects often have a certain amount in common with each other. Mountain bikes, road bikes, and tandem bikes, for example, all share the characteristics of bicycles (current speed, current pedal cadence, current gear). Yet each also defines additional features that make them different: tandem bicycles have two seats and two sets of handlebars; road bikes have drop handlebars; some mountain bikes have an additional chain ring, giving them a lower gear ratio.

Wednesday, June 2, 2010

BEST BOOK ON SPRING

DEAR ALL,

THE BOOK ATTACHED IS THE BEST BOOK FOR SPRING BEGINNERS..

SO GO FOR IT..



HERE IS THE LINK..
Spring Mvc Step By Step