wayne's profileTititaPhotosBlogListsMore Tools Help
    March 23

    我还是要看企划书...

    老头 to 下属:下午把企业策划书拿给我看。
     下属 to 下属老婆:企划书丢家里了,你下午帮我把它送到公司来。
     下属老婆 to 下属老婆的妹妹:我怀孕不方便,你下午把企划书给你姐夫送去吧。
     妹妹 to 妹妹的家教学生:今天下午不能去给你上课了。
     家教学生 to 开始的老头:爷爷,今天下午你能陪我玩嘛?

     老头 to 下属:企划书下午不用拿给我了。
     下属 to 下属老婆:企划书不用送了,恩。。。
     下属老婆 to 下属老婆的妹妹:企划书不用送了。。
     妹妹 to 妹妹的家教学生:今天下午还是要上课。。
     家教学生 to 开始的老头:爷爷,今天下午没有空跟你玩了。。

     老头 to 下属:下午我还是要看企划书……
    March 21

    Can World's Strongest Dad

    Read the article first and then watch the video: http://cjcphoto.com/can/

    本期三联周刊上也有相关的文章:《豪特之队:站在起点上的勇气》

    下面是从网上找到的文章,转载在此:


    http://www.ycwb.com/xkb/2006-09/17/content_1216769.htm

    两个人的马拉松

    仅仅为了儿子的一句话“爸爸,我想跑”,25年来,迪克·霍伊特推着儿子参加了85次马拉松比赛。做这一切的原因只是为了看到儿子脸上的笑容。而儿子的心愿是“让我推父亲一次”!

    这是一对父子间的感人故事。爸爸叫迪克·霍伊特,儿子叫里克·霍伊特。这对父子是长跑“健将”,在过去25年里,他们一共跑了 3770英里,其中包括85次马拉松赛、24次著名的波士顿马拉松赛、20次Duathlons赛、7次18.6英里赛、34次10英里赛、143次5英里赛、6次20英里赛、27次Falmouth7.1英里赛、15次4英里赛、2次11公里赛、8次15公里赛、204次10公里赛、4次8公里赛、92 次5公里赛、206次奥运标准的三项铁人赛、6次被公认不是平常人可以承受的终极三项铁人赛……

    但他们可不是普通的长跑“健将”:儿子的腿从一出生就不能动,只能坐在轮椅上;父亲也没有天生的运动才能。但仅仅是为了儿子的一句话 “爸爸,我想跑”,父亲就义无反顾地推着儿子开始了长达25年的长跑。有一次,他不但用轮椅推着里克跑了26.2英里,还用救生浮艇拖着他游了2.4英里(约3.84公里),然后再用自行车载着儿子骑了112英里(约180公里)———这些全部都是在一天内完成!父亲还曾拉着儿子参加越野滑雪,背着他爬山,甚至用自行车拉着他横越美国。

    那么,儿子又为他的父亲做了什么?“我最想送给老爸的,是让他坐在轮椅上,由我来推他一次!”

    编 号: 25727    
摄影作者:   
文件名:kgjwcy69215.jpg  
文件大小:K  
高 X 宽:420 X 300  
说明:kgjwcy69215.jpg

    11岁时第一次“说”话:“褐熊队,上!”

    这个动人故事发生在43年前美国马萨诸塞州的文彻斯特市。里克出世了。但刚来到这个世界他就遭遇了命运的捉弄,小里克几乎丧命:脐带勒住了他的脖子,并造成大脑损伤,出世后的里克根本无法控制四肢。

    转眼间,小里克9个月大了。医生对里克的父母说:“他以后将成为植物人。把他送到慈善机构算了!”但霍伊特夫妇没有这么做。迪克和他的妻子朱蒂注意到,当他们在房间里走动时,小里克的眼睛一直盯着他们。当里克11岁时,霍伊特夫妇把他送到特夫兹大学工程系,询问有什么办法帮助这孩子与人沟通。可得到的回复是:“不可能。他根本没有任何脑部活动。”

    但迪克反驳说:“你给他说个笑话试试。”大学里的人一试,果然,小里克笑了———他的大脑能正常地运转。结果,他们为里克装了一部能用头的侧面控制鼠标的计算机,里克终于能和外界沟通了。里克有生以来“说”的第一句话是:“褐熊队,上!”(译者注:褐熊队是波士顿的冰上曲棍球球队。)

    编 号: 25722    
摄影作者:   
文件名:kgjwcy69211.jpg  
文件大小:K  
高 X 宽:232 X 400  
说明:kgjwcy69211.jpg

    “爸爸,跑步时我好像不再是残疾人!”

    里克上高中后,一位同学因事故瘫痪了,学校为他举办了一次慈善长跑募捐活动。里克犹豫着对迪克“说”:“爸爸,我也想参加长跑。”

    这让迪克感到为难了:他本人都是四肢简单,从未一次不停歇地跑完1英里的路程,而现在,他又怎么能带着残疾的里克跑完5英里(约8公里)呢?不过,为了里克,迪克还是决定“顶硬上”。赛后,迪克的四肢足足痛了两周,以至于他后来说:“现在轮到我瘫痪了。”

    这次比赛也彻底改变了里克的生活。他在键盘上敲出了一句话:“爸爸,我们跑步时,我好像不再是一个残疾人了!”

    这句话也改变了迪克的生活。他希望能常常带给儿子同样的感受。他努力健身,与里克一起准备参加1979年波士顿的马拉松赛。

    可是,迪克从一位赛事管理者那里得到的答复是:“不行。”因为他们既不是独立的参赛者,也不是轮椅参赛者。结果几年来,霍伊特父子只是在赛事中跟着大队伍一起跑。但他们终于找了到正式参加比赛的方法:在1983年,他们参加了另一个马拉松赛,他们的成绩太好了,这令他们有资格参加1984年的波士顿马拉松赛。

    这时又有人建议说:“迪克,你们为什么不参加三项全能比赛?”可问题是———一个从来不会游泳而且自6岁起就没再骑过自行车的男人,怎么可能拉着一个重约50公斤的残疾儿子参加三项全能比赛呢?但迪克还是那句话:“试一试吧。”

    结果一试就试了212次三项全能比赛,其中包括4次在夏威夷举行、极费体力的15小时铁人赛!试着想想,一个老头用小舢板拖着一个成年残疾人,超越所有25岁左右的大块头,那是何等震撼人心的场面!

    迪克当被人问到为什么不单独参加比赛时,他说:“我不会独个儿参赛。”他说,自己参加比赛纯粹是为了享受他们父子俩一起跑步、游泳和骑自行车时的那种感觉,看到里克面上露出甜美笑容时,那种感觉非常“奇妙”。

    编 号: 25717    
摄影作者:   
文件名:kgjwcy69213.jpg  
文件大小:K  
高 X 宽:420 X 300  
说明:kgjwcy69213.jpg

    父亲和儿子都救了对方一命

    今年,已经分别是65岁和43岁的迪克和里克完成了第24场波士顿马拉松赛。在超过2万名选手中,他们的成绩排在第5083位。他们最好的成绩是在1992年的比赛中取得的,用时两小时40分钟,只比世界纪录慢了35分钟。当然,世界纪录是由健全的人在没有推着轮椅的情况下取得的。

    对此,里克自豪地“说”:“毫无疑问,我的老爸是‘世纪父亲’。”

    迪克也从这个过程中获得了好处。两年前,在一次比赛中他患上了轻度心脏病。医生们发现,他的一条大动脉有95%栓塞了。“如果你不是保持这样良好的状态,你很可能在15年前就一命呜呼了。”医生们对迪克说。

    从某种程度上说,迪克和里克都救了对方一命。

    编 号: 25712    
摄影作者:   
文件名:2222kgjwcy69214.jpg  
文件大小:K  
高 X 宽:298 X 400  
说明:2222kgjwcy69214.jpg

    “让他坐在轮椅上,我来推他一次!”

    现在,里克有自己的住宅(他享有居家照料服务)并在波士顿工作,而迪克从军队退役后,现在在马萨诸塞州的荷兰市居住,已经65岁了。他们总有团聚的方法,他们经常在全国各地发表演说,每个周末参加极耗体力的比赛。今年的父亲节,他们又团聚了。

    那一晚,里克想请父亲吃饭,但他更想送给父亲一份永远也买不到的礼物———他在电脑里这样写道:“我最想送给老爸的,是让他坐在轮椅上,由我来推他一次!”

    编 号: 25702    
摄影作者:   
文件名:kgjwcy69210.jpg  
文件大小:K  
高 X 宽:286 X 400  
说明:kgjwcy69210.jpg

    编 号: 25697    
摄影作者:   
文件名:kgjwcy69216.jpg  
文件大小:K  
高 X 宽:420 X 300  
说明:kgjwcy69216.jpg

    March 09

    微软 I'm 活动

    微软最新启动了一个 I'm 活动。I'm,是微软的一个资助慈善组织的活动。你可以在你的 Windows Live Messenger 的昵称前加上一串特殊代码,以表示你支持九个慈善组织中的其中一个,而你的昵称前也会出现一个 I'm 的标志。所有参加此活动的慈善组织都将在此活动的第一年获得最低10万美元的捐款,最高不限上额。而最高能达到多少,则取决于有多少人愿意在自己的昵称前加上该组织的代码。 以下是参加活动的组织:

    American Red Cross -- I'm 准备提供帮助,代码 = *red+u
    Boys and Girls Clubs of America -- I'm 为孩子提供理想的环境,代码 = *bgca
    National AIDS Fund -- I'm 与艾滋病(AIDS)抗争,代码 = *naf
    National MS Society -- I'm 参与到解决多发性硬化症(MS)的运动,代码 = *mssoc
    ninemillion.org -- I'm 帮助9百万流离失所的孩子,代码 = *9mil
    Sierra Club -- I'm 探索和保护这个星球,代码 = *sierra
    StopGlobalWarming.org -- I'm 阻止全球变暖,代码 = *help
    Susan G. Komen for the Cure -- I'm 寻找乳腺癌的治愈方法, 代码 = *komen
    UNICEF -- I'm 救助生死边缘徘徊的孩子,代码 = *unicef
    November 08

    介绍几个曲线图

    介绍几个曲线图

    Published by qinghou 十一月 7th, 2006.

    虽然下面几张图中的曲线可不是曲线救“站”的意思,但倘若你能找到适合自己站点的那个顶峰,寻求平衡,并能抓住机会超越,肯定能获得长久的发展(文章来源自这里,稍做解释,具体还请点击下面的链接)


    Barry Schwartz,可选择的矛盾:当人们没有选择的时候,很可怜。当你增加了选择,就增加了生活的乐趣。但是达到了一个点的时候,就达到了边缘效应。过了这个点,情况就开始恶化了,曲线开始下滑。


    Marissa Mayer,对特征的理解:当维持一个良好用户体验的时候,我们需要增加一些自己的特征。最初当你添加特征(功能性)的时候,用户体验有了新的起色,但很快就明显下滑了。


    Don Norman,产品生命曲线:在达到技术成熟期时,产品具有更好的性能和更高的可靠性。当技术超越了大多数客户的基本需求的时候,用户行为有了大的转变。情感反映、个人自豪感和满意度都成了主要的卖点。


    Kathy Sierra,特征曲线:只要不要对“用户满意顶峰”超越太多,我们相信所提供的产品和服务都能给予人们“由我掌控”的更好体验,可以达到更大的成功。

    Adobe向Mozilla捐赠Flash代码

    近日在美国旧金山举行的一次Web 2.0会议上,Mozilla基金会宣布收到了Adobe公司捐赠的一批Flash源代码。这是开源软件史上Mozilla收到的最大的一次代码捐赠。

    Mozilla基金会将建立一个新的项目,名为“Tamarin”,用来管理使用Adobe将来贡献的代码。

    Mozilla基金会执行官Frank Hecker称,这些改进将在2008年上半年融入FireFox的升级当中。

    也就是说,到时,FireFox将原生支持Flash,许多的网络程序都将得到性能提升。

    --------------------------------

    Flash的春天,未来的Flash应用会非常的棒!看好。

     

    November 03

    Debug php app bug under apache env

    -----------------------------
    环境介绍:
    -----------------------------
    apache2
    php4
    IlohaMail

    -----------------------------
    问题描述:
    -----------------------------
    apache2进程 100% CPU Usage.

      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
     9136 www-data  25   0 32004 7268 4624 R 93.2  0.3 862:10.69 apache2
     9139 www-data  25   0 32320 9060 6088 R 80.9  0.4 161:54.94 apache2
    14882 www-data  25   0 32096 7840 5164 R 78.6  0.4   1400:56 apache2
    27000 www-data  25   0 32072 6556 3980 R 73.9  0.3   1464:32 apache2
    23569 www-data  25   0 32092 7804 5112 R 52.4  0.4   2730:41 apache2

    -----------------------------
    调试过程:
    -----------------------------
    bjm2:~# which apache2
    /usr/sbin/apache2
    bjm2:~# gdb /usr/sbin/apache2
    (gdb) attach 5100
    (gdb) bt
    #0  0xb76a97d9 in execute () from /usr/lib/apache2/modules/libphp4.so
    #1  0xb76a552f in execute () from /usr/lib/apache2/modules/libphp4.so
    #2  0xb76a552f in execute () from /usr/lib/apache2/modules/libphp4.so
    #3  0xb76918f1 in zend_execute_scripts ()
       from /usr/lib/apache2/modules/libphp4.so
    #4  0xb766033e in php_execute_script ()
       from /usr/lib/apache2/modules/libphp4.so
    #5  0xb76b1520 in execute () from /usr/lib/apache2/modules/libphp4.so
    #6  0x08079045 in ap_run_handler ()
    #7  0x08079481 in ap_invoke_handler ()
    #8  0x0806a558 in ap_process_request ()
    #9  0x08065218 in _start ()
    #10 0x0821ba70 in ?? ()
    #11 0x00000004 in ?? ()
    #12 0x0821ba70 in ?? ()
    #13 0x080847cc in ap_run_pre_connection ()
    #14 0x08084685 in ap_run_process_connection ()
    #15 0x0807715d in ap_graceful_stop_signalled ()
    #16 0x08077416 in ap_graceful_stop_signalled ()
    #17 0x08077e42 in ap_mpm_run ()
    #18 0x0807e79d in main ()
    (gdb) info frame
    Stack level 0, frame at 0xbfc4a950:
     eip = 0xb76a97d9 in execute; saved eip 0xb76a552f
     called by frame at 0xbfc4b630
     Arglist at 0xbfc4a948, args:
     Locals at 0xbfc4a948, Previous frame's sp is 0xbfc4a950
     Saved registers:
      ebx at 0xbfc4a93c, ebp at 0xbfc4a948, esi at 0xbfc4a940, edi at 0xbfc4a944,
      eip at 0xbfc4a94c
    (gdb) up
    #1  0xb76a552f in execute () from /usr/lib/apache2/modules/libphp4.so
    (gdb) info frame
    Stack level 1, frame at 0xbfc4b630:
     eip = 0xb76a552f in execute; saved eip 0xb76a552f
     called by frame at 0xbfc4b900, caller of frame at 0xbfc4a950
     Arglist at 0xbfc4b628, args:
     Locals at 0xbfc4b628, Previous frame's sp is 0xbfc4b630
     Saved registers:
      ebx at 0xbfc4b61c, ebp at 0xbfc4b628, esi at 0xbfc4b620, edi at 0xbfc4b624,
      eip at 0xbfc4b62c

    函数 execute 的定义为:
    ZEND_API void execute(zend_op_array *op_array TSRMLS_DC);
    typedef struct _zend_op_array zend_op_array;
    struct _zend_op_array {
            zend_uchar type;        /* MUST be the first element of this struct! */

            zend_uchar *arg_types;          /* MUST be the second element of this struct! */
            char *function_name;                    /* MUST be the third element of this struct! */

            zend_uint *refcount;

            zend_op *opcodes;         zend_uint last, size;

            zend_uint T;
             zend_brk_cont_element *brk_cont_array;
            zend_uint last_brk_cont;
            zend_uint current_brk_cont;
            zend_bool uses_globals;

            /* static variables support */
            HashTable *static_variables;

            zend_op *start_op;
            int backpatch_count;

            zend_bool return_reference;
            zend_bool done_pass_two;

            char *filename;

            void *reserved[ZEND_MAX_RESERVED_RESOURCES];
    };

    function_name 这个字段可作为定位php当前执行函数的属性。
    根据函数定义,查看函数调用参数地址:

    (gdb) x /wx 0xbfc4b630
    0xbfc4b630:     0x08273a80         <-----  op_array的地址

    (gdb) x /3wx 0x08273a80
    0x8273a80:      0x082ff302      0xb636ae10      0xb636ae20 <-- function_name的地址

    (gdb) p (char *)(0xb636ae20)
    $4 = 0xb636ae20 "iil_c_appendfromfile"

    同样,查看 frame #0的函数:

    (gdb) down
    #0  0xb76a97d9 in execute () from /usr/lib/apache2/modules/libphp4.so
    (gdb) info frame
    Stack level 0, frame at 0xbfc4a950:
     eip = 0xb76a97d9 in execute; saved eip 0xb76a552f
     called by frame at 0xbfc4b630
     Arglist at 0xbfc4a948, args:
     Locals at 0xbfc4a948, Previous frame's sp is 0xbfc4a950
     Saved registers:
      ebx at 0xbfc4a93c, ebp at 0xbfc4a948, esi at 0xbfc4a940, edi at 0xbfc4a944,
      eip at 0xbfc4a94c
    (gdb) x /wx 0xbfc4a950
    0xbfc4a950:     0x082398b8
    (gdb) x /3wx 0x082398b8
    0x82398b8:      0x08260702      0x00000000      0xb63122f0
    (gdb) p (char *)(0xb63122f0)
    $5 = 0xb63122f0 "iil_readline"

    至此,可以断定,apache2目前陷入 iil_c_appendfromfile 里面的 iil_readline 循环当中。

    -----------------------------
    故障原因:
    -----------------------------
    浏览 IlohaMail 源码,查看函数 iil_C_AppendFromFile 中调用 iil_ReadLine 的地方。
    发现它没有正确处理错误返回。

    当webmail与imap服务器之间连接出现问题,iil_ReadLine/fgets等函数会返回错误。webmail应正确处理错误情况,避免陷入死循环。


    July 04

    [转载] 金正日语录摘编(颂读时要严肃、虔诚,不能发笑)

    [转载] 金正日语录摘编(颂读时要严肃、虔诚,不能发笑)
    发信站: 一见如故 (Tue Jul  4 08:53:41 2006), 本站(yjrg.net)

    “节约就是生产。”  
    “外交就是吃黄莲时也得装笑的一种交际。”
    “以情还情是人的美德。”
    “对意志坚强的人来说,没有不可能的事。如果说有什么不可能, 那不是朝鲜语。”
    “忠孝是革命家的最高品质。”
    “不存在离开孝心的名人,也不存在离开忠诚的伟人。”
    “信守忠诚的信念和情义就是忠臣,放弃则是奸臣。”
    “革命家的价值观和幸福观、人生观、革命观、组织观、道德观是以领袖观为前提,而领袖观的基本核心归根到底是对领袖的忠诚和心。”
    “人生观的基本核心在于对领袖的忠诚,人生的真正价值和幸福的标准也在于此。” “忠诚,是把领袖作为团结的中心、思想和领导的中心来拥戴,遵照领袖领导的革命战士的政治思想品质。”
    “对领袖的忠诚,要实现信念化、良心化、道德化、生活化。”  

    “忠臣和奸臣都在身边。”
    “青年人的工作场所要有歌舞,有歌舞的工作场所才有革新。”
    “离开歌舞的生活和青春,等于没有花香和生机的花。”
    “迫于统制和要求革命,还是自觉地革命, 这是区分混饭者和革命家的标准 。”
    “对党和革命无限忠诚和耿直,是革命家最重要的气质。”
    “伟大的思想,创造伟大的时代。”
    “伟大的思想,创造伟大的实践。”
    “支配世界的力量,不是金钱或者原子弹而是伟大的思想。”
    “革命不是靠家庭出身,而是靠伟大的思想。”
    “为伟大的思想所领导的党才是伟大的党。”
    “思想是劳动阶级唯一的武器,也是最有威力的武器。”
    “为伟大思想所领导的人民,才能成为创造伟大历史的高度自豪的人民。”
    “思想决定一切。”
    “思想一发动则万事顺利,思想一沉睡则前功尽弃。”
    “就像汽车发动后才可以疾驶一样,发动人的思想才能达到目的。”
    “主体思想,就是人民领袖的哲学。”
    “主体思想是任何力量也打不破的百战百胜的宝剑。”
    “思想、技术、文化,都要遵照主体的要求!”
    “共产主义者的人生以斗争开始,以斗争结束。”
    “只有存在伟大的领袖、伟大的党、真正的祖国的时候,民族才会光辉灿烂,个人的命运和荣誉才会闪耀。”
    “领袖是国家和民族的命运,一切幸福的象征。”
    “谈论没有领袖的革命胜利,就像奢望没有太阳的花一样。”
    “革命在领袖的领导下前进,在领袖的怀抱里人民才能过真正的生活。”
    “只要领袖伟大,小小的国家也会成为伟大时代思想的祖国、思想的强国和政治大国,四射光芒。”
    “伟大的领袖和伟大的党创造伟大的人民。”
    “一个民族的伟大性取决于其国家领袖的伟大,人民的未来取决于其领袖的英明。” “如果没有英明的领袖领导, 群众就等于没有大脑的肉体。”
    “如果没有卓越的领袖,人民就等于没有父母的孤儿。”
    “有领袖的福气,必然会有人民的福气。”
    “革命的领袖观是革命的世界观的核心,在其形成发展过程中起决定性作用。”
    “我们领袖是扶持万民的伟大的慈父,是万民景仰的恩惠的太阳。”
    “民族的伟大性不在于领土的辽阔或历史的悠久性,而是在于引导民族的领袖的伟大性。”
    “我们民族的伟大性就是我们领袖、我们党的伟大性。”
    “我 们社会主义祖国是金日成祖国,我们民族是金日成民族。”
    “爱国就是主体,主体就是爱国。”
    February 10

    看哪个名人和你像。。。

    http://www.myheritage.com/
    上传你的照片,看哪个名人和你像。。。

    我传了两张。
    第一张,像梅尔吉普森,大帅哥,嗯,不错不错,识别还算准确嘛!
    第二张,像Dalai lama。。。。。。我考!

    February 07

    杀伤力极强的英俊的小外甥的照片来了!

    警告:未成年少女请小心,以防深陷其中意乱情迷无法自拔!
    August 12

    想不想养一只这样的狗?

     
            萨摩耶,会笑的狗,它的微笑被认为最接近天使的微笑。
     
     

            英文名称:Samoyed 
            原产地:西伯利亚
            体重:23~29kg 
            身高:46~56cm

            如果说到用笑容赢得人心,萨摩耶犬绝对是个中高手。

            在一团雪白的被毛映衬下,明亮的眼睛、小巧的耳朵、乌溜溜的鼻头,再挂上一个招牌“萨式微笑”,那一份甜美可爱直扑向你,挡也挡不住。所以,萨摩耶犬作为工作犬而拥有众多的女性爱好者,就一点都不奇怪了。

            萨摩耶犬属于狐狸犬,相传原生活于伊朗高原,后来北移至北极海的叶尼塞河,并定居于此,“萨摩耶”一名是取自它最早的主人——生活于西伯利亚的原始部落萨摩耶族。

            这个民族因为长期居住在恶劣的环境中,因此培养出强悍、勇敢、耐力十足的民族性,其所豢养的狗的天性也几乎与主人如出一辙,是非常出色的雪橇犬。

            萨摩耶犬起初被用来放牧、保卫驯鹿和拉雪橇,后来由探险者和旅行者带回到欧美后受到了很大的欢迎,但其受欢迎的理由并不是因为这种狗具有强劲的耐力和健硕的体魄,而是它的性情温驯而笃厚,且外形优美。

            时至今日,现代的萨摩耶犬虽然有时仍然会参与拉雪橇等竞赛活动,但大部分的饲主早已将它们视为人类的伴侣来疼爱了。

            不过,由于萨摩耶犬依然保持着其吃苦耐劳的精神与体力,所以在现代极地考察探险活动中,还是继续担当着不可或缺的角色。

            萨摩耶犬生性快活、聪明、沉稳、独立心强,能和任何人做朋友。精力充沛,爱好在雪地中奔跑,活动量大,需要天天运动。因其被毛丰满,每周至少要整刷两次。

    熊猫成长日记 14天-2岁

    想不想养一只?
    July 24

    当年的尤因

    正在看美国梦一队vs克罗地亚,当年的尤因好年轻,太勇猛了,hoho,能跑能跳的。
    July 11

    超强猫咪

    飞檐走壁~~~ 猫大侠~~
    June 14

    Can you make it?

    http://www.ragan.com/stevesblog/ViewItem.asp?Entry=77

    I found it today on my friend's blog and I'm working on it. Can you make it?

    May 12

    Using TCP Keepalive

    Will finish this when have time... :)

     

    May 01

    GRUB & Windows 2003 Boot Problem

    近日在一台已经装了Windows 2003 Server的机器上安装Debian, 引导器为GRUB. 启动引导Win2003时, 显示下面信息后停止响应.
    root (hd 0,0)
    Filesystem type unknown, partition type 0x7
    chainloader +1

    出现这种问题后, 恢复MBR/重装Windows/重装Linux都不能解决问题.

    Google了一下,发现导致问题的原因:
    (1) BIOS和Linux里面所指定的硬盘参数不一致; 并且
    (2) Windows分区大于8GB (准确的说,是硬盘的第一个分区结束于柱面1024或之后)

    解决方法:
    (1) 在BIOS里面激活硬盘的LBA或large access模式. 要注意一定不能设置为AUTO.
    (2) 如果(1)的方法不行,就按照英文原文里面下面的方法继续试吧. (1)在我这里起作用. :)

    原文在这里: http://portal.suse.com/sdb/en/2004/05/fhassel_windows_not_booting91.html

    Windows No Longer Boots Following the Installation of SUSE LINUX 9.1

    Applies to: SUSE LINUX 9.1

    Symptom

    Following the installation of SUSE LINUX 9.1, the Linux system can be booted, but the Windows system no longer boots. After selecting the Windows entry in the boot loader GRUB, a message such as the following is displayed:

    root (hd 0,0) Filesystem type unknown, partition type 0x7 chainloader +1

    The computer stops at this point.

    The Windows boot loader may also stop with an error message (if GRUB or LILO was *not* installed in the MBR during the installation and the Windows loader was retained).

    The problem cannot be solved by restoring the original MBR with YaST or by writing a new MBR with Windows tools (with the command FIXMBR or with FIXBOOT from the Windows rescue console). Repairing the partition table with proprietary partitioning tools does not solve the problem and may even destroy the entire partition table. The problem cannot even be solved by uninstalling Linux or reinstalling Windows without deleting the entire hard disk.

    Cause

    The partitioning tool parted, which YaST uses during the installation, may write an incorrect partition table. The problem occurs if

    • the BIOS and Linux "see" different disk geometries AND
    • the Windows partition is larger than about 8 GB (more precisely: if the first hard disk partition ends on cylinder 1024 or beyond this point).

    When the system is booted, Windows may use the values in the partition table, which causes a failure.

    Currently, this problem also occurs on other Linux distributions using kernel 2.6.

    Solution

    One quick solution is to activate the LBA or large access mode under which the hard disk was previously addressed for the hard disks in the computer's BIOS. It is important that the hard disk values not be set to "AUTO".

    If this does not help (or if your BIOS does not offer this option), you can repair the partition table with a driver update. To do this, proceed as follows: On our FTP server, find two images at ftp://ftp.suse.com/pub/suse/i386/update/9.1/misc/parted/: one for creating a floppy disk and one for creating a CD.

    Floppy Disk

    To install the driver update from floppy disk, proceed as follows:

    • Download the file parted.img.gz and save it to a directory of your choice, for example, in /tmp.
    • Insert a floppy disk and use the following command to write the image to the medium: gunzip -c parted.img.gz >/dev/fd0 Caution: The previous content of the floppy disk will be lost.
    • Insert the installation CD/DVD (important: if you use an AMD-64 system, insert the 32-bit side of the DVD). Boot the first installation CD or DVD up to the point where you can choose one of the different installation variants.
    • Press F6. A message asking you to keep the driver update ready will be displayed.
    • Use the arrow key to select the menu item "Installation".
    • Enter the boot parameter "fixpart=1" and press ENTER.
    • When the message "Please choose the Driver Update medium" is displayed, insert the driver update disk you created and press "OK".
    • In the following menu, select "floppy" and confirm with "OK".
    • After completing the driver update, press "Back".
    • The following dialog for repairing the partition table displays your hard disk (usually /dev/hda) and the status of the partition table (broken). Select the hard disk and click "OK" to repair the partition table.
    • After repairing the partition table, exit the menu with "Back". Press the key combination CTRL-ALT-DEL to reboot the computer and remove all media from the drives.

    Now you should be able to boot both Windows and Linux.

    CD-ROM

    To install the driver update from CD-ROM, proceed as follows:

    • Download the file parted.iso.gz and save it to a directory of your choice, for example, in /tmp.
    • Use the following command to unpack the image: gunzip /tmp/parted.iso.gz
    • Burn the file /tmp/parted.iso as an ISO image on a CD by either using a graphical burning program, such as k3b or xcdroast, or from the command line: cdrecord -v -eject speed=2 dev=/dev/hdc /tmp/parted.iso The parameter dev=/dev/hdc might have to be adjusted according to the burner device file.
    • Insert the installation CD/DVD (important: if you use an AMD-64 system, insert the 32-bit side of the DVD). Boot the first installation CD or DVD up to the point where you can choose one of the different installation variants.
    • Press F6. A message asking you to keep the driver update ready will be displayed.
    • Use the arrow key to select the menu item "Installation".
    • Enter the boot parameter "fixpart=1" and press ENTER.
    • When the message "Please choose the Driver Update medium" is displayed, insert the driver update CD you created and press "OK".
    • In the following menu, select "cdrom" and confirm with OK.
    • After completing the driver update, press "Back".
    • The following dialog for repairing the partition table displays your hard disk (usually /dev/hda) and the status of the partition table (broken). Select the hard disk and click "OK" to repair the partition table.
    • After repairing the partition table, exit the menu with "Back". Press the key combination CTRL-ALT-DEL to reboot the computer and remove all media from the drives.

    Now you should be able to boot both Windows and Linux.

    If Linux Is Not Yet Installed

    If Linux is not yet installed, you can integrate the driver update to prevent any boot problems from the outset. Proceed as described above, but omit the parameter "fixpart=1" in the installation menu. Then follow the instructions. The update medium will be loaded and the installation will be performed with an updated libparted.

    Creating Update Media with Windows

    If you are not able to create an update driver medium with a Linux OS, proceed as follows to create it with Windows:

    First decide whether to use a CD or a floppy disk as update medium. Then unpack the relevant file (parted.img.gz for floppy or parted.iso.gz for CD) with a Windows unpacking program. For this purpose, use the program untgz32.exe located in the directory /dosutils/untgz on SUSE's first installation CD or DVD. Copy the file untgz32.exe to the directory containing the downloaded file. Open a command prompt, change to the corresponding directory and start the program with:

    untgz32 -d parted.img.gz parted.img

    or

    untgz32 -d parted.iso.gz parted.iso

    Writing on floppy:

    The directory /dosutils/rawrite/ on the first CD or DVD includes the program rawrite.exe that can be used to write the image to a floppy. Copy this program to the directory containing the unpacked file parted.img.

    Insert a floppy in the drive and start rawrite.exe. Enter the file parted.img as source file and confirm with Enter. Then enter the name of the floppy drive (usually "A") as write medium. The image will be written to the floppy.

    Writing on CD:

    Burn the unpacked file parted.iso to a CD in Windows with a burning program of your choice. Make sure you do not create a data CD but write the file as an ISO image.

    Keywords: windows,boot,grub,lilo,boot manager,ntldr

    April 20

    手工设定MSN Messenger 7的“Listening To”

    下面一段代码自动将MSN Messenger 7的“Listening To”设为当前歌曲+当前窗口标题。;)

    -------------------

    unit Main;

    interface

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls;

    type

      TMSNMusic = class
      public
        Sender: String;
        MagicStr: String; // =Music
        Command: Word;    // 0/1
        FormatStr,
        Title,
        Artist,
        Album,
        WMContentID: String;
        constructor Create;
        function Feed(s: String): Boolean;
      end;

      TfrmMain = class(TForm)
        Button1: TButton;
        Memo1: TMemo;
        Label1: TLabel;
        Memo2: TMemo;
        Timer1: TTimer;
        TimerTask: TTimer;
        procedure Button1Click(Sender: TObject);
        procedure FormClose(Sender: TObject; var Action: TCloseAction);
        procedure FormCreate(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
        procedure TimerTaskTimer(Sender: TObject);
      private
        { Private declarations }
        FMsnMusic: TMSNMusic;
        OldTitle: String;
        procedure SetMSNTitle(Title, Artist, Album: String);
        procedure SetMyMSNTitle(Task: String);
        procedure WMCopyData(var Msg: TWMCopyData); message WM_COPYDATA;
      public
        { Public declarations }
        procedure CreateParams(var Params: TCreateParams); override;
      end;

    const
      MSNMagic = $547;
      MSNMusicString = '%s\0Music\0%d\0%s\0%s\0%s\0%s\0%s\0';
      //MSNFormat = '{0} - {1} - {2}';
      //MSNFormat = '{0} - {1}';

    var
      frmMain: TfrmMain;

    implementation

    {$R *.dfm}

    { TMSNMusic }

    constructor TMSNMusic.Create;
    begin
      MagicStr := 'Music';
    end;

    function TMSNMusic.Feed(s: String): boolean;
    var
      s2: String;
      sl: TStringList;
      procedure Split(sl: TStringList; s, Delimiter: PChar);
      var
        p: PChar;
      begin
        p := AnsiStrPos(s, Delimiter);
        while p <> nil do
        begin
          p^ := #0;
          sl.Add(s);
          s := p + 2;
          p := AnsiStrPos(s, Delimiter);
        end;
        if s^ <> #0 then
          sl.Add(s);
      end;
    begin
      s2 := s;
      sl := TStringList.Create;
      Split(sl, PChar(s2), '\0');
      if sl.Count <> 8 then
      begin
        Result := False;
        exit;
      end;
      Sender := sl[0];
      MagicStr := sl[1];
      Command := StrToInt(sl[2]);
      FormatStr := sl[3];
      Title := sl[4];
      Artist := sl[5];
      Album := sl[6];
      WMContentID := sl[7];
      sl.Free;
      Result := True;
    end;


    procedure TfrmMain.Button1Click(Sender: TObject);
    begin
      SetMyMSNTitle(Memo1.Text);
    end;

    procedure TfrmMain.SetMSNTitle(Title, Artist, Album: String);
    var
      msnui: HWND;
      msndata: COPYDATASTRUCT;
      cmd: integer;
      buffw: array [0..499] of WideChar;
      s: String;
      MSNFormat: String;
    begin
      if (Title = '') and (Artist = '') and (Album = '') then
        cmd := 0
      else
        cmd := 1;

      MSNFormat := '{0}';
      if Artist <> '' then
        MSNFormat := MSNFormat + ' - {1}';
      if Album <> '' then
        MSNFormat := MSNFormat + ' - {2}';

      s := Format(MSNMusicString, ['void', cmd, MSNFormat, Title, Artist, Album, 'WMContentID']);
      StringToWideChar(s, buffw, sizeof(buffw));
      msndata.dwData := MSNMagic;
      msndata.cbData := lstrlenW(buffw)*2+2; //Length(s)*2+2;
      msndata.lpData := @buffw;

      msnui := FindWindowEx(0, 0, 'MsnMsgrUIManager', nil);
      while msnui <> 0 do
      begin
        if msnui <> Handle then
          SendMessage(msnui, WM_COPYDATA, Handle, Longint(@msndata));
        msnui := FindWindowEx(0, msnui, 'MsnMsgrUIManager', nil);
      end;
    end;

    procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      SetMyMSNTitle('');
      FMsnMusic.Free;
    end;

    procedure TfrmMain.SetMyMSNTitle(Task: String);
    var
      s, sTask: String;
    begin
      if FMsnMusic.Title <> '' then
      begin
        if FMsnMusic.Artist <> '' then
          s := FMsnMusic.Title + ' - ' + FMsnMusic.Artist
        else
          s := FMsnMusic.Title;
      end else begin
        s := FMsnMusic.Artist;
      end;
      if Task <> '' then
        sTask := '['+Task+']'
      else
        sTask := '';
      SetMSNTitle(s, sTask, '');
    end;

    procedure TfrmMain.FormCreate(Sender: TObject);
    begin
      FMsnMusic := TMSNMusic.Create;
      Timer1.Enabled := false;
      TimerTask.Enabled := True;
    end;

    procedure TfrmMain.WMCopyData(var Msg: TWMCopyData);
    var
      sText: PChar;
      s: String;
    begin
      if Msg.CopyDataStruct.dwData <> MSNMagic then
        Exit;
     
      sText := GetMemory(Msg.CopyDataStruct.cbData);
      StrLCopy(sText, Msg.CopyDataStruct.lpData, Msg.CopyDataStruct.cbData);
      s := WideCharToString(Msg.CopyDataStruct.lpData);
      FreeMem(sText);

      Memo2.Clear;
      if FMsnMusic.Feed(s) then
      begin
        Timer1.Enabled := False;
        Timer1.Enabled := True;
      end else begin
        Memo2.Lines.Add('invalid data, ignore it.');
      end;
    end;

    procedure TfrmMain.CreateParams(var Params: TCreateParams);
    begin
      inherited CreateParams(Params);
      StrPCopy(Params.WinClassName, 'MsnMsgrUIManager');
    end;

    procedure TfrmMain.Timer1Timer(Sender: TObject);
    begin
      Timer1.Enabled := False;
      with Memo2.Lines, FMsnMusic do
      begin
        Add('Sender: ' + Sender);
        Add('MagicStr: ' + MagicStr);
        Add('Command: ' + IntToStr(Command));
        Add('FormatStr: ' + FormatStr);
        Add('Title: ' + Title);
        Add('Artist: ' + Artist);
        Add('Album: ' + Album);
        Add('WMContentID: ' + WMContentID);
      end;
      SetMyMSNTitle(OldTitle);
    end;

    procedure TfrmMain.TimerTaskTimer(Sender: TObject);
    var
      h: HWND;
      title: array [0..255] of char;
    begin
      h := GetForegroundWindow;
      if h <> 0 then
      begin
        GetWindowText(h, title, 256);
        if StrComp(PChar(OldTitle), title) <> 0 then
        begin
          OldTitle := title;
          SetMyMSNTitle(OldTitle);
        end;
      end;
    end;

    end.