Posts

Showing posts from June 22, 2010

How to make thumbnail of any image in java : code, Examples ?

 /* This code need to configure image magik tool for Image Processing */   /* This code is completable for all windows and Linux operating system */ public int thumbImageMaker(String inputImage, String outputImage, int width, int height) {         int returnCode = 0;         Process process;         try {             String[] command = { "convert", "-thumbnail", width+"x"+height, inputImage, outputImage };             process = Runtime.getRuntime().exec(command);             returnCode = process.waitFor();         } catch (IOException e) {             e.printStackTrace();         } catch (InterruptedException e) {             e.printStackTrace();         }         return returnCode;     }

How to calculate Image Height and Width : Java Code Examples.

How to calculate Image Height and Width in java // stdBoxWidth :  Width of your box where you want to render the Image file. // stdBoxHeight : Height of your box where you want to render the Image file. public Map getImageHeightWith(String imagePath, String imageName, int stdBoxWidth, int stdBoxHeight){         Map ht=null;                 /*          * this is the standard height & width of jsp box.          * */         int StdHeight=stdBoxHeight;         int StdWidth=stdBoxWidth;                 /*          * this variable is for after compress height & width.          * */         float afterReduceWidthSize = 0f;         float afterReduceheightSize = 0f;                 try {             ImageIcon imageI = new ImageIcon(imagePath+"/"+imageName);             /*              *  This is the original height & width of image.              * */             int oriHeight=imageI.getIconHeight();             int oriWidth=imageI.getIconWidth()

Abhi On Java: Invoking Web Services through a proxy using JAX-RPC and JAX-WS

Abhi On Java: Invoking Web Services through a proxy using JAX-RPC and JAX-WS Not very often, we face the possibility of invoking Web Services provided by external entities that are outside our network. Some companies solve this by configuring their network to allow some application servers to bypass proxy servers. Whatever be the case, when in development, developers have to to be able to invoke web services through proxies. This post will be describe how to Invoking Web Services through a proxy using JAX-RPC Invoking Web Services through a proxy using JAX-WS The solutions provided here are specific to Oracle Weblogic Server 10.3. I would suggest that you try the solutions provided on " Java Networking and Proxies ", and only if they don't work (which happened to me), try the following.

Become Master In Java: What makes a plugin secure?

Become Master In Java: What makes a plugin secure?

java Expert Solutions: Client / Server Environment for finger print captu...

java Expert Solutions: Client / Server Environment for finger print captu... : "In a client/Server environment, fingerprint capture is executed on the client system and the matching and storing of the fingerprint data ta..."

How to Install jdk in pc ?

Install JDK, Download JAVA show video here. Now a days, java is every where, In mobiles mostly you will found java application. Here video for installing jdk

How to read a file in java - code example

Java code for read a text file in java   File file =  new  File ( "C:\\filenamehere.txt" ) ;      FileInputStream fileInputStream =  null ;      BufferedInputStream bufferedInputStream =  null ;      DataInputStream dataInputStream =  null ;      try  {       fileInputStream =  new  FileInputStream ( file ) ;             bufferedInputStream =  new  BufferedInputStream ( fileInputStream ) ;       dataInputStream =  new  DataInputStream ( bufferedInputStream ) ;              while  ( dataInputStream .available ()  !=  0 ) {               System.out.println ( dataInputStream .readLine ()) ;        }             fileInputStream .close () ;       bufferedInputStream .close () ;        dataInputStream .close () ;      }  catch  ( FileNotFoundException e ) {        e.printStackTrace () ;      }  catch  ( IOException e ) {        e.printStackTrace () ;      }

Converts a normal string to a html conform string

 Converts a normal String to a HTML Conform String static String conv2Html(String st) {         StringBuffer buf = new StringBuffer();         for (int i = 0; i < st.length(); i++) {             buf.append(conv2Html(st.charAt(i)));         }         return buf.toString();     }

Converts some important chars (int) to the corresponding html string

   Converts some important chars (int) to the corresponding html string        static String conv2Html(int i) {         if (i == '&') return "&";         else if (i == '<') return "<";         else if (i == '>') return ">";         else if (i == '"') return """;         else return "" + (char) i;     }

How to find Mime Type of the file, depending on the extension of the filename?

find Mime Type of the file, depending on the extension of the filename static String getMimeType(String fName) {         fName = fName.toLowerCase();         if (fName.endsWith(".jpg") || fName.endsWith(".jpeg") || fName.endsWith(".jpe")) return "image/jpeg";         else if (fName.endsWith(".gif")) return "image/gif";         else if (fName.endsWith(".pdf")) return "application/pdf";         else if (fName.endsWith(".htm") || fName.endsWith(".html") || fName.endsWith(".shtml")) return "text/html";         else if (fName.endsWith(".avi")) return "video/x-msvideo";         else if (fName.endsWith(".mov") || fName.endsWith(".qt")) return "video/quicktime";         else if (fName.endsWith(".mpg") || fName.endsWith(".mpeg") || fName.endsWith(".mpe")) return "video/mpeg";  

how to converts a byte size in a kbytes or Mbytes size ?

Convert byte to kbyte or Mbytes static String convertFileSize(long size) {         int divisor = 1;         String unit = "bytes";         if (size >= 1024 * 1024) {             divisor = 1024 * 1024;             unit = "MB";         }         else if (size >= 1024) {             divisor = 1024;             unit = "KB";         }         if (divisor == 1) return size / divisor + " " + unit;         String aftercomma = "" + 100 * (size % divisor) / divisor;         if (aftercomma.length() == 1) aftercomma = "0" + aftercomma;         return size / divisor + "." + aftercomma + " " + unit;     }

Client / Server Environment for finger print capturing

In a client/Server environment, fingerprint capture is executed on the client system and the matching and storing of the fingerprint data takes place on server system. For this reason, Verify method can’t be used. Instead, VerifyMatch will be used. NBioBSPJNI.INPUT_FIR inputFIR = bsp.new INPUT_FIR(); NBioBSPJNI.INPUT_FIR inputFIR2 = bsp.new INPUT_FIR(); Boolean bResult = new Boolean(false); NBioBSPJNI.FIR_PAYLOAD payload = bsp.new FIR_PAYLOAD(); inputFIR.SetTextFIR(textSavedFIR); inputFIR2. SetTextFIR(textCapturedFIR); bsp.VerifyMatch(inputFIR, inputFIR2, bResult, payload); if (bsp.IsErrorOccured() == false) { if (bResult) labelStatus.setText("Verify OK - Payload: " + payload.GetText()); else labelStatus.setText("Verify Failed"); }

What is NBioBSP Java Library?

The NBioBSP Java Library (NBioBSPJNI.jar) is designed to support developers using JAVA environment. NBioBSP Java Library based Java Native Interface Technology that facilitates easily integration of NBioBSP by developers using Java development. The NBioBSP Java Library also uses NBioBSP.dll and provides higher level of interfaces. NBioBSP Java Library supports almost all NBioBSP functions. Only valid for NBioBSP.dll version 4.781 or higher. Only valid for JDK version 1.5.0_20 or higher. File list :- ■ NBioBSPJNI.jar This is the java library of the eNBSP SDK. ■ NBioBSPJNI.dll It implements all java native interfaces. It use with the windows platform. ■ NBioBSPJNI.so It implements all java native interfaces. It use with the Linux platform.

Call Java script function in Applet program code

import java.applet.*; import java.net.*; public class Test extends Applet{ public void init(){ String msg = "Call Java script function in Applet program code"; try { getAppletContext().showDocument (new URL(" javascript:doAlert (\"" + msg +"\")") ); } catch (MalformedURLException me) { } } }

How to Make Signed (Trust) Applet.

Step to Make Signed (Trust) Applet. C:\>keytool -genkey -alias signMyAppt -validity 365 Enter keystore password:qwerty1234 What is your first and last name? [Unknown]: Manoj Kumar Shakya What is the name of your organizational unit? [Unknown]: PA. Tech. Sol. What is the name of your organization? [Unknown]: PA. Tech. Sol. What is the name of your City or Locality? [Unknown]: Gurgaon What is the name of your State or Province? [Unknown]: Gurgaon What is the two-letter country code for this unit? [Unknown]: IN Is CN=Manoj Kumar Shakya, OU=PA. Tech. Sol., O=PA. Tech. Sol., L=Gurgaon, ST=Gur gaon, C=IN correct? [no]: Yes Enter key password for (RETURN if same as keystore password):qwerty1234 Re-enter new password:qwerty1234 Now Signed your applet. C:\>jarsigner TestApplet.jar signMyAppt

How to capture finger prints in java

Java code for capture finger prints. NBioBSPJNI.FIR_HANDLE hSavedFIR; hSavedFIR = bsp.new FIR_HANDLE(); bsp.Enroll(hSavedFIR, null); // Enroll bsp.Capture(hSavedFIR); // Capture // Get Text FIR if (bsp.IsErrorOccured() == false) { NBioBSPJNI.FIR_TEXTENCODE textSavedFIR; textSavedFIR = bsp.new FIR_TEXTENCODE(); bsp.GetTextFIRFromHandle(hSavedFIR, textSavedFIR); } // Get Binary FIR if (bsp.IsErrorOccured() == false) { NBioBSPJNI.FIR fullSavedFIR; fullSavedFIR = bsp.new FIR(); bsp.GetFIRFromHandle(hSavedFIR, fullSavedFIR); } You can capture both type in your database and file. 1)textFIR 2)BinaryFIR

How to compare two finger prints file in java

Steps for compare two finger print files. // Make obj of NBioBSPJNI NBioBSPJNI bsp = new NBioBSPJNI(); // Make two obj for two files. NBioBSPJNI.INPUT_FIR inputFIR = bsp.new INPUT_FIR(); NBioBSPJNI.INPUT_FIR inputFIR1 = bsp.new INPUT_FIR(); Boolean bResult = new Boolean(false); NBioBSPJNI.FIR_PAYLOAD payload = bsp.new FIR_PAYLOAD(); NBioBSPJNI.FIR_TEXTENCODE textSavedFIR = bsp.new FIR_TEXTENCODE(); textSavedFIR.TextFIR = fingureData; NBioBSPJNI.FIR_TEXTENCODE textSavedFIR1 = bsp.new FIR_TEXTENCODE(); textSavedFIR1.TextFIR = dbData; //Set both files in these objects. inputFIR.SetTextFIR(textSavedFIR); inputFIR1. SetTextFIR(textSavedFIR1); // call verify mathod. bsp.VerifyMatch(inputFIR1, inputFIR, bResult, payload); System.out.println(bResult); return bResult;

Recent Post

Recent Posts Widget