Wednesday, June 23, 2010

Solution to dwr session error

Edit your web.xml file and and the following code.

<init-param>
<param-name>crossDomainSessionSecurity</param-name>
<param-value>false</param-value>
</init-param>

Sunday, May 9, 2010

Move large number of files in solaris using "awk"

  • Change directory where your files are located.
  • Use the following "awk" script to move files from one location to another.
  for k in `ls | awk '{print $1}'`; 
  do 
  mv $k destination;
  done

Monday, May 3, 2010

Use java 64 bit version

You have to use 64bit version of java when your memory allocation is larger than 4Gb.

Use -d64 parameter when running the application.

java -d64 -jar -Xms1024m -Xmx4096m Test.jar

Sunday, May 2, 2010

Type Cast in Java Script

In js, variables are created as var type. That means, js engine can cast it to the original type by itself.

parseInt(12) will be converted 12 to an Integer value.

           Example                           Result 
parseInt("12")                          12
parseInt("12.657")                    12
parseInt("12aaaa")                   12
parseInt("aaaa")                NaN (means "Not a Number")

Friday, April 23, 2010

Encrypt, Decrypt password in Mysql

Inserting password encrypted to database using the following sql.

INSERT INTO PASSWORD(pass) VALUES(DES_ENCRYPT('user password')); 

This SQL will encrypt the user inserted password to a encrypted text. In table level, password is unreadable.
Instead of DES_ENCRYPT() method you can come up with your own function.

Selecting password from database to a string.

SELECT DES_DECRYPT(pass) FROM PASSWORD ;

This SQL will return user password as user inserted.



Monday, March 29, 2010

weblogic.xml to use on memory session replication

<?xml version="1.0" encoding="UTF-8" ?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<session-descriptor>
<timeout-secs>300</timeout-secs>
<invalidation-interval-secs>60</invalidation-interval-secs>
<persistent-store-type>jdbc</persistent-store-type>
<persistent-store-pool>SessionDS</persistent-store-pool>
<persistent-store-table>WL_SERVLET_SESSIONS</persistent-store-table>
</session-descriptor>
</weblogic-web-app>

Use the above code for weblogic.xml. Your weblogic cluster MUST be configured to use jdbc persistence store to capture web-browsers and nodes sessions. WL_SERVLET_SESSIONS is the table for session store.

Add this weblogic.xml file to your WEB-INF directory and deploy your application to the weblogic cluster. When a cluster node down, it will replicate all the JSP sessions associates with the clients.

Sunday, March 14, 2010

Add your own jars to weblogic application

Sometimes weblogic server uses its server lib .jars. If you want your application to use your own versions of .jar files, add following code to your weblogic.xml file located in WEB-INF directory.

<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>

This will use libraries in your application.