Saturday, April 5, 2008

How to create Table using JAVA

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class SimpleTableExample extends JFrame
{

private JPanel topPanel;
private JTable table;
private JScrollPane scrollPane;


public SimpleTableExample()
{

setTitle( "Simple Table Application" );
setSize( 300, 200 );
setBackground( Color.gray );


topPanel = new JPanel();
topPanel.setLayout( new BorderLayout() );
getContentPane().add( topPanel );

// Create columns names
String columnNames[] = { "Column 1", "Column 2", "Column 3" };

// Create some data
String dataValues[][] =
{
{ "12", "234", "67" },
{ "-123", "43", "853" },
{ "93", "89.2", "109" },
{ "279", "9033", "3092" }
};

// Create a new table instance
table = new JTable( dataValues, columnNames );

// Add the table to a scrolling pane
scrollPane = new JScrollPane( table );
topPanel.add( scrollPane, BorderLayout.CENTER );
}

// Main entry point for this example
public static void main( String args[] )
{
// Create an instance of the test application
SimpleTableExample mainFrame = new SimpleTableExample();
mainFrame.setVisible( true );
}
}

JAVA Code for Home Rental Management

mport javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;

public class DataBase extends JFrame implements ActionListener
{
JButton btnAdd,btnNew,btnFind,btnDelete,btnCancel,btnView;
JLabel lblHouseNo,lblName,lblDate,lblAmount,lblempty;
JTextField txtHouseNo,txtName,txtDate,txtAmount;
JPanel panel1,panel2,panel3;
ImageIcon im;
Container con=getContentPane();
Connection cont=null;
Statement st=null;



public DataBase()
{
super("House Rental Management");
setSize(600,500);
setLocation(70,30);



panel1=new JPanel();
panel1.setLayout(new GridLayout(5,2));
lblHouseNo=new JLabel("Enter House Number:");
lblName=new JLabel("Enter Name:");
lblDate=new JLabel("Enter Date:");
lblAmount=new JLabel("Enter Amount:");
//lblAdvance=new JLabel("Enter Advance:");


txtHouseNo=new JTextField(15);
txtName=new JTextField(15);
txtDate=new JTextField(15);
txtAmount=new JTextField(15);
//txtAdvance=new JTextField(15);

panel1.add(lblHouseNo);panel1.add(txtHouseNo);
panel1.add(lblName);panel1.add(txtName);
panel1.add(lblDate);panel1.add(txtDate);
panel1.add(lblAmount);panel1.add(txtAmount);
//panel1.add(lblAdvance);panel1.add(txtAdvance);

panel2=new JPanel();
panel2.setLayout(new FlowLayout());

btnAdd=new JButton("ADD");
btnAdd.addActionListener(this);
btnAdd.setActionCommand("ADD");

btnNew=new JButton("NEW");
btnNew.addActionListener(this);
btnNew.setActionCommand("NEW");

btnFind=new JButton("FIND");
btnFind.addActionListener(this);
btnFind.setActionCommand("FIND");

btnDelete=new JButton("DELETE");
btnDelete.addActionListener(this);
btnDelete.setActionCommand("DELETE");

btnCancel=new JButton("CANCEL");
btnCancel.addActionListener(this);
btnCancel.setActionCommand("CANCEL");

btnView=new JButton("VIEW");
btnView.addActionListener(this);
btnView.setActionCommand("VIEW");

im=new ImageIcon("house.jpg");
lblempty=new JLabel(im);

JLabel el=new JLabel("Developed by BALU");
el.setForeground(Color.red);

panel2.add(btnAdd);
panel2.add(btnNew);
panel2.add(btnFind);
panel2.add(btnDelete);
panel2.add(btnView);
panel2.add(btnCancel);

panel3=new JPanel();
panel3.add(lblempty);
panel3.add(el);



con.add(panel1,BorderLayout.NORTH);
con.add(panel3,BorderLayout.CENTER);
con.add(panel2,BorderLayout.SOUTH);


show();
}

public void actionPerformed(ActionEvent ae)
{
String str=ae.getActionCommand();



if(str.equals("ADD")&&txtHouseNo!=null)
{
try
{
initializeConnection();
int no = Integer.parseInt(txtHouseNo.getText());
String name= txtName.getText();
String date = txtDate.getText();
int amount = Integer.parseInt(txtAmount.getText());
insertRecord(no,name,date,amount);
closeConnection();

}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,new String("Please! Enter all the Details:"),"",JOptionPane.INFORMATION_MESSAGE);
}

}
else if(str.equals("NEW"))
{
txtHouseNo.setText("");
txtName.setText("");
txtDate.setText("");
txtAmount.setText("");
txtHouseNo.requestFocus();
}

else if(str.equals("FIND"))
{
try
{
int hNo =Integer.parseInt(JOptionPane.showInputDialog(this,new String("Enter House No :"),"Find House...",JOptionPane.QUESTION_MESSAGE));
initializeConnection();

try
{
ResultSet myRs = getRecords("Select * from House where HouseNo="+hNo);

String message = " House No : "+myRs.getInt(1);
message = message + "\n Name : " + myRs.getString(2);
message = message + "\n Date :" + myRs.getDate(3);
message = message + "\n Amount :" + myRs.getInt(4);
JOptionPane.showMessageDialog(this,message,"House....",JOptionPane.INFORMATION_MESSAGE);

}
catch(Exception e) { JOptionPane.showMessageDialog(this,new String("Enter! Valid HouseNo:"),"",JOptionPane.INFORMATION_MESSAGE);
}

closeConnection();

}
catch(NumberFormatException nfe)
{
JOptionPane.showMessageDialog(this,new String("Fool! Enter a Number:"),"",JOptionPane.INFORMATION_MESSAGE);
}

}
else if(str.equals("DELETE"))
{
try
{
int hoNo =Integer.parseInt(JOptionPane.showInputDialog(this,new String("Enter House No to delete :"),"delete House...",JOptionPane.QUESTION_MESSAGE));
initializeConnection();

try
{
st.executeUpdate("Delete from House where HouseNo="+hoNo);

}
catch(Exception e)
{
}
closeConnection();

}
catch(NumberFormatException nfe)
{
JOptionPane.showMessageDialog(this,new String("Record deleted:"),"",JOptionPane.INFORMATION_MESSAGE);
}
}


else if(str.equals("CANCEL"))
{
System.exit(0);
}

else if(str.equals("VIEW"))
{
try
{
new TableDeneme();
}
catch(Exception e)
{
}

}
}


private void initializeConnection()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cont = DriverManager.getConnection("jdbc:odbc:balu","","");
st = cont.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
}
catch(Exception e) { }
}

private ResultSet getRecords(String query) throws SQLException
{
ResultSet rs=st.executeQuery(query);
rs.first();
return rs;
}

private void insertRecord(int houseNo,String name,String d,int amt)
{
name = "'" + name +"'";
d = "'" + d +"'";
String query = "insert into House values (" + houseNo +","+name+","+d+","+amt+")";

try
{
st.executeQuery(query);
} catch (Exception e) { }
JOptionPane.showMessageDialog(this,new String(" Record Added..."),"House....",JOptionPane.INFORMATION_MESSAGE);
}

private void closeConnection()
{
try
{
if (cont!=null)
{
cont.close();
st.close();
}
}
catch(Exception e) { }
}
public static void main(String args[])
{
DataBase db=new DataBase();
}
}





Code for TableDeneme:




import java.awt.event.*;
import java.awt.Window;
import java.awt.*;
import java.sql.*;
import java.io.*;
import java.util.Vector;
import java.util.EventObject;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.event.*;



class BasicWindowMonitor extends WindowAdapter{
public void windowClosing(WindowEvent e)
{
Window w=e.getWindow();
w.setVisible(false);
w.dispose();
System.exit(0);
}
}



class QueryTableModel extends AbstractTableModel{

Vector cache;
int colCount;
String[] headers;
Connection db;
Statement statement;
String currentURL;
String kolon;

public QueryTableModel()
{
cache=new Vector();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
}
catch(java.lang.Exception e)
{
System.err.println("Class not found exception : ");
System.err.println(e.getMessage());
}
}

public String getColumnName(int i)

{
return headers[i];
}

public int getColumnCount() {return colCount;}
public int getRowCount() {return cache.size();}

public Object getValueAt(int row,int col){
return ((String[])cache.elementAt(row))[col];
}

public boolean isCellEditable(int row, int col){ return true; }

public void setValueAt(Object value, int row, int col) {//are you editing?
/*prepare the query*/
/*you have to change the query to adapt it to your table*/
if(col==0) kolon="english";
if(col==1) kolon="turkish";
String s="update House set " + kolon + " = '" + (String)value + "' where " + kolon + " = '" + ((String[])cache.elementAt(row))[col] + "'";
System.out.println(s);
/*excecute the query*/
try{
statement.execute(s);
}catch(Exception e){System.out.println("Could not updated");}

((String[])cache.elementAt(row))[col] = (String)value;
fireTableCellUpdated(row, col);//also update the table
}
/*****end of abstracttablemodel methodlarý******/

public void setHostURL(String url){
if(url.equals(currentURL))
{return;}
closeDB();
initDB(url);
currentURL=url;
}

public void setQuery(String q){
cache= new Vector();
try{
ResultSet rs=statement.executeQuery(q);
ResultSetMetaData meta=rs.getMetaData();
colCount=meta.getColumnCount();
headers=new String[colCount];
for (int h=1;h<=colCount;h++) { headers[h-1]=meta.getColumnName(h); } while(rs.next()) { String[] record=new String[colCount]; for(int i=0;i
{record[i]=rs.getString(i+1);}
cache.addElement(record);
} //while sonu

fireTableChanged(null);
} //try sonu
catch(Exception e){
cache=new Vector();
e.printStackTrace();
}
} //setQuery sonu

public void initDB(String url){
try {
db=DriverManager.getConnection(url);
statement=db.createStatement();
}catch(Exception e){
System.out.println("Database could not started");
e.printStackTrace();
}
} //initDB sonu

public void closeDB(){
try {
if(statement!= null) {statement.close();}
if(db != null) {db.close();}
}catch(Exception e){
System.out.println("Database could not closed");
e.printStackTrace();
}
} //closeDB sonu

}

/* ***********************TableDeneme class********************* */
/* ***********************TableDeneme class********************* */
/* ***********************TableDeneme class********************* */
/* ***********************TableDeneme class********************* */

public class TableDeneme extends JFrame {

QueryTableModel qtm;
JTable table;
JScrollPane scrollpane;
JPanel p1,p2;
JButton jb,can;
ListSelectionModel rowSM;

public TableDeneme(){
super("Dictionary Window");
setSize(800,600);
setLocation(70,30);
setBackground(Color.blue);
qtm=new QueryTableModel();
table=new JTable(qtm);
scrollpane=new JScrollPane(table);
p1=new JPanel();
jb=new JButton("Click Here!");



can=new JButton("CANCEL");
can.setActionCommand("CANCEL");
p1.add(jb);



getContentPane().add(p1,BorderLayout.NORTH);
getContentPane().add(scrollpane,BorderLayout.CENTER);
getContentPane().add(can,BorderLayout.SOUTH);
addWindowListener(new BasicWindowMonitor());
setSize(500,500);
setVisible(true);

/*JOptionPane.showMessageDialog(new Frame(),"Press the button,\n"
+"It will fill the table with all records.\n"
+"Then you can edit the cells.\n"
+"When you select another cell, the previous one will updated.\n\n"

+"suhan@turkserve.net");*/


can.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
String str=e.getActionCommand();
if(str.equals("CANCEL"))
{
System.exit(0);
}
}
});

jb.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){

qtm.setHostURL("jdbc:odbc:;DRIVER=Microsoft Access Driver (*.mdb);UID=admin;UserCommitSync=Yes;Threads=3;SafeTransactions=0;PageTimeout=5;MaxScanRows=8;MaxBufferSize=2048;FIL=MS Access;DriverId=281;DBQ=HouseDB.mdb");
qtm.setQuery("select * from House where HouseNo orderby ASC");
}
});

}

public static void main(String[] args){
TableDeneme td=new TableDeneme();
}
}

Sunday, March 9, 2008

Sample Cover Letter and Resume(IT) for Fresher

Cover Letter

RESPECTED SIR / MADAM,

I have so mesmerized with your company’s record and profile. It incorporates all the things that my delusion work place has. So I wish to apply for the recruitment at your ward.

Here I have enclosed my curriculum vitae (CV) in application to the recruitment at your concern; I trust that you would accept my enclosed resume.

Even though I’m a fresher, I’m confident that my education and expertise will satisfy your search. I shall contribute my best to my work in order to drive out my passion and profession distinct from others to uphold the pride of my union by applying innovative thoughts intelligently and learning by practice.

Hence, I look forward to a personal interview with your personnel’s owing that you would be come back with a positive reply.

Thank you,
Place:

Date:

Yours truly,

(Your Name.)



RESUME


Your NAME

Mobile No: +XX-XXXXXXXXXX

E-mail : XXXXXXXXXXXXXX

Career Intention:

Provide Your Carrier Objective Here..................

Profile:

  • A Fresh Your Course(Example Engineering) graduate(Provide Your Branch)

  • Excellent Verbal and Written communication skills.

  • Add your Additional(specific) skills

Skill Set:


Languages : C, C++,JAVA, J2EE,.Net.

Web Designing : XML,DHTML,HTML, Photo Shop.

Operating Systems : Windows XP,98,Linux.

Database : Oracle

(You can add what you want..........)

Educational Qualifications:

Your school name,percentage,year of passing,etc...................

PPersonal Strength:

  • Your positive strengths

Project Details:

  • Your under graduate or post graduate project details. Provide your Project name,technology used,description,explanation.

Extra-Curricular

  • Provide your Extra Curricular activities here...(Example:Sports)

Personal Details:

  • Provide your personal details here.....

Example:Date of Birth,Gender,Nationality,Languages known,Address for Contact

Declaration:

I hereby declare that all the particulars furnished are true to the best of my knowledge and credence.

Signature of Aspirant,

(Your Name)








Thursday, February 28, 2008

A fun Love Story...............

I was like this

I saw a Girl

she was like this...

but actually with out make-up she was like this

but even i liked her


I like so much her . i told lot of
lies to her

example "u r soooo cute"


I gave costly gifts on feb 14th.. like this...



I gave a shock like this when she accepted

my proposal


I used to talk whole night and do this at office...


When ever i go with my gal friend , My friends

are look like this...


here I give a pose like this to them


Atlast my gal friend gave the roses to me like this..


I went to her home and shouted like: why u r cheating me

Her body-guard throw-out me

I was like this

dont know what to do started smoking...


I ended with


Monday, February 25, 2008

HDMI (High-Definition Multimedia Interface) Interface

HDMI (High-Definition Multimedia Interface) is DVI (Digital Visual Interface) with the addition of:

  • Audio up to 8-channels uncompressed
  • Smaller Connector
  • Support for YUV (Luminance-Bandwidth-Chrominance )Color Space
  • CEC (Consumer Electronics Control)
  • EIA/CEA-861B Info Frames

HDMI is a licensable audio/video connector interface for transmitting uncompressed digital streams. HDMI connects DRM-enforcing digital audio/video sources such as a set-top box, a HD DVD disc player, a Blu-ray Disc player, a personal computer, a video game console, or an AV receiver to a compatible digital audio device and/or video monitor such as a digital television (DTV). HDMI began to come out in 2006 on consumer HDTV camcorders and high-end digital still cameras.

Block Diagram


HDMI also includes provisions for HDCP. This allows content providers to prevent their programming from being illegally copied.

Features:

  1. HDMI can carry both uncompressed high definition video along with all existing multi-channel audio formats and even device control data in a single connector.
  2. HDMI represents the DRM (Digital Rights Management) alternative to consumer analog standards such as RF (coaxial cable), composite video, S-Video, SCART (Syndicat des Constructeurs d'Appareils Radiorécepteurs et Téléviseurs), and VGA(Video Graphics Array), and digital standards such as DVI(Digital Visual Interface) (DVI-D and DVI-I).
  3. HDMI is able to carry a bandwidth of 5-7 Gbps (gigabits per second) & formats.
  4. By design, HDMI was intended to be a smaller, more consumer-friendly connection.
  5. Supports High bandwidth Digital Content Protection – HDCP 1.1
  6. Backward compatible to DVI 1.0

Versions of HDMI

The following provides an overview of major functionality added to each version of HDMI:

HDMI 1.1:

  • Support for DVD Audio.

HDMI 1.2:

  • Added support for One Bit Audio, used on Super Audio CDs, up to 8 channels.
  • Availability of the widely-used HDMI Type A connector for PC sources and displays with full support for PC video formats
  • Ability for PC sources to use native RGB color space while retaining the option to support the YCbCr CE color space.
  • Requirement for HDMI 1.2 and later displays to support low-voltage (i.e., AC-coupled) sources, such as those based on PCI Express I/O technology.

HDMI 1.2a:

  • Consumer Electronic Control (CEC) features and command sets and CEC compliance tests are now fully specified.

HDMI 1.3:

  • Higher Data Rate and Resolution: HDMI 1.3 increases its single-link bandwidth to 340 MHz (10.2 Gbps) to support the demands of future HD display devices, such as higher resolutions, Deep Color and high frame rates.
  • Deeper Color: HDMI 1.3 supports 10-bit, 12-bit and 16-bit (RGB or YCbCr) color depths, up from the 8-bit depths in previous versions of the HDMI specification, for stunning rendering of over one billion colors in unprecedented detail.
  • Broader color space: HDMI 1.3 adds support for “x.v.Color”, which removes current color space limitations and enables the display of any color viewable by the human eye.
  • Mini connector: With small portable devices such as HD camcorders and still cameras demanding seamless connectivity to HDTV’s, HDMI 1.3 offers a new, smaller form factor connector option.
  • New Audio formats: HDMI 1.3 adds additional support for new lossless compressed digital audio formats Dolby TrueHD and DTS-HD Master Audio.

HDMI 1.3a:

  • Cable and Sink modifications for Type C
  • Source termination recommendation
  • Removed undershoot and maximum rise/fall time limits.
  • CEC capacitance limits changed
  • CEC commands for timer control brought back in an altered form, audio control commands added.

Types of HDMI Connectors:

Type A

Type A Connector Interface (HDMI Rev 1.3)

Pin

Signal

Pin

Signal

1.

TMDS Data2+

2.

TMDS Data2 Shield

3.

TMDS Data2-

4.

TMDS Data1+

5.

TMDS Data1 Shield

6.

TMDS Data1-

7.

TMDS Data0+

8.

TMDS Data0 Shield

9.

TMDS Data0-

10.

TMDS Clock+

11.

TMDS Clock Shield

12.

TMDS Clock-

13.

CEC

14.

Reserved (N.C. on device)

15.

SCL

16.

SDA

17.

DDC/CEC Ground

18.

+ 5V Power

19.

Hot Plug Detect

Shell

Ground Plane

Type B

Type B Connector Interface (HDMI Rev 1.3)

Pin

Signal

Pin

Signal

1.

TMDS Data2+

2.

TMDS Data2 Shield

3.

TMDS Data2-

4.

TMDS Data1+

5.

TMDS Data1 Shield

6.

TMDS Data1-

7.

TMDS Data0+

8.

TMDS Data0 Shield

9.

TMDS Data0-

10.

TMDS Clock+

11.

TMDS Clock Shield

12.

TMDS Clock-

13.

TMDS Data5+

14.

TMDS Data5 Shield

15.

TMDS Data5-

16.

TMDS Data4+

17.

TMDS Data4 Shield

18.

TMDS Data4-

19.

TMDS Data3+

20.

TMDS Data3 Shield

21.

TMDS Data3-

22.

CEC

23.

Reserved (N.C. on device)

24.

Reserved (N.C. on device)

25.

SCL

26.

SDA

27.

DDC/CEC Ground

28.

+ 5V Power

29.

Hot Plug Detect

Shell

Ground Plane

Type C

Type C Connector Interface (HDMI Rev 1.3)

Pin

Signal

Pin

Signal

1.

TMDS Data2 Shield

2.

TMDS Data2+

3.

TMDS Data2-

4.

TMDS Data1 Shield

5.

TMDS Data1+

6.

TMDS Data1-

7.

TMDS Data0 Shield

8.

TMDS Data0+

9.

TMDS Data0-

10.

TMDS Clock Shield

11.

TMDS Clock+

12.

TMDS Clock-

13.

DDC/CEC Ground

14.

CEC

15.

SCL

16.

SDA

17.

Reserved

18.

+ 5V Power

19.

Hot Plug Detect

Shell

Ground Plane

Pin Details:

Signal

Details

TMDS Data2+

Transition Minimized Differential Signaling

TMDS Data2 Shield

Transition Minimized Differential Signaling

TMDS Data2–

Transition Minimized Differential Signaling

TMDS Data1+

Transition Minimized Differential Signaling

TMDS Data1 Shield

Transition Minimized Differential Signaling

TMDS Data1–

Transition Minimized Differential Signaling

TMDS Data0+

Transition Minimized Differential Signaling

TMDS Data0 Shield

Transition Minimized Differential Signaling

TMDS Data0–

Transition Minimized Differential Signaling

TMDS Clock+

Transition Minimized Differential Signaling

TMDS Clock Shield

Transition Minimized Differential Signaling

TMDS Clock–

Transition Minimized Differential Signaling

CEC

Consumer Electronics Control

Reserved (N.C. on device)

No Connection

SCL

Synchronous clock

SDA

Synchronous Data

DDC/CEC Ground

Dynamic Display Clock

+5 V Power

Power supply

Hot Plug Detect

***********



Technical Specifications:

TMDS channel

* Developed by Silicon Image

* Carries audio, video and auxiliary data.

* converts an 8-bit signal into a 10-bit transition-minimized and DC-balanced signal

* TMDS is the key to transferring digital data from a TMDS transmitter to a TMDS receiver at high speeds up to 225 MHz.

* Audio sample rates: upto 192 kHz.

* Audio channels: up to 8.

DDC (DISPLAY DATA CHANNEL)

* Allows source to interrogate capabilities of sink (receiver).

* The DDC signal is used for device capability negotiation and HDCP(High-bandwidth Digital Content Protection) key exchange (HDMI handshake)

* I²C signaling with 100 kHz clock.

* E-EDID data structure according to EIA/CEA-861B and VESA (Video Electronics Standards Association) Enhanced EDID (Extended display identification data).

Consumer Electronics Control (CEC) channel (optional)

* Used for remote control functions.

* CEC Messages are sent using frames. Each CEC frame consists of a start bit, a header block and possibly data blocks

* One-wire bidirectional serial bus.

* Defined in HDMI Specification 1.1.

Disadvantages

No one is 100% perfect. The following are some disadvantage of HDMI

* Limited cable length

* Expensive cable cost

Reference

www.google.com

*************************************************************************************