Profilo di agentzhHuman & MachineFotoBlogElenchiAltro Strumenti Guida

Blog


29 aprile

三叶草

昨天在校园里漫步的时候,偶然间发现路旁的绿地上竟满是我最爱的三叶草。圆圆的叶子是那么娇嫩,那么雅致。我仿佛能觉出一缕淡淡的幽香……
20 aprile

CPAN is kid-safe? (关于 Ingy 的 XXX 模块)

As seen on #perl6 recently:

 <ingy> agentzh: http://rafb.net/p/I2uDsd35.txt
<ingy> try running that
<agentzh> looking
<ingy> you'll see that you can easily inspect all the things you want
<agentzh> what is XXX?
<ingy> a module
<ingy> :P
<ingy> it dies with a YAML dump
<ingy> it is arguably my most useful module
<agentzh> 1..1
<agentzh> Can't locate XXX.pm in @INC
<ingy> install it
<agentzh> wow
<agentzh> it's a real module?
<ingy> yes
<agentzh> awesome
<ingy> http://search.cpan.org/CPAN/authors/id/I/IN/INGY/XXX-0.10.tar.gz
<ingy> you can stick an XXX just about anywhere
<ingy> also comes with WWW YYY and ZZZ :)
<ingy> unfortunately XXX won't index
<gaal> CPAN is kid-safe?

不幸的是,就在这段聊天结束以后几个小时,Ingy 在台湾的公路上遭遇了一起严重的交通事故, 现在还在医院里急救。哀心地祝愿 Ingy 能够转危为安,早日康复!

Want a commit bit?

As seen on #perl6 today:

  <zxagent> agentzh: hello master
<agentz> zxagent: hello, boy :)
<agentz> zxagent: nice to see you here.
<agentz> zxagent: want a commit bit?
*** zxagent left the room (quit: Remote closed the connection).
<agentz> oops, too late
<TimToady> maybe you scared him off
<agentz> TimToady: *nod*

人物介绍

  TimToady: Larry Wall
zxagent: 我徒儿张星
agentzh: 我

结论

我徒弟实在是太有个性啦!

18 aprile

给唐凤的生日礼物

今天是 唐凤 的生日,真的很开心啊,祝 Audrey 生日快乐!

根据  Gaal 的提议 , 这几日我成功地在  feather  服务器上建立了 Pugs 的自动化 smoke 设施, 算作是 给唐凤的生日礼物 。 :D

现在 feather 上的 cron 程序每隔 24 个小时就会自动运行最新版本的 Pugs 测试集,并生成包含“灵巧链接”的 Perl 6 Synopses 文档:

http://perlcabal.org/syn/

比如其中的 S04:

http://perlcabal.org/syn/S04.html

你在其中会看到,我的  smartlinks.pl 程序会将一组一组的测试插入到文档的对应位置上,并根据 Smoke 生成的测试报表,用 × 在对应的行上,标记每一个特定的测试。

唐凤的 Pugs 博客上的几篇文章就是介绍这种 smartlinking 技术的:

前两篇是我写的,第三篇是  Mark Stosberg  写的。Mark 为我们的 feather 网站做了许多工作:

http://use.perl.org/~markjugg/journal/30739

markstos++ ;)

在 feather 上运行无人监管的自动化 smoke 在技术上需要一些特别的考虑:

  • cron 自动运行时刻的选择

    显然应该 smoke 的时间选在 feather 服务器一天当中负载最轻的时候。feather 的主人 Juerd 告诉我 在欧洲中部时间的晚上,一般会比较空闲,而白天 feather 的备份系统会比较地繁忙。因此我就在 crontab 中指定了 CET 1:00 AM.

  • CPU 和 RAM 资源的控制

    由于 Pugs 处于活跃的开发当中,在测试集运行的过程里,有些测试可能会陷入死循环,或者消耗掉所有内存, 而最终挂起或者让系统崩溃。由于 Juerd 并未对 feather 用户的资源进行限制,所以我需要自己使用 nice 和 ulimit 来进行资源限制。利用 nice 可以让 smoke 系统中的进程处于比较低的优先级,从而确保系统的其他用户仍能比较快地获得系统的响应。 而 ulimit 则可以限制 shell 实例中允许使用的总的内存量和 CPU 时间。

    目前,我为 smoke 系统中的进程分配的 NICE 数为 5 到 10 的样子, 而每一个 ./pugs 进程实例只允许使用最多 800 MB 的虚拟内存和 10 分钟的 CPU 时间。 一旦某个 ./pugs 实例超过了规定的时间或空间限制,系统就会 KILL 掉它,但这并不会中断整个 smoke 过程, 只不过对应的那组测试被标记为失败而已。

    说实话,nice 和 ulimit 还是 Juerd 向我介绍的 。 惭愧啊,呵呵。

    将 nice 和 ulimit 结合到一起,我便得到了一个“受限Pugs”,也就是下面这个 limited_pugs 脚本:

    http://svn.pugscode.org/pugs/util/limited_pugs

    关于其中一些 Bourne Shell 记法,我还 专门请教了 #perl6 频道中的高手们。

  • cron 活动的监视和诊断

    令人高兴地是, cron 在指定的时刻自动运行指定的命令的同时会记录下所有的 stdout 和 stderr 输出,并将之发送到我的 Gmail 信箱。 这样,监视和诊断远程 feather 服务器上的 auto-smoke 过程就是轻而易举的事情了。cron++

    今天早上我已经收到了 feather cron 发送给我的第一份 auto-smoke 的报告。看起来它工作得非常好。Yay!

为什么一个字节是 8 个比特?

记得我们班的“超级天才”宝权同志曾在大一学 C++ 的时候问过一个很特别的问题,即“一个字节为什么是 8 个比特?”

昨晚,我将此问题贴到了 irc.freenode.net 的 #perl6 通道上,Larry Wall (TimToady), jerry gay ([particle]), moritz 参与了讨论。下面是当时的聊天记录(agentzh 就是我啦,呵呵):

<agentzh> a friend of mine once asked me why a byte is of 8 bits.
<moritz> agentzh: what did you answer?
<moritz> agentzh: "computer scientist love powers of two"?
<agentzh> moritz: i told him because ASCII code has 7 bits and the people want to feel safer and add one more
<TimToady> lol
<moritz> *g* nice explanation ;-)
<agentzh> thanks :D
<TimToady> and then the Europeans all added one more, and did we feel safer?
<TimToady> I don't think so...
* agentzh wants to hear TimToady's explanation.
<TimToady> I think the ASCII explanation is basically correct, from a cultural point of view. When people started programming PDP-11s and doing a lot of string processing, they decided it was convenient that it came close to a power of two, and stuck with it.
<TimToady> and it was also fairly obvious about then that the next generation would be 32-bit processors, and then you get 4 chars into it.
<TimToady> but I think the powers-of-two argument was kind of a post-facto rationalization of the ASCII culture
<TimToady> basically, Pascal and C thought in bytes, so everything else followed along.
* TimToady remembers various contortions of trying to rationalize the type system of C on some weird old architectures that were not amenable to bytes...
<TimToady> and the term "byte" itself had not yet settled on 8 bits
* moritz thinks of "mix", Donald E. Knuth's assembler, that doesn't rely on a fixed byte size
<TimToady> yes. 36-bit computers tended to use 6 bit characters
<[particle]> octet is the correct term, but byte has become a synonym
<TimToady> byte is now the correct term. octet will die eventually
<TimToady> and go back to being 8 singers.
<TimToady> except for in standards documents, where it will likely remain a shibboleth

原始的聊天记录位于:

http://colabti.de/irclogger/irclogger_log/perl6?date=2007-04-17,Tue&sel=451#l672

包括上面这段记录的上下文,呵呵。昨天晚上 Larry 真是妙语连珠,Joke 不断啊。不愧是大师级人物……

章亦春

UML::Class::Simple 的用户反馈

没想到我发布到 CPANUML::Class::Simple 模块居然得到了用户如此之好的反馈,开心哦:

http://cpanratings.perl.org/dist/UML-Class-Simple

通过 Google ,我又在世界上找到了两个 UML::Class::Simple 用户:

我一定要继续努力,开发出更多更好的 CPAN 模块!耶 !:D

我对 Perl 6 开发的贡献汇集

今天在看网上一篇关于我的评论的时候找到下面这个 URL:

http://groups.google.co.uk/groups?as_ugroup=perl.*&as_uauthors=Agent+Zhang

它汇集了有关我在过去一年中对 Perl 6 开发的贡献。可惜我没早些发现它,要不我的简历会更有力一些
,呵呵。

包含了该链接的 use perl 评论也很有趣:

http://use.perl.org/comments.pl?sid=33843&op=&threshold=0&commentsort=0&mode=thread&cid=52032