Magics

MAGIC #1

Found that nobody can create a FOLDER anywhere on the Computer which can be named as "CON". This is something funny and inexplicable? At Microsoft the whole Team, couldn't answer why this happened! TRY IT NOW, IT WILL NOT CREATE A "CON" FOLDER


MAGIC #2

For those of you using Windows, do the following:
1.) Open an empty notepad file
2.) Type "Bush hid the facts" (without the quotes)
3.) Save it as whatever you want.
4.) Close it, and re-open it.
Noticed the weird bug? No one can explain!


MAGIC #3

Again this is something funny and can't be explained?
At Microsoft the whole Team, including Bill Gates, couldn't answer why this happened!
It was discovered by a Brazilian. Try it out yourself?
Open Microsoft Word and type
=rand (200, 99)
And then press ENTER And see the magic?..!


Magic #4

Did you know that a flight number from one of the planes that hit one of the two WTC towers on 9/11 was Q33N. In Notepad / WordPad or MS Word, type that flight number i.e Q33N. Increase the font size to 72. Change the font to Wingdings. ..... u will be amazed by the findings!!!


Magic #5
type " Zerg rush" on Google search and then see what happens.



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


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

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
.







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.



Connection to Mysql Database and Run servlet action with database


2.extract this jar file wheather with the help of  command prompt or with the help of  RAR zip extractor.
3.After extracting mysql connector jar file,we will find three folder
·         Com
·         META-INF
·         org
 5.Copy com  folder .
6. Paste above copied folder into the classes folder of your project’s WEB-INF folder.
7. Now  we are  connected with Mysql database.
8.write your servlet program importing sql package.
Include in this program points  given below  or make then import a package of  confgiration of points given below  then import:
a.  use of class.forName() method
b. use of getConnection() of the DriverManager class.
c.use of createStatement,excuteUpdate,etc….
9.compile your  servlet program.
10.copy the classes  files.
11.paste those  into the classes folder of project’s WEB-INF folder .
12.make web.xml file
13.run tomcat.
14.enter your URL as localhost:potnumberas 8080/application folder name/url of main servlet file which is included in web.xml file of project
e.g.    http://localhost:8080/di/DataInsertion
15.Process completed


Counters