Skip to main content

Posts

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