2008年12月28日星期日

run groovy the first time

java.lang.SecurityException: Prohibited package name: java.lang


remove ***\rt.jar from "classpath" and then groovy(.bat) runs well.

2008年12月19日星期五

evil 163.com

it hides the auditing note of user's comments.

Bitch and cheater.

2008年12月18日星期四

The column name xxx was not found in this ResultSet.

org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [select * from t_service_transaction where id = ?]; nested exception is org.postgresql.util.PSQLException: The column name sp_id was not found in this ResultSet.
    org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:107)
    org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:276)
    org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:554)
    org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:588)
    org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:617)
    org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:625)
    org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:657)


sp_id is absolutely not a field of table `t_service_transaction`,
and this exception occurred many times with different table names but same field name.

restart postgres sql server, and evrything goes fine.

@see:
http://archives.postgresql.org/pgsql-jdbc/2005-06/msg00086.php

2008年12月16日星期二

output 0 to 1000 without loop and if, at least two methods.

1. Java version, recursive.

package shawn.test;
public class Thousand {
    public static void main(String[] args) {
        descrease2(1000);
    }
    public static Integer descrease2(Integer i) {
        try{
            Integer tmp = 1 / (i+1);
        }catch(Exception e){
            System.exit(1);
        }
        System.out.println(i--);
        descrease2(i);
        return i;
    }
}


2. Javascript Version, implementing Javascript Closure
<script type="text/javascript">
function test($num) {
  document.write($num+"<br />");
  $num--;
  return $num>0?test($num):document.write("0<br />");
}
var testMe = test(1000);
testMe();
</script>

3. Perl version, using language buildin looping feature.

#!/usr/local/bin/perl -w
@array = (0 .. 1000);
map {print $_, "\t"} @array;

> or

#!/usr/local/bin/perl -w
@array = (0 .. 1000);
grep {print $_, "\t"} @array;

> Extreme version, only 19 charactrors, no white space,
> no quotes, no brackets, no semicolon:

map{print$_}0..1000

2008年12月9日星期二

2008年12月8日星期一

solve winlogon.exe memory leak

keywords: windows xp, winlogon.exe memory leak

delete this reg key, and the problem is solved:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify\psfus

you could compare your setting with other normal systems, and delete those unique keys.