Skip to main content

Posts

Showing posts from September, 2009

ThreadLocal

ThreadLocal is arguably the easiest way to render a stateful class thread-safe, or to encapsulate non-thread-safe classes so they can safely be used in multithreaded env. ThreadLocal can be used to implement per-thread-singleton, or per-thread-conext.

换个思路

昨天的新闻联播好像播了个盛大的晚会,貌似一部恢弘巨著,演员乌央乌央的站满了舞台,当然也有宋祖英鹤立鸡群的表演,和革命歌舞史诗东方红有一拼,第三代第四代核心都观看了演出(胡主席,江泽民等同志)。 可是大家拍拍自己的肚皮,有观看东方红的那份感动吗?看着一个个细皮嫩肉的演员,穿着崭新的红军贫农的衣服,滑稽可笑。一切都看着那么假。时代在变,现在世界上只有一个活在乌托邦的国家朝鲜,在搞这种东西。佛说,诸行无常,万物都是在变化的。可惜,看到的还是一些不顾事物的变化,天真的弹奏着过去的调调。冷战的年代,国家摩擦的时期,国家需要整齐强大的阅兵仪式来提升士气,威慑敌方。和平年代,换个思路,来些花车,美女,来平和一下国内的戾气。 说来说去,我们过去有孔孟之道,程朱理学,三民主义,毛泽东思想维系国民的信仰,现在呢?

what's your driving mood?

the road has two lanes, one for straight, one for left turn, and some space for bicycles and motorcycles. during rush hour, the road is packed with three lines of cars, that's fine. even with that, some drivers still want to cut in between lanes. this is my experience this morning. i was driving as a good citizen to work this morning. the road was jammed with traffic, as usual. a van wanted to merge in the traffic, nobody yielded. the two cars almost collided. i let the van in. from nowhere, a taxi popped up and joined in. now the traffic was jammed. i waited these 2 cars mingled. after the traffic was just back to normal, a 3rd car tried to cut in. now i was totally pissed off, and pushed that car behind, like other drivers did.

jms

producer <bean id="fooBatchProcessor" class="foo.jms.client.JmsFooBatchProcessor"> <property name="jmsTemplate" ref="jmsTemplate"> </property> </bean> <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"> <property name="connectionFactory" ref="connectionFactory"> </property> <property name="defaultDestination" ref="barQueue"> </property> </bean> <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="vm://embedded?broker.persistent=false"> </property> </bean> <bean id="barQueue" class="org.apache.activemq.command.ActiveMQQueue"> <constructor-arg value="mq.queue.bar"> </constructor-arg> </bean> consumer/listener <jms:listener-cont

wrong login password in oracle enterprise manager

in oracle em, when you perform oracle db, listener shutdown/start, and some other administration tasks, you will need put host username and password. if you see the wrong password message, try this following steps: run secpol.msc add your account into the policy - log on as an batch job

Damn hard to get a good sleep

I sleep light, and very easy to be woke up by small noise. This is how I slept last night. At 10PM, I was already super doopy sleepy, and fall asleep right away. Around 2:30AM, I was woke up by some noise, and heard the humming noise of mosquito. I was bothered by this small insects, and managed to kill two. Around 4AM, I was back to sleep. Around 5:30AM, I was woke up again by that stupid cat. After giving her some good kicks, I was back to bed at 6AM. At 6:45AM, wake-up alarm run off!

tsinghua 100-year anniversary logo

阿含经--听佛陀讲述最原味的佛法

佛法之根:缘起论 因缘聚则生,因缘散则灭。 佛说四谛:苦集灭道 苦又三苦:(苦苦(生,老,病,死),坏苦(怨憎会,爱别离,求不得),行苦(五蕴盛)八苦 苦的根源:贪,嗔,痴三毒 涅磐寂静 戒,定,慧三学 十二因缘 无明,行,识,名色,六处,触,受,爱,取,有,生,老死 五蕴 色受想行识 十二处 六尘:色声香味触法 六根:眼耳鼻舌身意 十八界 六尘六根六识 四法印 诸行无常,诸法无我,一切行苦,涅磐寂静 三宝 佛法僧 三学 戒定慧 五戒 不杀生,不偷盗,不邪淫,不妄语,不饮酒 八正道 正定,正念,正精进,正命,正业,正语,正思维,正见 四念处 身念处(观身不净),受念处(观受是苦),心念处(观心无常),法念处(观法无我) 七觉支 法觉支,精进觉支,喜觉支,猗觉支,舍觉支,定觉支,念觉支 四禅八定 色界四禅(初禅,二禅,三禅,四禅) 无色界四定(空无边处定,识无边处定,无所有处定,非想非非想出定) 四摄 布施摄,爱语摄,利行摄,同事摄 八觉 少欲,知足,远离,精进,正念,正定,正慧,不戏论 居家八法 今世安乐四法:方便具足,守护具足,善知识具足,正命具足 来世安乐四法:信具足,戒具足,施具足,慧具足 六道轮回 阿修罗道,天道,人道,畜生道,饿鬼道,地狱道 三界二十八天 欲界六道,欲界六天,色界十八天,无色界四天 三千大千世界 小世界:须弥山,四大部洲,日月及天界 小千世界:一千小世界 中千世界:一千小千世界 大千世界:一千中千世界 四大部洲 东胜神洲、西牛贺洲、南赡部洲(人类居住, 寿命变化 ),北俱芦洲

Power board of Samsung 32" LCD TV

After one and half years, the Samsung 32" LCD TV won't power up. After some online searching, it seems a common problem of this brand. Actually, it reminds me another Korean brand, LG. We bought a LG LCD TV. It has the similar problem. Luckily, that one was still under warranty, so it got fixed for free. Based on my personal experience, Korean brand sucks. To save the trouble on this trash brand, I sold it cheap without fixing it.

core aop concepts

modularization of cross-cutting concerns join point - a point in the execution of a program such as a method call or field assignment pointcut - an expression that selects one or more join points advice - code to be executed at a join point that has been selected by a pointcut aspect - a module that encapsulates pointcuts and advice

a small car accident

Just a couple of days after I posted the traffic mess , I was bite by it. At the right spot in that photo, I was trying to change the lane. Obviously, I was overconfident, and bam !, hit the taxi in front of me. Luckily, both sides involved were in good mood. I called 110, and after 15 minutes, police came. I was full responsible for this, and paid taxi driver 300 CNY as a quick solution. Police issued the report. The next day, I called my insurance company to report the case. Insurance company send an inspector over to check my car, and issued a repair estimation form. I will need to fix my car and claim the expense later on.

让你更快乐的五个习惯

想想谈恋爱时的感觉:你感觉棒极了。你用全新的眼光看世界。你愿意接受任何挑战。你难道不喜欢永远处在这种状态吗? 我们曾经讨论过如何影响那些给你带来快乐的人,比如你的孩子或同侪。 本周,我想重点谈谈你本人。具体地说,就是看看有什么方法能让你把积极的想法融入到生活中,以便给自己的快乐带来切实的影响。为什么要这样做呢?原因是人在快乐的时候,各种各样的积极结果会随之而来。举例来讲,各种研究结果发现,人在快乐的时候,考试时临场发挥更好、卖东西卖得更多、免疫系统更强大、能更好地应对挑战,并且会给周围人的快乐感带来积极的影响。 哈佛大学毕业的积极思维心理学家、研究机构Aspirant首席执行长肖恩•阿克尔(Shawn Achor)说,让你体验爱情的眩晕感的化学物质──多巴胺和5-羟色胺,也能激活大脑的学习中心。阿克尔说,快乐而放松的大脑比处于压力之下的大脑有着更高的智力,保持积极的态度实际上可以帮助我们学习更多的东西。这进而会帮助我们更加成功,也更快乐。研究看来验证了这一点。上世纪30年代一项有名的研究中,科学家们对坚持写日记的修女进行了跟踪。那些在日记中使用更多积极词汇的修女比那些使用更多消极词汇的人活得要长。实际上,有90%持乐观态度的修女活到了85岁以上,其他人则只有34%。 心理学家巴巴拉•弗里德里克森(Barbara Frederickson)的研究发现,积极情绪使我们可以建立更多的智力和社交联系。如果你情绪积极,很可能会思维清晰、组织新信息和回忆起这些信息的速度更快,这样你会更快、更富创新性地进行思考。 试着在两分钟里列出美国50个州的名字,或是处理一下工作上的问题。如果你的情绪积极,很可能会更快、更准确地做完。在工作上,快乐的人往往表现更好、销售业绩更好、更轻松地应对挑战、避免出现工作倦怠,因此饭碗会更牢靠。阿克尔说,一项研究发现,那些有着更积极情绪的人在18个月后获得的老板评价也更好、工资会更高。 关于这项研究的一个好消息是,正如消极思维是可以后来学来的,积极的想法也可以。人的大脑是灵活的。所以,让我们看看一些你现在马上就可以进行的“快乐”练习,对你的大脑进行训练,希望这会让你走上快乐之路。 1.每天记下让自己感激的事 因为工作,健康或和美的家庭而心存感激?那么就表达出来。写下或大声说出你的感激,或许可以和你的伴侣一起做。感激的东西每天可以不同。研究发现,与对照组相

the road to big expo

I don't get it, suddenly all roads in PuDong are in bad shape and need construction work. It is just a city expo, who cares? I don't believe there is any other countries whoever hosted this expo did this. This is the very common road situation in PuDong. The road is not fully blocked, but just here and there, one lane is blocked. The small road blockers are everywhere. I am not exaggerate, everywhere.