1. Config support utf-8 with url on Tomcat

    In server.xml, find and edit like below:

    <Connector URIEncoding=”UTF-8” connectionTimeout=”20000” port=”8080” protocol=”HTTP/1.1” redirectPort=”8443”/>

    7 months ago  /  1 note

  2. When type characters by Japanese Keyboard on textarea, won’t trigger keyup event, but we can use keydown event.

    7 months ago  /  1 note

  3. Limit length in texarea

    When limit length in textarea, browser calculate that string by characters, so a new line character is counted by 1. But in some OSes, a new line is “\r\n”, if in db you limit characters, you need remove “\r” before save.

    7 months ago  /  0 notes

  4. Spring Roo

    To avoid Java heap space error,

    +when select a huge of rows, we should be get by parts then add them to list

    +when return response to client, we should write data in many times

    7 months ago  /  0 notes

  5. Java indexOf method for multiple matches

    i = str.indexOf('x');
    while(i >= 0) {
         
    System.out.println(i);
         i
    = str.indexOf('x', i+1);
    }

    7 months ago  /  0 notes  /  Source: stackoverflow.com

  6. Yii - “Warning: date()”

    Edit php.ini, change to
    
    date.timezone = "Asia/Ho_Chi_Minh"

    7 months ago  /  0 notes  /  Source: code.google.com

  7. CentOS

    1. Install HTTP server

    yum install httpd httpd-devel

    /etc/init.d/httpd start

    2. Install MySQL

    yum install mysql mysql-server mysql-devel

    /etc/init.d/mysqld start mysql

    3. Install PHP

    yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml

    /etc/init.d/httpd restart

    4. Open port 80

    iptables -I INPUT -i eth1 -p tcp -m tcp —dport 80 -j ACCEPT

    service iptables save

    5. Install zip, unzip

    yum install zip unzip

    6. Install gcc, g++, make

    yum install gcc-c++

    yum install make

    7 months ago  /  0 notes

  8. Jquery trigger click

    $(‘a#swaswararedirectlink’)[0].click();

    7 months ago  /  0 notes  /  Source: stackoverflow.com

  9. Half- And Full-width Characters In CJK (and normalization)

    Latin Characters in half-width and full-width: Asia Asia
    Katakana in half-width and full-width: アジア アジア

    Encodings of Japanese: http://www.sljfaq.org/afaq/encodings.html
    Java Normalizing Text (recommend NKFC): http://docs.oracle.com/javase/tutorial/i18n/text/normalizerapi.html
    Normalizing Example: http://ideone.com/7iAId
    Normalizing Algorithm: http://nlp.solutions.asia/?p=39 or see below:

    Read More

    8 months ago  /  0 notes  /  Source: nlp.solutions.asia

  10. MySQL sum() return NULL if there were no matching rows

     SUM([DISTINCT] expr)

    Returns the sum of expr. If the return set has no rows, SUM() returns NULL. The DISTINCT keyword can be used to sum only the distinct values of expr.

    SUM() returns NULL if there were no matching rows.

    8 months ago  /  0 notes  /  Source: dev.mysql.com