Xiangyu's profile* Learning To Fly *BlogListsGuestbookMore Tools Help

Blog


    October 31

    Lack of Center

    There gotta be a better way to start a day than waking up every morning --- Garfield.

    There gotta be a better way to live my life than thinking about what my life should be every ten minutes --- Spirit.


        Monica: Phoebe, do you  have a  plan ?
        Phoebe: I don't even have a  pl .


    生活没有中心是一件很可怕的事情,像我现在这样。

    没有什么事,让我一想到它心中便充满力量;
    没有什么人,让我一想到她烦恼就一扫而光。

    悲哀么? 我觉得是。不过这样的生活倒凭添了许多思考的时间,虽然思考的结果从来都是“我需要再多思考”~

    mmm,那么就让我继续思考吧~


    Powered by ScribeFire.

    October 30

    【转载】Hello World

    原文:http://www.gnu.org/fun/jokes/helloworld.html

    How the way people code "Hello World" varies depending on their age and job:

    High School/Jr.High

     10 PRINT "HELLO WORLD"
    20 END

    First year in College

     program Hello(input, output)
    begin
    writeln('Hello World')
    end.

    Senior year in College

     (defun hello
    (print
    (cons 'Hello (list 'World))))

    New professional

     #include <stdio.h>

    void main(void)
    {
    char *message[] = {"Hello ", "World"};
    int i;
    for(i = 0; i < 2; ++i)
    printf("%s", message[i]);
    printf("\n");
    }

    Seasoned professional

     #include <iostream.h>
    #include <string.h>
    class string
    {
    private:
    int size;
    char *ptr;
    public:
    string() : size(0), ptr(new char('\0')) {}
    string(const string &s) : size(s.size)
    {
    ptr = new char[size + 1];
    strcpy(ptr, s.ptr);
    }
    ~string()
    {
    delete [] ptr;
    }
    friend ostream &operator <<(ostream &, const string &);
    string &operator=(const char *);
    };

    ostream &operator<<(ostream &stream, const string &s)
    {
    return(stream << s.ptr);
    }
    string &string::operator=(const char *chrs)
    {
    if (this != &chrs)
    {
    delete [] ptr;
    size = strlen(chrs);
    ptr = new char[size + 1];
    strcpy(ptr, chrs);
    }
    return(*this);
    }
    int main()
    {
    string str;
    str = "Hello World";
    cout << str << endl;
    return(0);
    }

    System Administrator

     #include <stdio.h>
    #include <stdlib.h>
    main()
    {
    char *tmp;
    int i=0;
    /* on y va bourin */
    tmp=(char *)malloc(1024*sizeof(char));
    while (tmp[i]="Hello Wolrd"[i++]);
    /* Ooopps y'a une infusion ! */
    i=(int)tmp[8];
    tmp[8]=tmp[9];
    tmp[9]=(char)i;
    printf("%s\n",tmp);
    }

    Apprentice Hacker

     #!/usr/local/bin/perl
    $msg="Hello, world.\n";
    if ($#ARGV >= 0) {
    while(defined($arg=shift(@ARGV))) {
    $outfilename = $arg;
    open(FILE, ">" . $outfilename) || die "Can't write $arg: $!\n";
    print (FILE $msg);
    close(FILE) || die "Can't close $arg: $!\n";
    }
    } else {
    print ($msg);
    }
    1;

    Experienced Hacker

     #include <stdio.h>
    #include <string.h>
    #define S "Hello, World\n"
    main(){exit(printf(S) == strlen(S) ? 0 : 1);}

    Seasoned Hacker

     % cc -o a.out ~/src/misc/hw/hw.c
    % a.out
    Hello, world.

    Guru Hacker

     % cat
    Hello, world.

    New Manager (do you remember?)

     10 PRINT "HELLO WORLD"
    20 END

    Middle Manager

     mail -s "Hello, world." bob@b12
    Bob, could you please write me a program that prints "Hello, world."?
    I need it by tomorrow.
    ^D

    Senior Manager

     % zmail jim
    I need a "Hello, world." program by this afternoon.

    Chief Executive

     % letter
    letter: Command not found.
    % mail
    To: ^X ^F ^C
    % help mail
    help: Command not found.
    % damn!
    !: Event unrecognized
    % logout

    Research Scientist

            PROGRAM HELLO
    PRINT *, 'Hello World'
    END

    Older research Scientist

    	WRITE (6, 100)
    100 FORMAT (1H ,11HHELLO WORLD)
    CALL EXIT
    END


    Powered by ScribeFire.

    October 29

    【转载】Tom Petty's "Learning to fly" Warned Us about 9/11

    原文:http://bestuff.com/stuff/tom-pettys-learning-to-fly-warned-us-about-911

    I came up with this theory shortly after the tragedy, as a humorous response to the sudden interest in Nostradamus predictions, but as time went on, the lyrics became more and more accurate.

    Well I started out down a dirty road (The Middle East)
    Started out all alone (Most nations didn't hate America to the extent that they do currently)
    And the sun went down as I crossed the hill (The middle east became a target when capital "hill" was "crossed" or angered)
    The town lit up (New York City on 9/11)
    the world got still (the initial shock)

    Im learning to fly but I aint got wings
    (Taking flying lessons, but not actually becoming a pilot)
    Comin down is the hardest thing
    (Crash landing)

    Well the good old days may not return
    And the rocks might melt, and the sea may burn
    (War and economic collapse)

    Im learning to fly but I aint got wings
    Comin down is the hardest thing

    Well some say life will beat you down
    Break your heart, steal your crown
    (US dollar loses value to the Euro, American citizens losing control of their government, or the destruction of Iraq's former government)
    So I started out for God knows where
    But I guess I'll know when I get there
    (Uncertain times)

    Im learning to fly around the clouds (recognizing political lies)
    But what goes up must come down (Twin Towers, and US world dominance)

    Im learning to fly but I aint got wings
    Comin down is the hardest thing
    Im learning to fly around the clouds
    But what goes up must come down

    Im learning to fly
    Im learning to fly

    转载者按:这其实是很不错的一首歌,也是我Space名字的出处,有兴趣者可Google之~



    Powered by ScribeFire.

    Devil in Angel

    What is devil? And what is angel?

    These two seemingly distinct entities don't have as  much difference in nature as you may consider.
    Each of them is no more than one step away from the other.

    What is devil?
    Something that keeps you from what you're longing for.


    And what is angel?
    Something leads you to what you've expecting.

    But what makes you sure that what you've longing for is right for you?


    And that naturally leads to this conclusion: there's devil in every angel, and vice versa.

    Powered by ScribeFire.

    October 28

    Spirit

    我向大家正式推荐Spirit这部片子。

    特点:堪称完美的配乐,了解我网名的由来……还不够吗?

    我机器上有,感兴趣者可与我联系。


    Powered by ScribeFire.

    A Walk To Remember

    Which one is bitter?

    To see you standing in front of me without knowing that I love you? We love each other but there's no possibility that we can be together? Or, we're together knowing our time will not be long enough to fill my life?

    I don't know since I've never been through any of them.

    If you know, tell me.

    If you don't know neither, try the movie <A Walk To Remember> with the Chinese name <初恋的回忆>.


    Powered by ScribeFire.

    Lin Yutang

    最近在读林语堂先生的《My Country and My People》。

    林先生确实是个了不得的人,在美国的影响远远超出了我原先所知道的。

    作为一个作家,林先生连续获得了两届诺贝尔文学奖提名,不过可惜最终未能获奖,这也是他唯一“想得但是没有得到的”奖。

    林语堂还发明了一种现代的字典索引方式,并在晚年于台湾以此为工具编纂了近代较早的中英词典。

    除此之外,他还发明了第一台中文打字机,不过由于种种原因未能投产,不过其专利后来与索引专利一起被一家台湾公司买了去,并随后用于生产。

    林先生可谓近代中国知识分子的典型代表,也是成绩斐然的代表,他的作品对让世界了解中国功不可没。

    嗯,这本书要好好读读~


    Powered by ScribeFire.

    October 26

    新机器

    搬回来了,换了新机器,很爽,爽的有些不习惯……

    Powered by ScribeFire.

    October 25

    Behind Your Back

    昨晚做了个诡异的梦~

    梦中我同时和两个女孩谈恋爱,可是却在与A女约会时碰到了B女,正在我尴尬不已拼命想借口时,发现B女是来和C男约会的,于是两桌人相邻入座,开始约会~

    噩梦如此~


    但愿人生不如此~


    Powered by ScribeFire.

    October 21

    B+ Tree Done

    忙活了将近两周,终于把这个破玩意搞定了。

    感想:低级错误太多了……如果没有那么多的低级Bug,时间至少能节省一多半~

    不管怎样,是写出来了,基本满意吧,想做的基本都做了,没时间做内存管理比较遗憾,以后有机会再说吧~

    最后向大家推荐一下YourKit Java Profiler这个工具,很好用,非常利于Debug时的错误定位,不过是个收费软件,不知道有没有破解~

    下周终于可以好好读些paper了~


    Powered by ScribeFire.

    October 17

    哇哈哈哈哈!!!!!

    调了两天多,bug终于被搞定了!!!

    这就是思维变化和程序改动不一致的问题,所以教训是:一定要想清楚问题再动手,不要频繁地改动代码,尤其是微小改动,很难追的,尤其是测试数据比较大的程序,更是难上加难啊!!!

    在此要特别感谢傻徐同志的细致和耐心,单身美女们要把握住啊!

    心旷神怡……


    Powered by ScribeFire.

    October 15

    某人格测试~

    测试地址:http://www.coach168.com/9/nine.asp
    第五型 理智型



    五号特性:思想家


    基本恐惧:无助,无能,无知


    基本欲望:能干,知识丰富


    对自己要求:当我成为某一方面的专家时,我就 okay 了。


    特质:热忠于寻求知识,喜欢分析事物及探讨抽象的观念,从而建立理论架构。


    顺境〔能干时〕:理想主义者,对这世界深刻的见解,专注于工作,敢于革新,及产生有价值的新观念。


    逆境〔无能时〕愤世嫉俗,对人采取敌对及排斥的态度,自我孤立,夸大妄想,只想不做。


    处理感情的方法:用抽离方式处理,仿佛是旁观者, 100 %用脑做人,不喜欢群体动作,对规则不耐烦


    身体语言:双手交叉胸前,上身后倾,翘腿;面部表情;冷漠,皱起眉头;讲话方式 / 语调:平板,刻意表现深度,兜转,没有感情。


    常用词汇:我想;我认为;我的分析是……;我的意见是……;我的立场是……


    工作环境:理论,逻辑;单独工作,无时间限制;不必管理别人。


    不能处理逆境时出现的特征:与现实脱节型:


    吝啬:有被吞噬的恐惧;抗拒感情牵绑;病态式的自我孤立;冷血、无感觉;延迟采取行为;认知导向;空虚感;内疚;自卑;负面;过敏;长时间独处, 希望不被骚扰;有特殊专长,基本技能劣拙;想象能力极高,特别多恐惧;不祈望被爱=防止伤害


    五号警钟:感觉被人或事掩盖时,实时退避入思维世界;从客观与安全的立场评估环境;与实际情况脱节;集中思维上的评论=抽离;累积的评论成为五号的现实。


    座右铭:知识就是力量


    典型冲突:难以接近,令人 ( 尤其二号及四号 ) 有挫败感


    优点:学者风范,有深度,处变不惊


    缺点:自觉高人一等,与人保持距离


    最适宜工作环境:有足够的时间去思考及分析,不必做出实时响应


    不适宜工作环境:公开竞争及对抗


    令人舒服地方:不感情用事,样样有数据支持


    令人不满地方:太过冷冰冰,城府深,高深莫测


    沟通要点:不要侵犯五号的空间及时间;避免一切身体接触;不要求五号给予实时的反应,容许他们有时间思索; 采取主动;不要对五号的思想或感受做出假设;五号不能处理人际冲突,帮助他们缓和此类情况。


    激发要点:赞赏五号的学识及分析能力,容许五号在采取行动前做出说尽观察;协助五号成为业内的专家;邀请五号评论其它同事的表现;让五号有足够的空间及时间去自我伸展;协助五号明暸他们冷冰冰的态度对人的影响。


    号的时间管理:私人时间;解救方案;容许五号有私人时间;五号擅于做事后分析,不要催促他们做出决定;五号容易将思考与行动混淆,以为思考过等于做了,帮助他们集中结果,及做定时检讨;一定要给予五号清楚的限期成事。


    5 号达成协议:准备充份的数据;做出全理性的讨论;让五号有足够时间思考。


    常见问题:独家村,神秘人


    解救方案:基本上容许他做独行侠,同时帮他看到他对小组的独特贡献,及小组对他的支持.



    Powered by ScribeFire.

    Debug

    I hate debugging.


    Powered by ScribeFire.

    October 14

    浅谈Java中的System.gc()的工作原理~

    趁着今天写程序的热乎劲儿,小谈一下System.gc()这个神秘的东东~

    很多人把Java的“效率低下”归咎于不能自由管理内存,但我们也知道将内存管理封装起来的好处,这里就不赘述。

    Java中的内存分配是随着new一个新的对象来实现的,这个很简单,而且也还是有一些可以“改进”内存回收的机制的,其中最显眼的就是这个System.gc()函数。

    乍一看这个函数似乎是可以进行垃圾回收的,可事实并不是那么简单。
    其实这个gc()函数的作用只是提醒虚拟机:程序员希望进行一次垃圾回收。但是它不能保证垃圾回收一定会进行,而且具体什么时候进行是取决于具体的虚拟机的,不同的虚拟机有不同的对策。

    那么下一个问题就是:gc()进行回收的准则是什么?也就是说什么样的对象可以被回收?
    简单来说就是:没有被任何可达变量指向的对象。这里的可达是我发明的……意思就是能够找到的,那什么样的是不可达的呢?
    比如说:
    a.v = b;
    b.v = c;
    /*
     *Watch out !
     */
    a.v = d;
    看一下这段代码:
    第一行:对象a的变量v指向了对象b
    第二行:对象b的变量v指向了对象c
    第六行:对象a的变量v指向了变量d。
    这个时候,虽然变量c指向的对象有c以及b.v指向它,但是它们都已经不可达了,为什么?因为唯一可以找到它们的是a.v,但是现在a.v指向了d,所以他们就是不可达的了。

    理由也很直观:没有任何可达变量指向你,你还有活下去的理由吗?你就算活下去谁能找得到你呢?

    所以说,C++中将释放了的指针置为null的习惯要保留到Java中,因为这有可能是你释放内存的唯一途径。

    最后的箴言:不要频繁使用gc函数。
    我的建议是:保持代码健壮(记得将不用的变量置为null),让虚拟机去管理内存。

    晚上还要赶程序,就说这么多~


    Powered by ScribeFire.

    October 13

    暂时搬家~

    Web组要装修了,只能暂时搬到移动组来寄居了~

    与组织分离了,虽说只是一墙之隔~

    新环境有好有坏,我还算比较喜欢~

    Done~


    Powered by ScribeFire.

    October 10

    Back to DQ~

    这似乎是开学以来第一次吃东区吧?~

    熟悉的牛肉拉面,不熟悉的气氛~

    又开始怀旧了……没办法,就是这么个人~


    Powered by ScribeFire.

    October 09

    宣讲会~

    今天也算见识了一回嘛叫宣讲会。

    总的来说就是公布一些有利于自己的统计数字,营造一种貌似很好的气氛~

    没了。


    Powered by ScribeFire.

    更新

    实验室要装修了,可能有一个星期左右的时间要在宿舍窝着了,不爽~

    宿舍机器由于不是SP2不能装Live Writer,这可大大打击了我更新的热情。

    幸好我们还有万能的FireFox~
    只需一个小插件,我又可以离线编辑了,哇哈哈哈~

    某人,这不算神神叨叨吧~


    Powered by ScribeFire.

    October 06

    OrientI

    有多少人知道OrientI这个名字?恐怕没几个……

     

    这很正常,因为这是一个开发到一半就停工的项目,开发者呢,就是我。

     

    这是我进入实验室接触的第一个项目,做了有一段时间,虽然中途由于别的事情耽搁了下来,不过收获还是很大的~

     

    最近忽然想起了她,觉得不应该这么对她,遂决定翻出来看看。

     

    今天看了一天Legacy代码,依稀想起了很多,那时的事,那时的我~

     

    决定把它做下去,虽然时间比较难以保障,不过我会尽力的。

     

    我的要求不高,毕业之前做出来,就算对得起自己。

    October 04

    Stuck

    H`nn\b`n _ji"o m`opmi)

    H\f`n h` a``g nj pi^`mo\di)

    =po rc`i D n`` tjpm ^mtno\g `t`n'

    D fijr oc\o oc`t"m` bpd_dib h` cjh`)

    ?m`\h \ _m`\h rdoc tjpm km`oot nhdg`'

    H\f` \ rdnc oc\o tjp rdgg ]` hdi`)

    Rmdo` \ njib oj am`` ht hdi_'

    Ndib \gjib jm g`o h` amjri)

    Rc\o da tjp adi_ jpo :

    Rc\o da tjp opmi h` _jri :

    H\t]` do"n ht _`nodit'

    H\t]` ocdn dn h`\io oj ]`)

    ?ji"o \nf h` cjr D a``g'

    @q`i D _ji"o fijr ajm m`\g)

    GDf` \ h`o`jm ocmjpbc oc` idbco'

    g`ao \ n^\m di ht c`\mo)