This page is not available in 繁體中文, as a result the English (en_US) version is shown instead.
一年回顧

天生一年又一年,三四五六七八年… 哦錯了,我不是在題詩

只是突然想寫下一些過去一年發生的事。

也許由工作開始寫起吧。有些人覺得工作只是工作,生活不應該被工作影響。但在我看來工作畢竟是生活的一大部份,當然也應該在我心中占有一定的份量。2011年我正式開始全職做storage,但對以前做了四年的那部份也不是想放下就能夠放下的。一直到現在我還是關注那邊的世界,對一些事不關己的事情太過留心。連我以前的上司也跟我說當我已經做了自己能做到的,就應該放下了。自己的工作還有很多,實在不值得在其他人的事情上花太多心思。在這個組學到的實在太多,沒有學到的也還有很多,所以也還不急於去征服世界

工作與遊戲之間當然就是寓工作於遊戲了。因工作關係去了瑞士幾天,也順道玩了幾天,大部份的照片都可以在這裏看到。公費旅行最高興的莫過於公費,但瑞士本身也非常美麗,有機會的話自費也會再去一次。2011年出差的次數沒有2010年的多,但2010年是太多太頻密了。2011年去了的還有Seattle和Chicago,Seattle 2010年已經去過兩次了,Chicago是第一次,但可惜來去怱怱的,也沒有看到些甚麽。

公費旅遊以外還和我哥去了一次澳洲,照片都這這裏。在冬季沒有甚麽比做候鳥往南飛更快樂的事了。

工作和旅遊以外還有人。有些人是在工作以內的,比如說一個同事告訴我她明年結婚,未婚夫還是因為我所以認識的。雖然我覺得在他們之間我的作用有限,不過也很替他們高興。也比如說一個跟我差不多時間進公司的同事被昇為了經理。雖然管理別人一直都不是我想做的,不知道為甚麽聽到這個消息心還是有些酸酸的。不過那條路既然自己早已放棄,也就不要去想太多了。也有人是由工作以內變成工作以外的,對他我只能說祝褔,因為那是他想做的。雖然很不捨得他離我而去。

有時候也會想自己想做的到底是甚麽。42是一個很容易說出口的答案,是那不是一個有用的答案。一直到最近才有多一點頭緒:目標就是要造出一樣能夠改善很多人生活的東西。甚麽「東西」,怎樣「改善」還沒有想到,但我想一百萬該是一個不錯的「很多」。目標是要高,但不應該不切實際。

當然還有一些人是工作以外的。2011年可以算是我對那個網上「實驗」最認真的一年。可惜的是在這一年遇到的人中只有和一個J保持聯繫。可幸的是和W成了不錯的朋友,也因而又開始了每週的羽毛球。以為能和P再次聯絡,但結果只有失望。這些和其他的都是好人,能夠認識到也可以說是這個實驗沒有結果的好結果了。

by khc on Sun Jan 1 23:26:52 2012 Permlink
Tags: chinese

Dear tan kah ing

Dear tan kah ing,

Your email address probably isn't the same as mine, so please don't create an Apple ID with my email address. You can reset your password all you want, but you won't be able to verify that you own my email address, because you really don't own it.

Thanks!

PS: I've reset my password and changed my security questions, as well as updated your address in Singapore to "None of your business". Oh, and I wasn't born in 1962.

PS again: Dear Apple, my middle name is not kah, that's someone else. Please let me change it, thanks!

by khc on Fri Nov 25 11:51:50 2011 Permlink
Tags: weirdstuff

The Answers We Already Knew

Back in the days when I was actively participating in all things pidgin, two of the frequently requested features were the the ability to find out if the other person has received your instant message (and say, not caught by some spam filter), and the ability to find out if a person has blocked you. While that is actually possible (to some extent) in some protocols, the standard answer we always gave was: yes, she (almost always, the person who asked for this kinds of features was a guy and the other person was a female) received your message and chose not to respond, and yes, if you don't see her online, she probably blocked you.

Of course, merely working on an instant message client did not give us special insights into relationship dynamics, and we were never really sure if the answers we gave were always the correct ones. I've just figured that people who asked those questions already knew the answers, and they just needed someone else to break it to them.

Fast forward many years. I have moved on and officially retired myself from pidgin. Recently I contacted an old acquaintance (over a medium which, sadly, does not support the aforementioned features) and, perhaps unsurprisingly, found myself wondering about those same questions as well. This morning, while lying in bed, I remembered the standard answer that we always gave out. So here I am, breaking it to myself, yes, the message probably was not caught by a spam filter, and yes, it probably went through.

by khc on Thu Nov 17 22:10:37 2011 Permlink

DO NOT WANT

Sometimes well intended optimizations can get in the way, and this is one of them.

In general, when a file is read from or written to, the operating system keeps the data around in case it's needed again. This is in general a good idea, except when it's not. Sometimes you know that after you won't need the cached data again any time soon, and it's better for the operating system to forget about it instead of letting the cache balloon and push out more useful, albeit less recently used data. For example, when performing a backup a large amount of data is read from the disk and then written out to (typically) another media. It's unlikely that much of the just backed up data is going to be needed again, at least until the next backup window. Unfortunately on Linux the interface to control this is fairly limited. One can write a LD_PRELOAD library to tell Linux to uncache files that are just closed:

#if 0
gcc $0 -shared -o $0.so -ldl -fPIC && LD_PRELOAD=$0.so exec $@
#else
#define _GNU_SOURCE
#include <dlfcn.h>
#include <fcntl.h>
#include <stdlib.h>

int close(int fd)
{
    static int (*close_func)(int) = NULL;
    posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED);
    if (close_func == NULL)
        close_func = dlsym(RTLD_NEXT, "close");

    return close_func(fd);
}
#endif

posix_fadvise(3) says the following about POSIX_FADV_DONTNEED:

POSIX_FADV_DONTNEED attempts to free cached pages associated with the specified region. This is useful, for example, while streaming large files. A program may periodically request the kernel to free cached data that has already been used, so that more useful cached pages are not discarded instead.

Additionally, a length of 0 indicates that the advice applies until the end of file. This is insufficient however. If the program exits without closing its files then they will never be uncached. And when streaming large files they also won't be uncached until after the cache is already polluted. Those issues can be fixed by wrapping read, write, pread, pwrite and related functions, or by directly modifying the program when it's possible to do so. Still, the interface is unsatisfactory. For example, if a file was already cached before it's backed up, you don't want the backup process to uncache it. There's also no good way to use posix_fadvise to uncache write data, given what the manpage says:

Pages that have not yet been written out will be unaffected, so if the application wishes to guarantee that pages will be released, it should call fsync(2) or fdatasync(2) first.

Calling fsync(2) or fdatasync(2) while doing large streaming writes is simply unacceptable. Instead, it would be much better if the advice can be given at file open time and it would last for the duration of the file descriptor. The kernel can then take the hint and not cache accesses made through that file descriptor. O_DIRECT can achieve this, but sometimes you don't want the extra semantics and requirements that it brings.

by khc on Tue Nov 8 00:41:41 2011 Permlink
Tags: computer

曾經有一段時間,會夢想自己以寫作為生。

小時候喜歡看阿濃,也看報章專欄,如「百變星信箱」,「大玩派」等等。偶而看到喜歡的,還會把它們剪下來。移民來美國的時候,捨不得把那些剪報扔掉,便讓它們都跟我一起坐飛機來到太平洋的另一邊。在這邊中文無用,在一心想學好英文下中文也就荒癈了,後來一次整理舊東西時看到那些發黃的剪報,把它們從頭到尾看了一片 — 就像分手前的吻別 — 便再也不見。

直到大學最後一個學期,偶而發現甚麽叫「提筆忘字」,在為了讓自己不太內疚下開始學中文打字。後來發覺自己有很多空閒時間都不在電腦前面,便先把想寫的在一本小本子上寫下。剛開始時是想把21歲前自己的故事寫下來,後來還寫了一個小故事,再後來還把兩次旅遊的經過寫下來,那些的大部份,都可以在這裏看到。一共也寫了幾萬字吧?寫得自己也看不下去了,便不寫了。畢竟自己的中文程度有限。

現在賴以為生的是做軟件。我不喜歡叫自己做軟件工程司,更不喜歡編程員這個稱號。別人問起,我通常都會說:我做軟件。做跟作不一樣,大部份時間,作甚麽都是已經定下來,至於怎麽做,有些時候我還能做點決定。曾經對自己說,喜歡軟件是因為能夠滿足到自己的創作慾,但現實一點來說,工作上的創作空間有限。

也許這是好事。在這個自立門户的泡沬中自己也不是沒有想過該有一番「作」為,但實在是想不到甚麽好主意。在有能力「作」自己喜歡的事前,能夠「做」一些自己喜歡做的也不是一件壞事。

我不是The Brain,我不一定要每一天都要征服世界,只要有一天能夠就可以了。

僅以此獻給所有失意 — 不能一步登天 — 的人。

by khc on Sat Nov 5 10:18:59 2011 Permlink
Tags: chinese
Older Posts