Thursday, February 4

最近看的书

最近看完了Dragonlance的第二个trilogy了。这套书最大的特点就是:每一刻,我都无法预测下一章节会发生什么。不像中国YY小说,谁都知道主角是永远幸运的。这本书是几个兄弟一起出去游历,每个人都可能死 ,还有人可能活过来.已经死去的人,还在精神上一直鼓励其他的朋友。在死去的时候能够说:"We should not mourn those who have fulfilled their destiny. Mine is fulfilled." 这是很幸福的事情。

My honor is my life. Sturm说。

第一个三部曲里,几个朋友游历,遇见了邪恶要征服世界,所以他们一起把黑暗女神赶走了。第二个三部曲里,他们中的几个回到很久以前,打算从根源消除邪恶。其中两个觉得做不了,就跑回来了;可是一不小心,多跑了两年,发现世界已经被毁灭。所以他们再跑回去要刺杀一个人...不翻到最后一章,你绝对想不到最后发生了什么。

每一个人的性格都很鲜明,每一种生物都有自己的特性。每个人都有自己的弱点,也有心中的坚持。这套书真不愧是经典。

下一本应该是The Second Generation,不过我会放一段时间,专心把欧洲历史看完。这星期看到的欧洲历史说英国亨利8世为了要个儿子,要求离婚,可是罗马天主教不允许,所以他就把辖下的教会改为英国国教Anglican Church (The Church of England),然后他就把只生了一个女儿的老婆休了,娶了第二个老婆;结果第二个老婆还是生了个女儿;他再休(或杀了?)第二个老婆,然后第三个老婆才生了儿子。
后来,儿子/大女儿/二女儿的故事才惊心动魄!

与此同时,我还要看林语堂那本 The wisdom of Confucius. 市图书馆有中文版的吾土吾民,也有英文版的my country and my people,1936年版,但是只有一本,不外借,只能去馆里翻 :)

前年翻的是Outlander系列,看到第4本的时候,发现篇幅太长,语音书竟然有42张CD,所以就放下来了。那个系列我一直没有搞清楚到底他们能不能改变历史。一个护士回到200年前(苏格兰),在丈夫要参加一个她从历史书里看到的必输的战斗之前,丈夫把她送回到现实世界生下女儿。20年后,向女儿坦白之后,她们发现了那个丈夫在战后的踪迹,所以她又回到200年前寻找爱情;几年之后,女儿从历史书发现他们漂流到美国拓荒时死亡,所以她也回到200年前试图救他们;她男朋友也追回去了。但是,到底他们改变了历史没有?应该在第4本里有答案。

Wednesday, January 13

非法献花

网友们自发到谷歌北京总部大楼前献花,从中午开始一直络绎不绝,今晚,北京推友和网友已经聚集在谷歌总部大楼前。网友们献上鲜花,点上蜡烛,摆上了白酒。清华科技园的保安人员前来阻止,并声称:必须事先向有关部门申请,获得审批后方可进行,否则属于非法献花。于是“非法献花”成为最雷人的互联网最新流行词。半个小时后,百度百科、互动百科等均收录了“非法献花”这一词汇,但仅仅过了一个小时,这些名词则立即被删除。

各大互联网门户网站均未对此事件策划专题进行报道,号称中国第一社区的天涯论坛上则暗哑无声,找不到一条相关的消息。

尽管今天白天Google中国总部坐地标牌上的鲜花都被科技园的保安们收走了(他们还发明了个值得载入史册,生动记录了我们这个荒诞时代的新词汇“非法献花”,呵呵,太有喜感了),但他们下班后Google中国的标牌依旧重新被温馨的鲜花、啤酒、蜡烛和字条所簇拥,在那些温馨的字条和卡片里面,我看到了网友代冉云飞冉匪和宋石男四一哥献上的鲜花(看到咱们四川人,感觉那个亲切呀),在字母G的中间和字母O的上面,我还看到了两本英文原版的乔治·奥威尔的《1984》。
Source


Related link: Google: A New Approach to China
Related link: 义无再辱

Related link: 在Google说遭到大规模有组织的入侵之后,Adobe也说话了。

中国说:我要把外国通向中国的网线都剪掉,让他们成为世界上最大的局域网,哈哈哈哈。

Tuesday, January 12

[Music]林子祥 - 誰能明白我

林子祥 - 誰能明白我
作曲:林子祥 作詞:鄭國江 


昂然踏著前路去 追趕理想旅途上
前行步步懷自信 風吹雨打不退讓
無論我去到哪方 心裡夢想不變樣
是新生 是醒覺 夢想永遠在世上
前路那怕遠只要自強 我繼續獨自尋路向
常為以往夢想發狂 耐心摸索路途上

懷自信我永不怕夜航 到困倦我自彈自唱
掌聲我向夢想裡尋 儘管一切是狂想

途人路上回望我 只因我的怪模樣
途人誰能明白我 今天眼睛多雪亮
人是各有各理想 奔向目標不退讓
用歌聲 用歡笑 來博知音的讚賞

懷自信我永不怕夜航 到困倦我自彈自唱
掌聲我向夢想裡尋 儘管一切是狂想~~

昂然踏著前路去 追趕理想旅途上
前行步步懷自信 依照心中那正確方向
懷著愛與恕的心 充滿夢想的笑着
用歌聲用歡笑 來博知音的讚賞
用歌聲用歡笑 來博知音的讚賞


偶尔在硬盘找到的。听了许多遍,开头那个“昂然踏著前路去”我以为是“茫然”呢,一直认为这个“茫然”用得不好。今天搜到歌词,才发现“昂然”果然用得最好。

Labels:

这首歌,我的堂哥哥非常喜欢,经常唱K时狂歌的(还有就是陈百强的《感情到老》)。

哈哈,你的年龄暴露了⋯⋯
 
It's not fair to judge my age from this song. I don't remember listening to this song when I was young....er.
 

Friday, January 1

[Music]晚风-上海之夜

晚风 歌手 叶倩文


曲/词:黄沾

晚风中 有你我的梦
风中借来一点时间紧紧拥
拥的那个梦
像一阵风 像一阵风
悠悠爱在风中轻轻送

我心的爱
是否你心的梦
可否借一条桥让我俩相通
在这借来的桥中
明天的我 明天的你
会不会再像那天相拥

今晚的风和明天的梦
到底在你心里有多少影踪
可否这个晚上
借来时间 借来晚风
把我的爱送到你心中


这首歌是1984年电影《上海之夜》的主题曲,影片中37年日本进犯上海,一对邂逅的青年(钟镇涛和张艾嘉)相约战后再续前缘;10年后,他们又来到了这个城市...Would they carry these same feelings like the day they hugged?

Friday, November 13

Disable button after sumit

Originally, an asp.net page has a button
< id="btnCreate" text="Create" runat="server" onclick="btnCreate_Click">
to fire the btnCreate_Click event.

The event takes a few seconds to perform its job, so the client complained that sometimes she clicked the button twice, and 2 items are created. "It would be better if the button is disabled after clicked".

Sure, we programmers can do that.

Adding "btnCreate.Enabled=flase" into the btnCreate_Click event can not do the trick, because this property will not be set until all the jobs in this event are performed and the new page is return to client's browser. A javascript applet must be activated to disable this button, when the form is being submitted into server and firing up the event.

How about adding javascript directly in this button like:
< id="btnCreate" text="Create" runat="server" onclick="btnCreate_Click" onclientclick= "
"this.value='Please wait...'; this.disabled = true; " + ClientScript.GetPostBackEventReference(btnCreate, string.Empty) + ";");
It worked perfectly for IE and Firefox 3.0, until the Firefox 3.5 was release in July 2009.

At this point, the HTML source of rendered page is like:
< input type="submit" name="ctl00$MainPageContent$btnCreate" value="Create" onclick="this.value='Please wait...'; this.disabled = true; ;__doPostBack('ctl00$MainPageContent$btnCreate','')" id="ctl00_MainPageContent_btnCreate" />

After July, I got reports saying duplicate items were generated at the same second. I collected all the Addons from the clients and literally added them into my Firefox (it was 3.0 because I didn't notice the version is playing an important role) one by one. After adding one Addon, I restarted the Firefox and visited the same page to click the button. After adding all 15 Addons, there is no duplicate items from my Firefox.
Finally the Firefox version number is located as the source of this issue. Paros and Firebug is deployed to catch the traffic. Only one post action from Firefox 3.5 fires up the btnCreate_Click event twice. That is so weird. Is that a bug in Firefox 3.5, or in Asp.NET?

I don't see any Googled page mentioned this problem, and there was no solution existed, until this blog is written.

Solution: Step 1, modify the button as
< id="btnCreate" text="Create" runat="server" onclick="btnCreate_Click" style="color: rgb(255, 0, 0);" usesubmitbehavior="false">
Step 2, modify the code in Page_Load as
btnCreate.Attributes.Add("onclick",
"this.value='Please wait...'; this.disabled = true; ");
After that, the HTML source of rendered page is almost the same:
< input type="button" name="ctl00$MainPageContent$btnCreate" value="Create" onclick="this.value='Please wait...'; this.disabled = true; ;__doPostBack('ctl00$MainPageContent$btnCreate','')" id="ctl00_MainPageContent_btnCreate" />



Analysis:
The description of UseSubmitBehavior from Microsoft
is very confusing:
Use the UseSubmitBehavior property to specify whether a Button control uses the client browser's submit mechanism or the ASP.NET postback mechanism. By default the value of this property is true, causing the Button control to use the browser's submit mechanism. If you specify false, the ASP.NET page framework adds client-side script to the page to post the form to the server.
Originally, the
UseSubmitBehavior is "true" by default, the HTML source is
< input type="submit" name="ctl00$MainPageContent$btnCreate" value="Create" />

If you have been reading the HTML source carefully, you can notice that the < input > of first HTML source is a "Submit", and the second < input > is a "Button". The UseSubmitBehavior decides the difference. My first solution added a javascript __doPostBack into a "Submit", and the Firefox 3.5 decides to submit the form twice, I guess.

The combination of local javascript and serverside script can be very fragile, so extra attention must be taken to deal with it.

Thursday, October 29

The Three Great Virtues

Recently I figured out I have the 3 great virtues of a programmer:

  1. Laziness - The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful, and document what you wrote so you don't have to answer so many questions about it. Hence, the first great virtue of a programmer.
  2. Impatience - The anger you feel when the computer is being lazy. This makes you write programs that don't just react to your needs, but actually anticipate them. Or at least pretend to. Hence, the second great virtue of a programmer.
  3. Hubris - Excessive pride, the sort of thing Zeus zaps you for. Also the quality that makes you write (and maintain) programs that other people won't want to say bad things about. Hence, the third great virtue of a programmer.

(Wiki)
My fellow people always ask me to be humble. I should have let them know: I am too pride to be humble!

Ed2k Monitor

I shared /media/public/Incoming/waitinglist/ folder, so from other computers in the network user can create a text file with content of
ed2k:xxxxxxxxxxxxxxxxxxx
ed2k:xxxxxxxxxxxxxxxxx
This script will monitor this folder for any new text file and feed ed2k links into aMule:



#!/usr/bin/perl
#The purpose of this script is to monitor a directory periodically, and run ed2k (aMule) for new entries in this folder (then delete them).

#ben@fadshop.net. Jun 1, 2009.

# Version 2: Aug 11, 2009. Read each line of the files for importing.



# Edit Cronjob by:

# crontab -e

#0,15,30 * * * * script.sh

###or

#0-59/15 * * * * script.sh



# model: http://www.perlmonks.org/?node_id=283849

use strict;

use warnings;



sub printlog

{

my $logfile = shift;

my $logmessage = shift;

my $now = localtime time;

open(LOGFILE, ">>$logfile");
print LOGFILE $now . " " .$logmessage . "\n";

close LOGFILE;

}



sub scandir

{

my $dir = shift;

my $fileProcessor = shift;



opendir (DIR, $dir) or die "Cannot open $dir: $!\n";

while (my $filename = readdir(DIR))

{
next if $filename =~ /^\.\.?$/; # skip . and ..
if ($filename =~ /\.txt$/) {

&$fileProcessor("$dir/$filename");
}
if ($filename =~ /.torrent$/) {
`transmission "$filename"&`;
}

}

close DIR;

}





sub runed2k

{

my $filename = shift;
print "got file: $filename\n";
open(ED2KFILE, $filename);

foreach my $line (){
$line =~ s/\r(\n?)//;
if ($line =~ /^ed2k/){

`ed2k "$line"`;

#print LOG

printlog('/tmp/ed2klog', $line);
}
if ($line =~ /^http/){
chdir('/media/public/Incoming/');

`wget "$line"&`;

#print LOG

printlog('/tmp/ed2klog', $line);
}
}

close(ED2KFILE);
unlink($filename);

}







scandir('/media/public/Incoming/waitinglist',\&runed2k);



The result is: In any computer of my network, I can put the ed2k link into text file. The Linux server will retrieve the ed2k resource for me overnight.

Wednesday, October 21

宗教和心理市场:生活助理市场上陌生供应商检测单

1、供应商所提供的,正是你很长时间以来寻找却没有找到的。很奇怪,他正好知道你
缺什么。

2、与供应商的第一次接触就为你看问题打开了全新的视线。

3、供应商的世界观非常简洁明了,能够借以解答一切问题。

4、供应商试图从情感上争取你,其他成员很快就成了你的“好朋友”。

5、你觉得提出批评性看法,那些新朋友会感到失望,而且,如果你总得拒绝新朋友不
断的邀请会觉得过意不去,因为你不愿意做一个不讲礼貌的人。

6、供应商越来越多地进入你的生活,逐渐形成一种引力:似乎进去容易出来难。

7、尽管如此,你还是不清楚供应商的情况。对你的要求是,不要思考,不要检验。你
的新朋友会说:“这没法解释,必须自己去体验,我们所经历的完全是另外一个层次…
…”或类似的说法。

8、供应商有一个拥有真理的大师或者是神的传话人,他的决定权不受任何怀疑。

9、供应商的教义被视为是唯一真确、永久正确的知识,拒绝传统的科学,拒绝理性思
维,拒绝理智,认为这些只重视脑,是负面的,是属于撒旦的等等。

10、供应商缺乏理性的讨论文化:因为供应商认为自己拥有不可改变的真理,所以认为
一切关于自己的教义和组织的讨论都是多余的。

11、供应商内部的批评者被诬陷、隔绝或开除。

12、来自供应商外的批评被当作供应商正确的证据。

13、供应商总感觉自己被敌对势力包围,外部的人都在对自己施展阴谋。

14、供应商只认识两种人:要么是朋友,要么就是敌人,谁不是我们的支持者,谁就是
我们的反对者。

15、世界面临着大灾难,只有供应商自己知道,如何让这世界或自己的信徒得救。

16、供应商内部的人是精英,外部的人都在走邪路,充其量是传教的争取对象。

17、供应商可以为了实现自己的目标不择手段。

18、供应商内部通过特别的标志或行为规则与其他人隔离开来,比如通过自己的语言、
特定的服装、饮食、对日常生活的控制和对私人关系的干涉。

19、供应商促使你与到目前为止的社会关系隔离,原因是这些社会关系影响你的进步。

20、供应商促使你把自己的信息来源局限于供应商自己的意识形态(不看新闻,不读报
纸,不读文学作品,只读供应商内部的读物)

21、供应商给你安排任务,要求你参加活动,占用你几乎所有的时间(比如卖书刊、参
加学习班、参加活动、祈祷、打坐、共同读书、拉新人入教)。

22、你很少一个人单独活动,总是有供应商的人来接你,或许你还被要求到供应商的集
体住处去住宿,对你的个人生活的控制被称为是对你坚持走唯一正路的支持。

23、供应商也为你做通常由每个人自己做的决定。

24、供应商公开或暗示性地要求你严格服从,甚至要求你放弃自我,因为这是取得进步
或得救的唯一途径。

25、如果你对供应商产生怀疑,不会有人关心你怀疑的原因,更多的是,你将会听到某
些现成的解释:这套体系本身没错,只是你还没到时候。如果你没能取得进步,那么原
因只在你自己,因为你信得不够,读得不够,理解得不够,祈祷不够,打坐不够或者是
上课上得不够等等。

26、有时候你会觉得这个供应商可怕,觉得自己受到了压力,可是你很快就排除这种念
头,并且尽力使自己更加靠近这个供应商。


从柏林市政府邪教事务专员2002年报告“都是邪教Sekte吗?——风险与副作用”第II部分第
8章“宗教和心理市场”摘译.报告把所有作为调查对象的团组称为“生活助理市场上容易引起冲突的供应商”,在涉及到宗教性质团组的检测单中只是说“供应商”。如果某教某派符合检测单中的一个以上特征,就要小心,这个教派就可能会给当事人在家庭生活、工作或/和个人心理等方面带来不同的麻烦,符合得更多,就应该更加小心。德文原文可在柏林市政府教育、青年与体育厅网页下载,网址是:
http://www.senbjs.berlin.de/familie/sog_sekten_psychogruppen/thema_sog_sekten.asp (点击"Alles Sekte - oder was?"下载PDF文件)

=========

摘录自 乡下人进城

Sunday, September 13

转:有些东西就该丢掉,可偏就有人把那当作宝

作者 李笑来 Sept 11, 2009

我想将来我还会不停地遇到给我讲阴阳、五行、八卦、太极、中医、风水、佛教、基督教……诸如此类的“神秘而又灵验,并且往往难以驳斥”的各种理论——并且出于善意。

这其实多少有点像一台配置了酷睿双核CPU的电脑被主人固执地坚持使用DOS操作系统一样:

倒也不是说DOS就不是操作系统了,也不是说DOS就一无是处了,只是说,我们现在已经有更好的操作系统,比如Windows,或者Linux以及它的无数种发行版……

然而,如果坚持使用DOS的人声称“我乐意,你管得着么?!”,这就比较难办,因为我们又必须尊重个人选择。


不过,当我们尊重他们的“个人选择”之时,他们却不尊重给予他们尊重的人,不惜恶毒地“诅咒”(却又以“好意”的方式表达),这就多少有点令人难为情了。

有鉴于此,各自爱用啥用啥,好不好呢?

Saturday, August 8

[Music] The street where wind settles



When you are tired, you should listen to this melody.