The man is Expert for some thing in the world. So all of Expert can join with us and Share your knowledge and Experience. Following this blog you can be a Expert.
Virus?????????? Are you afraid??? In this post i write about how to create a simple virus. Actually this simple. To write this virus you want windows note pad. Actually this not a virus(but it is work like a virus). This some program. OK.. let's start.
Open the Notepad
Copy and Paste code attrib +a +s +r +h /s /d
Save this as hide.bat
Copy this bat file to folder which you like (but not to Windows) and double click
Now you can see all of folders and files are hided.
OK. this is the first steps. this step is for show the above file
Open the Notepad
Copy and Paste code attrib -a -s -r -h /s /d
Save this as show.bat
Copy this bat file to folder that all files are hide(above folder).
This post is not about IT. But i think it is very valuable to you. This video about how to tie a tie.I put this video because lot of gentlemen face a problem when they tie a tie. I also face that. so watch that..
This code is little bit difficult to understand than other code. This code want your basic SQL Language knowledge. I'll put SQL notes presently. Now you can learn it from using this link. Basic SQL
In this problem first you have to create a database and then create a table. I create Database called SWOWNER and create table called NAME.
And i add another field called ID(Jtextfield3) in our form. We can doing this without that field. but i think it is easy for you if i add that field.
in my table(Name) ID is the primary key. first you have to open the sql console or there have GUI based sqlide such as MySQL Control Center, PHP My admin(this is web based sqlguiide).
Code for create database.
Syntax CREATE DATABASE database_name
CREATE DATABASE SWOWNER;
Then go in to the database using following commands
Syntax
USE DATABASE_NAME;
USE SWOWNER;
Then you have to create a table in the SWOWNER database called as NAME.(there's no rule that the Database name and table names are writing Block letters. Its for you for understand easy). In the table there have three field called ID(int), Fname(varchar) and Lname(varchar).
CREATE TABLE NAME( ID int NOT NULL Fnamevarchar(255) NOT NULL Lnamevarchar(255)
PRIMARY KEY(ID)
)
in this table ID and Fnamecolomn aren't be null. it should be have value and Lname can be null. The primary key is ID.
okkkkk this are all about sql. not about java. now i write code for save button. so double click on the save(JButton1) button.
before coding to save button first you have to create db class. right click on the your package that consist in source package >> New >> Java class >> db >> Finish now it create db class. first you have to import sql drivers(i dont know what is the real name for that). To that we can use following command
import java.sql.*;
if we put * all of drivers are import. When we use netbeance ide it is automatically import this drivers. then write follwing commands in the db class.
private static Connection con; public static Connection getMyConnection() throws Exception{
Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/SWOWNER", "root", "");
if we didn't use this db class not problem. the problem is we have to write above command all place where we connected java and sql. so i think crate db class is suitable and its very clear full.
before code the save button you have to add mysql-connector-java-5.0.7-bin.jar to libraries. To know about how to download and installed mysql java connecter click here.
to add java sql connector file to the netbeance right click on the libraries>> Add JAR/Folder >> select the file>>open. If it add it shows like following picture.
OKKkk. now we can write code for save button.
Save Button Command
try { Connection con = db.getMyConnection(); Statement stmt = con.createStatement(); String sql=" insert into NAME() values('"+ jTextField1.getText() +"','"+ jTextField2.getText() +"','"+jTextField3.getText()+"')";
jTextField1.getText():>>this code means that get all data that in the jtextField1. this code write inside in ' " + + " ' (don't forget)
insert into Table_Name() :>> this code is sql code. we can put out column name in the bracket. If we didn't use all fields(columns) to save data we should write the coloumn names that we use to save data
i think that second code is good if you use. because it is very clear if we use large number of feilds for table and we can check each textfield.(soon on).
I use above example for show that. There have Exit button(jButton2). When you press Exit button it should close the forms. To that there have another simple code.
First double click on the exit button(or right click >> Event >> actionPerformed). Now it show the relevant methode. Then type this code.
this.dispose();
Now its OK. If you press Exit button it will close. Amazing....
I create simple form using netbeance. In this form there have First Name(jLabel1), Last Name(jLabel2), two fields(jTextField1, jTextField2) and two buttons Save(jButton1) Exit(jButton2).
Now if i run the program it display simple form. I add First Name in to the Jtextfield1 and press enter. The curser didn't go to other field. PROBLEM???????
To solve this problem there have code. In this form i want to first add first name and then second name. So first go to the First Name textfield(Jtextfield1). Then Right click >> Events >> Key >> KeyPressed. Then show that methode. So there you have to write some small code.
if (evt.getKeyCode() == 10) { jTextField2.requestFocusInWindow(); }
10 meance if you press enter. This code saying, if you press enter at Jtextfield1 (==10) curser should go to the Jtextfield2.
if you execute your program using DOS command prompt it is belongs to command line execute mode. This is not user friendly. Today this type software use is rare. Now a day people trend is using GUI to execute java. in this post i hope to write how to design simple form using netbeance ide. if you want design some software i recommended that first design the all forms that consist in your software in a paper. So you can freely design your software forms.(but it is your choice) . Ok friend now we look at how to create java application in netbeance. i put the all steps in snaps.
Step 1: double click in the netbence IDE(ha ha ha).
Step 2:File >> New Project Then show that dialog box. Select Java application and press next button.
If your machine not available java???? How do you know that? Yes. You can know that java installed to your machine or not. There have various ways.
Control panel >> check that java were installed.(if java were install the icon will show)
In command line type javac and press enter >> show some symbols and some valid commands.
Warning:
To show these things you have to set the path. I will show you how to set the path in presently.
Above steps are primary steps to know that machine had install java or not. OK. Do you have java in your machine??? Yes. so this below instructions are not relevant to you. But i think that it can improve your knowledge. Now i put how the java installed to the machine.
Installation of JAVA
To install java first you have to go to the sun.java web site. You can go to that site using following link.
After click the link you came there. Then select platform(Windows, Linux, Salaries,etc ). Then click download button. Then ask that your user name and password. If you regitered there you can add your user name and password. If you not its not problem. You can skip this step.