2012年9月19日 星期三

Program Design and develop

1.  Version control
  • use date to build a version
  • write a version files


2.  Error message
  • use log4j to record different error message


3. Properties files
  • we can set different files such as project or test




log4j


Writing step:

a. write a log4j.properties in your package
{code}
log4j.rootLogger=Info, A1


# A1 is set to be a ConsoleAppender
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
# %d is date and it's format
# %p is output the log priority info DEBUG INFO WARN ERROR FATAL
# %c is class name
# %l is line position
# %m is the message in contents
# %n is new line
# output format
#[12/09/20 09:26:10][DEBUG][HelloWorld-14] Sample debug message
#[12/09/20 09:26:10][INFO][HelloWorld-15] Sample info message
#[12/09/20 09:26:10][WARN][HelloWorld-16] Sample warn message
log4j.appender.A1.layout.ConversionPattern=[%d{yy/MM/dd HH:mm:ss}][%p][%C-%L] %m%n
{code}

b. write a class call hello word
{code}
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;


public class HelloWorld {
   
    static final Logger logger = Logger.getLogger(HelloWorld.class);

    // Reference http://werdna1222coldcodes.blogspot.tw/2009/11/javalog4j.html
    public static void main(String[] args) {
            // 會自動設定
            //BasicConfigurator.configure();
            System.out.println("Start Log4j test");
            logger.debug("Sample debug message");
            logger.info("Sample info message");
            logger.warn("Sample warn message");
            logger.error("Sample error message");
            logger.fatal("Sample fatal message");
    }
    
}

{code}

c. Reference
http://werdna1222coldcodes.blogspot.tw/2009/11/javalog4j.html

AJP Introduction

AJP is the apache and tomcat community method.


English:
http://www.mulesoft.com/tomcat-connector

Chinese:
http://tc.itkee.com/sysapp/detail-16d3.html
http://puremonkey2010.blogspot.tw/2010/09/linux-apachetomcat-tomcat-worker.html

Office:

http://tomcat.apache.org/tomcat-4.0-doc/config/ajp.html

2012年9月13日 星期四

validate From

There we introduce an article which use javascript to check the form field,
it use the tradition methods to get form field elements, and introduce some register event content.

you can see:
http://www.webcredible.co.uk/user-friendly-resources/dom-scripting/validate-forms-javascript.shtml

2012年9月12日 星期三

Javascript interpter in rhino

There are  a javascript interpter on local machine.
It is the rhino, it is written by java, and you can download it, then

type
[]java -jar js.jar JSFileName

will show the result,

js.sh
{code}
#!/bin/bash
RLWRAP='rlwrap -C js';
exec $RLWRAP java -jar ~/IBMS/Program/java/lib/js.jar "$@";

{code}


Rhino Download:
https://developer.mozilla.org/en-US/docs/Rhino/Download_Rhino?redirectlocale=en-US&redirectslug=RhinoDownload


rlwrap download: http://utopia.knoware.nl/~hlub/uck/rlwrap/

reference:
http://workingrhino.blogspot.tw/2007/10/getting-started.html











2012年9月10日 星期一

極光行動 (Operation Aurora)

http://tw.trendmicro.com/tw/support/tech-support/board/tech/article/20120430133619.html

2012年9月4日 星期二

Java regular express

1. It is a good content in this to explain the java regular express you can reference it

http://www.vogella.com/articles/JavaRegularExpressions/article.html