2009年3月24日星期二

曾国藩12条

曾国藩写过很多关于为人处世的家书,他的部分家书得到很多读者的青睐。

他为自己立下课程十二条:

  1. 主敬:整齐严肃,清明在躬,如日之升。
  2. 静坐:每日不拘何时,静坐四刻,正位凝命,如鼎之镇。
  3. 早起:黎明即起,醒后勿沾恋。
  4. 读书不二:一书未完,不看他书。
  5. 读史:念三史(指《史记》、《汉书》、《后汉书》),每日圈点十页,虽有事不间断。
  6. 谨言:刻刻留心,第一工夫。
  7. 养气:气藏丹田,无不可对人言之事。
  8. 保身:节劳、节欲、节饮食。
  9. 日知其所无:每日读书,记录心得语。
  10. 月无忘其所能:每月作诗文数首,以验积理的多寡,养气之盛否。
  11. 作字:饭后写字半时。
  12. 夜不出门。

2009年3月21日星期六

SQLServer之查找column上的constraint

SQLServer如果column有default value, 竟然会自动创建一个constraint, 名字是随机取的,因此drop column前要先drop这些constraint, 但是知道有哪些关联constraint可不容易:

select
col.name,
col.column_id,
col.default_object_id,
OBJECTPROPERTY(col.default_object_id, N'IsDefaultCnst') as is_defcnst,
dobj.name as def_name
from sys.columns col
left outer join sys.objects dobj
on dobj.object_id = col.default_object_id and dobj.type = 'D'
where col.object_id = object_id(N'dbo.dsyh858375307642')
and dobj.name is not null

2009年3月18日星期三

DB2之执行sql脚本

最普通情况:
db2 -tvf yourfile.sql  脚本中用分号隔开每条语句, !开头的语句表示clp命令

换个分隔符@:
db2 -td@ -vf yourfile.sql 

DB2之db2trc

除了db2diog.log之外的详细trace, 一般是给developer来debug的
一个普通流程:
db2trc on; #打开trace
db2trc clr; #清空之前的trace
do your things
db2trc dump trace.dmp; #导出trace
db2trc off; #关闭trace
db2trc flw trace.dmp trace.flw; #转成flw格式
db2trc fmt trace.dmp trace.fmt; #转成fmt格式

参考:

2009年3月16日星期一

Java的隐藏与覆盖

五大原则:

1. 实例方法被覆盖,静态方法被隐藏

2. 试图用子类的静态方法隐藏父类中同样标识的实例方法是不合法的,编译器将会报错

3. 试图用子类的实例方法覆盖父类中同样标识的静态方法也是不合法的,编译器会报错

4. 静态方法和最终方法(带final的方法)不能被覆盖

5. 实例变量和类变量能被隐藏,被子类的同名变量成员隐藏, “super”可以访问父类中被隐藏的实例变量



2009年3月12日星期四

DB2中有用的系统视图

参考:http://www.devx.com/dbzone/Article/29585/1954

SYSCAT.TABLES
Column Name Data Type Description
TABSCHEMA VARCHAR(128) Stores the schema name on which the database object is defined
TABNAME VARCHAR(128) Stores the name of the database object, such as table, view, nickname, or an alias
TYPE CHAR(1) Identifies the database object as a table, view, alias, or a nickname (The type value 'T' means table; 'V' means view; 'N' means nickname; and 'A' means alias.)
COLCOUNT SMALLINT Number of columns in the table or view
KEYCOLUMNS SMALLINT Number of columns that constitute the primary key
KEYINDEXID SMALLINT Index ID for the primary key
KEYUNIQUE SMALLINT Number of unique constraints in the table or view



SYSCAT.VIEWS
Column Name Data Type Description
VIEWSCHEMA VARCHAR(128) Schema name for the view
VIEWNAME VARCHAR(128) Name of the view
DEFINER VARCHAR(128) User who created the view
VIEWCHECK CHAR(1) Type of view checking defined for this view:
  • N = means no check option
  • L = means local check option
  • C = means cascaded check option
  • READONLY CHAR(1) Defines whether the view is read only or not:
  • Y = means read only
  • N = means view is not read only
  • VALID CHAR(1) Determines the validity of the view:
  • Y = means view is valid
  • X = means view is invalid
  • TEXT CLOB(64K) DDL text for view


    SYSCAT.INDEXES
    Column Name Data Type Description
    INDSCHEMA VARCHAR(128) Name of the schema on which the index is defined
    INDNAME VARCHAR(18) Index name
    DEFINER VARCHAR(128) User who created the index
    TABSCHEMA VARCHAR(128) Stores the schema name of the table on which the index is defined
    TABNAME VARCHAR(128) Stores the name of the table for which index is defined
    COLNAMES VARCHAR(640) List of columns in the index
    UNIQUERULE CHAR(1) Determines whether the index is unique or not:
  • D = means duplicate allowed
  • P = means primary index
  • U = means unique index
  • INDEXTYPE CHAR(4)
  • CLUS = means clustered index
  • REG = means regular index
  • DIM = means dimension block index
  • BLOK = means block index




  • SYSCAT.TRIGGERS
    Column Name Data Type Description
    TRIGSCHEMA VARCHAR(128) Name of the schema on which the trigger is defined
    TRIGNAME VARCHAR(18) Trigger name
    DEFINER VARCHAR(128) User who created the index
    TABSCHEMA VARCHAR(128) Stores the schema name of the table for which the trigger is defined
    TABNAME VARCHAR(128) Name of table for which the trigger is defined
    TRIGTIME CHAR(1)
  • A = means after trigger
  • B = means before trigger
  • I = means instead of trigger
  • TRIGEVENET CHAR(1) Event for which the trigger is defined:
  • I = means INSERT
  • D = means DELETE
  • U = means UPDATE
  • GRANULARITY CHAR(1) Determines whether the trigger is executed per statement or per row:
  • S = means once per statement
  • R = means once per row
  • TEXT CLOB(64K) Full text of the trigger statement




    2009年3月9日星期一

    项目中的教训

    1, 每个迭代没有及时的review, 造成无法快速的响应变化

    2, 虽然defect被良好的跟踪记录了,但是需求和设计的更新没有有效的跟踪和记录,每次更新设计文档的时候都很混乱。应该一开始就用wiki来写文档,每次做review或者讨论的结果都应该及时更新wiki.

    3, 既然团队缺少明确的leader,我应该主动承担leader的一些任务,比如及时更新记录每次review和讨论的结果,这个我做的相当不够

    2009年3月7日星期六

    WAS之Node、Profile、Server与Cell

    关于 Node、Profile 与 Server:
    这三个概念比较容易混淆,我们拿出来对比说明:Node=Profile。Node 是管理上使用的概念,Profile 是实际的概要文件,它们代表同一事物。Server 就是所谓的 Application Server Instance , 这是我们实际要布署 Application 的地方。在IBM WAS ND 产品中受管节点的 Node Agent 目的就是让 Deployment Manager Server 可以透过 Node Agent 来管 Node (Profile) 中的 Application Server Instance,一个 Node (Profile) 中可以有多个 Application Server Instance。

    如果是非 ND 版本 , 则属于 Single Server 版本,那么一个 Node (Profile) 中只能有一个 Application Server Instance,如果你希望在一台机器上有多个 Application Server Instance,那就只能透过创建多个 Profile (Node) 来达成,但这些 Node (Porfile) 彼此独立没有管理上的关系 (RelationShip),只要使用的 TCP/IP Port 不要冲突即可。

    Cell:
    单元是整个分布式网络中一个或多个节点的逻辑分组。单元是一个配置概念,是管理员将节点间逻辑关联起来的实现方法。管理员根据具体的业务环境,制定对其整体系统集成环境有意义的条件来定义和组织构成单元的节点。就一般情况来说,可以将单元看作是最大的作用域。

    参考:http://www.ibm.com/developerworks/cn/websphere/library/techarticles/0705_qihong/index.html

    2009年3月3日星期二

    读《轻松scrm之旅》

    这两天一口读完的这本书,如同读金庸小说血脉贲张,梳理下points:

    1. 迭代(sprint)分的小些比较好,每个sprint都是调整的机会,sprint多了调整的机会也多了,在每个sprint都要完成几个story

    2. 工作task化, story都要细分成task,task是最小的work item(8-10 person-hour工作量最好), 团队成员自主来选择task, 用task面板来管理task, 大家在task面板上能看到所有task的状态.


    3. 每天开scrum每日会议,时间不超过15分钟,大家都站着开,看着task面板轮流发言。每个人回答3个问题,1我昨天做啥了,2今天打算怎么做,3遇到什么困难。会议时间一定要控制,如果有细节应该会下讨论。scrum会议能保证团队之间互相了解,并且及早发现问题。

    4. sprint结尾的review会议非常重要,然后应该紧接着开下个sprint的plan会议。这两个会议是scrum中最最重要的两件事情。

    5. 文档要尽量少而精,最好用wiki来维护

    6. 虽然文档少,但是可以采用结对编程的方法使新人快速上手,结对编程最好用共享桌面或共享IDE的工具来实现。组员之间也应该采用结对的方式来做code review,最好一老带一新。

    7. 第N+1个sprint测试第N个sprint的内容

    2009年3月2日星期一

    今天一点体会

    DCUT上周终于结束了,虽然还留下几个特费劲的defects. 今天release meeting的时候,老板突然提出我们的实现不够smart,哎~,老板说的确实有些道理,可是怎么现在才提出来啊。这次的开发确实有很多不足:

    1. 所谓的迭代根本没起到作用,虽然每个迭代结束都更改了点设计,但是没有认真的做迭代Review和下个迭代的Plan,这两件事至关重要,要是老板的comments上个迭代能提出来就好了

    2. 迭代点不能拖延,做不完的任务应该放到下个迭代,每个迭代点是个非常好的调整机会

    3. Test team介入的还是晚了,导致他们前期无事可做,现在又赶不上进度

    4. Dev Team没有了leader,导致大家讨论太少,code review也做的不够,我应该主动来push