Tuesday, November 28, 2006

Holy Shit!!

OMG,the setup for Hibernate is wrong!!I shouldn't direct assign a SessionFactory to DAO class that extends HibernateDaoSupport...I should declare a HibernateTemplate bean and assign to the DAO class...there isn't enough time for me to change it at the moment.Guess I will change it over the weekend.Wish Me Luck

Monday, November 27, 2006

富士山下 - 陳奕迅

歌手:陳奕迅 | 作曲:Christopher Chak
填詞:林夕 | 編曲:陳珀 / C. Y. Kong
攔路雨偏似雪花 飲泣的你凍嗎
這風褸我給你磨到有襟花
連調了職也不怕 怎麼始終牽掛
苦心選中今天想車你回家
原諒我不再送花 傷口應要結疤
花辦鋪滿心裡墳場才害怕
如若你非我不嫁 彼此終必火化
一生一世等一天需要代價

誰都只得那雙手 靠擁抱亦難任你擁有
要擁有必先懂失去怎接受
曾沿著雪路浪遊 為何為好事淚流
誰能憑愛意要富士山私有
何不把悲哀感覺 假設是來自你虛構
試管裡找不到它染污眼眸
前塵硬化像石頭 隨緣地拋下便逃走
我絕不罕有 往街裡繞過一周
我便化烏有

情人節不要說穿 只敢撫你髮端
這種姿態可會令你更心酸
留在汽車裡取暖 應該怎麼規勸
怎麼可以將手腕忍痛劃損
人活到幾歲算短 失戀只有更短
歸家需要幾里路誰能預算
忘掉我跟你恩怨 櫻花開了幾轉
東京之旅一早比一世遙遠

誰都只得那雙手 靠擁抱亦難任你擁有
要擁有必先懂失去怎接受
曾沿著雪路浪遊 為何為好事淚流
誰能憑愛意要富士山私有
何不把悲哀感覺 假設是來自你虛構
試管裡找不到它染污眼眸
前塵硬化像石頭 隨緣地拋下便逃走
我絕不罕有 往街裡繞過一周
我便化烏有

誰都只得那雙手 靠擁抱亦難任你擁有
要擁有必先懂失去怎接受
曾沿著雪路浪遊 為何為好事淚流
誰能憑愛意要富士山私有
何不把悲哀感覺 假設是來自你虛構
試管裡找不到它染污眼眸
前塵硬化像石頭 隨緣地拋下便逃走
我絕不罕有 往街裡繞過一周
我便化烏有

你還嫌不夠
我把這陳年風褸
送贈你解咒

Acegi and Webwork Interceptor

I am currently using Webwork 2.2.4+Spring 2.0+Acegi 1.0.2.The authentication structure from Acegi is awesome.

I was trying to retrieve user details such as display name,company name and email address from database based on user name.Therefore I wrote a UserContextInterceptor that retrieve user's record from database and store to user's session.

//UserContextInterceptor.java

public class UserContextInterceptor extends AroundInterceptor {
...//some other methods

@Override
protected void before(ActionInvocation invocation) throws Exception {
// TODO Auto-generated method stub

UserContext userContext=null;
Map session=ServletActionContext.getContext().getSession();
if(!session.containsKey(USER_CONTEXT)){
userContext=new UserContext();
userContext.setUser(userManager.getUsersByUsername(
ServletActionContext.getRequest().getUserPrincipal().getName()
));

ServletActionContext.getContext().getSession().put(USER_CONTEXT, userContext);
}else{
userContext=(UserContext)session.get(USER_CONTEXT);;
}
if (invocation.getAction() instanceof UserContextAware){
((UserContextAware) invocation.getAction()).setUserContext(userContext);
}
}
}

First post in this blog...

Its 5.44am in the morning...been rushing work for the past 2 weeks,yet still a long way to go.Guess this is the life of a programmer.Luckily most of the things working as expected,and got some help on interface from colleague.