Pages

Saturday, 11 August 2012

HOW TO RUN JAVA RMI PROGRAM

 
Remote Method Invocation(RMI) facilitates object function calls between Java Virtual Machines(JVMs)
Step 1
$ first we create interface program like
           /*interface:inte.java*/
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface inte extends Remote
{
        int add(int a,int b)throws RemoteException;
        int sub(int a,int b)throws RemoteException;
        int mul(int a,int b)throws RemoteException;
        int div(int a,int b)throws RemoteException;
}

$ Save the program as inte.java, and compile the program
Step 2
$ Next create a server program like
            /*Server Program:cserver.java*/
import java.io.*;
import java.rmi.*;
import java.rmi.server.*;
import java.rmi.registry.*;
public class cserver extends UnicastRemoteObject implements inte
{
        public cserver()throws RemoteException
        {
                super();
        }
        public int add(int a,int b)throws RemoteException
        {
                return a+b;
        }
        public int sub(int a,int b)throws RemoteException
        {
                return a-b;
        }
        public int mul(int a,int b)throws RemoteException
        {
                return a*b;
        }
        public int div(int a,int b)throws RemoteException
        {
                return a/b;
        }
       
         public static void main(String args[])
        {
        try
        {
                inte c1=new cserver();
                String I="CI";
                Naming.rebind(I,c1);
                System.out.println("Server bound and started");
        }
        catch(Exception e)
        {
                e.printStackTrace();
        }
        }
}
$ Save the program as cserver.java, and compile the program
Step 3
$ Now create a client program like
            /*Client Program:cclient.java*/

import java.rmi.*;
public class cclient
{
public static void main(String args[])
{
        try
        {
        String I="CI";
        inte c=(inte)Naming.lookup(I);
        System.out.println("Ready to continue");
        int i=c.add(2,3);
        int j=c.sub(3,2);
        int k=c.mul(2,4);
        int l=c.div(4,2);
        System.out.println(i);
        System.out.println(j);
        System.out.println(k);
        System.out.println(l);
        }
        catch(Exception e)
        {}
}
}
$ save the program as cclient.java, and compile like
Step 4
C:\java\jdk1.5.0\bin>javac inte.java
C:\java\jdk1.5.0\bin>javac cserver.java
C:\java\jdk1.5.0\bin>javac cclient.java

C:\java\jdk1.5.0\bin>rmic cserver
C:\java\jdk1.5.0\bin>start rmiregistry
// we see the new empty block cmd prompt
//new window
C:\java\jdk1.5.0\bin>java cserver
Server bound and started.
//new window
C:\java\jdk1.5.0\bin>java cclient
Ready to continue

5
1
8
2
                                                                        Thank you
                                                                     By BOOBALAN

HOW TO RUN C GRAPHICS PROGRAM


Five easy step to make your TC able to run graphics program are as follows.
1.     Download turbo 3 and install.
2.     Open the C:\TC\BGI and select and copy the CGA.BGI and EGAVGA.BGI FILES .
3.     Save the above to files in to C:\TC\BIN\ directory.
4.     Open TC .EXE and click the options->linker->libraries and select the graphics library option.
5.     And now you can compile your graphics program.

  THANK YOU
BY BOOBALAN

Wednesday, 8 August 2012

How to create java package programs

Hai now i show how to write java package programs and explain with examples

Step 1.
first create a java package like
note:  $ we must create sub directory to store the package
         $ package name and sub directory name are same
$ create a directory like
          c:\program files\java\jdk1.5.0\bin>md student
$ enter the sub directory like
          c:\program files\java\jdk1.5.0\bin>cd student
          c:\program files\java\jdk1.5.0\bin\student>
Step 2.
now we can type the package program
syntax : package packagename;
example :
         c:\program files\java\jdk1.5.0\bin\student>edit
package student;
public class p1
 {
    public void display()
       {
          System.out.println(" this is package");
        }
}

$ save the package as p1.java
$ and exit the program
Step 3.
compile the package program like
          c:\program files\java\jdk1.5.0\bin\student>javac p1.java
with no error go for next step
Step 4.
type the main program
here we just come out the sub directory and create the program like
         c:\program files\java\jdk1.5.0\bin\student>cd..
         c:\program files\java\jdk1.5.0\bin>
go for edit
         c:\program files\java\jdk1.5.0\bin>edit
              
                import student.p1;
                class p2
                  {
                     public static void main(String args[])
                        {
                            p1 ob = new p1();
                            ob.display();
                         }
                   }

$ save and exit the program like p2.java
$ compile and run the program like
          c:\program files\java\jdk1.5.0\bin>javac p2.java
$ without error
         c:\program files\java\jdk1.5.0\bin>java p2
          this is package
         c:\program files\java\jdk1.5.0\bin>


thank you by,  
          R.Boobalan




   

Sunday, 8 July 2012

How to make dial-up connection to you pc

For example we do a Bluetooth connection

 1. connection your mobile and PC 
 2. go to -> my Bluetooth place right click your smart phone icon    (ex:Nokia 7610)click connect to dial-up networking.
 3. close the connection tag.
 4. Right click on my computer ->properties->hardware->device manager->modems->Bluetooth modem
 5. Right click Bluetooth modem->properties->advanced
 6. and we see Extra initialization commands: and type +CGDCONT=1,"IP","TATA.DOCOMO.INTERNET"(for docomo connection)
 7. press ok, and close the device manager.
 8. then start->connect to->show all connections->we see Bluetooth connection icon.
 9. and double click the icon , and change the dial no : *99***#.
 10. and press Dial


Than you will get the dial-up connection.
 Thank you by BOOBALAN....

How to delete shortcut virus

  1. Go to Start Menu > Run
  2. Type cmd (cmd stands for command prompt)
  3. And using cd\ 
  4. Next change particular directory (ex:cd f:)
  5. Then type f:\attrib -h -r -s /s /d f:\*.*
  6. After your get the shortcut files in your f drive
  7. Now you can remove the recycle floder
  1. +s - meaning it is a system file (which also means that you cannot delete it just by using the delete command)
  2. +h - means it is hidden (so you cannot delete it)
  3. +r - means it is a read only file ( which also means that you cannot delete it just by using the delete command)
 Find autorun.inf

  1. Type attrib -s -h -r autorun.inf ( be sure to include -s -h -r because you cannot change the attributes using only -s or -h or -r alone)
  2. Type attrib again to check if your changes have been commited
  3. If the autorun.inf file has no more attributes, you can now delete it by typing del autorun.inf
  4. Since SilentSoftech.exe is a malware you can remove its attributes by doing step 1 and step 3(just change the filename) ex. attrib -s -h -r silentsoftech.exe

Make auto shutdown with shortcut


You can find free auto shutdown applications on the net, but your Windows XP has this feature too. If you want to make your own then follow these steps:
  1. Make a new shortcut on your desktop, don’t know how to make new shortcut, read on bloggers. Right click on empty area of your desktop, choose New and then Shortcut. This will open Create Shortcut wizard window. Now type ‘ shutdown –s –t 3600 –c “Maintenance” ‘. Click Next and then give a name for your new shortcut, Click Finish.
  2. The number ‘3600’ is the number for countdown in second, so you can give your own number here (just change the number). If you don’t want to display any message then delete this part ‘ –c “Maintenance” ‘. If you want to change the message then just change this part “Maintenance” with your own message.
  3. After you create a shutdown shortcut, you can make it prettier. How ? ... Easy, just right click on that shortcut and then choose Properties. Then under Shortcut tab, click Change Icon.. button and then choose better icon.
You also can make a shortcut to cancel your shutdown, here how:
Follow step 1, but this time type ‘ shutdown –a’, the next steps just same steps.
Important:
To do this you have to have in your machine the file shutdown.exe placed on c:\windows\system32\ or the program don't work, you have also to be administrator