2012年8月19日 星期日

好用連結


好用連結

工具連結

Free Online Tools For Developers  http://www.freeformatter.com/ 
DBDesigner  http://dbdsgnr.appspot.com/ 
JS Code Snippet  http://scriptsrc.net/ 
Google Code Playground https://code.google.com/apis/ajax/playground/ 

Code Paste 

  http://paste.ideaslabs.com 
  http://codepad.org/ 

JS Loader 

  http://requirejs.org/
  http://headjs.com/ 
  https://developers.google.com/loader/?hl=zh-TW

JS Render

JS Render  https://github.com/BorisMoore/jsrender 

JS Component

Bootstrap  http://twitter.github.com/bootstrap/   

Maven Q&A

Maven

    http://maven.apache.org/index.html
    http://maven.apache.org/plugins/index.html

    Maven實在是個很方便的東西,管好了library寫程式的心情大悅 XDD
    目前都是用Eclipse所以也就很自然的用Eclipse的Plugin,又所以更自然的遇到了一些問題!!

調整預設的Compiler版本

    pom.xml <project> 裡面加入設定



自動把Maven library放進WEB-INF/lib資料夾

先在 project>build 中加入

 再到 project > build > plugins 裡面加入

2012年8月12日 星期日

JavaScript小筆記

分類 :

  1. Primitive types, Object types
  2. Methods, Types
  3. Mutable types, immutable types
Number 
  1. 0, -0 (0 == -0, 1/0 != 1/-0)
  2. Infinity, -Infinity
  3. NaN
  Function

  function func(){
    this.x = 0;
    this.getX = function(){ return this.x; }
    this.setX = function(x){ this.x = x; }
  }
  var a = func(); //此時執行的this是javascript最頂層的global object
  var b = new func(); //此時執行的this是javascript最頂層的global object


      

    Log4j PatternLayout

    好吧 = =

    等我英文夠好 我會把他記起來的

    http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html

    重要的部分節錄如下


    The recognized conversion characters are

    Conversion CharacterEffect
    cUsed to output the category of the logging event. The category conversion specifier can be optionally followed by precision specifier, that is a decimal constant in brackets.If a precision specifier is given, then only the corresponding number of right most components of the category name will be printed. By default the category name is printed in full.
    For example, for the category name "a.b.c" the pattern %c{2} will output "b.c".
    CUsed to output the fully qualified class name of the caller issuing the logging request. This conversion specifier can be optionally followed by precision specifier, that is a decimal constant in brackets.If a precision specifier is given, then only the corresponding number of right most components of the class name will be printed. By default the class name is output in fully qualified form.
    For example, for the class name "org.apache.xyz.SomeClass", the pattern %C{1} will output "SomeClass".
    WARNING Generating the caller class information is slow. Thus, use should be avoided unless execution speed is not an issue.
    dUsed to output the date of the logging event. The date conversion specifier may be followed by a date format specifier enclosed between braces. For example, %d{HH:mm:ss,SSS} or %d{dd MMM yyyy HH:mm:ss,SSS}. If no date format specifier is given then ISO8601 format is assumed.The date format specifier admits the same syntax as the time pattern string of the SimpleDateFormat. Although part of the standard JDK, the performance of SimpleDateFormat is quite poor.
    For better results it is recommended to use the log4j date formatters. These can be specified using one of the strings "ABSOLUTE", "DATE" and "ISO8601" for specifying AbsoluteTimeDateFormatDateTimeDateFormat and respectivelyISO8601DateFormat. For example, %d{ISO8601} or %d{ABSOLUTE}.
    These dedicated date formatters perform significantly better than SimpleDateFormat.
    FUsed to output the file name where the logging request was issued.WARNING Generating caller location information is extremely slow and should be avoided unless execution speed is not an issue.
    lUsed to output location information of the caller which generated the logging event.The location information depends on the JVM implementation but usually consists of the fully qualified name of the calling method followed by the callers source the file name and line number between parentheses.
    The location information can be very useful. However, its generation is extremely slow and should be avoided unless execution speed is not an issue.
    LUsed to output the line number from where the logging request was issued.WARNING Generating caller location information is extremely slow and should be avoided unless execution speed is not an issue.
    mUsed to output the application supplied message associated with the logging event.
    MUsed to output the method name where the logging request was issued.WARNING Generating caller location information is extremely slow and should be avoided unless execution speed is not an issue.
    nOutputs the platform dependent line separator character or characters.This conversion character offers practically the same performance as using non-portable line separator strings such as "\n", or "\r\n". Thus, it is the preferred way of specifying a line separator.
    pUsed to output the priority of the logging event.
    rUsed to output the number of milliseconds elapsed from the construction of the layout until the creation of the logging event.
    tUsed to output the name of the thread that generated the logging event.
    xUsed to output the NDC (nested diagnostic context) associated with the thread that generated the logging event.
    XUsed to output the MDC (mapped diagnostic context) associated with the thread that generated the logging event. The X conversion character must be followed by the key for the map placed between braces, as in %X{clientNumber} whereclientNumber is the key. The value in the MDC corresponding to the key will be output.
    See MDC class for more details.
    %The sequence %% outputs a single percent sign.
    By default the relevant information is output as is. However, with the aid of format modifiers it is possible to change the minimum field width, the maximum field width and justification.
    The optional format modifier is placed between the percent sign and the conversion character.
    The first optional format modifier is the left justification flag which is just the minus (-) character. Then comes the optional minimum field width modifier. This is a decimal constant that represents the minimum number of characters to output. If the data item requires fewer characters, it is padded on either the left or the right until the minimum width is reached. The default is to pad on the left (right justify) but you can specify right padding with the left justification flag. The padding character is space. If the data item is larger than the minimum field width, the field is expanded to accommodate the data. The value is never truncated.
    This behavior can be changed using the maximum field width modifier which is designated by a period followed by a decimal constant. If the data item is longer than the maximum field, then the extra characters are removed from the beginning of the data item and not from the end. For example, it the maximum field width is eight and the data item is ten characters long, then the first two characters of the data item are dropped. This behavior deviates from the printf function in C where truncation is done from the end.
    Below are various format modifier examples for the category conversion specifier.

    Format modifierleft justifyminimum widthmaximum widthcomment
    %20cfalse20noneLeft pad with spaces if the category name is less than 20 characters long.
    %-20ctrue20noneRight pad with spaces if the category name is less than 20 characters long.
    %.30cNAnone30Truncate from the beginning if the category name is longer than 30 characters.
    %20.30cfalse2030Left pad with spaces if the category name is shorter than 20 characters. However, if category name is longer than 30 characters, then truncate from the beginning.
    %-20.30ctrue2030Right pad with spaces if the category name is shorter than 20 characters. However, if category name is longer than 30 characters, then truncate from the beginning.
    Below are some examples of conversion patterns.

    %r [%t] %-5p %c %x - %m%n
    This is essentially the TTCC layout.
    %-6r [%15.15t] %-5p %30.30c %x - %m%n
    Similar to the TTCC layout except that the relative time is right padded if less than 6 digits, thread name is right padded if less than 15 characters and truncated if longer and the category name is left padded if shorter than 30 characters and truncated if longer.

    2012年8月11日 星期六

    xml定義 DTD & XSD


    iBatis
    iBatis Config
    <!DOCTYPE sqlMapConfig
          PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
          "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
    iBatis SqlMap
    <!DOCTYPE sqlMap
          PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"  
          "http://www.ibatis.com/dtd/sql-map-2.dtd">

    Struts2
    <!DOCTYPE struts
          PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
          "http://struts.apache.org/dtds/struts-2.0.dtd">

    Web-app (web.xml)

    XML Doctype Definition (dtd before servlet 2.3)
    <!DOCTYPE web-app
          PUBLIC "-//Sun Microsystems, Inc.//DTD WebApplication 2.2//EN"
          "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">

    <!DOCTYPE web-app
          PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
          "http://java.sun.com/dtd/web-app_2_3.dtd">

    XML Schema Definition (xsd after servlet 2.4)
    <web-app
          xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">


    <web-app

          xmlns="http://java.sun.com/xml/ns/javaee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
          version="2.5">

    Spring


    beans (2.0 dtd)

    <!DOCTYPE beans
          PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
          "http://www.springframework.org/dtd/spring-beans-2.0.dtd">


    beans (2.0 xsd)

    <beans
          xmlns="http://www.springframework.org/schema/beans"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

    beans (3.0 xsd)
    <
    beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">



    http://www.springframework.org/schema/aop
             http://www.springframework.org/schema/aop/spring-aop-3.0.xsd

    http://www.springframework.org/schema/context
             http://www.springframework.org/schema/context/spring-context-3.0.xsd

    http://www.springframework.org/schema/mvc
            http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd

    http://www.springframework.org/schema/jee 
         http://www.springframework.org/schema/jee/spring-jee-3.0.xsd

    http://www.springframework.org/schema/tx
         http://www.springframework.org/schema/tx/spring-tx-3.0.xsd

    http://www.springframework.org/schema/oxm
        http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd

    http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-3.0.xsd

    http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.0.xsd

    http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd

    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd