Aptitude (12) ASP.NET (2) Automata (4) Browser (1) C (5) C# (1) C++ (10) Code (3) CSS (1) Data Structure (1) DATABASE (3) HTML (1) java (43) JSP (1) math (1) MySql (8) other (6) php (3) Servlet (3)

Sunday, 12 February 2012

Package Demo


Package demo:
Creating a user define package
-          A package is a folder having related set of classes
-          Two packages can have classes with same name
-          Such packages get placed into some folder on some driver
-          It works as a library for any project
Steps
  1. Create a folder as container of your packages
    1. d:\mypackages
  2. Think your package names and created sub folders with those names under your container folder
    1. E.g. p1 and p2
  3. Create your classes and place them into these folders
    1. Each class must have package command on top

Example
Create a class as General having some general methods like SquareRoot, CubeRoot and place it into p1 package

Create another class as Sample in package p2 having some sample method like Hi(), Hello()

Create a class UsingPackage where input a number from keyboard and print square root and cube root of that number using the class General of p1 package.

Note: To search the classes inside the packages, we need to define the CLASPATH

CLASSPATH is an environment variable to search the class files

For Kawa
            Packages à classpath à Add Dir… à Select the folder name having the packages
            D:\mypackages

For DOS
-          Set the CLASSPATH using
o   SET CLASSPATH=%CLASSPATH%;d:\mypackages;

For NetBeans
-          Select Libraries Properties
§  Add Jar/Dir…

Note:
 Remember  every properties of  classes,methods,packages etc. otherwise you can find such types of errors:

1.--------------------------- Compiler Output ---------------------------
UsingPackage.java:1: package p1 does not exist import p1.*; ^ UsingPackage.java:11: cannot find symbol symbol  : variable MyClass location: class UsingPackage           System.out.println("Square root is : "+MyClass.square(n));                                               ^ 2 errors

2. --------------------------- Compiler Output ---------------------------
UsingPackage.java:11: square(int) is not public in p1.MyClass; cannot be accessed from outside package         System.out.println("Square root is : "+MyClass.square(n));                                                      ^ 1 error

3. --------------------------- Compiler Output ---------------------------
UsingPackage.java:11: square(int) is not public in p1.MyClass; cannot be accessed from outside package         System.out.println("Square root is : "+MyClass.square(n));                                                      ^ 1 error


Saturday, 4 February 2012

Private Browsing


When we use computer of others we should use “Private Browsing” option of Browsers.
Because In a Private Browsing session, Browser won't keep any history, search history, download history, web form history, cookies, or temporary internet files.  However, files you download and bookmarks you make will be kept.

CTRL+shift+p for  firebox


Take a backup or Restore backup on same version DB

You can copy all the files or selected files from the data folder of installed mysqls server folder.
and you can paste it on other computers. note that the version of mysql shloud be same from where you cpoied and to where you want past


Friday, 3 February 2012

Take a backup or Restore backup

1. Go to download paath of MySql administrator and download it.
2.Install the above downloaded software on your Computer where mysql database be already installed.
3. After installing the above software ,Run this software.
4.It will demand password of your MySql server. So Enter your MaSql server password which s/w is already installed on your computer.
5.Now You will take backup or Restore your backup in/from .sql format.
6. a screensot is given below
.







Wednesday, 1 February 2012

A very simple way for connecting MySQL

  • Make a lib names folder inside WEB-INF folder of your project.
  • Go to Download This MySQL connector  .JAR file    and download it.
  • Place the above downloaded jar file inside the lib folder which is created in step 1.
  • now place your servlet's classes file into classes folder.
  • place web.xml file of your project into WEB-INF folder.
  • Run tomcate and enter your project's running URL.
  • Process completed.