Tuesday, June 30, 2009

how to add an external weblogic server to jdeveloper

add "Oracle\Middleware\wlserver_10.3\server\lib\weblogic.jar" file to "Oracle\Middleware\jdeveloper\jdev\lib\ext" and restart the jdeveloper.

1) In jdevepoler view menu choose "Application Server Navigator".

2) Then right click on the "Application Servers" and select "New Application Server".

3) Enter weblogic server ip , port, username, password.

4) Enter the weblogic domain as "WLS_Domain";

5)Test your cnnection.

6) Right click on your project select Deploy --> to your weblogic server.

get integer value of a char

int x = str.charAt(1)

This return the integer values of the char.

ex:-

A = 97

Friday, June 26, 2009

Disable back button in IE using js

use this code in your page onload method.

window.history.forward(1);

Sunday, June 14, 2009

remove unwanted chars (new line,tab) in java

String truncated = originalString.replaceAll("\\p{Cntrl}", "");

Monday, June 8, 2009

mysal data load and unload

SELECT * INTO OUTFILE 't1.txt' FIELDS ENCLOSED BY '0' FROM t1;

LOAD DATA INFILE 'LEVEL4.TXT' INTO TABLE HSBC_LEVEL4 FIELDS ENCLOSED BY '|';

Friday, May 15, 2009

Autoboxing and Unboxing in java example

Java is an Object Oriented programming language. We have to deal with primitive types and objects together.

Here autoboxing comes to play the role. It wraps the primitive data type into a object. There are wrapper classes for it.

For Example : -

 public class FormatPrint {

     public static void main(String[] args) {

       System.out.printf("There is only %d thing.", 1);

     }

   }


The signature of the printf() is

printf(String format, Object... args)

But, inthe above example i have printed a integer value. This is called as autoboxing. This can be used in Generics,too.

Here is java normal java generic example : -

 import java.util.ArrayList;

   public class ManualBoxing {

     public static void main(String[] args) {

        ArrayList list = new ArrayList();

        for(int i = 0; i < 10; i++){

            list.add(new Integer(i));

        }

     }

   }

But we don't need to "new Integer(i)". We can use autoboxing and simply the code as follow.

import java.util.ArrayList;

    public class Autoboxing {

      public static void main(String[] args) {

          ArrayList<Integer> list = new ArrayList<Integer>();

          for(int i = 0; i < 10; i++){

             list.add(i);

          }

      }

    }

For further details : -

http://java.sun.com/j2se/1.5.0/docs/guide/language/autoboxing.html

Wednesday, May 13, 2009

Delete non empty directory in java

import java.io.File;

class DeleteDir {

public static void main(String args[]) {

deleteDirectory(new File(args[0]));

}

static public boolean deleteDirectory(File path) {

if( path.exists() ) {

File[] files = path.listFiles();

for(int i=0; i<files.length; i++) {

if(files[i].isDirectory()) {

deleteDirectory(files[i]);

}

else {

files[i].delete();

}

}

}

return( path.delete() );

}

}