2009-01-25

守岁杂记

又一次未能回老家过年, 临时起意今年主动守岁, 且按北京时间与老家亲友同步熬个通宵.

估算着老家团年饭开桌前, 先打个电话回去, 惊喜地发现全体亲友们在老姐的鼓动下, 头次解放思想而跟进时代在餐馆定位团年. 难得二大姑三大姨都到齐了, 电话中只听得欢声笑语, 热闹非凡. 老姐还说给我留了位, 听得感觉暖洋洋的.

看完两张无聊但还算有趣的影碟, 本地时间才刚过三更多. 离春晚开播还有两个钟头. 试着上网搜索山寨春晚的直播网址, 试图到时同时看两场晚会, 增加点乐趣好对抗瞌睡虫. 可笑根本连不上去, 而且是500类的错误, 纯属糊弄网民大众, 闹剧一场, 比"芙蓉姐姐"还不如 -- 人家好歹还摆了些独创性的S造型, 大家随时都能上网查到. -- 还是要讲究"没有金刚钻, 甭揽那瓷器活"麽.

突然看到梁羽生大侠节前升天的新闻. 梁大侠高寿, 算得是喜丧. 他是信佛的, 祝福他西天成佛.

静夜中五更悄然来临, 熬夜最困顿的时刻, 难怪古人要靠鸡鸣来提醒去赶飞机大炮, 这个时候一睡倒自个可真没法自然醒. 泡一杯茶, 思考守岁的原因和意义. 古时华人讲究多子多福, 大家庭居多, 除夕夜全体团聚到一家, 床铺显然不够. 于是安顿好老人小孩 (小孩多是挤到一起, 既有趣热闹, 又无意中培养了堂表兄弟间的熟络, 自然排除隔阂, 达到兄弟同心的境界), 青壮年就围着火讲故事熬夜. 但只有一小搓家庭拥有能不停讲故事的人, 如何大家一起熬夜而不困倒呢? 棋牌之外, 麻将应运而生 -- 国粹因吾此深思而诞生. 善莫大焉.

编出两个贫嘴问答题打发了剩余的时间. 壮哉熬夜!

问1:二者选一, 有水洗澡无衣服换, 有衣服换无水洗澡. 你选哪样?为什么?

答1A:宁可只换衣服不洗澡, 避免洗澡而不换衣服。因为刚洗完澡时皮肤毛细血管畅通, 不换衣服则等于为脏衣上的细菌病毒大开城门, 不战而降!

答1B:拿了衣服走人. 找地儿收集尿水制作蒸馏水再洗澡, 还可能一不留神就制作出了矿泉水.

答1C: 洗完澡不穿衣服. 赤条条来去无牵挂.


问2: 为什么国人上公共汽车不排队而要一哄而上地挤?

答2: 因为从小就人多车少, 不挤就没车上. 时间长了就形成条件反射, 看见车来就是刺激信号. 同样条件搁哪国都一样. 等经济发展到车多人少了, 别说挤, 请都不上车! 关排队不排队什么了事.

2009-01-24

英雄凯旋 - 赞振华4号船长和船员们

海盗专业, 一份古老神秘很有钱途的职业, 前途未卜;

抗击海盗, 一份崇高的临时工种, 别指望谁干一辈子.

在神秘恐怖的亚丁湾, 突遇名动天下的索马里海盗,

振华4号船长彭维源遇危而定, 准备得当而指挥有序,

全体30名船员临危不乱, 水龙当机枪啤酒瓶是炸弹,

拒悍匪于咫尺处达数小时, 无畏的精神, 无敌的勇气.

全球为他们的勇敢惊叹, 身为华人对此而倍感骄傲.

向英雄们脱帽致敬, 为他们的谋略果敢和精神干杯.

2009-01-16

Debug Stored Procedure in TOAD

Pre condition: install/upgrade to version 9.6 or above of TOAD for Oracle.
Step 0: Debugger Options
View => Toad Options -> Debugger
Starting with the 10g release, Oracle offers a new interface, known as JDWP, for debugging PL/SQL and stored Java procedures. Toad fully supports both interfaces, but recommendation is to continue with DBMS_DEBUG unless you need to debug your Java code.
Step 1: Compile with Debug
1.1 Enable compile with debug: turn on the 'little green bug' button
1.2 Compile:
Database => Schema Browser -> My Schema -> Functions / Procedures / Packages
Right click on the procedure / package item, and then select "Compile" -> "Compile with Debug" from the popup menu.
Step 2: Load stored procedure code into the editor
Right click on the procedure / package item, and then select "Load in Editor" from the popup menu.
Step 3: Set breakpoints (Optional)
Click on the line number which you want the line to be a breakpoint
Step 4: Start debug:
4.1. Debug => Run / Run to Cursor / Step Over
Or click on the debug toolbar
Note: please choose "No" if you encounter following confirm window (when the code contains reference to other schema), otherwise you probably will run into privileges problem.
4.2. Set parameters:
Replace the NULLs with your test data value
Step 5: Use (Smart) Watches to view the PL/SQL variables value
When the execution pause at a breakpoint (current cursor), one can define watches or use the embedded Smart Watches (pay attention to "Enable Smart Watches" checkbox) to view variables value
For some detail explanations, please refer to http://docs.google.com/View?docid=dhq5wjmg_342dhsdnbdb

Swing TreeCellEditor Methods Call Flow

Help a friend fixed a bug. discovered the clear call flow of Swing tree editor. keep it here for future reference.



V0.2 (Correction
, Jan.19, 2009):


Important: in the initialization part of a customized TreeCellEditor, one must implement an ActionListener and register it to the real editor Component’s listener list.
In the implementation, call stopCellEditing() and check the return value, if true, fire ChangeEvent to listeners’ editingStopped() methods.


A. User choose (click / select) a node for editing:
1. isCellEditable()
// [if return false, exit!]
2. getTreeCellEditorComponent()
// argument “Object value” is the initial (existing) value (model wrapped) of the selected node to be edited.
// here is the place to store the initial value
3. shouldSelectCell()
// returned value only affect the node will be highlight (mark as selected) or not.

B1. User finished editing (leave the node / select another node):
4. stopCellEditing()
// here is the place to:
// * get the editor status,
// * do validate if necessary
// * compare to the initial node value,
// * and set the new node value.
If return false, should no fire ChangeEvent to listeners, so no call to step 5.
5. getCellEditorValue()

B2. User canceled editing:
4. getCellEditorValue()
// the tree (swing framework code) retrieve the result for purpose not known yet.
5. cancelCellEditing()


0. addCellEditorListener()



[last some grievance only]:
Though Java docs is much better compare to MSDN docs. Some parts are still not good enough or hard to understand, especially some advanced features. Looks like these Java API designs are designed for the designer only, no intention for user's understanding. I guess that's why some experienced technical decision makers want to switch from Java to .Net - tired of try to understand the underline design. Just follow some examples and use the tools to drug&drop and it works. That's what VisualStudio.NET good at. Who cares how it designed, who cares bug fix!

2009-01-14

支持周惠敏

迟到的评论, 看不看随缘.

周惠敏是真纯情.

在这一次的港媒与名人的战争中, 周惠敏的纯情展露无遗, 而且不受普通人性恶尘的沾染, 甘愿舍弃世俗的声誊而捍卫自己的情感空间,
宁受孤立而坚持到底. 没有这一点, 光凭倪震的鬼才和小聪明是不可能面对众多媒体而占优势的. 周惠敏靠着纯情与坚持, 高效地完败无知的小三,
撼卫了属于自己的情感空间. 这一点只怕后辈的青春玉女们难以匹敌. 对比同期的伊能静闹剧, 高低立判.(只可怜庾澄庆得顾虑小孩,
无法如倪震般挥洒自如). 更别提甲淳类的姣姣女们了.

也算见识了倪震的文字. 可惜鬼才太过, 开脱自己有余, 自省精神欠缺, 不足以成大器. 如果网民形成抵制, 不再看其文章,
拒绝购买其出版的报刊杂志, 这号称的才子会如何反应? 是否会安心一心一意在后台出谋划策支持周惠敏?
倒是很有兴趣看这一对才子佳人最终会走向何方.