Today just hit an OutOfMemoryError when using Gant build script to compile my code.
Google for way to set heap size for Gant, but in the end found the solution by set it in JAVA_OPTS.
set JAVA_OPTS="-Xmx512M"
// shall I write some keywords here to boost search engine ranking?
Today just hit an OutOfMemoryError when using Gant build script to compile my code.
Google for way to set heap size for Gant, but in the end found the solution by set it in JAVA_OPTS.
set JAVA_OPTS="-Xmx512M"
Posted by Thiam Teck (1983 - ?) at 10:28 PM 0 comments
tags: Gant
We know using proper logging library instead of System.out is important. But when there are a legacy application that still using the System.out and System.err, it will be good to be able to pipe it into file for troubleshooting.
The solution is set the swallowOutput="true" in Tomcat context of your webapp. Then this will pipe the stdout and stderr into the logger configured in the same context.
Posted by Thiam Teck (1983 - ?) at 9:47 AM 0 comments
tags: Tips and Tricks, Tomcat
MySQL SELECT statement allowed us to pipe the query result in to a file via SELECT ... INTO OUTFILE. It work just fine for me most of the time, until recently I hit this error:
ERROR 1 (HY000) at line 1: Can't create/write to file '\home\myuser\my_output_file.txt' (Errcode: 2) mv: cannot stat `/home/myuser/my_output_file.txt': No such file or directoryThe first thing come to my mind is the problem of file permission, so I grant 777 permission to my output directory. But the problem still exist.
The SELECT ... INTO OUTFILE 'file_name' form of SELECT writes the selected rows to a file. The file is created on the server host, so you must have the FILE privilege to use this syntax.And the keyword is "server host". I made wrong assumption that it will write file to the server that execute the SELECT ... INTO OUTFILE.
mysql -u myuser -ppassword -h remotehost mydb < myquery.sql > my_output_file.txtReading documentation is bored but important :P
Posted by Thiam Teck (1983 - ?) at 10:48 PM 0 comments
tags: MySQL
SSH login with password authentication is often a problem for shell script that run without human interaction. One of the option by simulating user input via some Expect script. While another option is to setup certification based authentication.
Below is the steps:
1. SSH to client host (said with username 'myuser')
2. Generate keys at client host, press 'Enter' while it prompt for key location and passphrase.:
$ ssh-keygen -t rsa
$ cd ~
$ mkdir .ssh
$ chmod 700 .ssh
$ cat id_rsa.pub >> ~/.ssh/authorized_keys
$ chmod 600 ~/.ssh/*
Posted by Thiam Teck (1983 - ?) at 7:17 PM 0 comments
tags: guide
If you have log4j configured as below, you will notice that log entry from "yourLogger" will duplicate in appender
log4j.rootLogger=info, stdout
log4j.logger.yourLogger=info, stdout
log4j.rootLogger=info, stdout
log4j.logger.yourLogger=info, stdout
log4j.additivity.yourLogger=false
Posted by Thiam Teck (1983 - ?) at 10:54 PM 1 comments
tags: Tips and Tricks