Friday, September 23, 2016

remote monitor and dump the java process

remote monitor and dump the java process: 1) in the machine that java process is running. create following filw with content: file name:jstatd.all.policy content: grant codebase "file:${java.home}/../lib/tools.jar" { permission java.security.AllPermission; }; do not change the above content, event in windows, the path even looks not reflect right path. 2) start jstatd with following way with exactly copy jstatd -J-Djava.security.policy=jstatd.all.policy 3) in remnote monitoring machine, start jvisualVM add remote machine name or IP, the java process will be fecthed, you can monitor and profile now.

Thursday, August 18, 2016

build a jdk rt.jar with debug option

1)download the src.zip for your jdk 2)unzip src.zip into a tmp/src folder:unzip src.zip -d /src 3)get list of all java class into a file: find -name "*.java* > files.txt 4)compile all java files:javac -verbose -g -d ..\out -J-Xmx2048m -cp c:\jdk7u80\jre\lib\rt.jar;c:\jdk7u80\lib\tools.jar @files.txt 5)create jar file:cd tmp\out; jar cvf rt.jar * 6)copy the rt.jar into jdk\jre\lib\endorsed

Wednesday, August 17, 2016

Log4J appender format

here is the best log4J appender ConversionPattern value "%d{MM/dd/yyyy hh:mm:ss aa} [%-5p] [%c{1}] - %m%n", it approved working it print out the date time, log type and class name and message remember put it in the appender you expected, because we might have mutiple appender, one for file, one for console, etc.

Thursday, July 28, 2016

chrome trouble shooting

chrome has many chrome://commands that will help you tuning and trouble shooting your chrome. chrome://about will list all commands and its links.

Wednesday, July 13, 2016

Using R studio to find the set intersect and difference

1) make data into a one column text file with a title, or two dimension data matrix
2) use  read.csv read file into a data frame
3) use column index in data frame to read one column into a array(set)
    a <- data[,1]
4) use intersect to get common set between set
5) use setdiff to find set diffence

Tuesday, June 21, 2016

filter subversion log to specific period of time and from specific user

svn log http://olsvn.autc.com/repos/DataServicesCore -qv -r {2016-06-01}:{2016-06-20} |sed -n '/bd/,/-----$/ p'

Friday, May 20, 2016

apache commons-email SimpleEmail sent out email missed subject line

following code is simple and use to send out email, but in my case, received email miss subject line, the problem is the class path include som libraries that cause java-mail to fail

public class Test{
        public static void main(String[] args){
                try{
                SimpleEmail email = new SimpleEmail();
                email.setDebug(true);
                email.setHostName("xx.xxx.xxx.xxx");
                email.setSmtpPort(25);
                email.setSSLOnConnect(false);
                email.setFrom("noreply@openlane.com");
                email.setSubject("THIS IS SUBJECT LINE");
                email.setMsg("This is a test mail from command line");
                email.addTo("my.email@openlane.com");
                email.send();
                }catch(Exception e){
                        e.printStackTrace();
                }
        }
}

the problam library is geronimo.specs:geronimo.specs and geronimo-activation_1.1_spec:
org.apache.geronimo.specs
exclude them from pom file(or classpath will solve the problem)