Java - contro lkeyboard 'lock key' state programmatically

Java Controlling the lock keys : Caps Lock, Scroll Lock, Num Lock 's state - programmatically
public class Lock_Key_Control_In_Java {
    public static void main(String[] args) {
        Toolkit tk = Toolkit.getDefaultToolkit();

        //enable disable key state Caps Lock, Scroll Lock, Num Lock keys
        tk.setLockingKeyState(KeyEvent.VK_NUM_LOCK, true);
        tk.setLockingKeyState(KeyEvent.VK_CAPS_LOCK, false);
        tk.setLockingKeyState(KeyEvent.VK_SCROLL_LOCK, false);
    }
}
The lock keys LED in the keyboard should be  turned ON or OFF ?

Java: Loading images in JFrame - Reusable ImageFrame

Sometimes we need to show multiple images in separate window by using single line statement :
new ImageFrame(inImg, "Input Image ");// inImg is reference to Image object
The code below can be used to load images in JFrame as a separate window.

java copy file, move file code example

Java source code - copying a file , moving a file - working source code example :
Code for deleting a folder and sub folder recursively is here 
public final class FileIOUtility {
    private FileIOUtility() {}
    public static void moveFile(File src, File targetDirectory) throws IOException {
        if (!src.renameTo(new File(targetDirectory, src.getName()))) {
            String str = (new StringBuilder()).append("Failed to move ").append(src).append(" to ").append(targetDirectory).toString();
            throw new IOException(str);
        } else

Installing Android SDK, ADT in eclipse

How to Install Android SDK, ADT
Step 0: Read the Documentations - 
Start from Android's mother site @http://www.android.com

Android: Introduction to android platform - framework

Brief Introduction

Android is an Operating System for mobile devices developed by Google, which is built upon Linux kernel. Android competes with Sambian OS,

Final Year Computer Project Suggestion, A HUGE LIST

Here is a list of project suggestion for final year project (BE computer).
I have collected them from various sites.

Screen capture Utility , Automatic Video Tutorial Maker
HTML Editor - text processing
Image Search engine using image clustering
Semantic WEB
PCI/USB FM RadiPlayer with Tunning, Volume Control, and capture feature
LAN Based Bit Torrent
Automatic Friend tagging on Facebook based on Face Recognition
Hostel Election Software
Collaborative Web Browsing
Web based Application for Multiple Clients
ATM USING FINGER PRINTS
WEBCAM BASED HUMAN MACHINE INTERACTION (WEBCAM MOUSE)
MAC Layer Scheduling in Ad-hoc Networks
WIRELESS AUDIENCE POLLING SYSTEM
FACE DETECTION USING HSV (BY PERFORMING SKIN SEARCH OF INPUT IMAGE)
Smart Mail Transfer Protocol
Windows Multi File Search utility
FTP Explorer
Harddisk data recovery tool
Consumer-oriented devices and services
Mobile TV and IPTV
Telemedicine portals
Gesture Recognition using ANN or HMM or ..
TCPIP Chat client server

Tutorial on Ibatis-Using Eclipse Ibator plugin to generate Persistence POJO Models, SqlMap and DAO :: with coverage of Dynamic SQL and working downloadable example

IBatis is a lightweight persistence framework that maps objects to SQL statements. The SQL is decoupled from the application logic by storing in XML descriptor file . SQL mapping is done by data mapper to persist objects to a relational database. 
In this article i am going to discuss on how to use ibator plugin in eclipse to generate Java model objects from your database, the DAO interface and its auto implementation to access your db and auto generated SQL map xml files. And also we will deal with fun of dynamic SQL.  The Link for downloading the working eclipse project is given at the end of article. For more detail about ibatis visit the references at last of this article.


Part A: Ibator/DB Configuration
Step 1. Installing IBator
Visit this link and download ibator plugin for eclipse

http://code.google.com/p/mybatis/wiki/Downloads?tm=2

Or From Eclipse Update Site :

http://ibatis.apache.org/tools/ibator
Step 2. Requirements and Project Configuration: 

EasyJFrame : Reusable JFrame class

Here, i am going to describe a reusable jFrame class, which can be used as substitute of standard console output.

Resuable JFrame CODE:

Java-Opening a URL in default browser with start utility in windows


Java-Opening a URL in default browser with start utility in windows
String cmd = "cmd.exe /c start ";
String file = "http://www.google.com";
Runtime.getRuntime().exec(cmd + file);

Dependency Injection with Java Spring IoC, A Complete Example


Here i am going to describe a simple example of Dependency Injection which uses Spring IoC framework.
You may refer to my earlier"Understanding Dependency Injection and Its Importance" for understanding the concepts.
This example uses Implementation of  Operation, Reader and Writer Interfaces.
We simply perform a one of the arithmentic Operation by taking values from Reader and write the values using Writer Class.

Reader Interface:
public interface Reader {
    Operands readValues(String promptMsg);
}

Its implementations can be:
ConsoleReader:
public class ConsoleReader implements Reader{
    Operands oprnds;
    Scanner sc;
    public ConsoleReader (){
        oprnds=new Operands();
        sc=new Scanner(System.in);
    }
    public Operands readValues(String promptMsg) {
        System.out.println(promptMsg);
        oprnds.setOp1(sc.nextLong());
        oprnds.setOp2(sc.nextLong());
        return oprnds;
    }
}


The Operation Interface
public interface Operation {
    Result operate(long op1,long op2);
    String getOperationName();
}


The Operation Interface can have implementations such as
Multiply
public class Multiply implements Operation {
    Result res;
    public Multiply(){
          res=new Result();
    }
    public Result operate(long op1, long op2) {
        res.setRes(op1*op2);
        return res;
    }
    public String getOperationName() {
        return "Multiply";
    }
}

Addition
public class Add implements Operation {
    Result res;
    public Add(){
        res=new Result();
    }
    public Result operate(long op1, long op2) {
        res.setRes(op1+op2);
        return res;
    }
    public String getOperationName() {
        return "Add";
    }
}


The  writer Interface
public interface Writer {
    void write(Result res);
}

Its ConsoleWriter Implementation
public class ConsoleWriter implements Writer{
 public void write(Result res){
    System.out.println("The result after operation : "+res.getRes());
  }
}

Its TXTFileWriter Implementation
public class TXTFileWriter implements Writer{
    File file;
    PrintWriter fwriter;
    public TXTFileWriter(){
        try {
           file = new File("output.txt");
           fwriter = new PrintWriter( new BufferedWriter( new FileWriter(file)));
       } catch (Exception ex) {
           System.err.println(ex);
        }
    }
    public void write(Result res)
  {
     fwriter.println(res.getRes());
     fwriter.close();
    }
}


The Model Classes
Operands
public class Operands {
    private long op1;
    private long op2;
//setters and getters
}

The Result Class
public class Result {
    private long res;
    //setters and getters
}


Now create a configuration file in class path i.e, src folder of project directory - confBean.xml.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="operation" class="com.gt.spring.operation.Add"/>
<bean id="reader" class="com.gt.spring.reader.ConsoleReader"/>
<bean id="writer" class="com.gt.spring.writer.ConsoleWriter"/>
<beans>

The dependency injection will help you to inject the implementations of an object at runtime.
In the Main Class: read the xml file and inject the dependent beans…
public class Main {
    public static void main(String[] args) {
    ApplicationContext ctx = 
new ClassPathXmlApplicationContext("confBean.xml");
        //get beans from ctx
        Reader rdr = (Reader) ctx.getBean("reader");
        Operation opr = (Operation)ctx.getBean("operation");
        Writer wrt = (Writer) ctx.getBean("writer");//
        //read operands
        Operands opnds = rdr.readValues("Enter the Values :");
        //do operation
        Result res =opr.operate(opnds.getOp1(), opnds.getOp2());
        //write result
        wrt.write(res);
    }
}