RX-30 Finger Print Module Device Interfacing

     Many of  you have must heard about the finger print sensor which actually a nice way to provide security.Here  i have given the interfacing of the R30-X finger print sensor module with  ARM LPC2148 board but the basics remains same for all the micro-controllers.     The first thing for interfacing the sensor with the controller is the handshaking,in which the controller first sends a signal or hex codes to the sensor and it acknowledges .After handshaking only the controller can talk to the sensor. unsigned char Message[16] =…

Read More

We are Dreamers

  We are the dreamers              We are the dreamers                                       with a dream of flying high,      We try to touch the sky,                                     And go to a boundless world.             We believe in what we are,                                   We do what we can.              Nothing can stop us,                                    because we are the dreamers.               Our dream is to built an INDIA,                                                   which world will know.               We tempted to achieve our goal,                                                    And eager to score it.                Everybody will know us,                                                    because we…

Read More

Simple currency converter in JAVA

Here goes a simple JAVA code to convert rupees by using the online yahoo exchange rates. Code: package com.oksbwn.currencyRate;import java.io.IOException;import javax.swing.JOptionPane;import org.apache.http.client.HttpClient;import org.apache.http.client.ResponseHandler;import org.apache.http.client.methods.HttpGet;import org.apache.http.impl.client.*;import com.oksbwn.popUp.popMe;public class YahooCurrencyConverter{ @SuppressWarnings({ “deprecation”, “resource” })public float convert(String currencyFrom, String currencyTo) throws IOException { HttpClient httpclient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(“http://quote.yahoo.com/d/quotes.csv?s=” + currencyFrom + currencyTo + “=X&f=l1&e=.csv”); ResponseHandler responseHandler = new BasicResponseHandler(); String responseBody = httpclient.execute(httpGet, responseHandler); httpclient.getConnectionManager().shutdown(); return Float.parseFloat(responseBody); } public void convertToRs(){String to = null; String amnt=JOptionPane.showInputDialog(null, “Any to rupee..”,”$”); //if (“$”.charAt(0).((); if(amnt.substring(0,1).compareTo(“$”)==0) to=”USD”; if(amnt.substring(0,1).compareTo(“E”)==0) to=”EUR”; double ghh=1; try{…

Read More

JFrame that pops-up from the taskbar like notifications.

Here i have given the JAVA code to make a popup that happens exactly like the gmail desktop application does.It uses a JFrame to make the window. Code: package com.oksbwn.popUp;import java.awt.*;import java.awt.event.*;import javax.swing.*;import com.oksbwn.ErrorHandling.handleExceptions;import resources.RscLoader;public class popMe extends JFrame { private static final long serialVersionUID = 1L; public static void main(String[] args) throws Exception{ new popMe(“hi”, “from Bikash”, “ok”,15, 125); }public popMe(String message,String header,String image, final int time,int height) { Runnable r = new newThreadPop(message,header,image,time,height); new Thread(r).start(); } } class newThreadPop implements Runnable { private String message; private String header;…

Read More

A Transparent screen to lock the Desktop.

In this code i am sharing the code to lock the PC screen by using a transparent JFrame so as to restrict others to use it.The frame disappears  only when the user enters the right username and password.This enables the user to let the background tasks going on and lock the screen.This has the only problem that it can be closed by the task manager.If you find a solution to it please let me know.Code: package com.oksbwn.systeminteraction;import java.awt.Color;import java.awt.Dimension;import java.awt.Toolkit;import java.awt.event.KeyAdapter;import java.awt.event.KeyEvent;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import java.io.IOException;import javax.microedition.io.Connection;import javax.microedition.io.Connector;import javax.swing.BorderFactory;import javax.swing.JButton;import javax.swing.JComponent;import…

Read More

Drive space usage information in JAVA

This JAVA code gives the dpace usage by the ‘c:’ drive you can modify it for others. Code: package com.oksbwn.systeminteraction;import java.io.File;public class DiskSpaceDetail{ public String FreeSpaceInDrive() { String space=””; File file = new File(“C:”); long totalSpace = file.getTotalSpace(); //total disk space in bytes. long usableSpace = file.getUsableSpace(); ///unallocated / free disk space in bytes. space=space+”C:”; space=”T: “+ totalSpace /1024 /1024 + ” MB F: “+ usableSpace /1024 /1024+” MB”; return space; } }

Read More

Taking a snap of the Desktop in JAVA

Here i have gioven the code to take a snap of the desktop using JAVA.Hope you will use it in your own way. Code: package com.oksbwn.systeminteraction;import java.awt.Color;import java.awt.Dimension;import java.awt.MouseInfo;import java.awt.Point;import java.awt.Rectangle;import java.awt.Robot;import java.awt.Toolkit;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import java.awt.image.BufferedImage;import java.io.File;import javax.imageio.ImageIO;import javax.swing.*;import resources.RscLoader;import com.oksbwn.ErrorHandling.handleExceptions;import com.oksbwn.popUp.popMe;public class CaptureScreen { static JFrame frame2=new JFrame(); static Point p; static Point R; static Point D; static int Finaly; static int Startx; static int Starty; static int Finalx; static JTextField jt=new JTextField(); public static void main(String[] args) { CaptureScreen cS=new CaptureScreen(); cS.SnapTaker(); } public void SnapTaker() { Dimension…

Read More

PC Login Duration in JAVA

This code snippest is about getting the time duration from which the user has been logged in using JAVA.  code: package com.oksbwn.systeminteraction;import java.io.BufferedReader;import java.io.InputStreamReader;import java.text.SimpleDateFormat;import java.util.Date;public class OsLoginTime { public static long getSystemUptime() throws Exception { long uptime =0000; Process uptimeProc = Runtime.getRuntime().exec(“net stats srv”); BufferedReader in = new BufferedReader(new InputStreamReader(uptimeProc.getInputStream())); String line; while ((line = in.readLine()) != null) { if (line.startsWith(“Statistics since”)) { SimpleDateFormat format = new SimpleDateFormat(“‘Statistics since’ MM/dd/yyyy hh:mm:ss a”); Date boottime = format.parse(line); uptime = System.currentTimeMillis() – boottime.getTime(); break; } } return uptime/36000;//in millisecond }}

Read More

Get own IP address in JAVA

This is a code snippest to get the current IP address of own system. code: package com.oksbwn.systeminteraction;import java.net.InetAddress;import java.net.UnknownHostException; public class IpAdress{ //public static void main(String[] args){public static InetAddress getIP(){ InetAddress ip; try {ip = InetAddress.getLocalHost(); return ip; } catch (UnknownHostException e) {e.printStackTrace();} return null; } }

Read More

Draggable Transparent JFrame in JAVA

Here i am going to post about a JFrame that is transparent ,having a close button and is draggable.The JAVA code is given below. Code: public class transparentJFrame { public static void main(String[] args) { new transparentJFrame(Date,Head,Detal); }public transparentJFrame(String Date,String Head,String Detal) { JFrame frame = new JFrame(); frame.setUndecorated(true); frame.setBackground(new Color(Color.black.getRed(), Color.black.getGreen(),Color.black.getBlue(),1)); //Change value of ‘1’ above to have diff transparency ((JComponent)frame.getContentPane()).setBorder( BorderFactory.createMatteBorder( 3, 2, 2, 2, Color.black)); frame.setBounds(100, 50, 500, 400); frame.getContentPane().setLayout(null); final JLabel lblX = new JLabel(“X”); lblX.setBounds(frame.getWidth()-15,5,15,15); lblX.setForeground(new Color(255, 255,255)); lblX.setToolTipText(“Closern”); lblX.addMouseListener(new MouseAdapter() { @Override public void…

Read More