Thursday, December 9, 2010

Oracle Select Date

select * from audit_log
where CREATED_DATE > to_date('08-12-2010','dd-mm-yyyy')

Friday, December 3, 2010

Apache In Linux

Start Apache
goto /usr/local/apache2/bin
type: ./apachectl start

Stop Apache
goto /usr/local/apache2/bin
type: ./apachectl stop

Check Apache Service Available or Not
ps -ef | grep apache

If apache up, it will show something like this:-
daemon 1599 1589 0 10:52:38 ? 0:00 /usr/local/apache2/bin/httpd -k start
daemon 1600 1589 0 10:52:38 ? 0:00 /usr/local/apache2/bin/httpd -k start
daemon 1598 1589 0 10:52:37 ? 0:00 /usr/local/apache2/bin/httpd -k start

Wednesday, October 27, 2010

Convert int to double

int myInt = 255;
System.out.println("int value=" + myInt);

BigDecimal bdInt1 = new BigDecimal(Integer.toString(myInt));
BigDecimal bdInt2 = new BigDecimal(100);

bdInt1= bdInt1.divide(bdInt2);
double d = bdInt1.doubleValue();
System.out.println("double value=" + d);

Convert double to int

double myDouble = 2.55;
System.out.println("double value=" + myDouble);

BigDecimal bd1 = new BigDecimal(Double.toString(myDouble));
BigDecimal bd2 = new BigDecimal(100);

bd1= bd1.multiply(bd2);
int i = bd1.toBigInteger().intValue();
System.out.println("Int value=" + myDouble);

Monday, September 6, 2010

Zip Command

jar -cvf server.zip server.log

Tuesday, August 10, 2010

Export DB Script

exp db_user_name/password@DBSID file=backup_20100810.dmp log=backup_20100810.log owner=db_user_name

Monday, July 26, 2010

Grant All Permission

Grant all permission to all .sh file
1) go to the correct folder directory.
2) type command>> chmod 777 *.sh

Wednesday, July 7, 2010

Unix Command

Copy
cp -r fromFolderName toFolderName

JDK vs JRE

You must have a copy of the JRE (Java Runtime Environment) on your system to run Java applications and applets. To develop Java applications and applets, you need the JDK (Java Development Kit), which includes the JRE

Monday, May 24, 2010

Check Oracle Status in UNIX

Check Oracle Service Status

Login as orale:
[oracle]#su - oracle

Check status command:
[oracle]# lsnrctl status

Stop Oracle Service in UNIX

Stop oracle service

Login as oracle:
[oracle]#su - oracle

Stop service:
[oracle]# lsnrctl stop

Note: command=lsnrctl=LSNRCTL

Shutdown db:
[oracle]#dbshut

Start Oracle Service in UNIX

Start Oracle server in UNIX

Type the following command, enter:
Login as oracle:
[oracle]#su - oracle

start service:
[oracle]# lsnrctl start

Note: command=lsnrctl=LSNRCTL

start database:
[oracle]#dbstart

Friday, April 30, 2010

Eclipse Search Shortcut Key

Search shortcut key: ctrl + shift + T

Enable Eclipse Remote Debug in JBoss

1. Open run.bat and find the lines that look like this:

rem enable remote debugging.
set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y %JAVA_OPTS%

2. Start Jboss. (JBoss will hang there until you connect a debugger to it.)
3. In Eclipse, open your project, and on the toolbar click on the debugger bug arrow, then Open Debug Dialog.
4. Choose "Remote Java Application", right-click, New… and update the port to the address in the run.bat (address=8000, you could change it to any no).
5. Click Debug
6. Set a break point somewhere in your code or a library that has source attached
7. Exercise your project (via a web service, for instance) and when it hits one of your breakpoints, it will break in Eclipse.

Wednesday, April 28, 2010

Ibatis - BLOB Data Type

<resultMap id="soapDataResult" class="soapRequest">
<result property="action" column="ACTION"/>
<result property="reqMsg" column="REQ_MSG" jdbcType="BLOB"/>
</resultMap>


<update id="updateSoap" parameterClass="soapRequest">
UPDATE SOAP_REQUEST
SET REQ_MSG = #reqMsg:BLOB#
</update>

Check IMEI

Type *#06# to check IMEI value

Thursday, April 8, 2010

Unicode Character Set

Useful link

http://www.querytool.com/help/907.htm

http://www.oracle.com/technology/tech/globalization/pdf/TWP_NCHAR_Migration_10gR1.pdf

Tuesday, March 30, 2010

Convert Native to Ascii

Run below batch script in command prompt:-

native2ascii -encoding UTF-8 chinese.txt messages.properties

p/s: no need install any software

**********
Sample Content: chinese.txt

prompt.OldPassword=請輸入 [舊密碼]
prompt.NewPassword=請輸入 [新密碼]
prompt.ConfirmPassword=請輸入 [確認密碼]
prompt.PasswordLength=請輸入6-8位數字的 [新密碼]

***********
Sample Output: message.properties

prompt.OldPassword=\u8acb\u8f38\u5165 [\u820a\u5bc6\u78bc]
prompt.NewPassword=\u8acb\u8f38\u5165 [\u65b0\u5bc6\u78bc]
prompt.ConfirmPassword=\u8acb\u8f38\u5165 [\u78ba\u8a8d\u5bc6\u78bc]
prompt.PasswordLength=\u8acb\u8f38\u51656-8\u4f4d\u6578\u5b57\u7684 [\u65b0\u5bc6\u78bc]