Official Site

click here to view our new site launched

Pages

Wednesday, November 30, 2011

Sunday, April 24, 2011

How to Make bootable Windows 7 DVD

Windows 7 Bootable


Note:
you should select and change to 4.7gb as DVD size in Ultra ISO at top right corner.

Download boot_se7en.bif below

Saturday, April 23, 2011

Remove Windows7 Activation

To make windows 7 as full version without activation using keys.
  1. Download RemoveWAT tool
  2. Click and run as Administrator.
  3. Cilck on 'Remove WAT 'option.
  4. Then Wait after explorer restarts and see your windows 7 property window does not show " 30 days to activate windows" windows area.
You can download RemoveWAT tool from here

Tuesday, April 19, 2011

MYSQL connectivity Java

// java bean for database connection to MySQL

package db;
import java.sql.*;

public class DbConnect {

private Connection conn = null;

public Connection OracleConnect() {
try {

Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
System.out.println("connected");
//return conn;
} catch (Exception e) {
//in case no password error catching error and try again.
try{
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "");
}
catch (Exception ee) {
System.out.println("Error in Database Connection2"+ee.getMessage());
}

System.out.println("Error in Database Connection1"+e.getMessage());
}
finally{
return (conn);
}
}

protected void CloseConnection() {
try {
conn.close();
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}
}



Tuesday, February 8, 2011

Random number generation in Java

import java.util.*;
import java.text.SimpleDateFormat;
import java.util.Date;

public class RandomGen {

public String genRandom() throws Exception {

String random = "";

Date date = new Date();

SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmssSS");

random+=sdf.format(date);

return random;
}

}

Friday, February 4, 2011

Store and Read image from Database Using Java



/* To Store image in database- Store.java */
import java.io.*;
import java.sql.*;

public class Store {


public static void main(String args[])throws Exception


{Connection con=null;
String url="";



try{
// Step 1. Load the Type 1 database driver:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// Step 2. Create a connection to the database
// using pre-defined Data Source:
File f=new java.io.File("c:/Temp.accdb");
File c=new java.io.File(System.getProperty("user.dir")+"/Temp.accdb");

if(f.exists())
url= "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" +f.getPath();
else if(c.exists())
url= "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" +c.getPath();

con = DriverManager.getConnection(url,"","");
File imgfile = new File("D:/semanticweb.jpg");

if(!imgfile.exists())
imgfile=new File("semanticweb.jpg");

FileInputStream fis = new FileInputStream(imgfile);
PreparedStatement psmnt = con.prepareStatement("INSERT INTO IMAGESTORAGE(IMAGE) VALUES(?)");
psmnt.setBinaryStream(1, (InputStream)fis, (int)(imgfile.length()));
int insertCount= psmnt.executeUpdate();
System.out.println(insertCount);
psmnt.close();
con.close();
}

catch(Exception e)
{
System.out.print(""+e);
}
}
}



/* To retrieve image from database and store in local directory- Retrieve.java */

import java.io.*;
import java.sql.*;

public class Retreival
{


public static void main(String args[])throws Exception


{
Connection con=null;
String url="";

int c;


// Step 1. Load the Type 1 database driver:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// Step 2. Create a connection to the database
// using pre-defined Data Source:
File f=new java.io.File("c:/Temp.accdb");
File ff=new java.io.File(System.getProperty("user.dir")+"/Temp.accdb");

if(f.exists())
url= "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" +f.getPath();
else if(ff.exists())
url= "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" +ff.getPath();

con = DriverManager.getConnection(url,"","");
PreparedStatement psmnt = con.prepareStatement("SELECT IMAGE FROM IMAGESTORAGE");
ResultSet rs = psmnt.executeQuery();
if(rs.next())
{

InputStream fis1;
FileOutputStream fos;
fis1 = rs.getBinaryStream("image");
fos = new FileOutputStream(new File("SunsetImageRead.jpg"));

while ((c = fis1.read()) != -1)
{
fos.write(c);
}

fis1.close();
fos.close();

}

}
}


Click here to download Complete workspace (database,image,Retrieve.java, Store.java)




Send Mail in Java


package mail;

import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;


public class SendMail {
String MAIL_SERVER = "smtp.gmail.com";


public void Sendmail(String USERNAME,String PASSWORD,String fromAddress,String toAddress,String subject,String message) {
try {

Properties properties = System.getProperties();
properties.put("mail.smtps.host", MAIL_SERVER);
properties.put("mail.smtps.auth", "true");

Session session = Session.getInstance(properties);
MimeMessage msg = new MimeMessage(session);

msg.setFrom(new InternetAddress(fromAddress));
msg.addRecipients(Message.RecipientType.TO, toAddress);
msg.setSubject(subject);
msg.setText(message);

Transport tr = session.getTransport("smtps");
tr.connect(MAIL_SERVER, USERNAME, PASSWORD);
tr.sendMessage(msg, msg.getAllRecipients());
tr.close();
} catch (AddressException ex) {
System.out.println(ex.getMessage());
}
catch (MessagingException ex) {
System.out.println(ex.getMessage());
}

}



public static void main(String[] args){

String USERNAME="xxxx@gmail.com";
String PASSWORD="your password";
String fromAddress="xxx@gmail.com";
String toAddress="toaddress";
String subject="your subject";
String message="your message";

s.Sendmail(USERNAME, PASSWORD, fromAddress, toAddress, subject, message);

}


}



click here to download mail.jar and SendMail Java bean
$2.49 .COM at GoDaddy.com! Expires 5/14/13