2008-12-16

SR-71 飞行员与控制台的对话

"我永远记得那一天的无线通讯,当时我正和沃尔特(我的后座驾驶员)一起在13英里高度划过南加利福尼亚的天空。
"在飞入洛杉矶空域的时候,我们一直监听着空中其他飞机和飞控中心的通讯。虽然飞控中心并不真正控制我们,但是它始终在自己的雷达上监视着我们。这时,我听到一个塞斯纳(一种螺旋桨民用飞机)飞行员请求塔台读出他的地速。
"'90节。'塔台回复。
"沉默了片刻,一架双发比奇(一种螺旋桨民用飞机)也同样要求塔台读出它的地速。
"'120节。'塔台回答。
"很明显那天并不只有我们对自己的地速感到自豪,因为几乎是立刻,无线电上传来一个F-18飞行员得意的声音'哦,中心,'灰尘52'需要地速读出。'
"短暂的沉默之后,塔台回答'地速525节,灰尘。'
"又一阵短暂的沉默。正当我心里痒痒的考虑时机是否成熟的时候,我听到后座传来了熟悉的无线电开关的喀嗒声。就在这一瞬间,我明白我和Walt成了真正的拍档。
"'中心,我是'白杨'20,需要地速读数,完毕。'
"一阵比平常长的多的沉默之后:'白杨',我这里的读数是,呃……1742节。
"那天那个频道没有更多的地速读数请求了。"

以下是另一段著名的SR-71与洛杉矶塔台的对话:
"请求60000英尺高度的空域使用权,over。"
沉默了片刻,传来了塔台调度员略带惊奇和嘲讽的声音:
"你打算怎么爬升到那个高度?"
沉默。飞行员回复:
"我们不打算爬升到那个高度。我们要下降到那个高度。over。"
"........."

2008-06-11

About the Internet Explorer 7 User Agent

*    On Windows XP SP2, IE7 will send the following User-Agent header: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
*    On Windows 2003 Server, IE7 will send the following User-Agent header: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2)
*    On Windows Vista, IE7 will send the following User-Agent header: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)

什么是Erlang

Erlang是一个由Ericsson计算机科学试验室设计开发的程序语言。开源的Erlang已经发布以帮助、鼓励在爱立信以外来发展这门语言。

Erlang是一种编程语言,但有着很多与操作系统的相关特性:并发进程、调度、内存管理、分布式、网络,等等。

最初的开源Erlang发行版,所包含的Erlang的实现,相当于一个大型的爱立信的中间件,以用于建立分布式高可用性系统。

Erlang有以下特性:

并发性 - Erlang有着非常经量级进程,它可以动态的改变内存需求。进程没有共享内存和异步消息传递机制。Erlang为应用程序提供了,大量并发进程的支持。而在对于操级系统本身而言,没有并发需求。

分布式 - Erlang也被设计运行于分布式环境。一个Erlang虚拟机被称为一个Erlang节点。一个Erlang节点可以在另一个Erlang节点上建立并行运行的进程,可能用于其它的操作系统。进程位于不同的节点,可是通信方式与本节点的进程间通信方式是的一样的。

健壮性 - Erlang有着多种原始错误检测机制,可以用来构建容错系统。如,一个进程可以监视其它进程的状态,甚至另一个进程可能运行于其它节点上。分布式系统中的进程可以被配置成无效,以迫使它自动迁移到恢复节点上。

软实时性 - Erlang提供软实时性,即在毫秒级别做出反应。在这种系统下,长时间的垃圾回收的时延是不被允许的,所以Erlang使用增量式垃圾回收技术。

代码热升级 - 很多系统无法停下来,来做软件维护,如银行系统。Erlang允许程序代码在程序运行的时候被修改。旧代码可以同步的被替换成新代码。在转输的过程中,无论是旧代码还是新代码,可以共存。这样可以在不打忧机器正常运行的同时,升级并纠正BUG。

增量式代码加载 - 用户可以控制代码加载的详细方式。在嵌入式系统中,所有代码通常在引导的时候被加载的。在开发系统中,代码需要时才加载,甚至当系统运行时加载。如果只是测试遗落的BUG,那么只有有BUG的代码才需要被加载。

外部接口 - Erlang进程与外界通信,使用的是与Erlang进程间通信所使用的相同的消息传递机制。这个机制也常常用于主机操作系统,与使用其它语言开发的程序之间的交互。如果考虑到效率的话,还会用到一些比较特殊的概念,如:直接将C语言连入Erlang运行时系统中。

How do you explain cloud computing to your grandma?

Once upon a time I worked at an Asynchronous Transfer Mode (ATM) switch startup. Over a delicious Christmas punch my grandma asked me what I did for a living that I could afford such extravagantly inexpensive gifts. Always so subtle. I explained I worked on an ATM switch. Mistake. She sniffed, said that’s nice, and asked my why the Automated Teller Machine ate her bank card that morning. No matter how hard I tried I couldn’t convince her I didn’t work on bank ATMs. To all future job interrogations I waxed off, protesting I do boring software stuff that nobody cares about.

Not put off in the least, grandma asked me last night to explain this cloud computing thing she keeps hearing about at her church club. Afraid of being another victim of the distortion field surrounding cloud computing, I instead referred her to Kent Langley’s excellent overview of the subject in Cloud Computing: Get Your Head in the Clouds. It does a good job demystifying the very confusing concept of cloud computing. It has nice diagrams, definitions, examples and is a great place to start.

She agreed that she had learned a lot, but one thing still troubled her: what’s the difference between cloud computing and utility computing? They seem to be the same to her. Always so perceptive. She felt sure if she could drive this point home she would score big points with her church group. Oh the pressure.

I steadied myself and explained 3Tera’s take is that cloud computing is for service users and utility computing is for service builders. Cloud computing is essentially about the surrender of control. Users of a service like Salesforce.com don’t care how the site is implemented. They don’t care about how it scales, deals with failure, or any of the other 1000s of little details you have to care about when running a complicated operation. Users just want their service to work when they need it. Utility computing customers on the other hand require fine control over their resources because they are the builders of services like Salesforce.com. Cloud computing is built on utility computing. You couldn’t build a Salesforce.com on Google whereas you could build it on top of 3Tera or Amazon.

StorageMojo thinks all this cloud/utility nonsense is just foggy thinking. Real computing will stay local because the cost of network access is too high. Memory and CPU are plentiful and cheap while bandwidth is neither. Distributed computing 1990s style will still rule the day.

Mike Nygard thinks there’s A Cloud for Everyone in the future. Latency matters and “Keeping your endpoints on your own network at least lets you control your own latency.” Security matters and pushing your precious data into the hands of strangers isn’t secure. Yet we see SalesForce, Google Docs, Basecamp, SugarCRM, and hosted email all flourishing so is privacy really a concern for newer generations trying to get stuff done?

HP’s Patrick Eitenbichler thinks “utility computing refers to a business model, while cloud computing describes the underlying IT architecture” with the real decision point being “utility/cloud computing vs. purchasing your own IT assets.”

Geva Perry writing for GigaOM essentially agrees with Mr. Eitenbichler saying: Utility computing relates to the business model in which application infrastructure resources — hardware and/or software — are delivered. While cloud computing relates to the way we design, build, deploy and run applications that operate in a virtualized environment, sharing resources and boasting the ability to dynamically grow, shrink and self-heal.

Krish tries to condense that down to: cloud computing is software as a service (where companies run their own software) and utility computing is hardware as a service (where you can run your own software).

Margaret Rouse makes a good case for cloud computing being just a better marketing concept for utility/grid/cluster/distributed/parallel computing.

Bits or Pieces smartly ignores saying the word cloud but my impression is they think providing Software as a Service on a utility computing basis is the game changing innovation.

James Urquhart defines the cloud to include: SaaS, PaaS (e.g. force.com) and HaaS (e.g. Amazon, Mosso, etc.). SaaS is in clearly in play today, HaaS is being experimented with, but PaaS may be the most interesting facet of the cloud in the long term.

Keystones and Rivets finds that “The Cloud” is grid computing wrapped up in a service offered by data centers.

Confident I must have answered her original question, I asked “Now, doesn’t that clear things up grandma?”

Grandma sniffed, said that’s all very nice, but she still wanted to know why the ATM ate her bank card! I groaned and said “Goodnight grandma. I’ll call again next week.” “Excellent,“ she Cheshire smiled, “next week my church group is going to tackle if social networks are really monitizeable.”

2008-04-17

现实当中的幽灵船


  • 玛丽·赛勒斯特号(Mary Celeste),在1872年被发现遗弃在葡萄牙和亚速尔群岛之间的海域,尽管船只毫发无损但船员却不见踪影。

  • Joyita号于1955年被发现遗弃于太平洋。

  • 货轮Fisah Ketsi号,于1990年发现其漂流于巴西东海岸,船员消失,货仓盖敞开。

  • 建生号于2006年3月26日在澳大利亚海岸被发现,无人知道船只的来源或出现在该地点的原因。

  • 有水手曾报告说看见已沉没27年的Valencia 号蒸汽船出现于温哥华岛(Vancouver Island)附近。这艘船如幽灵般的尾随其他船只,直到这些船只靠近海岸,这些目击者还称看见其5号救生船完好无损的漂浮在其母船的周围,同样无人驾驶。

  • Ourang Medan,通常被归于幽灵船的行列,尽管一些怀疑者给出了船员死因的解释。

  • Baychimo ,1931年在北冰洋航行时由于被浮冰卡住而弃船,其通常被认为已经沉没,但它在其后的38年间不断被报道发现仍在漂浮,但没有人曾前去救援此船只。

  • Kaz II号,2007年4月18日被发现漂浮于澳洲昆士兰北部汤斯维尔80海里外,2007年4月15日在昆士兰北部的爱丽海滩出发,拯救人员于2007年4月20日早上登上游艇,发现引擎、电脑及无线电也在启动,所有情况均很正常,他们更看到台面摆放了食物及餐具,但游艇却人去楼空,救生艇却不见了,但游艇完全没有遇事痕迹,有关当局已将“Kaz II”号封为“鬼游艇”。

  • U-Boat,在大西洋航线,曾经有货柜商船发现第二次世界大战纳粹徳国旧式U-Boat于雾降时浮出大海,雾散即消失;货柜商船以望远镜侦察此潜艇,发现潜挺不能站人之艇首往往立站一名纳粹军官,脸色苍白瘦双手环搂胸,可怕的是此“人”眼无双瞳,发现后不数日,此区海域常出现海难,出现似为预警示人。

The Flying Dutchman - 飞翔的荷兰人

飞翔的荷兰人(德语:Fliegender Holländer;英语:The Flying Dutchman。又译作漂泊的荷兰人,彷徨的荷兰人等),是传说中一艘永远无法返乡的幽灵船,注定在海上漂泊航行。飞翔的荷兰人通常在远距离被发现,有时还散发着幽灵般的光芒。据说如果有其他船只向她打招呼,她的船员会试图托人向陆地上或早已死去的人捎信。在海上传说中,与这艘幽灵船相遇在航海者看来是毁灭的征兆。在德文里(fliegend)是用来表示一种持续飞行的状态,形容受诅的荷兰人永远飘流在海上,四处航行,却始终无法靠岸的悲惨宿命。

2006年,飞翔的荷兰人的故事被用于加勒比海盗系列电影中,船员受诅咒渐渐变化成海洋生物,船长戴维·琼斯(Davy Jones)是影片中的主要反派之一,因与海洋女神卡吕普索之间的感情纠葛与背叛而招致诅咒。

关于飞翔的荷兰人的故事在航海传说中有很多个版本,与之相关的是福肯伯格船长(Captain Falkenburg)的中世纪传奇故事,他以自己的灵魂为赌注与魔鬼掷骰子,被诅咒在北海不停往返直到审判日。

飞翔的荷兰人第一次在书中被提到是在乔治·巴林顿《Voyage to Botany Bay》(1795年)一书的第6章:

    译文:我对海员崇敬幻影的迷信常有耳闻,但从未对这类记录给予太多信任。据传一艘荷兰军舰在好望角外失事,船上无人生还。同行的船只经受住了暴风,随后抵达好望角。整修后返回欧洲的途中,他们在相同的纬度遭到猛烈的暴风雨的袭击。值夜的一些水手看到,或者在想象中看到,一艘船满帆向他们始来,仿佛要将他们撞沉:一名水手尤其确定这正是在前一场暴风中沉没的船,或者是她的幻影。但暴风雨稍停的时候,黑云似的船就消失了。幻影在海员心里挥之不去,等船靠岸,故事也就像野火般在人中传开了,幻影也被称作飞翔的荷兰人。

根据一些来源,这艘幽灵船的船长原型是17世纪的荷兰船长伯纳德·福克(Bernard Fokke)。福克因从荷兰到爪哇航行的离奇神速而出名,当时的人因而怀疑他与魔鬼为伍以达到如此的速度。

对飞翔的荷兰人的第一次详细的描述应该是布莱克伍德杂志(Blackwood's Magazine)1821年五月刊上的一篇文章。事件发生的地点是好望角:

    译文:她是一艘阿姆斯特丹船,于70年前起航。她的主人是亨德里克·范德戴肯(Hendrik van der Decken)船长。他是一个坚定可靠的海员,就算与魔鬼为敌也会按自己的意见行事。从来没有哪个他手下的船员有任何抱怨,虽然船上的具体情形外人无从知晓。故事是这样:在好望角转弯的时候他们正试图在恶劣天气中通过桌湾。然而,风越来越大,不断的向船冲击,范德戴肯在甲板上咒骂大风。日落稍后,一艘经过的船问他是否不打算当晚入港,范德戴肯回答“如果我进港,就让我永世受诅咒,因为我将在此迎风航行直至审判日。”他确实一直没有进港,人们相信他仍在海面上大风中航行,每次有人遇到这艘船,她都有恶劣的天气相伴。

19到20世纪之间在外海上有很多起对“飞翔的荷兰人”的目击事件。威尔士亲王乔治(后来的乔治五世)的目击是最著名的几次之一。1880年,在他十五岁时,他与兄长威尔士亲王阿尔伯特·维克多(其父是后来的爱德华七世)一起正由辅导老师达尔顿(John Neale Dalton)陪伴,乘4000吨的轻巡洋舰巴坎堤号(HMS Bacchante),进行为期三年的航行。在澳大利亚悉尼和墨尔本之间海面上,达尔顿写到:

    译文:在早晨4点“飞翔的荷兰人”出现在我们的船首方向。它像幻影般发着红色的光,照亮了200码以外双桅船的桅杆和船帆。她从船首左侧靠近时,在舰桥上值班的军官和后甲板上的见习军官显然都看到了她。见习军官立刻被派往前甲板,但到达时她在附近出现过的痕迹已经消失的无影无踪了,连在地平线上都找不到她的任何踪迹。10点45分,早先发现飞翔的荷兰人的海员从前桅中部顶横桁坠落到前甲板上,摔得粉身碎骨。

2008-04-02

Sending Non-ASCII Text to MySQL in UTF8 Encoding

This section provides a test on sending non-ASCII character strings to MySQL server in UTF8 encoding.

The next test I did was to re-run the same SQL INSERT statement that included Latin1, UTF-8, GBK and Big5 characters directly. But I changed MySQL session settings with character_set_client=latin1 and character_set_connection=latin1 to see how MySQL applies the conversion when executing the INSERT statement.

<?php #MySQL-Send-Non-ASCII-UTF8.php
# Copyright (c) 2007 by Dr. Herong Yang, http://www.herongyang.com/
#
$con = mysql_connect("localhost", "Herong", "TopSecret");
$ok = mysql_select_db("HerongDB", $con);
$test_name = "Send Non-ASCII";

# Set character_set_results
mysql_query("SET character_set_results=utf8", $con);

# Set character_set_client and character_set_connection
mysql_query("SET character_set_client=utf8", $con);
mysql_query("SET character_set_connection=utf8", $con);

# Show character set encoding variables
$sql = "SHOW VARIABLES LIKE 'character_set_%'";
$res = mysql_query($sql, $con);
while ($row = mysql_fetch_array($res)) {
print($row['Variable_name']." = ".$row['Value']."\n");
}
mysql_free_result($res);

# Delete the record
$sql = "DELETE FROM Comment_Mixed WHERE Test_Name ='$test_name'";
mysql_query($sql, $con);
print("\nNumber of rows deleted: ".mysql_affected_rows()."\n");

# Build the SQL INSERT statement
$sql = <<<END_OF_MESSAGE
INSERT INTO Comment_Mixed (Test_name, String_ASCII,
String_Latin1, String_UTF8, String_GBK, String_Big5)
VALUES ('$test_name', 'Television',
'T?l?vision', '电视机/電視機', '???', '???');
END_OF_MESSAGE;

# Run the SQL statement
if (mysql_query($sql, $con)) {
print("\nNumber of rows inserted: ".mysql_affected_rows()."\n");
} else {
print("SQL statement failed.\n");
print(mysql_errno($con).": ".mysql_error($con)."\n");
}

# Get the recod back
$sql = "SELECT * FROM Comment_Mixed"
. " WHERE Test_Name = '$test_name'";
$res = mysql_query($sql, $con);
if ($row = mysql_fetch_array($res)) {
print("\nTest Name = ".$row['Test_Name']."\n");
print(" String_ASCII: 0x".bin2hex($row['String_ASCII'])."\n");
print(" String_Latin1: 0x".bin2hex($row['String_Latin1'])."\n");
print(" String_UTF8: 0x".bin2hex($row['String_UTF8'])."\n");
print(" String_GBK: 0x".bin2hex($row['String_GBK'])."\n");
print(" String_Big5: 0x".bin2hex($row['String_Big5'])."\n");
}
mysql_free_result($res);

mysql_close($con);
?>


Note that string literals in the source code above will not be displayed properly, because this book uses UTF-8 encoding. Here is the output:



C:\>\local\php\php MySQL-Send-Non-ASCII-UTF8.php

character_set_client = utf8
character_set_connection = utf8
character_set_database = latin1
character_set_filesystem = binary
character_set_results = utf8
character_set_server = latin1
character_set_system = utf8
character_sets_dir = \local\mysql\share\charsets\

Number of rows deleted: 0

Number of rows inserted: 1

Test Name = Send Non-ASCII
String_ASCII: 0x54656c65766973696f6e
String_Latin1: 0x543f6c3f766973696f6e
String_UTF8: 0xe794b5e8a786e69cba2fe99bbbe8a696e6a99f
String_GBK: 0x3f3f3f3f3f
String_Big5: 0x3f713f3f3f3f


The output is interesting:




  • Conversion from character_set_client, utf8, to character_set_connection, utf8 - Identical encodings. No conversion will happen.


  • Conversion from character_set_connection, utf8, to column String_ASCII's encoding, ascii - Will happen with potential data loss. But the input text for String_ASCII is ASCII characters only and compatible with UTF-8. The output shows no problem.


  • Conversion from character_set_connection, utf8, to column String_Latin1's encoding, latin1 - Will happen with potential data corruption. MySQL took my Latin1 input string as a UTF-8 string and converted to Latin1. Output of String_Latin1 shows one corrupted character (0xE9 was replaced by 0x3F) in two places.


  • Conversion from character_set_connection, utf8, to column String_UTF8's encoding, utf8 - Perfect match. No conversion will happen. Output of String_UTF8 is perfectly correct.


  • Conversion from character_set_connection, utf8, to column String_GBK's encoding, gbk - Will happen with potential data corruption. MySQL took my GBK input string as a UTF-8 string and converted to GBK. Output of String_GBK is totally corrupted.


  • Conversion from character_set_connection, utf8, to column String_Big5's encoding, big5 - Will happen with potential data corruption. MySQL took my Big5 input string as a UTF-8 string and converted to Big5. Output of String_Big5 is totally corrupted.

2008-04-01

Automotive family tree 2008



4月1日:愚人节

1945年,在第二次世界大战中,美国军队在日本冲绳岛登陆,冲绳岛战役(图)陆上之战爆发。
1976年乔布斯沃兹尼亚克美国加利福尼亚州成立苹果公司
1979年伊朗举行全民公决,通过在伊朗建立伊斯兰共和制政体的国家。
2001年,前南斯拉夫联盟总统米洛舍维奇因涉嫌滥用职权等罪被塞尔维亚警方逮捕。
2002年荷兰安乐死法律正式生效,成为世界上第一个承认安乐死合法的国家。

Google has acquired FeedBurner

http://www.feedburner.com/google