Monday, March 31, 2014

optimization on Java application

I wrote an application to compare the instruments across many different systems. It needed 6 to 7 minutes to run at the beginning.
After the optimazation, the runtime is cut to 22 seconds. There are three methods used to optimize the application:
1. Use indexed collection (google cqengine) instead of looping the collection
It needs more than 30 seconds for 30 million loops, after the update, it only needs 1 or 2 seconds.
2. Set -Xms -Xmx to allocate more memory for this Java application.
3. At the beginning, the csv report file is saved to clob directly. Now since it's more than 10 megabytes, it needs 6 to 8 seconds to insert.
After zip/save to blob, it's less than 1 seconds including the zip time.

Wednesday, March 26, 2014

Spring in Action Third Edition

Spring in Action Third Edition
1. Source code
 www.manning.com/SpringinActionThirdEdition
2.
The act of creating associations between application components is commonly referred to as wiring.
In a Spring application, an application contextloads bean definitions and wires them
together. The Spring application context is fully responsible for the creation of and
wiring of the objects that make up the application.
In a Spring application, an application contextloads bean definitions and wires them
together. The Spring application context is fully responsible for the creation of and
wiring of the objects that make up the application.
ClassPathXmlApplicationContext.
Applying aspects
3.
Spring rich client
4.
By default, all Spring beans are singletons. When the container dispenses a bean
(either through wiring or as the result of a call to the container’s getBean()method)
it’ll always hand out the exact same instance of the bean.
<bean id="poeticDuke"
class="com.springinaction.springidol.PoeticJuggler">
<constructor-arg value="15" />
<constructor-arg ref="sonnet29" />
</bean>
<bean id="theStage"
class="com.springinaction.springidol.Stage"
factory-method="getInstance" />
<bean id="kenny"
class="com.springinaction.springidol.Instrumentalist">
<property name="song" value="Jingle Bells" />
<property name="age" value="37" />
<property name="instrument" ref="saxophone" />
</bean>
inner bean:'
<bean id="kenny"
class="com.springinaction.springidol.Instrumentalist">
<property name="song" value="Jingle Bells" />
<property name="instrument">
<bean class="org.springinaction.springidol.Saxophone" />
</property>
</bean>
To set a property to null, you simply use the <null/>element.
To force Spring to produce a new bean instance each time one is needed,
you should declare the bean’s scopeattribute to be prototype.
<bean id="ticket"
class="com.springinaction.springidol.Ticket" scope="prototype" />
The astute reader will recognize that Spring’s notion of singletons is limited to the
scope of the Spring context. Unlike true singletons, which guarantee only a single
instance of a class per classloader, Spring’s singleton beans only guarantee a single
instance of the bean definition per the application context
5.
To define setup and teardown for a bean, simply declare the <bean>with initmethodand/or destroy-methodparameters.
If many of the beans in a context definitionfile will have initialization or destroy
methods with the same name, you don’t have to declare init-methodor destroymethodon each individual bean. Instead you can take advantage of the
defaultinit-methodand default-destroy-methodattributes on the <beans>element.
6. wiring collection
<bean id="hank"
 class="com.springinaction.springidol.OneManBand"> <property name="instruments">
<list>
<ref bean="guitar" />
<ref bean="cymbal" />
<ref bean="harmonica" />
</list>
</property>
</bean>
//map
<bean id="hank" class="com.springinaction.springidol.OneManBand">
<property name="instruments">
<map>
<entry key="GUITAR" value-ref="guitar" />
<entry key="CYMBAL" value-ref="cymbal" />
<entry key="HARMONICA" value-ref="harmonica" />
</map>
</property>
</bean>
7. SpEL
<property name="song" value="#{songSelector.selectSong()?.toUpperCase()}"/>
<property name="multiplier" value="#{T(java.lang.Math).PI}"/>
<property name="validEmail" value=
"#{admin.email matches '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.com'}"/>
8.
Autowiring helps reduce or even eliminate the need for <property>and
<constructor-arg>elements by letting Spring automatically figure out how
to wire bean dependencies.
 Autodiscovery takes autowiring a step further by letting Spring figure out
which classes should be configured as Spring beans, reducing the need for
the <bean>element.
When a bean has been configured to autowire by autodetect, Spring will attempt to
autowire by constructorfirst. If a suitable constructor-to-bean match can’t be found,
then Spring will attempt to autowire by type.
9.
Annotation wiring isn’t turned on in the Spring container by default. <context:annotation-config>tells Spring that you intend to use annotation-based
wiring in Spring
10.
The <context:component-scan>element does everything that <context:annotation-config>does, plus it configures
Spring to automatically discover beans and declare them for you.
<context:component-scan
base-package="com.springinaction.springidol">
</context:component-scan>


Todo: Aspect-oriented Spring

Saturday, March 22, 2014

Oracle SQL Developer Debug



SQL> grant debug connect session to hr;

授权成功。

SQL> grant debug any procedure to hr;

授权成功。

SQL>

Sunday, March 16, 2014

Big Bang Season 1 E1

photon
integral:
differential:
renegate:
I've never renegated on a proffer of sperm before.
clavicle
transvestite
battlestar galactica
I know that moving can be stressful, and I find when I'm undergoing stress that good food and company can have a comforting effect. Also, curry is a natural laxative and I don't have to tell you that a clean colon is one less thing to worry about.
I'm no expert, but I believe in the context of a luncheon invitation, you might want to skip the reference to bowel movements.
Today we tried masturbating for money.
Well, make yourself at home.
spoof
You can find scribbled on the wall of any men's room at mit.
In the winter this seat is close enough to the radiator to remain warm, and yet not so close to cause perspiration. In the summer, it's directly in the path of a cross-breeze created by opening windows here and there.It faces the television at an angle that is neither direct, thus discouraging conversation. Not so far wide as to create a parallex distortation. I could go on, but I think I've made my point.

Saturday, March 8, 2014

一天一句话 地道美语表达 (P80 - 101)

http://forum.iask.info/showthread.php?t=339102&page=81
you and I loved to zing each other. 喜欢互相吐槽对方。
I lost you你把我弄糊涂了。
I lost you.Please start over你把我弄糊涂了。重新说一下吧。

My time is your time全听你的。也可以翻译成请你吩咐男人!学会这句!
May I have the check, please? 我能看看帐单吗

吃完饭别忘了给钱喔! check 就是账单的意思, 另外也可以说 buy the bill(买单), 就跟中文里说的买单是一样的。

切记千万不要以 penny(硬币)付小费。如果你把 penny 丢在桌上,尽管你付小费很多,很可能会被服务生误解为不满其服务,是一种羞辱的举止。除非服务实在是太差了,否则绝不可在小费中放置任何 penny。
如果你忘记看天气预报,你想知道今天多少度,该怎么问呢?
What's the temperature today? 

--- Would you prefer a window or an aisle seat? 你想要靠窗还是靠走道的座位?
----I’d like a window seat. 我想要靠窗的座位。

I’d like an aisle seat. 我想要靠走道的座位。

Could you give me a better price?
你可以给我一个实在价吗?

it's an orgasm.那是性高潮。
What does that supposed to mean?你这话是什么意思?
I can't keep it up. I'm exhausted我不能再这么下去。我累了。
I've been acting like I'm okay, but I'm not.我一直假装没事,其实不是。
You're not wearing long johns?你还没穿秋裤呢?
口语里long johns就是秋衣秋裤的意思,动词用wear

What are you!你算什么东西!
大家记住!Who are you是你是谁的意思。
What are you是
你算什么东西!意思相差很远!不要说错!

I'm zone out 我走神了
及时行乐则是to eat, drink and be merry
Your delivery 有你快递
I got a delivery this morning我今天早上收到了个快递
yucky school dinners 学校饭很难吃
Why are you still up 你怎么还没睡 我妈经常跟我说这句话!!
We had a bit of a row.我们吵架了。
have a row: 吵架 row: 大声争吵

You are enigmatic 装神弄鬼的!
enigmatic: 神秘的

I'm sleep-deprived: 睡眠不足
This is karma报应呀,这就是报应!
Everyone has a little dirty laundry每个人都有一些脏衣服的含意是每个人都有不可告人的秘密
相当于“Everyone has a skeleton in his closet”。

You rock 你真牛b或You're really something!你真牛b
Prices are running wild all over the country.全国的物价都在暴涨
Electricity has gone up 电费也涨了

She is a carbon copy of her sister.她跟她姐姐长得一模一样carbon copy以表示“极相像的人;极类似的事”
You're blowing this out of proportion.你小题大作了。
roll right off one's tongue 舌头上滚下来-----顺口
trip over one's own tongue 打磕巴,trip除了“旅行”还有“绊倒”的意思
拗口的东西则是“a tongue twister”(不仅仅是绕口令啊~)

大众情人是“Lady killer” (女性杀手啊~~~)
Every girl dreamt of dating him in college. He's such a lady killer!
有些大众情人仗着自己长得帅,脾气古怪,很难伺候,那么难伺候怎么说呢?
High maintenance 就是难伺候的意思
比如说 My boss is a high-maintenance guy! He's constantly complaining.


菜鸟的英语是newbie/ˈnubi/
菜鸟通常需要别人的指点,别人的指点比较地道的说法是:pointers
例如,I need someone to give me a few pointers on how to find the coolest iPhone apps.
而对于要提供帮助的人来说,可以这么回答: I can show you the ropes.
为什么用"rope"这个词呢?因为在很久以前,新水手必须掌握的技能就是如何操控绳子,这个词用法渐渐被扩大了,show sb. the ropes就是教导新手做某件事情的意思。


夜猫子是“night owl”,owl是猫头鹰的意思
既然提到了夜猫子,不如把和睡觉有关的词都告诉大家吧~~
睡觉这个词,其实也是有口语表达的,叫“hit the hay”,“hay“是“稻草、干草”的意思
light sleeper是睡觉轻的人,与之相反,睡觉比较“死”的人是sound sleeper


awesome adj. 令人敬畏的; 使人畏惧的; 可怕的; 极好的
这个词可以用来表达“牛”的意思,You're awesome就是“你太牛了”
另外,你还可以说"you rule" or "you rock",表达的意思相同,只不过"rule"和"rock"是动词。
如果形容“牛气哄哄”的人(贬义),可以用cocky


国外一般将大龄女青年称为3S lady,也就是Single(单身)、Seventies (大多数生于上世纪七十年代)、Stuck(被卡住了,即在寻找伴侣的路上被卡住了)。也有人用SAS来形容“黄金剩女”,即single(单身)、attractive(迷人),successful(成功)。
除此之外,on the shelf这个短语也可以表示女子过了适婚年龄依然未能嫁出去的状态。
例如:Why is the hello girl still on the shelf? (为什么这个女接线员还没嫁出去?)
即将被“剩”下的男女,也有一个称号---doomed single必剩客)


如果你打算和朋友去旅游,把东西都打包装好后,可以说“Everything is in the bag.Let's set off!"意思是一切都搞定了,我们出发吧!

Let's play it by ear! 意思是看情况而定。
play it by ear原指人不用乐谱,仅凭记忆就可弹奏乐曲,引申为“没有计划,依据当时的情况而定。


"真笨!"英文怎么说 
Bill: I ran into a glass door yesterday.
比尔 :我昨天撞到玻璃门上了。
Mary : What a bone head! Be careful next time.
玛丽 :真笨,下次小心点。
"What a bone head’‘ 就是形容某人真笨的意思,bone head字面 为“骨头脑袋“,引申为”没有脑筋的人,笨蛋”,例如:She is a bone head.她是个笨蛋。


跟某人一般见识就是 stoop down to one's level.
stoop n. 门廊,游廊; 自贬; 弯腰
vt.& vi. 屈服,忍辱; 弯腰; 倾斜; 自贬
给大家举个例子:We would only be stooping down to his level if we returned the insult.
如果我们用粗鲁的语言回敬他的话,那么我们把自己降低到和他一样的水平了。


It takes two people.一个巴掌拍不响。

Don’t chicken out! 别做胆小鬼!
chicken除了“鸡”的意思,也指“胆小如鼠的人”,chicken out指“因为胆小而落跑”。以后遇到这样的胆小鬼,记得对他说:“Don’t chicken out!”

Lunch is on me. 
午饭我请客。


小心眼儿可以用petty adj. 不重要的; 卑鄙的,小气的;
比如说这句话:you don't know how petty she is!
就是 “你都不知道她是有多小心眼!”的意思。
hold a grudge against sb.是记仇的意思,
Get over it 就是“不再计较”的意思。


He is an alpha male.他是男人中的男人。
alpha male:alpha是希腊字母的第一个字母,即居统治地位的,占主导地位的男性。He is an alpha mal也就是 纯爷们


电灯泡是the third wheel,可别直译成light bulb啊!
说完了电灯泡,就不得不说这个词组了:love birds.指的是那些特别爱在大众面前秀恩爱的情侣(本人表示很反感~~)
例如,I don't want to be the third wheel and bother the love birds!


I'm about to burst!: 我快憋不住了!
这句话用憋不住尿或屎上


That's a girl/boy: 真乖。 对对方亲昵的称呼。

到现在,美国仍十分流行一种表示“上厕所”的说法,那就是to answer the call of nature
所以I need to answer the call of nature.就是“我想去厕所”的意思,我们还可以简短地说nature calls
nature这个单词用来隐喻不便直言的身体功能或部位


I‘m starving! 我饿死了!
Tummy is grumbling 肚子饿的咕咕叫
Grab a bite 随便吃点东西
I’ll go to the mall and grab a bite.


AA制 Go Dutch
a:How about we just go Dutch? 我们AA制好吗?
b:It's settled. 就这么说定了.
a:That makes so much more sense.这还差不多!


Pro 高手, 牛人, 行家
Jonathan makes these wonderful pancakes . He is such a pro at cooking.(pancake是煎饼的意思~)
Hotshot 既有胆量又有能力的人
Jeremy Lin is definitely a hotshot basketball player!
Big deal 大人物
Big leagues 某领域的最高级别
My friend David is kind of a big deal now.He recently got accepted to Harvard .He is going to the big leagues now.


Lucy : Waiter, come here please. Could we have a doggie bag?
露西:服务员,过来一下,请问我们可以将这些剩菜打包吗? 

Waiter : Sure. Wait a moment.
服务员 ::当然可以,等一下

doggie bag和小狗有什么关系呢?
在西方国家,人们去饭店总会有饭菜吃不完的时候,扔了觉得浪费,想打包回家又有些碍于面子,所以人们常会说:“把菜装起来,我拿回家给小狗吃”。实际上小狗是享受不到美味的,久而久之,这种装剩菜的袋子就被称为doggie bag。


She sulked again. 她又在生闷气了

眼屎:sleepies ; eye gunk
I always have sleepies in the corner of my eye when I wake up in the morning.
耳屎:earwax
I use Q-tips to get the earwax out of my ears.(PS:Q-tips是棉签)
鼻屎:Booger
如果某个人很烦人,你也可以说“You are such a booger ”


I have a weakness for sth.” 这句话很容易引起歧义。
它的不是说“不喜欢某物”,而是“对什么东西抵抗力弱”,也就是表示“十分喜爱,禁不住诱惑”的意思。
因此,“I have a weakness for coffee.” 不是说不喜欢咖啡,而是说我抵挡不住咖啡的诱惑,表明“我酷爱咖啡”。


今天冷死啦!
It's freaking cold today!


1)I've missed my period.我大姨妈没来。

  2)I’m having my period./I'm on my period. 我现在是月经期。

  3)My period is over.我月经期结束了。

  4)I just had my period yesterday.我昨天刚来月经。

  5)My aunt Flo is visiting. 我的大姨妈来了。

  6)My period was 2 days late/early. 我大姨妈推迟(提前)了两天。

  Gentlemen, please do not piss your women off during their period. It's quite dangerous!


喝汤是“Eat soup”,而不是“Drink soup”
汉语的“喝稀饭”也不要译成drink porridge,应译成eat porridge(吃稀饭)。小孩“吃奶”不能译成eat milk,而应译为suck the breast(吸乳)。“喝奶”可以译成drink milk。

I was twice married 我结过两次婚

I fed up with learning English 英语我是学腻了
Fed up with 极厌恶 后面可以加人或者事情 对什么人或者事情很厌恶的时候,就可以这么说


My stomach is growing.我肚子开始咕咕叫了.

What a bummer 杯具了
A bummer就是坏消息的意思~ 


中国国航的表达是 Air China,可不要说成 china airlines,后者是台湾的中华航空

It was a wildgoose chase.白费了半天劲
a wildgoose chase:野鹅性野, 行踪不定, 人们很难捕获, 故wildgoose chase 指“徒劳之举”, “白费力气的追逐”。


强迫症; 有强迫症的人 OCD=obsessive-conpulsive disorder
例如:
David Backham is an OCD.If he has 3 sodas, he has to throw one away.Because the number of sodas must be even. So OCD!
小贝有强迫症。如果他有三罐饮料,他就必须扔掉一罐,因为饮料必须是双数才可以。真是有强迫症啊



Sunday, March 2, 2014

地道美语表达 (Page 70 - 79)

From http://forum.iask.info/showthread.php?t=339102&page=70
1.
不管那么多了~英语怎么说 

Here goes nothing 中文里很难找到完全对应的说法,有点像: “好了,不管那么多了,就这样吧。”
2.
Don't take this the wrong way别曲解我的意思
3.
Here we go: 好啦。 可以啦。开始吧。

这句话在美剧中太常见了,出现频率很高,意思也很多,好啦。 可以啦。开始吧。都可以用这句
4.
郁闷~用英语怎么说 

I'm so down.郁闷


其实说法有很多,I'm so depressed. 我很郁闷 或 I feel so upset. 我觉得很沮丧。 都可以

5.
Why have you been so short-tempered lately?你最近怎么脾气那么急?

Short-tempered: 脾气不好的 。lately: 最近

6.
翻来覆去睡不着~英语怎么说

I've been tossing and turning all night翻来覆去睡不着

toss and turn! 这个词组的意思就是辗转反侧,难以入眠!
7.
卖萌的小眼神~英语怎么说 

puppy-dog eyes 就是睁大眼睛,像小狗一样卖萌装可怜

看个句子:my little nephew gives me those puppy-dog eyes every time he wants to play with my iPad!

8.
你给我记住!~英语怎么说 

You mark my words 你给我记住!
9.
sit-ups仰卧起坐

sit-ups really help them lose their beer bellies仰卧起坐帮助他们减掉了啤酒肚
10.
I had jet lag for 2 days 我倒了两天时差
jet lag: 时差。来看下面的例句,学学“倒时差”怎么说吧。
When I went to Japan, I had jet lag for 2 days.(上次去日本,我倒了两天的时差。)
11.
没事 ,我自己来~英语怎么说

Never mind, I'll do it myself.没事,我自己来
12.
scantily dressed 穿得那么暴露

The way Mary was so scantily dressed will also cause tongues to wag.玛丽穿得那么暴露,肯定会让人说闲话的。
13.
网速太卡~英语怎么说

Internet is lagging. 网速太卡!

这个是个老美告诉我的。

14.
我来帮你~英语怎么说

I'm doing you a favor 我来帮你。
15.
杯具了~英语怎么说
What a bummer 杯具了


A bummer就是坏消息的意思~

16.
别不好意思~英语怎么说 

Don't embarrass 别不好意思了!

I'm not embarrassed.我才没不好意思。

17.
你放屁!~英语怎么说 

You are talking shit! 你放屁=你胡说=你瞎说八道,很气愤的口气!
18.
高兴得发疯 go hog wild(固定成语)

The kids went hog wild 孩子们简直高兴得发疯
19.
It's just that she's so... cheap.She's beneath you.

她也忒俗了吧。配不上你。
20.
Give me a straight answer, don't muck me about!(给我一个干脆的回答,别蒙我!!)

muck me about: 蒙我,耍弄我
21.
Too salty太咸了。
22.
Well, we'll scrimp and save.这样吧,我们开源节流。

scrimp: 节省着过日子。没想到国外也有这个词
23.
六辆车撞在一起了!Ouch...a six-car pileup!

Pileup 就是连环车祸
24.
Could you give me a better price?
你可以给我一个实在价吗?

记得在美国和老美还价的时候要说Could you give me a better price,他会对你另眼相看。觉得你是个坎价的行家。
如果卖东西的人非让你加几块钱,你就用这样的口气告诉他。
15 dollars final price.15元,不再讲价了

25.
Wrap it up ,please 是一种比较文明的表达方式,
还有一种很随意的方式是 :Can you give me a box.
另外 有一个单词叫doggie bag狗食袋。有时候也有人会说Can you give me a doggie bag~~也是打包的意思,不过这句话太不文雅了。
所以我们常用的表示 要打包带走的句子是
Can you give me a box/bag 或者 Wrap it up ,please

26.
Can you possibly take it easy?你能不能悠着点儿?


possibly: 可能 take it easy: 慢点来

27.
She always stays as cool as a cucumber when things go wrong.有问题发生时,她一直很淡定。


cool as a cucumber 镇定自若=
很淡定

28.
“你们这里有什么菜做得好?”“你们这儿有什么特色菜?”~~~~地道英文表达
What's good here?

如果你是第一次到一家餐厅吃饭,就可以用这个句子来问服务生,“你们这里有什么菜做得好?”“你们这儿有什么特色菜?”同样的意思还可以用另外一个句子来表达,“What do you recommend? ” 一般说来,每个餐厅都有它最拿手的几道特色菜,所以就一定要问一下,以免后悔哦

29.
找你的电话~用英语怎么说 

You're wanted on the phone. 

30.
Foul! ref! foul!“犯规啦!裁判!”


除了运动员和观看比赛的人以外,还有一族人群很特殊,那就是裁判,裁判的英文是referee,念的时候重音在第二个字母r上,但是在比赛中很少听到球迷去喊这么完整,一般都简称ref。foul是犯规的意思

31.
舒舒服服洗个澡,然后上床睡~英语怎么说 

Take a long bath and be in bed 舒舒服服洗个澡,然后上床睡觉

32.
Don’t even think about it. 这种事你想都甭想。
一定要注意even的用法,才能表达出这么强烈的意思。

33.
We can't handle another kid.养不起孩子啦。


kid可以换成 猫啊,狗啊,反正养不起什么,就说什么