123
 123

Sun 05 September, 2010

Click here to bookmark this link.Channel Image08:53 fishywang: RT @ndzk: 世博亲历记:中国人的低素质让世博蒙羞? http://goo.gl/4tgo by @yanghengjun» Twitter / fishywang
fishywang: RT @ndzk: 世博亲历记:中国人的低素质让世博蒙羞? http://goo.gl/4tgo by @yanghengjun
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.03:03 BeamAtic 头灯让你可以开着远光灯不关 (11 留言)Engadget 中国版» fishy's shared items in Google Reader

分类:

远光灯有助于看清前方的道路,但是一直开始的话对对向来车是很危险的。由日本 Ichikoh Industries 推出的 BeamAtic 或许是解决夜间行车难题的好方法。采用法国 Valeo SA 的技术,车上有摄影和搭配的影像处理软件来判断对向来车的位置,并且将对向来车的那一小块的灯光屏蔽掉。如此一来就可以一直开着远光灯,也不会影响到对向来车了。不过看起来好像前车还是会受到影响的样子,不知道这东西是不是真的有用?

预计下个月就可以在日本买到改装配备,Ichikoh 也在和车商谈,希望能将这个列为标准配备。

引用来源 | 此文章网址 | 转寄此文章 | 回应


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sat 04 September, 2010

Click here to bookmark this link.21:28 小设计大作用,有切口的透明胶带理想生活实验室» fishy's shared items in Google Reader

经常用透明胶带的同学都会有这样的感觉,每次其实用得不多,但无论是找切口还是断开都是件痛苦的事情(不是每个人的牙齿都咬得断啊),于是设计师Zhichuan Tang就带来了这样一款透明胶带设计,它名为“V-tape”,就是在胶带上整齐地开了一个V槽,一下子就解决问题了,你觉得怎么样呢?

这一设计还获得了2010年度的iF设计奖项,看似小小的创意,同样能够打动使用者,当然也包括评委。


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.21:28 100个囚犯和灯泡的那些事儿(下)Matrix67: My Blog» fishy's shared items in Google Reader

    即使灯泡的初始状态不定,当 n=2 时,两个人也能保证都知道对方进过房间。假设双方手中各有两个球,囚犯 A 总是试图把自己的小球放进盒子,囚犯 B 总是试图把小球取走。如果 B 拿到了 4 个小球,他就知道了 A 一定来过房间;而只要 A 放好的小球被拿走了, A 也知道 B 进过了房间。
    但是,当 n>2 时,不存在这样的协议,使得有两个人都能获知所有人都已进过房间。 Peter Winkler 的 Mathematical Puzzles: A Connoisseur's Collection 一书中给出了这个结论的一个大致证明思路。
    让我们考虑其中任何一个囚犯。我们假设他的策略是确定性的,他的下一步行动完全取决于之前看到的状态序列。假设在某一步,他看到的状态和上次离开房间时的状态相同,但他选择了改变状态。这时,你可以质问他,那你为啥不在上次就把状态改过来,偏偏要这次才去扳开关呢?看守完全有可能连续两次都是叫你进的房间,这样你不就浪费了一次进房间的机会了吗?因此,我们可以假设,当他进入房间时看见的状态和上次走的时候一样,他是不会去扳动开关的。
    接下来,让我们假设在某一步,这个囚犯的策略是“不动开关,保留原状态”。那么,我们可以认为他以后就再也不会动那个开关了!因为在最坏情况下,他根本没有改变灯泡状态的机会!具体地说,若无视掉这个囚犯以后的行动,今后的房间状态序列里必然有一种状态将出现无穷多次,比方说状态“开”出现了无穷多次吧。那么在最坏的情况下,这个囚犯从此开始总是在开灯的时候进屋。而他在这一步没有变动开关,并且以后的每一步里他所看到的状态都将和上次看到的一样,因此以后他都不会变动开关了。


    因此,这名囚犯首次进入房间时的策略绝不可能是“不动开关”,因为这样他以后可能都没机会动开关了,没人会知道他来过房间。如果他的策略是“如果灯开着,就把它关掉”,那么由第一个引理,今后他看见关灯状态都不会去改变状态了,直到下次见到灯亮时才会有所行动。每次见到灯亮时,他有两种选择,把灯关掉,或者让它接着亮。如果选择关灯,他又要等到下次灯亮才会行动;如果不关灯的话,相当于他这次没做任何操作,今后就再也没法行动了。也就是说,他的整个策略无非是“关过多少多少次灯之后就不管了”。类似地,如果他首次进入房间时的策略是“如果灯关着,就把它打开”,同理可知他今后的策略限制在了“再开几次灯就不开了”。当然,首次进入房间的策略还可能是“无论状态如何,总是扳动开关”,不过实际情况一揭晓,他的策略也就立即归为了上述两种情况中的一种。
    换句话说,每个人的策略都无外乎两种:只负责开 x 次灯,或者只负责关 x 次灯。当然,如果所有人都只开灯不关灯(或者只关灯不开灯),肯定是一点用处都没有。因此,无妨假设囚犯 A 负责开灯,囚犯 B 负责关灯。如果囚犯 C 也只负责开灯, A 永远不能分辨出 B 、 C 究竟是都完成了协议,还是都差最后一步;如果囚犯 C 只负责关灯, B 就成了那个被蒙在鼓里的人了。
    也就是说,整个问题的唯一解法就是,其中一个人只负责关灯,另外所有人只负责开灯;或者其中一个人只负责开灯,另外所有人都只关灯。换句话说,我们的“统计者协议”其实是唯一的解法。

 
    在 Mathematical Puzzles: A Connoisseur's Collection 一书中,我们有幸看到了这个问题的另一个更加有趣的变种,让囚犯们的难题继续活跃着人们的大脑。
    还是 100 个囚犯,还是一个空房间,还是要求所有囚犯事先构造一个协议,能保证有人可以断定出所有人都来过房间。不过,这次不同的是,房间里有两个灯泡,分别由两个开关来控制(不妨假设初始时他们都是不亮的)。大家估计要说了,一个灯泡都能解决的事儿,用两个灯泡还不容易?嘿嘿,这次有一个附加的要求:所有人都必须遵循同一套策略。

    这些智力游戏不仅仅是思维的体操,它竟然有不少让人意想不到的实际应用。远在这个智力题诞生之前,就有一个几乎等价的分布式计算难题困扰着人们:假如一个程序有 n 个进程,它们操作的是同一段(不太宽裕的)公共内存。但在程序运行中,有些进程可能会崩溃掉。我们希望程序能报告出当前还有多少个进程在工作,但使用的空间越少越好。一个简单的解决方案就是,预先指定一个进程作为统计者,照搬囚犯们的策略,只消一个 bit 即可统计出活动进程的大致数量。但问题是——这个统计进程崩溃了咋办?因此,为了避免有关键进程崩溃,这些进程的行为必须得一致才行。 1990 年, Michael J. Fischer 、 Shlomo Moran 、 Steven Rudich 、 Gadi Taubenfeld 四位牛人共同发表了一篇叫做 The Wakeup Problem 的论文,提出了著名的跷跷板协议 (see-saw protocol) ,成功解决了这一难题。

    我们还是把其中一个开关想象成一个盒子,它里面只能放一个小球。再把另一个开关想像成一个跷跷板,它也只有两种状态:左低右高、左高右低。要想改变跷跷板的倾斜方向,只能扳动它的开关。初始时,每个囚犯手中都有一个(假想的)小球。每个囚犯第一次进入房间后,他都幻想自己坐到跷跷板低的那一边上,然后把自己这一侧扳高。以后每次回到这个房间时,他都看看自己所在的那一侧是高还是低:如果是低的话,他就取走盒子里的小球(如果有的话),于是手中就多了一个小球;如果是高的话,他就在盒子里放一个小球(如果盒子是空的),此时手中的小球就少了一个。注意,如果他把手中的最后一个小球放进盒子了(此时他手中没有小球了),他就必须从跷跷板上下来,把自己所在的那一侧扳低,之后就再也不进行任何操作了。如果有某个囚犯收集到了 100 个小球,显然他就知道所有人都来过房间了。问题的关键就是:为什么最终总会有一个人能集齐所有的小球?
    其实,协议中的很多复杂的细节都是为了保证下面这个引理成立:每一个人离开房间之后,房间里都只可能有两种情况:

      A. 跷跷板两侧的人一样多
      B. 高的那边多一个人

    这是因为,如果有囚犯第一次进入房间,他将坐上低的那一侧,并把那一侧扳高,于是原本是情况 A 现在就会变成情况 B ,而情况 B 则会变成情况 A ;另外,如果有囚犯下了跷跷板,高的那一侧将少一人,同时该侧将被扳低,同样有情况 A 将变情况 B ,情况 B 将变情况 A 。
    现在,让我们假设所有人都进过房间了,并且有 k 个人正在跷跷板上(其余的人都已经离开跷跷板了)。由于跷跷板两侧最多差一人,因此当 k 大于 1 时,跷跷板两侧都是有人的。而由于每个人都进过房间了,因此不会有新的人坐上跷跷板了。此时,位于高处的人将不断拿出自己的球,并被位于低处的人取走。直到某个时刻高处有人拿不出小球了,他将走下跷跷板,此时跷跷板的状态才会发生变化,跷跷板上的总人数将变成 k-1 。最后跷跷板上只剩一个人时,显然他就拥有了所有人的小球,此时他就知道所有人都来过了。

    容易想到,如果初始时房间的状态不定,人手两个球的改进方法同样能解决问题。当然,对问题的探索是永无止境的,我们相信囚犯与灯泡的问题还会有更多漂亮的变种和扩展,不断启发着人们的思维。即使这些问题没有任何使用价值,思考过程本身也是有益而有趣的。让我们感谢最初设计这个智力趣题的无名氏,他给我们带来了无尽的思维乐趣。


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.20:28 瘾科学:忆阻器 (47 留言)Engadget 中国版» fishy's shared items in Google Reader

分类: ,

这个礼拜有一则大新闻,是 HP 将和 Hynix 合作,在 2013 年前让使用忆阻器(Memristor)的记忆装置上市,和闪存一较高下。这在业界被认为是一个重要的里程碑,但是忆阻器究竟是什么?它有什么神奇的特性,让它这么受重视?在这篇里小姜试着用最简单的方式,介绍忆阻器这有趣的「新」电子零件给大家,并且探讨为什么它可能是晶体管以来,最重要的电子进展。

什么是忆阻器?

忆阻器的英文 Memristor 来自「Memory(记忆)」和「Resistor(电阻)」两个字的合并,从这两个字可以大致推敲出它的功用来。最早提出忆阻器概念的人,是华裔的科学家蔡少棠,当时任教于美国的柏克莱大学。时间是 1971 年,在研究电荷、电流、电压和磁通量之间的关系时,蔡教授推断在电阻、电容和电感器之外,应该还有一种组件,代表着电荷与磁通量之间的关系。这种组件的效果,就是它的电阻会随着通过的电流量而改变,而且就算电流停止了,它的电阻仍然会停留在之前的值,直到接受到反向的电流它才会被推回去。用常见的水管来比喻,电流是通过的水量,而电阻是水管的粗细时,当水从一个方向流过去,水管会随着水流量而越来越粗,这时如果把水流关掉的话,水管的粗细会维持不变;反之当水从相反方向流动时,水管就会越来越细。因为这样的组件会「记住」之前的电流量,因此被称为忆阻器。


继续阅读全文 瘾科学:忆阻器

此文章网址 | 转寄此文章 | 回应


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image20:03 fishywang: @jjgod 看到盒子上有个A的图标,不知道是不是表示Region A,不过我翻了下我的Matrix Collection的盒子倒是没找到类似的东西» Twitter / fishywang
fishywang: @jjgod 看到盒子上有个A的图标,不知道是不是表示Region A,不过我翻了下我的Matrix Collection的盒子倒是没找到类似的东西
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.13:46 100个囚犯和灯泡的那些事儿(上)Matrix67: My Blog» fishy's shared items in Google Reader

    说有 100 个囚犯分别关在 100 间牢房里。牢房外有一个空荡荡的房间,房间里有一个由开关控制的灯泡。初始时,灯是关着的。看守每次随便选择一名囚犯进入房间,但保证每个囚犯都会被选中无穷多次。如果在某一时刻,有囚犯成功断定出所有人都进过这个房间了,所有囚犯都能释放。游戏开始前,所有囚犯可以聚在一起商量对策,但在此之后它们唯一可用来交流的工具就只有那个灯泡。他们应该设计一个怎样的协议呢?

    这个经典的问题在网上转载无数,题目描述被好事者们改得天花乱坠,甚至加进了“这盏灯永远有充足的能源供应”、“如果灯泡坏了或是电路出了故障会马上修好”等条件,剥掉了“算法问题”的外壳,填补了本不存在的漏洞,让更多的人动起了脑筋。在论坛上,每次贴出这个问题,总会引起一大群人的口水战。但很不幸的是,这个题目的来源至今仍是个谜。据目前的已知情况推测,这个题目最早来源于 Berkeley 的电气工程荣誉学会,时间大概是 2001 年。在 2002 年的 7 月, IBM 的 Ponder This 趣题栏目介绍这个题目,囚犯与灯泡一炮走红,随即遍布网络的各个角落。 2003 年, The Mathematical Intelligencer 杂志上发表了一篇题为 One hundred prisoners and a lightbulb 的论文,也让囚犯们正式引起了数学家们的关注。


    相信这个问题的答案大家已经非常熟悉了,不过这里我想用另一种更玄乎的、更具启发性的方式重新讲述一下答案。
    不妨幻想房间中有一个盒子,盒子里可以容纳一个小球。灯泡亮就表示这个假想的盒子里有一个假想的小球,灯泡不亮就表示这个假想的盒子是空的。因此,用开关控制灯泡就相当于在盒子里放进小球或者取走小球。初始时,每个囚犯手中都有一个小球(当然这个小球也是囚犯们自己意淫出来的)。游戏开始前,囚犯们选择一个代表作为统计者。之后,每次有囚犯进入房间后,如果小球还在他手里,盒子恰恰又是空着的,他就把小球放进去;而统计者的任务就是收集小球——每次进入房间后,看到盒子里有小球就把它拿走。如果某个时刻统计者手中集齐了(包括它自己的) 100 个小球,就说明所有人都进过房间了。

    这个简单而巧妙的协议让人大为折服。然而,对这个问题的讨论并未结束,计算协议完成所需的期望时间、设计期望时间更短的协议,这都是非常有挑战性的问题,虽然它们已经背离了这个问题的初衷——协议的设计。这篇论文里详细总结了著名数学趣题论坛 [wu::forums] 上的牛人们对上述问题的探索。不过,即使回到协议设计的话题上,这个题目也还有戏可唱。
    现在,让我们来考虑这个问题的一个加强版。上述策略能成功的原因是,大家都知道房间里的灯泡一开始是不亮的(盒子里一开始没有小球)。如果灯泡的初始状态并不确定,那就麻烦了:统计者收集了 100 个小球并不足以说明所有人都来过房间,而他有可能永远也等不到第 101 个小球。那么,这个问题还有解吗?在继续想下去之前,你不妨先思考一下。

 
    是的,这个问题仍然有解,而且办法和原来几乎一样,只是有一些非常巧妙的变通。此时,“小球模型”开始发挥作用了:在引入了一些更加复杂的因素后,比起开灯关灯,用“小球语言”来描述显得更直观易懂。
    囚犯们仍然选出一个统计者,由他来完成收集小球的任务。只不过这一次,每个囚犯初始时都有两个(假想的)小球。每个囚犯来到房间后,如果发现盒子是空的,手中正好还有小球的话,他就在盒子里放一个小球。统计者仍然只负责把小球从盒子里取出来。什么时候统计者收集到了200个小球(包括自己的两个),他就知道所有人都来过了,因为如果还有人没进房间,他最多只能拿到 198 + 1 个小球。注意,这 200 个小球可能就是囚犯手中的 200 个小球,也有可能是囚犯手中的 199 个小球加上初始时房间里的小球。体会一下这个协议如何巧妙地解决了房间初始状态不确定的难题,真是越想越有味道。

    还不过瘾吗?现在与大家分享一个更强的加强版。
    在以上协议中,只有一个人能知道所有人都来过房间。是否存在一个协议,使得最终可以产生两个人,他们都知道所有人都进过房间?如果存在这样的协议,给出一个来;如果不存在,证明之。为了方便思考,你可以暂时假设初始时房间的灯泡不亮。
    不要轻易就认定这是不可能的。至少当 n = 2时,这样的协议明显存在!


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image11:07 fishywang: 居然有公司做ps3版的catan...» Twitter / fishywang
fishywang: 居然有公司做ps3版的catan...
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image08:43 fishywang: @fbzhong 我都不听。。。» Twitter / fishywang
fishywang: @fbzhong 我都不听。。。
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image07:33 苏州(南京,上海)流水帐» Big Fish

上周去南京与T公司的程序猿们小聚(名义上是庆祝Mac的女儿满月),于是我就带着某人在去南京之前顺便去苏州玩了一天。

上周四(8.26)一早坐飞机飞上海虹桥,计划是直接去虹桥火车站被高铁。虹桥机场和虹桥火车站虽然是直接连着的,不过因为虹桥机场太新,很多东西都还没修好,但是却又很high的把所有指路牌子都挂出来了,于是经常会出现照着指路的牌子到了一个还没修好的电梯的事情,比如这个:

Liar

而且本来貌似设计的是可以直接从2层连接过去的,但是因为没修好,目前只能从B1过去,不过即使是B1看起来也还是很震撼的:

Hongqiao Station

然后跟着指示牌找售票处,发现所有的窗口都没开,但是旁边有两排自动售票机:

Train ticket machine

这个售票机很高级,要是你不小心选了个上海站始发的车,还会给你提示:

Train ticket machine

然后就买了两张票,光荣的被高铁。这个机器可以吃100的纸币,吐50元、5元的纸币和1元的硬币:

train ticket

因为中午没有车(难道开火车的中午也要休息吃饭么。。。),于是只好买了下午2点的,中午只能在虹桥站吃饭发呆玩PSP。。。

好不容易混到时间,上车,半小时后抵达苏州。

苏州火车站跟虹桥一样,到处都在修,某人说看起来就像一个巨大的卖拉面的亭子。。。我们由于不想排巨长的队打车,于是走出火车站想在外面打,结果发现外面这条路全线禁停且包括出租车上下客。。。于是走了N远才到垂直的路上打到车,那天的太阳还巨毒,真是悲剧。

我订的是如家阊门山塘街店(后来知道那个字读"chang1"),地址在西中市XX号,这就出现3个地名了,于是跟司机说要去的地方的时候非常的费劲。。。在费了好大劲终于让司机明白我们要去的地方在哪儿后,他说,那地方单行去不了。。。最后把我们放在了附近的一个桥上,然后步行过去,不过很近就是了。

好不容易安顿下来,都快到晚饭时间了。我们研究了一下决定去观前街步行街逛逛顺便吃晚饭,于是就从酒店出发。出发的时候照了一下如家这个古色古香的院子:

Homeinn courtyard

出门看到有卖可丽饼的,于是买了两个,边走边吃:

Creez Crepe

路上看到了一个很拉风的公交车站,不过后来发现貌似老城区所有的公交车站都长这样:

Bus station

走了半个多小时终于走到了观前街。这家如家的好处就是到哪儿都是差不多半小时的步行距离。到了石路我们先研究了一下附近的馆子,本来决定要吃一家连锁馄饨店的,结果悲剧的下暴雨了。。。于是只好就近进了一家小吃店。这家店有个很拉风的名字,叫“好人民间小吃”,坐下后服务员会问候你“欢迎好人”,走的时候会说“好人慢走”。总之就是吃一顿饭被发卡无数。。。

Good man card

不过这家店的味道一般,不太推荐。吃完后雨也小了,就继续逛步行街,逛完步行街后又痛苦的等了几十分钟,才终于打到出租车回酒店。

第二天一早起来,在几个园林中选择了留园。出门往西走,进了一家叫奥灶面的面馆吃早饭。这家的面10块钱左右一碗,有大块的肉和好喝的汤,面条也是比较筋斗的细面条,总之就是超级的好吃。

本来我们是打算提前买去南京的火车票,结果在一堆人的指路下发现传说中的售票点越来越远越来越不靠谱,只好放弃开始打车。又是等了半天没打到车,最后只好坐上了一辆人力三轮车:

Bike rider

路上蹬车师傅说他那里有团体票可以按照普通票的价格卖给我们,这样他赚差价我们省车费,双赢。于是成交,我们省了5元车费,他多赚了3元的门票差价。

进园先是看到了层层的窗子:

Windows

然后是俩人在演奏评弹:

Ballad singing

这个园子就是围着中间的一池荷叶的一圈建筑,这就是中间的荷叶:

Lotus

当然除了建筑外还有盆栽:

Plant

和石头:

Huge rock

据旁边的某个团的导游说,这个石头还是排得上号的超大石头。

这个石头旁边还有个小池子,里面除了有荷花和雨外,还有只小乌龟在游来游去!

Turtle

再接着往前走,有个美女在弹古筝:

Guzheng

以及一条颜色很鲜艳,调了下饱和度后就很像油画的小木船:

Boat

最后是有人唱戏,唱的好像是《游园惊梦》:

Opera

然后出园,打车回酒店。路上看到了我们头天晚上本来想吃的那家连锁馄饨店,于是进去吃午饭,结果虽然很便宜(两个人一共只花了10块钱),味道却是一般。

退房后打车去火车站,发现出租车停在了火车站的二楼,这里貌似上下客没人管,所以各位坐车到苏州的出站的时候可以考虑去二楼打车。

不过还是得下到一楼去买票,悲剧的是晚上6点之前的所有去南京的一等座、二等座和站票都卖完了!于是我只好买了两张最近的车的特等座,每张190大元。

又在候车厅百无聊赖的等了一个小时,终于坐上了去南京的火车。传说中的特等座就是一车厢最顶头的一个小房间,没几个座位,也没啥很特别的服务,就是贵而已。。。

到了南京后与各位程序猿会合,然后我去新街口桔子酒店check-in后大家去打台球吃饭,最后大家集体前往雪总豪宅参观、打游戏、等等等。。。我顺便拿到了雪总帮我从台湾带的星际2——的盒子(因为实际上我之前就要他把我的号发给我玩上了):

Star Craft 2

然后到了12点左右,雪总开车送我们回酒店,顺便买猪蹄和接接客老师。其它人继续在他家玩游戏/打地铺。

第三天睡到中午起来,一起去吃午饭和给Mac的小女儿买了个婴儿推车作为礼物。然后大家一起到了Mac家看望了他的女儿并合影,于是名义上的任务就完成了,接下来大家可以肆无忌惮的玩了。一群人又浩浩荡荡的开进城吃完饭和K歌,结束后又集体跑去原T公司后面的小巷吃串和买猪蹄。然后我们回酒店,其他人继续打游戏和打地铺。。。

最后一天中午起床退房后雪总把我们接到他家,吃过午饭后教主带着几个教众先撤,剩下的人继续打游戏。最后雪总开车把最后几个人送到了火车站/飞机场,于是大家开开心心的回家,结束江南美好旅程。

最后感谢地主雪总的辛苦款待!

btw1: 苏州的更多照片在flickr上

btw2: 南京的桔子酒店还不错,可以参考这个对北京桔子酒店的介绍和评价

btw3: 关于众人打的游戏,可以参考这些tweet


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image05:36 fishywang: amazon.com上卖的Big Fish BD居然有中文、韩文和泰文字幕。。。» Twitter / fishywang
fishywang: amazon.com上卖的Big Fish BD居然有中文、韩文和泰文字幕。。。
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image04:38 fishywang: 煎了个牛排,炒了个小白菜,土洋结合吃晚餐。。。» Twitter / fishywang
fishywang: 煎了个牛排,炒了个小白菜,土洋结合吃晚餐。。。
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image04:37 fishywang: @xydonkey 普通,37%» Twitter / fishywang
fishywang: @xydonkey 普通,37%
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.04:25 动物的冷幽默四则科学松鼠会» fishy's shared items in Google Reader

1.蜉蝣

原文
原作: GJCaulkins 汉化:游识猷
clip_image001

2.鲑鱼

原文
原作: GJCaulkins 汉化:游识猷
clip_image002

3.苍蝇

原文
原作: GJCaulkins 汉化:游识猷
clip_image003

4.蝙蝠

原文
原作: GJCaulkins 汉化:游识猷
clip_image004

本文地址(转载请注明出处): 复制
收藏、分享这篇文章: 豆瓣 新浪微博 人人网 开心网 QQ空间 qq书签 人民微博 GOOGLE书签 MySpace 百度搜藏 鲜果       更多...


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image03:12 fishywang: SC2剧情战役通关,不过最后一关降了难度。。。» Twitter / fishywang
fishywang: SC2剧情战役通关,不过最后一关降了难度。。。
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image01:23 fishywang: Flickr's new UI really saved me a lot of time for blogging.» Twitter / fishywang
fishywang: Flickr's new UI really saved me a lot of time for blogging.
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.01:05 终极YY神器——泡泡过滤器(36P)掘图志» fishy's shared items in Google Reader

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

终极YY神器——泡泡过滤器

已有 11 人发表评论,猛击这里参与讨论。使用阅读器看不到视频的同学请点击这里
© 2007-2010 掘图志 | 订阅 | 本文链接 | 投稿 | twitter | 新浪微博 | 乐果冲钻特价
使用 feeds.juetuzhi.cn 订阅本博客的同学麻烦更新订阅地址为 feeds.juetuzhi.net, 给您带来的不便请谅解。
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.01:05 『娱乐』敢死队:沦为生意的回忆阅读 · 良品杂志» fishy's shared items in Google Reader
       史泰龙、布鲁斯·威利斯、施瓦辛格、李连杰……他们的名字串起了上世纪八九十年代动作片的辉煌。如今,老男人们再次聚首,在“队长”史泰龙的带领下重战沙场,纷纷赤膊上阵,在巴西的丛林里大秀身手,以血肉真身炸出了一部动作片。在这几位老男人气喘吁吁又跌跌撞撞的奔跑中,那句台词怎么说的,“兰博,你不是牺牲品。”(Rambo, you’re not expendable.)

几个老男人撑起一台戏

       故事从一群雇佣兵在海盗船上解救人质开始,几挺机枪“啪啪啪”先把你的视力扫晕,再执行下一个更加艰难的任务。在一张以欺骗和贪婪交织的大网中,史老师发现了象征希望与良知的美女。在文身艺术家米基·洛克老师的两行清泪里,史老师领悟了“救美女—获救赎—得永生”的人生真谛。在几乎用炸药毁了整个小岛后,老师留给美女250万美元的银行卡重建家园。一个拥抱后飘然离去……

       自打史泰龙会算命的老妈算出自己儿子发迹于文字工作,史老师就开始学写剧本,一发不可收拾地写了洛奇系列、兰博系列……当然也包括这部《敢死队》。史老师长期合作的制片人凯文·金·坦普尔顿说:“史泰龙一直强调剧本必须要有血有肉。这是他教会我的东西。如果没有灵魂,就没有好故事,更不会有好电影。对史泰龙来说,编剧可不只是编个故事。如果说过去史泰龙的电影作品里动作和故事的比重各占一半的话,那么在《敢死队》里,故事几乎占据了一切。”

       坦普尔顿的话当然有水分。要不然习惯演独角戏的史老师怎么拉来一群老男人帮他分担戏份?看着他从浮动木板码头一路狂奔冲向飞机的那场戏,我的心都要碎了。史老的蹦蹦跳跳没有轻盈和速度,有的只是老骥伏枥的气喘吁吁。情急之下,纵身一跃,顺势抓住上升的飞机,飞机刮起每小时30-40公里的风,史老师被吹成了一条和水面平行的线。64岁的史泰龙完全明白单靠码头冲刺跳飞机、炸掉一座小岛不足够撑起一部动作片。虽说他已经心有余力不足,但片子里有的是其他男人。杰森·斯坦森担当起掀起高潮的重任——37岁的斯坦森小弟站在飞机机头改出的小隔间里,用一挺机枪扫射敌人。同样是天空地面的打斗场景,《天龙特工队》玩的是坦克打飞机的创意,《敢死队》耍的是男人扮酷的宝,前者靠特效,后者靠演员表演。

       在连续的、串起整部片子时长的几次追击里,有一场影迷们翘首以盼的历史性会晤。幕后老大哥布鲁斯·威利斯准备把任务卖给雇佣兵,两方买家是史泰龙和施瓦辛格。镜头定格瞬间就足够让影迷们屏住呼吸,要知道这三位动作片大哥此前从未同时出现在一部片子里!

       为了史老,施瓦辛格和布鲁斯·威利斯特地调配了自己的时间。虽说片子最后呈现出的只有三巨头短短会晤的5分钟,表演上也尽是耍耍嘴皮子的口水戏,谁能否认动作电影界的“丘吉尔”、“斯大林”、“罗斯福”站在1平方米内不是件激动人心的事?看着穿着西装渐行渐远的施瓦辛格的背影,影院里的观众们都不自觉地冒出一句:“I’m back!”史老师为这个日渐福态的身影写了如下台词:“他疯了吗?”“是的,他打算将来当总统。”

沦为生意的回忆

       除了这场著名的三巨头会晤大戏,聚集了几乎所有动作片标杆式人物的《敢死队》本身就是一场老男人聚会。制片人坦普尔顿说:“以前我以为只有阿诺德·施瓦辛格会做出这种事,没想到史泰龙居然会这么做。此前已经有很多采用这种模式拍的电影——去南美洲的一座小岛推翻那里的独裁政权。但史泰龙坚持要尽其所能挑选最佳阵容创作一部巨作。我认为他做到了。杰森·斯坦森是现在当红的动作明星,加上亚洲最知名的功夫巨星李连杰,以及大家熟知的大牌演员埃里克·罗伯茨和米基·洛克。”

       厌倦了电脑特效、3D、白面小生……大块肌肉、真枪实弹、硬拳头打斗的表演是动作片的回归。“追求这种传统让我们受了很多的伤,但这向没有能力做电脑特技的人提供一种值得借鉴的方法,这就是所谓的传统。这就像一种循坏,我们让演员用自己的技术和绝活完成拍摄,避免成为现代科技的奴隶。这非常重要。”史泰龙说。

       老男人们站在一起,观众纷纷掏钱买票。《敢死队》上映第一周便登顶北美票房冠军,票房上,一群老男人以他们的胜利证明动作片最硬的底气不是性感的8块腹肌、火爆的场景甚至是巧妙的桥段,而是观众们的回忆。“这部影片的确在国际上和美国国内都引起了很大的关注,我希望它的票房能够超过一亿美元。这样我们就能发财了。”这是另一位制片人艾威·勒纳的大实话。说到底,对电影工业来说,回忆或是桥段都是一桩生意。

『周末画报』 撰文 钟蓓

良品周刊·平媒精选文章由现代传播 旗下媒体提供,你可以在这里阅读到《周末画报》、《新视线》、《生活》等诸多杂志的经典文章,支持RSS订阅Email订阅 ,亦可通过Google Reader鲜果QQ阅读有道  等在线阅读器获取,或在MSN直接订阅


特别推荐:iPhone用家可以在『周末画报·iWeekly』中阅读到更多精彩专栏文章

从现在起,你也可以关注良品豆瓣小组
                     以及良品新浪微博


Tags - , ,

add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image00:40 fishywang: nice nose http://flic.kr/p/8xWjvR» Twitter / fishywang
fishywang: nice nose http://flic.kr/p/8xWjvR
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Fri 03 September, 2010

Click here to bookmark this link.23:43 足不出户:手机上移动银行远程兑现支票爱范儿: 拇指资讯小众讨论» fishy's shared items in Google Reader

网络银行在十几年前就出现了。用户可以登录银行网站查看帐户信息,转帐,支付帐单,开设户头,几乎一切需要去银行的操作在网络上都可以实现,除了存钱取钱兑现支票之类需要亲自到场的操作。随着智能手机的普及,越来越多的银行也开发了手机应用,让用户们随时随地可以查看帐号信息等等。差不多两年前,美国中西部一家小银行率先推出使用 iPhone 应用远程兑现支票服务,一时受到大众热捧。不过由于银行太小,没有遍布全美的 ATM,所以开户的用户并不多。

最近,美帝的大银行大通(Chase)也推出了类似的服务。笔者曾经短暂的有过 Chase 银行帐号,由于他们服务质量过差而取消掉了。这次为了试试这个很潮的远程支票兑现服务,特地去开通了一个帐号尝鲜:)这个服务是每天每张支票金额不能超过 1000 美刀。所以为了试验,好不容易等到一张 800 刀的支票,嗯,开始折腾:

先去 App Store 下个免费的 Chase Banking app,有效支票一张。

首先是登录,通过 HTTPS 链接,数据加密后传输到服务器上(比起国内银行网站永无止境的插件安装,仅IE6支持,银行指定 USB 安全钥匙,再加上 N 次重启~~~ 崩溃~~~~)

第三个“Deposits”的按键就是远程支票兑现的功能界面了。选择了一个帐号,然后输入金额。下面是需要拍两张照片:支票正面和背面(带有签名的):

拍摄完支票正面和背面照片后,Next 按键就变成了绿色,按下去就开始处理信息了:

图片上传到 Chase 服务器后,他们应该是采用 OCR(Optical Character Recognition)技术来识别图片里的数字。支票上最重要的信息是支票帐号号码,支票转帐号码,和支票的金额。这个技术很成熟了,不过现在结合手机和网络,在一个意想不到的领域发挥了作用。可见,科技就是第一生产力。

如果图片不够清楚,会提示你拍摄更清晰的照片,再试一次:

一切顺利的话,服务器返回信息会列出 OCR 识别的结果(支票帐号信息和金额,信息敏感,这里图片就省略了)确认后这张支票就已经存到帐号里了。手头的支票保存 7 天,确定没有问题后就销毁:)

这是个非常实用的功能,省了用户跑银行,也省了银行员工的工作量,节约了传统兑现支票过程中所浪费的纸张,而且这个功能是全天 24 小时开放(貌似有国内国企网站晚上关闭,只在营业时间开放,非常的让人 Orz)

科技的发展,就是为了让人更好的生活,省下时间来做更重要的事情。既然可以在手机上实现远程支票兑现,那接下来是不是可以尝试用手机来存钱和取钱呢?(有点囧。。。但不是不可能。。。)

Follow follow @lordhong@lordhongfollow @lordhong@lordhong,转载请注明 ifanr 原文链接 → 论坛讨论


© lordhong for 爱范儿: 拇指资讯小众讨论, 2010. | Permalink | 14 comments | Add to del.icio.us
Post tags: , ,


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image23:09 Testing my new tripod» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

Testing my new tripod

with Olympus E-P1 and Olympus 14-42mm F3.5-5.6 lens


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.22:32 施一公、饶毅的《科学》杂志社论阮一峰的网络日志» fishy's shared items in Google Reader

这样级别的人出来讲真话,还是很震撼的。

======================================

China's Research Culture

中国的科研环境

Science 3 September 2010:
Vol. 329. no. 5996, p. 1128

Yigong Shi1, Yi Rao2,

施一公,饶毅

1. Yigong Shi is a professor and dean of the School of Life Sciences at Tsinghua University, Beijing, China. E-mail: shi-lab@tsinghua.edu.cn

2. Yi Rao is a professor and dean of the School of Life Sciences at Peking University, Beijing, China. E-mail: yrao@pku.edu.cn

【摘要】

施一公是清华大学生命科学学院教授、院长,饶毅是北京大学生命科学学院教授、院长。

近日,两位科学家联合撰文,讨论目前中国的科研基金分配体制及科研文化问题。他们在文章中指出,尽管近年来中国研究经费持续以20%的比例增长,但这种增长没有对中国的科学和研究起到应有的强大的促进作用,现行的科研基金分配体制甚至在某种程度上阻碍了中国创新能力的发展。

他们认为,目前正是中国打破研究基金管理中各种潜规则、建立健康研究文化的时机,一个简单但重要的起点是所有新的研究基金必须基于学术优劣分配,而不再依赖私人关系。

----摘自《科学时报》9月3日的报道

【正文】

(以下采用《科学时报》的译文)

Government research funds in China have been growing at an annual rate of more than 20%, exceeding even the expectations of China's most enthusiastic scientists.

中国政府投入的研究经费以每年超过20%的比例增加,甚至超过了中国最乐观的科学家们的预期。

In theory, this could allow China to make truly outstanding progress in science and research, complementing the nation's economic success.

从理论上讲,它应该能让中国在科学和研究领域取得真正突出的进步、与国家的经济成功相辅相成。

In reality, however, rampant problems in research funding--some attributable to the system and others cultural--are slowing down China's potential pace of innovation.

而现实中,研究经费分配的严重问题却减缓了中国潜在的创新步伐。这些问题部分归结于体制,部分归结于文化。

Although scientific merit may still be the key to the success of smaller research grants, such as those from China's National Natural Science Foundation, it is much less relevant for the megaproject grants from various government funding agencies, which range from tens to hundreds of millions of Chinese yuan (7 yuan equals approximately 1 U.S. dollar).

尽管对于一些比如由中国国家自然科学基金委员会资助的小型研究经费来说,科学优劣可能仍然是能否获得经费的关键因素,但是,对来自政府各部门的巨型项目来说,科学优劣的相关性就小多了,这些项目的经费从几千万元到几亿元人民币。

For the latter, the key is the application guidelines that are issued each year to specify research areas and projects.

对后者而言,关键问题在于每年针对特定研究领域和项目颁发的申请指南。

Their ostensible purpose is to outline "national needs." But the guidelines are often so narrowly described that they leave little doubt that the "needs" are anything but national; instead, the intended recipients are obvious.

表面上,这些指南的目的是勾画"国家重大需求";然而,项目的申请指南却常常被具体而狭隘地描述,人们基本上可以毫无悬念地意识到这些"需求"并非国家真正所需;经费预定给谁基本一目了然。

Committees appointed by bureaucrats in the funding agencies determine these annual guidelines. For obvious reasons, the chairs of the committees often listen to and usually cooperate with the bureaucrats.

政府官员任命的专家委员会负责编写年度申请指南。因为显而易见的原因,专家委员会的主席们常听从官员们的意见,并与他们合作。

"Expert opinions" simply reflect a mutual understanding between a very small group of bureaucrats and their favorite scientists.

所谓"专家意见"不过反映了很小部分官员及其赏识的科学家之间的相互理解。

This top-down approach stifles innovation and makes clear to everyone that the connections with bureaucrats and a few powerful scientists are paramount, dictating the entire process of guideline preparation.

这种自上而下的方式不仅压抑了创新,也让每个人都很清楚:与个别官员和少数强势科学家搞好关系才最重要,因为他们主宰了经费申请指南制定的全过程。

To obtain major grants in China, it is an open secret that doing good research is not as important as schmoozing with powerful bureaucrats and their favorite experts.

在中国,为了获得重大项目,一个公开的秘密是:作好的研究不如与官员和他们赏识的专家拉关系重要。

This problematic funding system is frequently ridiculed by the majority of Chinese researchers. And yet it is also, paradoxically, accepted by most of them.

中国大多数研究人员常嘲讽这种有缺陷的基金分配体制。然而,一个自相矛盾的现象是,他们中的绝大多数人却也接受了它。

Some believe that there is no choice but to accept these conventions. This culture even permeates the minds of those who are new returnees from abroad; they quickly adapt to the local environment and perpetuate the unhealthy culture.

部分人认为除了接受这些惯例之外别无选择。这种潜规则文化甚至渗透到那些刚从海外回国学者的意识中:他们很快适应局部环境,并传承和发扬不健康的文化。

A significant proportion of researchers in China spend too much time on building connections and not enough time attending seminars, discussing science, doing research, or training students (instead, using them as laborers in their laboratories).

在中国,相当比率的研究人员花了过多精力拉关系,却没有足够时间参加学术会议、讨论学术问题、作研究或培养学生(甚至不乏将学生当做廉价劳力)。

Most are too busy to be found in their own institutions. Some become part of the problem: They use connections to judge grant applicants and undervalue scientific merit.

很多人因为太忙而在原单位不见其踪影。有些人本身已成为这种问题的一部分:他们更多地是基于关系,而非学术优劣来评审经费申请者。

There is no need to spell out the ethical code for scientific research and grants management, as most of the power brokers in Chinese research were educated in industrialized countries.

无须陈述科学研究和经费管理中的伦理规章,因为绝大多数中国研究界的权势人物都在工业化国家接受过教育。

But overhauling the system will be no easy task.

然而,全面改变这一体制并非易事。

Those favored by the existing system resist meaningful reform. Some who oppose the unhealthy culture choose to be silent for fear of losing future grant opportunities. Others who want change take the attitude of "wait and see," rather than risk a losing battle.

现行体制的既得利益者拒绝真正意义上的改革;部分反对不健康文化的人,因为害怕失去未来获得基金的机会,选择了沉默;其他希望有所改变的人们则持"等待和观望"的态度,而不愿承担改革可能失败的风险。

Despite the roadblocks, those shaping science policy and those working at the bench clearly recognize the problems with China's current research culture: It wastes resources, corrupts the spirit, and stymies innovation.

尽管路途障碍重重,科学政策制定者和一线科学家们都已清楚地意识到中国目前科研文化中的问题。它浪费资源、腐蚀精神、阻碍创新。

The time for China to build a healthy research culture is now, riding the momentum of increasing funding and a growing strong will to break away from damaging conventions.

借助于研究经费增长的态势和日益强烈的打破有害成规的意愿,现在正是中国建设健康科研文化的时刻。

A simple but important start would be to distribute all of the new funds based on merit, without regard to connections.

一个简单但重要的起点是基于学术优劣,而不是靠关系,来分配所有的新基金。

Over time, this new culture could and should become the major pillar of a system that nurtures, rather than squanders, the innovative potential of China.

随着时间的流逝,这种新文化能够而且应该成为一种新系统的顶梁柱,它将培育而不再浪费中国的创新潜力。

(完)


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.22:32 Duke Nukem Forever preview: Yeah, it's actually playable. No, really.Joystiq» fishy's shared items in Google Reader
After what is arguably the longest, most troubled development in the history of video games, Duke Nukem Forever is finally, really, truly here. It's not being shown secretly, behind-closed-doors at some industry event. Instead, it's at PAX, an event that is, more than any other in this industry, consumer facing, and that tangibility is a big part of Gearbox's reveal.

Wait, who? Gearbox Software, the Texas-based dev who's helping to bring 3D Realms' pre-Google (think about it!) labor of love to consoles, is behind this revival along with publisher 2K Games. "This is a game you can't make promises about," Gearbox prez Randy Pitchford told an audience of incredulous gamers this morning. "Haven't we not been teased enough? We don't want to tease. We just thought we'd bring it to PAX." And Gearbox didn't just bring a trailer - although it did bring one of those - but more importantly, there's about 15 minutes of playable game. Let that sink in for a while.

While we weren't able to grab video of the trailer - you'll have to settle for my account - Pitchford did say that people could take pics. Actually, he said, "You've got cameras. You've got cellphones with cameras on them. Take all the pictures you want [...] We'll even take the pictures for you." You know, when Duke Nukem Forever was first announced, I didn't have a cellphone yet ... and the idea of a cellphone with a camera on it? Madness.

Continue reading Duke Nukem Forever preview: Yeah, it's actually playable. No, really.

JoystiqDuke Nukem Forever preview: Yeah, it's actually playable. No, really. originally appeared on Joystiq on Fri, 03 Sep 2010 16:15:00 EST. Please see our terms for use of feeds.

Permalink | Email this | Comments
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.22:32 Duke Nukem Forever footage: Press Right Trigger to urinateJoystiq» fishy's shared items in Google Reader
2K Games hosted a video livestream of its booth shortly after the re-announcement (or is it un-cancellation?) of Duke Nukem Forever, showing off a few fans getting their first shot at the alien-murdering sim. You can check out a couple of over-the-shoulder gameplay clips from this stream posted just after the jump.

And, yes, it is worth noting that this particular demo begins with Duke Nukem relieving himself, an action you apparently execute by pressing Right Trigger. You're going to feel tempted to press Left Trigger, but for the sweet love of God, you have to resist that urge.

Continue reading Duke Nukem Forever footage: Press Right Trigger to urinate

JoystiqDuke Nukem Forever footage: Press Right Trigger to urinate originally appeared on Joystiq on Fri, 03 Sep 2010 14:00:00 EST. Please see our terms for use of feeds.

Permalink | Email this | Comments
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image19:56 fishywang: RT @soulhacker: 给所有对iTunes 10的竖排控制按钮无法忍受滴人:「defaults write com.apple.iTunes full-window -1」 记得先退出iTunes再运行» Twitter / fishywang
fishywang: RT @soulhacker: 给所有对iTunes 10的竖排控制按钮无法忍受滴人:「defaults write com.apple.iTunes full-window -1」 记得先退出iTunes再运行
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.12:01 消费者的消费观酷壳 - CoolShell.cn» fishy's shared items in Google Reader

原文:http://theoatmeal.com/blog/apps

How I feel about buying apps

星巴克:这是你的venti-soy-whipped-frappa-lardy-lattechino,也就$7.15,你需要加点糖吗?只需要再加$1.95。

消费者:绝对要加。让我们的血糖值高到月亮上!

How I feel about buying apps

票房:先生,想看“断背3D吗”?一张票只要$13!

消费者:没问题!另外,有优惠吗?我想花$20再买点爆米花和碳酸饮料。

How I feel about buying apps

Apple:新的iPhone 4G,加上税要$425.19

消费者:只要$425?!这仅相当于我老婆把背上的毛给去掉价格的1/10!拿钱!花这点钱连想不用想。

How I feel about buying apps

Apple:iPad 3GS 加一个保护盒,一共$875.24

消费者:$875?这就些?啊,我要两个,一个给我,一个给我身边这个有毛的朋友。

How I feel about buying apps

网站:下载应用:HorseHunter Extreme!点击OK确认你想花$0.99买这个应用。

消费者:什么?什么?什么?!99美分?!靠,我不知道……这么多钱啊!我应该把我的会技师找来,或是明天再说吧。

(完)

相关文章


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.12:01 You Call This A Circle of Life?!Cute Overload» fishy's shared items in Google Reader

“… and so, Simba, the gazelles eat the grass, and then we eat the gazelles, and then we poop out the gazelles and they go back into the grass. And then a baboon smears Welch’s Grape Jelly on your forehead and that’s how you become king…”

That’s a song cue if ever I heard one, Andy R.


Filed under: Uncategorized Tagged: Kittens
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.03:22 世博奇观,丢尽中国脸--独角兽资讯www.unicornblog.cn» fishy's shared items in Google Reader
世博奇观,丢尽中国脸
 独角兽资讯 发表于 2010-9-3 13:13:00
 

南方周末本期世博专稿《HIGH过之后,优雅起来,世博开启国民素质成人礼》初稿,原文已被删改。

这篇稿子历经七次修改,数次送审,最后出来的稿子已经与原文完全不同,所有批评世博会的内容悉数删除。

世博固然是一场盛会,但它只是一个国家成长历程中的一个节点,我们记录这期间发生的尴尬,并不心怀恶意。

所谓的“文明”从来指的不是老百姓是不是随地吐痰、大小便,而应是生活在其间的公民如 何自主地改造生活,如何生活得更加从容、克制、理性而有尊严。

探讨文明现象,不代表我们用柏杨式的文章对国人“横加”指责,我们更愿意由此展开对一 个城市乃至一个国家治理方法论的探讨。

直面尴尬,心怀美好,改变随时随刻可以开始。

作者:陈鸣、实习生 刘高阳

 上海世博会,又一个属于中国的时间。在展现城市文明的同时,这 个横跨浦江两岸的巨大园区本身就是一个存在184天的微型城市。游客将与现代场馆共同构成这次展示。

“城市让生活更美 好”,然而,行走在这个临时城市里的游客却正在让这个系统濒临崩溃。

失控的“热情”

在经历了最初的好奇之后,很多外国场馆工作人员对中国的好感被冲刷殆尽。

       两个月前,阿娜斯塔西亚(Anastasia Yevets)对上海世博会充满了期待,而如今,她的心情却比上海连绵的梅雨更加糟糕。

      这个来自白俄罗斯的姑娘和她的同事们正在目睹一场“灾难”的发生——他们的场馆越来越像一个动物园。中国游客们在场馆里大声喧哗,接打电话,拿起相机对 着每一个金发碧眼的老外狂拍。“有时候,中国人一手猛拍着桌子,一边对你喊着嘿!嘿!嘿!他们想喊我合影,却让我觉得自己像只被围观的猩猩。”最令阿娜斯 塔西亚难以置信的是,几天前,一位中国老太太甚至放任她的孙子在场馆的正中央拉了一坨大便。

      处于震惊和崩溃边缘的并不仅仅是阿娜斯塔西亚。

      在古巴馆,Shela Borges Glez见到了令她不解的一幕。一开始,她们在墙上划出一小块区域供游客留言,但是,只用了两天不到的时候,汉字 就像蝗虫一般疯狂地覆盖了整个场馆的墙壁。中国游客的热情程度显然令这些加勒比海居民猝不及防,甚至连Shela的办公室都不能幸免,在玻璃门上,中国人 写满了“XX到此一游”和“XX我爱你”之类的字样。在数次清理之后,Shela和她的同事放弃了努力,每次擦完不久,中国人又将攻占他们的玻璃。他们只 好贴出“禁止往墙上涂画”的告示,以这样的形式为自己一开始的错误决定埋单。

       世博园里发生的这一切,就上海的雨季一样,无休无止,令人心生厌倦。

      埃及馆的Tahany刚刚从开罗飞到上海来接替她同事 的工作,那位好心的前任馆长提醒她“一定要看好我们的石头!”场馆里摆的雕像都是公元1000多年前的文物,其中包括有“阿蒙霍特普四世的巨像”和“爱神柱”之类的珍品。

       这些从开罗运送过来展品大部分没有加装防护罩,“因为在我们国家没有人会去摸文物,因为那是一种犯罪行为”,但很快,埃及馆的大部分工作人员不得不放弃原先安排的工作,他们每两个人守着一处雕像,并拉上围栏,阻止每一只靠近的手掌。一个中方工作人员告诉南方周末记者,埃及人迅速地学会的第一句汉语不是“你 好”,而是“不要摸”,每天念咒般地重复上百遍。

       在捷克馆,游客们一度像苏联红军攻占柏林德国国会大厦一样纷纷爬上圣约翰·波穆克的青铜像,直到铜像被护栏围了起来。在孟加拉馆盖章,一位黑人工作人员面 色冷竣,机器人一般地只重复说一句话:“排队,排队,排队,排队……”。

       在经历了最初的好奇之后,很多外国场馆工作人员对中国的好感被冲刷殆尽。

      “他们刚到上海的时候,看到那些宏伟奇特的展馆,都是‘Wow’的惊叹,觉得中国人很了不起,而在见识了中国游客之后,所有人都开始讨厌中国人。”和那 些面对人山人海的中国不知所措的朋友们不同,阿娜斯塔西亚算是半个“中国通”,她有一个中文名字叫做“梅芳”。然而在学习汉语三年以后,她突然发现不知该 如何向自己的朋友解释这样一个复杂的中国。

       在梅芳的朋友里,很少有人像她一样游历过中国贫穷的乡村和小城镇,更不用提理解眼前这些操着各类不同口音的人做出种种“失礼”举动的原因所在。“我经常告 诉朋友们,不是所有中国人都是这样。”

       但即使是梅芳,也很快失去了耐心,她的眼睛在无数次突如其来的闪光灯照射后开始干涩胀痛,有一天因为制止游客插队,一个中国男子用地图狠狠地拍打了梅芳的 手臂,这次袭击让她委屈得哭了起来。在中国小孩在场馆中央大便之后,白俄罗斯馆终于用巨大的围栏把中央的圆形场地围了起来。

 守不住的场馆

 作弊与反作弊,破坏与反破坏,偷盗与反偷盗,成了一场每日上演的拉锯战。

       当“梅芳们”在场馆里焦头烂额的时候,蔡雯俊和她的同伴们也在人潮中努力站稳。她来自华东政法大学,是世博文化中心的一名志愿者。很多时候她被调配到北门疏导人流,在这个出口,人群被分成两队,一队通往六楼参观,一队则直接出馆,两个队伍中间用隔离带隔开。很多时候隔离带和志愿者的引导被视若无睹,只有在 发现走错了之后游人才返过来要求志愿者让他们原路进馆。“他们既想不受控制地乱走,又丝毫不愿承担走错的后果。”

      连不明国情的外国工作人员也很快明白,“过度热情”已经无法解释眼前发生的一切。除了不讲礼貌和规则,更多千奇百怪的状况从第一天开始,从场馆的入口处,就层出不穷——一位法国馆的工作人员告诉记者,最初的几天他们像目睹奇迹一样,看着那些从绿色通道坐轮椅进入的游客一进馆就纷纷站立起来行走。

       破坏规则的好处显然十分诱人——当别人还在排两三个小时甚至更长时间的队时,绿色通道上的人员却可以在二十分钟内进馆,而且还能捎进一个“护理人员”。在 一些场馆门外至今可以看到为数甚众、真假莫辨的残疾人排起长队。

       “有一次,一个有着强壮肱二头肌的中年男子坐在轮椅上,很疼似的紧紧握住自己的手臂,却告诉我们他患的是小儿麻痹症。”一个在沙特馆门口协助维持秩序的志 愿者说。一些明显已经接近10岁的孩子被父母安排坐进了婴儿车,以此换取不排队的特权。

       在经历了最初阶段完全开放的姿态之后,很多场馆开始小心调整收缩他们的策略。所有试图由绿色通道进馆的老人、孩子和残疾人都被要求出示相关的证件,一些明显有作弊行为的游客被挡在通道之外。

       但这只能挡住一部分人,精明的游客们依然能够掏出各类红绿缤纷的证件。有的家庭为了让一家老少都能通过,在场馆门口精心商量着如何分配手头的老年人身份 证、残疾证和婴儿车。这看起来像是一盘跳棋游戏,任务就是一堆棋子搭上另一堆棋子的顺风车,从而跳到场馆的那一边去。

       即使作弊失败,对大多数人来说也没有什么损失,“通常被戳穿了之后游客们还一边大骂工作人员,一边离开,脸上不但没有惭愧,反倒对我们有不通融办事的鄙夷”,一位来自江西科技师范学院的工作人员愤怒地说。

       进入场馆内部之后,游园狂欢才刚刚开始。在捷克馆,一个名为“捷克明珠”的视觉装置吸引了游客围观,这个由5个巨大玻璃面组成立体屏幕璀璨明亮,令观众仿 佛触手可及。开馆之初就不断地有游客用脚磕打玻璃,他们只是想知道屏幕到底是不是玻璃做的。于是一个专门的工作人员被派在此处专门制止人们的破坏行为。

       在摩肩接踵的嘈杂环境里,偷盗与反偷盗,也成了一场每日上演的拉锯战。

       在泰国馆的最后一个参观环节是放映一部3D的电影,场馆内的设施会随着电影场景洒水和喷施香气,显然十分钟的尖叫体验令很多观众沉醉其中,于是,他们决定 趁混乱把3D眼镜捎回家去。

       泰国馆的解说在每场电影结束时都会向游客们恳求:“这个眼镜在家里看电视是不会有3D效果的,我们的眼镜已经越来越少,请您不要拿走。”但结果令人无奈, 泰国馆馆长Saranpat Anumatrajkj向南方周末记者抱怨,馆内的3D眼镜每天以5%-7%的速度丢失,“每放一场电影大约会损失10个, 而我们每天大概会放50多场电影。”

       在中国铁路馆,3D影院的200多个座位如今只能坐100多人,原因是3D眼镜被偷到只剩这么多了。

       香港人似乎对3D眼镜遗失的可能性有更充分的预判,他们直接在眼镜上贴条形码,在场馆出门处设立安检门,任何试图带眼镜离开的人都会引起机器的尖锐叫声。 尽管如此,人们并没有放弃努力,安检门因此每日鸣叫不已。

       比眼镜更小的物品更适合被带走,在波黑馆,狭长走道上的液晶电视上的8GU盘被游人尽数拔光,最后馆方不得不把数据盒藏起来,通过USB线再连接到电视 上。

       也有人尝试更有挑战性的目标,6月27日下午,波黑馆的两名中国游客从严密封闭的玻璃壁橱里成功地偷出几件嵌有珠宝的首饰,没有人知道他们是怎么做到的。 幸运的是另一位游客在离馆前及时地举报了他们。

盖章族的围攻

 “他 们做的就是盖章盖章盖章盖章……”中国人自己打了起来。打斗密集地持续了一两天后就没再发生,因为印章也被偷走了。

        “世博会的主题曲应该是一片笃笃笃的敲章声。”突尼斯馆的Anis Basti调侃道。世博护照,这个起源于1967年蒙特利尔世博会的玩意儿从来没像在中国这么火爆过,这令他根本无法理解。

       围绕世博会赚钱的黄牛们开始提供盖章服务,游客只要在门口等待,黄牛入馆盖章,最后收取一笔数十元的手续费。

       场馆有冷热门之分,而在盖章这一事情上,每个国家的场馆终于实现了“平等”。在只有6个房间的乌拉圭馆,为应对盖章的人流,其中一半房间被改成了盖章专用 房。在泰国馆,铜、木、橡胶等各类材质的印章则被悉数敲坏。

       中国游客的狂热在盖章上终于全面爆发。在丹麦馆,游客为争夺印章而与工作人员发生冲突,这被拍成视频传到了网上。爱尔兰馆的印章被当场抢去,原因是工作人 员拒绝为同一个人盖数十本护照,于是游客决定自己动手,最后爱尔兰工作人员不得不报警。

       拒绝这些长时间排队的中国游客的盖章要求时常要冒一定风险。“死爱尔兰鬼”、“死丹麦鬼”、“死法国佬”……各种口音的咒骂足以令人崩溃。

       Shela所在的古巴馆干脆将盖章台移到场馆外面,并用铁链将章子链了起来。更多场馆把印章收了起来,不再提供盖章服务。在白俄罗斯馆,工作人员同样挂出 了纸牌,上面直截了当地写着“没有章”。“他们做的就是盖章盖章盖章盖章,根本就不看我们的馆”,一位挪威馆的工作人员在面对上海电视台的摄像机时忍不住痛哭。

       泰国的Saranpat告诉记者,盖章的人群不时地与工作人员发生冲突,最后他们干脆把印章放在桌子上让人们自己动手,导致的结果却是更加混乱,中国人自 己竟然也打了起来。打斗密集地持续了两三天后就没再发生,因为印章也被偷走了。

       Saranpat很不理解,他们的场馆设计用很多技术手段设计了逼真的互动体验,依然有很多中国人进来只是盖个章,然后就匆匆寻找出口。

       对这一点中国人看得更清楚,一位经常出入世博园的上海本地记者说:“其实世博会更像一个充满异域风情的游乐园,人们来这里玩耍,心态和旅游没有区别,那些代表现代科技走向的技术既没人懂,更没人看。”

       而“盖章”则不一样,这在中国从来不是一件简单的事,有时候甚至是一种文化。有一次,白俄罗斯馆要送一个平板小推车进园区,最后盖了十多个章才获得批准。 每一次填写表格,都是疲于奔命地在楼上楼下四处寻找那些手握印章的人。

      “这是一个很奇怪的社会系统,所有人在找人办事。在我们国家,一个章就足以通过所有审批。”梅芳无奈地说。

失去尊严的地方

 一群筋疲力尽的排队游客终于情绪失控,他们在场外齐声大喊“纳粹!纳粹!”,以致于德国馆不得不 向园方要来了更多的保安。

        每一天发生的零星不快,并不足以阻止游人的到来,相反,在开园初期遇冷之后,每天游客数量都在节节攀升。每天游览人数已经从最初的每天20几万人上升到现 在的45万人以上。

       顾晓芳是江苏一家国企的员工,6月初她被单位组织前往上海参观世博。在人满为患的沙特阿拉伯馆,她看到很多散客因为长达5个小时的排队时间而瘫坐在地,这 个过程中大人们没有机会上厕所,小孩子们开始随地大小便,有的人开始打牌玩游戏机,更多人无所事事。这样的场景让她想起了恐怖的春运。

       闷热潮湿的上海加剧了人们的烦躁。上个月德国媒体报道,一群筋疲力尽的排队游客终于情绪失控,他们在场外齐声大喊“纳粹!纳粹!”,以致于德国馆不得不向 园方要来了更多的保安。

       顾晓芳认为网络上把园区里出现的种种不文明现象都归结到游客身上并不公平,在她看来,超长的排队使人们失去了尊严。“园区可以修得很大,蛇形栅栏可以设置 得很弯很长,人们的耐心和体力却是有限的。”

       在志愿者蔡雯俊看来,很多时候园区和游客需要共同改进,比如世博文化中心的6楼有几家餐厅,前来就餐的人可以由餐厅人员带领直接上楼,但是很多人并没有途 径可以订餐。蔡雯俊和她的同伴做过尝试,他们试了包括查号台在内的各种方法都没有找到订餐电话。“我们都联系不上的话,游客更不可能了,最后他们肯定就要 开始抱怨。”

       来自上海第二工业大学的刘永生是该校志愿者在中国馆的带队老师,她认为在排队两三个小时后人会极端疲惫,场馆方在设置上可以更加人性化。她举例子,在中国 馆南广场排队的游客通常比较长,平时尽量安排到伞亭处,如果遇到天气炎热的情况,就把队伍再往里放,一直排进手扶电梯,“让游客觉得毕竟是进馆了,这样就 可以很好地安抚他们的情绪。”

      然而陆续增加的旅游人数,无疑还将对园区公共服务构成持续挑战。公共汽车站大部分时间人头攒 动,尤其是世博大道线上的乘客时常需要分流到过江线上,再从就近站点步行到达场馆。

       就在顾晓芳参观世博园前后几天,世博局发布的旅行社团队入园预约情况信息显示,6月4、5两天的预约团队数共达到9152个,预约游客人数共达35.35 万人次。截止5月底,世博局票务中心提供的数据,已售出的3771.2万张票中有接近三分之一是团体票,而其中大量是单位采购的“福利票”。到上海看世博 在很多地方更像是一项任务。一位在重庆工作的女士因为害怕拥挤的原因拒绝参加世博,而被所在工作单位罚款1500元。

中国成人礼

 世博会不止是拍个照,盖个章,不理解世博真正的含义,无以理解现代化

        在园区的许多角落,游客似乎正在让世博会走向尴尬。在靠近美国馆的吉野家,欧洲广场附近的肯德基餐厅,在公交车站,不时可以看到冲突的人群。人们因为碰撞、排队、踩脚而爆发了各类口角。

       成年人们看起来兴奋而富有激情,同时像小孩一样易怒。他们中的很多人从周边的江浙一带赶来上海,心情迫不及待,然而从每天早上排两小时队进园开始,这一天 的游览就注定是一个极费体力和耐心的工程。

       阵雨不时地袭击人群,在那些拥挤的队伍里,撑伞的人们互相把雨水滴到周围人的身上,然后开始了互相指责。6月27日早晨7点钟开始,南方周末记者体验了一次两个半小时排队入园的经历。游客的争吵从未停止。两位来自香港的游客在队伍中为人劝架,他们对园方表示不解:“明知道每天队伍都这么长,上海最近又每天 下雨,为什么不多盖一些遮雨棚?明知道每天好几万人等着入场,为什么不把开馆时间提前?”

       精心建设对比走马观花,在世博园这个微型城市里,人与城市的不匹配成了目前为止最大的尴尬。

       在志愿者蔡雯俊看来,世博会让很多人聚焦在一个空间里,很多问题就会放大凸现出来,这并不是世博会的问题,而是人的素质问题。在大部分行色匆匆的游客的理解里,花160元人民币进园就是享受服务的。在应聘上海世博志愿者时,蔡雯俊曾经怀揣着不错的预期,“我们对游客提供了帮助,他们应该会是感谢的态度,结 果他们经常喊我们服务员!”

        在集中逛了几个热门场馆之后,顾晓芳和几位单位同事便放弃了继续参观,“说实话,都是看个热 闹,什么高新科技真的看不懂。”他们围坐到高架步行桥下一边打牌一边抱怨这里一点都不比普通游乐园好玩。

       “四十年前的日本大阪世博会参观者突破6000万人,日本一半的国民参加并见证了那场盛会,其成功的举办被公认为是日本国家现代化到来的标志。而上海世博 会的价值正被低估,一个本来应该是全民科技的盛会正在成为一个的只是养眼的景点。”一家上海媒体评论说。

       6月26日傍晚,梅芳坐在白俄罗斯馆的角落里,这份工作已经让她精疲力尽。她开始怀念在北京的生活,她回忆起北京奥运会时候的愉快经历,“所有事情流程顺畅,每个工作人员会讲英语,没有观众会袭击你……”

       有时候她也在沮丧中表达了理解:“我知道你们有过三十年的封闭,人们的价值观被推翻并重建,就像苏联时候的我们一样。”这似乎正是她理解中国人行为的机缘 所在,面对她那圈已经厌烦中国的朋友,她说:“如果只到了上海和北京,那你就没有真正到过中国,更多的地方不发达。这里有坏人也有好人,有时候他们只是因为还不富裕。”

       这一天傍晚,在雨水和排队双重考验下,游客们已经筋疲力尽,人群东倒西歪地坐在路边的草地上。一场盛大的花车游行让他们重新兴奋起来。那是一场连绵细雨之后的移动演出,远处是吹奏着西洋乐曲的铜管乐团。近处的一辆花车上京剧演员们京韵婉转,围拢而来的游客们爆发出震耳欲聋的欢呼声,在雨后的阳光下,演员们 水袖挥舞,华装闪亮,那样的场景宛若盛唐。

来源:圣者为王

 

延伸阅读

华盛顿观察:美国专家淡定看世博

来自上海世博会国家馆的内部消息


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.03:22 一件小事女巫店» fishy's shared items in Google Reader

很多人在问,我最近是怎么了,不太更新博客,人也没怎么出现,嗯,我是遇到一个小小事故。

某天中午,我站在公寓门口的马路边,甚至还未走到马路上,等待着人行道的绿灯亮起,然后几秒钟之间就被一辆破旧的残疾人开的那种三轮车撞倒了,说起来也没多严重,不过当下被撞倒,还是意识模糊了那么一下子的。等可以爬起来的时候,嘴巴鼻子都在流血,模模糊糊的,看到是一个老人开的三轮车,他吓得已经呆在路边了,公寓的保安赶过来,正在叱责他,不让他走。乱哄哄的,我只听到保安说,撞我的人是瘸子,还听到似乎是撞我的老人说,要找他儿子……

说实话,当下我是害怕的,生怕伤到脸会毁容,也不知道到底会怎么样,只能粗浅的判断腿好像没断,就一瘸一拐在保安的帮忙下打了车,去了朝阳医院,路上打电话让亲人赶紧来。

其实到了医院就已经安心了,至少我知道自己没什么大事,该缝针的缝针,该消毒的消毒,自己还很英勇的一个人顶着一张破脸去交了费,我现在的记忆有点模糊,那会儿老先生有来过吗,还是没有,我不太记得了。

没多一会儿,亲人就来了。盖盖超级会安慰人的,手脚麻利的去替我缴费啊拿药啊什么的;一路还调侃我说,刚好啊,给你个机会去整容,还说着,哎呦,你现在是左脸、左胳膊、左腿都有伤,左边看影响市容;不过看右边就没事了,好人一个……其实没多一会儿,也就一个多小时以后,缝完针,打点滴的时候,我就可以呵呵笑出来,全然忘记了老先生的存在。

老先生出现了,穿着我小时候记忆中那种蓝色的布裤子,很像工装的那种,破旧的不行,一个已经被汗渍和长久的洗刷侵蚀到薄到透明的跨栏背心,很脏。盖不住的是他苍老黝黑的皮肤,看得出,他家境不好,而且现在还在操劳的做事。他手里提着一个蓝色的塑料袋,里面鼓鼓囊囊的装着不知道什么。

他就怯生生的站在观察室的门口,手里拿着一卷鸡蛋糕和一小筒绿豆饼,手伸向我们。我跟盖盖说说笑笑的时候,他不敢打断,也并没有进来。我看到他,也不知道他已经在门口站了多久,招呼老先生进来,他就站在门口,走了几步,是一位跛脚的老先生。努力了半天,说不出来话,我想,或许,他是要跟我说“对不起”的,但他并没找到合适的词,等了半天,他说,我不是故意的啊,我停不下来啊……

我赶忙说,没事没事,老大爷,我没什么大事儿。他看着我说,流血了啊,这得好多钱吧,还缝了……我突然意识到,我刚被撞的时候,因为鼻子眼角嘴巴都在流血,裙子也撕了,大概看起来蛮恐怖的,对一个贫困的老人来说,或许,这一撞,将是他的“不能承受之重”。心里马上就紧了一下,而,我还没开口,盖盖就跟老先生说,老爷爷,没事,我们自己可以处理,不用你给钱。

老先生显然没想到是这样,嘴里嘟念着什么,我们听不清楚,但他也不敢离去。而我或盖盖,也都不知道该如何描述或者confirm这样的决定,于是我接过老先生给的鸡蛋糕和绿豆饼。我知道这应该都是护士在给我处理伤口、缝针的时候,老爷爷焦虑又担心又抱歉的那段时间里,在朝阳医院门口的小卖部里买来的,或许这是他唯一买的起的,又或许,这是他的生活里,代表享受的好吃头……

老先生出门之后,一度,我们以为他已经走了。但在点滴尚未完的时候,走廊里有一阵叱责,一个中年人带着口音的大声的不留情面的呵斥,我跟盖盖都知道发生了什么,开始响起来的时候,我们默不作声,只能盯着点滴瓶。但无奈,那些话,太难听了,我也无法忍受这是一个儿子叱责自己的父亲。于是推着点滴瓶架子,一瘸一拐的走到观察室门口。

是一个同样黝黑的,看不清楚面孔的中年人在指着老先生骂,内容大约是那谁谁谁被讹了四万块你知道不知道啊!就让你去送个孩子你就给我惹事!!!我×,这钱谁出啊,人家说不要就不要了啊!要找还不是马上就能找来!你……%&*@#¥
老先生就木木然的站在那里,那只蓝色的塑胶袋还提在手里,轻轻地颤抖着。

我努力的大声跟他说,别骂了,带你爸走吧,我是被他撞的人,我真的不要医药费了,但你别骂你老子,再骂我就跟你要钱……

男子不是恶人,听到我说这些,并没装傻溜走,而是马上走过来,一步步走到灯底下的时候,看到他的样子,也是个老实人的样子,肯定是个工人或者之类的,非常谦卑的一直跟我道歉,说遇到好人,说如何如何,我不想再接话,只是告诉他,去把那车的刹车修了,这是必须的,然后就让他走……

男子千恩万谢的,点头致意很多次,然后转身走开了,他并未招呼他父亲,就自顾自的大步流星的走开了,然后盖盖站在门口,扶着我,跟那老人说,老爷爷再见……
老人看了我们一下,似乎是摆了摆手,佝偻着的身影,一瘸一拐的缓慢的就消失在走廊里了。

这件事情,就这样结束了。并没有什么煽情的桥段,也没有后续。之后的一个礼拜,我暂停了工作,跟制片人请了假,在家休息,还去做了小的修补手术,等待拆线和复原,一切ok。说起来,我应该算幸运,自己处理这件事情的过程,也并没有什么差错,但不知道为什么,每每想到那位老先生,那对父子,心里总是一阵紧,一阵酸楚。但愿他们过得好。


收藏到:Del.icio.us

add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image03:04 fishywang: Got a copy of Big Fish BD as my birthday present.» Twitter / fishywang
fishywang: Got a copy of Big Fish BD as my birthday present.
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Thu 02 September, 2010

Click here to bookmark this link.Channel Image23:43 fishywang: @jjgod 一样啊,是到确认收货那里输入密码后点按钮然后要求你输入密码,貌似是不认输进去的密码» Twitter / fishywang
fishywang: @jjgod 一样啊,是到确认收货那里输入密码后点按钮然后要求你输入密码,貌似是不认输进去的密码
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image23:37 fishywang: RT @xydonkey: http://ow.ly/2yT53 这个让我想起以前一个打捞河里小车的悲剧,不过那个据说是PS的» Twitter / fishywang
fishywang: RT @xydonkey: http://ow.ly/2yT53 这个让我想起以前一个打捞河里小车的悲剧,不过那个据说是PS的
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.23:17 趣题:寻找隐藏的公共秘密Matrix67: My Blog» fishy's shared items in Google Reader

    刚刚看到一道智力题,颇有些意思,说来给大家听听。我把题意稍微改了一下,原题中的 XX 侠是一个(不太容易解释的) lynch mob 。

    某座城市里发生了一起命案,已经确定凶手是 8 个嫌疑犯之一。经过很多可靠的调查,城南和城北的两名警探各自独立地把嫌疑犯的名单缩减到了两个人。现在,两名警探正在通电话,他们试图对比一下彼此的调查结果。如果他俩的嫌疑犯名单中正好只有一处重合,他们就能确定出凶手的身份了。但问题是,这座城市里有一个伸张正义、凌驾于法律之上的 XX 侠,他正在窃听两名警探的通话。如果他从中获知了凶手的身份,他将在警方实施拘捕之前先杀死凶手。
    现在, XX 侠已经知道了那 8 个嫌疑犯是谁,但不知道两名警探各自都把目标锁定在了哪两个人上。这两名警探之前从未见过面,这通电话是他们俩第一次进行交流。他们俩能成功地确定凶手的身份,而又不让 XX 侠知道凶手是谁吗?
    (当然,这里我们不允许使用那些基于数论的公钥加密体系,不然题目就没啥意思了)


    显然,要想秘密地传递消息,他们事先必须得有一个只有他们俩才知道的秘密。这个问题有趣就有趣在,两名警探之间并不是没有公共的秘密——他们是有一个公共秘密的,而这个公共的秘密恰恰是他们此次通话的目的。让我们来看看下面这种方案是如何利用这个公共秘密的。

    为了便于叙述,我们把 8 个嫌疑犯用数字 1 到 8 编号。从 8 个嫌疑犯中选出 2 个人有 28 种情况,我们把这 28 种情况列成下表:

(1,2)  (1,3)  (1,4)  (1,5)  (1,6)  (1,7)  (1,8)
(3,4)  (2,4)  (2,3)  (2,6)  (2,5)  (2,8)  (2,7)
(5,6)  (5,7)  (5,8)  (3,7)  (3,8)  (3,5)  (3,6)
(7,8)  (6,8)  (6,7)  (4,8)  (4,7)  (4,6)  (4,5)

    注意这个表的特点:每一列恰好都既无重复又无遗漏地包含了所有 8 个嫌疑犯。假设警探 A 的嫌疑犯名单是 (1,2) ,他就这样告诉警探 B :

我的嫌疑犯名单在第一列中。

    如果 B 的嫌疑犯名单也在第一列中,他就立即知道两份名单是一模一样的。因此 B 可以说:

洗洗睡吧,我们俩的嫌疑犯名单是一样的。

    但若 B 的嫌疑犯名单不在第一列,对比一下自己手中的名单,他就能知道 A 的名单可能是第一列的哪两个了。比方说,如果 B 的两个嫌疑犯是 (2,7) ,他就知道了 A 的名单只可能是 (1,2) 或者 (7,8) 。接下来, B 就跟 A 说:

我名单中的两个人或者都在 1、2、7、8 这一组里,或者都在 3、4、5、6 这一组里。

    由于 A 的两个嫌疑犯是 (1,2) ,当 A 听了 B 的这句话后,立刻就意会了:其实 B 的那两个人是在前一组里面的。此时, A 、 B 之间就有了一个公共的秘密!有了这个公共的秘密, A 、 B 之间的秘密交流就容易多了。比如说, A 可以借助这个公共秘密,大胆地把自己手中的名单告诉 B :

我的名单是这一组中的前两个人。

    或者更明确地说:

我的名单是 (1,2) 或者 (3,4) 。

    B 也能立即明白, A 指的是 (1,2) 。一对比 B 自己的名单,哦,原来凶手是 2 号。于是 B 就可以说:

凶手是你的名单中编号大的那一个。

    或者干脆说:

凶手是 2 号或者 4 号。

    由于 XX 侠不知道他们讨论的是前一组还是后一组, XX 侠就只能听天书了。

 
    知道答案后我不由得拍案叫绝,随后便开始静下心来仔细思考,究竟为什么两名警探能进行秘密通信?用于交流的公共秘密究竟是从哪里来的?其实,这个隐藏的公共秘密来源于双方的一个共识:我们两人的名单有交集。换句话说,如果 A 手中的名单是 (1,2) , A 就知道了 B 的名单一定是(1,2), (1,3), ... , (1,8), (2,3), (2,4), ... , (2,8) 等 13 种情况中的一个。同时, B 也知道他自己的名单是这 13 种情况中的一个(因为他知道自己的名单是什么),因此这个信息就成了两人之间的一个隐藏着的公共秘密。
    类似的情况还发生在很多其它的场合。比方说,有 1、2、3、4、5 五张牌,随机发给 A 和 B 两个人,每个人发两张牌。显然,他们俩互相之间都不知道对方手中的牌。现在,有一群人在旁边围观, A 能否把自己手中的牌告诉 B ,而不让围观者知道?这是有可能的,因为 A 、 B 两人享有一个别人都不知道的信息:他们知道对方手中没有什么牌!举个例子来说, A 手中的牌是 (1,2) ,那么 A 就知道 B 手中既没有 1 又没有 2。当然, B 自己肯定也知道这一点,因此他们就有了一个别人不知道的秘密信息。
    怎样利用这个公共秘密呢?不妨像前面那样,把五选二的 10 种情况列成下表,其中每一列的 4 个数都不相同:

(1,2)  (1,3)  (1,4)  (1,5)  (2,3)
(3,4)  (2,5)  (3,5)  (2,4)  (4,5)

    现在, A 只需要说自己的两张牌在哪一列就可以了。如果 A 说自己的牌在第一列,但 B 手中的牌是 (3,5) ,那么 B 就立即知道 A 的牌是 (1,2) 了,因为 A 不可能有 3。
    继续深入的研究还能得出一些更有意思的结果:在打牌时,你甚至有办法把自己手中的牌秘密地告诉你的队友!


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.23:17 Futurama S06E10中的数学问题Matrix67: My Blog» fishy's shared items in Google Reader

     

    经典 Geek 动画 Futurama 上周播出了第 6 季的第 10 集 The Prisoner of Benda 。在这一集中,教授 Farnsworth 发明了一种“心灵对换机”,它可以把两个人的思想互相对换,使得 A 的大脑跑进 B 的身体里,而 B 的大脑则跑到 A 的身体里。 Farnsworth 和 Amy 都想得到对方的身体,便成为了这台机器的第一对实验者。等到他们爽够了想换回来后, Farnsworth 却发现了一个严重的问题:已经互换过大脑的两个身体不能再次进行大脑对换操作。但这并不表示两个人完全没有希望回到自己的身体里—— Farnsworth 突然想到,或许可以用第三者作为一个临时的大脑储存空间,从而实现间接对换。正巧机器人 Bender 进了实验室,于是(身为 Amy 的) Farnsworth 和 Bender 又坐上了机器,这下 Farnsworth 的大脑便跑到 Bender 身体里了,而 Bender 的大脑则进了 Amy 的身体里。此时 Farnsworth 才意识到,引入一个第三者是不够的——再让(身为 Bender 的) Farnsworth 和(身为 Farnsworth 的) Amy 互换大脑,可以让 Farnsworth 恢复原状,但同时 Amy 的大脑会跑到 Bender 的身体里去;这样 Bender 和 Amy 的身体正好颠倒了,而他们却已不能再次使用机器。换句话说,要想恢复两个换位了的大脑,需要引入不止一个新的人。
    但现在,问题已经变得更加复杂了——这下已经产生了三个大脑位置错乱的人。大家很容易联想到一个更一般的问题:给定 n 个人以及他们之前使用“心灵对换机”的记录,至少得引入多少个新的人,才能让所有人的大脑都“物归原主”呢?


(给大家上传一个无字幕版本)

  

    当然,这一集的结局是圆满的: 9 个大脑位置错乱的人,在两个新躯体的帮助下,用了 13 次对换,完成了还原的工作。编剧在剧中给出了一般情况下问题的答案:不管 n 是多少,不管现状有多混乱,引入两个新的身体总是足够的。在剧中,这个结论的证明过程写在了一个黑板上,编剧毫无顾忌地给了黑板一个特写——上面写的真的就是这个结论的证明(点击这里看大图)!

  

 
    这一群编剧来头可不小,他们竟然个个都拿过数学学位。下面,就让我们一起来看看这群变态编剧的证明思路。这是一个构造性的证明。首先,让我们来考虑一种特殊的情形:

躯体:1  2  3  4  5  6  …  k-1  k
大脑:2  3  4  5  6  7  …   k   1

    换句话说,这些人的脑子所在的位置正好“转了一圈”。我们引入 x 、 y 两个新的人,然后使用下面的策略(每行第 i 个数表示第 i 具躯体里装的谁的大脑,第一行是初始时的状态):

2  3  4  5  6  …  k   1  x  y  
x  3  4  5  6  …  k   1  2  y
x  y  4  5  6  …  k   1  2  3
x  y  3  5  6  …  k   1  2  4
x  y  3  4  6  …  k   1  2  5
x  y  3  4  5  …  k   1  2  6
… … …
x  y  3  4  5  … k-1  1  2  k
x  y  3  4  5  … k-1  k  2  1
x  2  3  4  5  … k-1  k  y  1
1  2  3  4  5  … k-1  k  y  x

(谢谢大家提醒,已更正)

    容易验证,上面所有的对换操作均发生在原来的人与最后两个人之间,而且所有操作都没有重复。也就是说,不管初始时的混乱状态是怎么得到的,引入 x 和 y 之后,这 k 个大脑总能回到自己的身体里去,而 x 和 y 的位置则与初始时颠倒。注意到一个 1 到 n 的排列总能分解成若干个循环的乘积,对每个循环分别进行上述操作,最后如果需要的话就再把 x 和 y 互换一下,问题就解决了。


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.20:51 [医药卫生] bf射出的精液是粉红色,正常吗水木社区 今日十大热门话题» fishy's shared items in Google Reader
发信人: potential (potential), 信区: Medicine
标 题: bf射出的精液是粉红色,正常吗
发信站: 水木社区 (Fri Sep 3 02:39:25 2010), 站内

什么原因引起的呢,应该注意什么

平时生活是基本每天一次或两次,一次最少半小时,一般一个多小时

怎么突然这样呢
--
可以看着你一直幸福,这样就好。


※ 来源:·水木社区 newsmth.net·[FROM: 211.99.222.*]

add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image20:12 fishywang: 淘宝真是good job,现在那个safari的登陆控件能登陆不能确认收货了» Twitter / fishywang
fishywang: 淘宝真是good job,现在那个safari的登陆控件能登陆不能确认收货了
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image19:52 fishywang: RT @eddyxu: RT @pipitu: RT @localhost_8080: 昨晚梦见男朋友和别的女人在逛街,梦里我的第一反应是查源代码…结果调试半天查不出来为什么显示的是那个女人不是我,最后含泪把那个女人给注释掉了,再一运行就是我男朋友自己逛街了…醒来囧字脸呆 ...» Twitter / fishywang
fishywang: RT @eddyxu: RT @pipitu: RT @localhost_8080: 昨晚梦见男朋友和别的女人在逛街,梦里我的第一反应是查源代码…结果调试半天查不出来为什么显示的是那个女人不是我,最后含泪把那个女人给注释掉了,再一运行就是我男朋友自己逛街了…醒来囧字脸呆 ...
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image19:21 fishywang: @xydonkey 16很便宜了好吧。。。» Twitter / fishywang
fishywang: @xydonkey 16很便宜了好吧。。。
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image19:21 fishywang: got priority inbox» Twitter / fishywang
fishywang: got priority inbox
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image18:13 fishywang: RT @loic: yesterday was the all time highest number of ping.fm accounts created, thanks, Steve. Should I put an Apple logo on ping.fm home?» Twitter / fishywang
fishywang: RT @loic: yesterday was the all time highest number of ping.fm accounts created, thanks, Steve. Should I put an Apple logo on ping.fm home?
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image11:03 fishywang: 真是严重老年痴呆,刚想起来在淘宝上买三脚架的时候应该顺手买一点镜头纸。。。但是三脚架已经发货了» Twitter / fishywang
fishywang: 真是严重老年痴呆,刚想起来在淘宝上买三脚架的时候应该顺手买一点镜头纸。。。但是三脚架已经发货了
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image04:30 Suzhou Night» fishy GPSed tracks
Country:  China (Jiangsu Sheng)
City: Suzhou

add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image04:30 Suzhou Liuyuan Garden» fishy GPSed tracks
Country:  China (Jiangsu Sheng)
City: Suzhou

add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Wed 01 September, 2010

Click here to bookmark this link.Channel Image01:02 Opera band» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

Opera band

@Liuyuan Garden (留园), Suzhou, Jiangsu, China. 27th Aug., 2010


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image01:00 Opera» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

Opera

@Liuyuan Garden (留园), Suzhou, Jiangsu, China. 27th Aug., 2010


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image00:59 Opera» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

Opera

@Liuyuan Garden (留园), Suzhou, Jiangsu, China. 27th Aug., 2010


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image00:57 Opera» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

Opera

@Liuyuan Garden (留园), Suzhou, Jiangsu, China. 27th Aug., 2010


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image00:56 Boat» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

Boat

@Liuyuan Garden (留园), Suzhou, Jiangsu, China. 27th Aug., 2010

High saturation & cropped edition


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image00:55 Guzheng» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

Guzheng

@Liuyuan Garden (留园), Suzhou, Jiangsu, China. 27th Aug., 2010


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image00:53 Turtle» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

Turtle

@Liuyuan Garden (留园), Suzhou, Jiangsu, China. 27th Aug., 2010


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image00:52 Turtle» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

Turtle

@Liuyuan Garden (留园), Suzhou, Jiangsu, China. 27th Aug., 2010


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image00:50 Turtle» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

Turtle

@Liuyuan Garden (留园), Suzhou, Jiangsu, China. 27th Aug., 2010


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image00:49 Huge rock» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

Huge rock

@Liuyuan Garden (留园), Suzhou, Jiangsu, China. 27th Aug., 2010


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image00:39 P8270029» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

P8270029

@Liuyuan Garden (留园), Suzhou, Jiangsu, China. 27th Aug., 2010


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image00:36 P8270021» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

P8270021

@Liuyuan Garden (留园), Suzhou, Jiangsu, China. 27th Aug., 2010


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Tue 31 August, 2010

Click here to bookmark this link.Channel Image23:23 Plant» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

Plant

@Liuyuan Garden (留园), Suzhou, Jiangsu, China. 27th Aug., 2010


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image23:20 Lotus» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

Lotus

@Liuyuan Garden (留园), Suzhou, Jiangsu, China. 27th Aug., 2010


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image23:07 Lotus» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

Lotus

@Liuyuan Garden (留园), Suzhou, Jiangsu, China. 27th Aug., 2010


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image20:34 Ballad singing» Uploads from Yuxuan.fishy.Wang

Yuxuan.fishy.Wang posted a photo:

Ballad singing

@Liuyuan Garden (留园), Suzhou, Jiangsu, China. 27th Aug., 2010


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sun 22 August, 2010

Click here to bookmark this link.Channel Image07:59 看过The Expendables» fishy 的收藏
The Expendables

推荐: 还行

备注: 过期和二线动作明星联欢会


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Wed 18 August, 2010

Click here to bookmark this link.Channel Image07:22 生日恐龙» Big Fish

哦不是说恐龙过生日了,是说收到了某人的纯手工恐龙作为生日礼物!

罗马假日:

Birthday Dinosaur - Roman Holiday

头被吃了。。。

Birthday Dinosaur - Eaten

感谢心灵手巧的那谁!

随机附送福大爷舔啊舔啊舔啊视频一具:

如果你实在看不到,就看这个吧。。。


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Tue 17 August, 2010

Click here to bookmark this link.Channel Image10:38 看过The School of Rock» fishy 的收藏
Click here to bookmark this link.Channel Image06:33 看过Shrek Forever After» fishy 的收藏
Shrek Forever After

推荐: 推荐

备注: 我说是猫咪减肥教育片,某人说是中年危机教育片


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sun 15 August, 2010

Click here to bookmark this link.Channel Image06:10 看过The Ghost Writer» fishy 的收藏
The Ghost Writer

推荐: 推荐

备注: 真是憋不住话啊,啥都跟人说


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image03:25 换硬盘倒Mac OS X» Big Fish

SC2 is coming! 然后我辛辛苦苦下下来后发现,这玩意又是一个不支持case-sensitive分区的东西。

为什么要说“又”呢?目前已知的不支持case-sensitive分区的程序包括:

  • 据说Adobe的若干CS系列东西不支持(不过我都没用过,我用过的Lightroom,Reader啥的倒是都支持);
  • 微软的Remote Desktop Client,其实这个可以用,只是会生成一个无比傻逼的“/users/fishy/library”目录而已(我用CoRD替代);
  • Steam Mac版在安装的时候会直接拒绝安装到case-sensitive分区上;
  • 我实在想不起来还有啥了。。。

所以你看,基本上对生活影响不大的。所以作为一个程序员,我自从被case-insensitive分区搞过一次后,就在06年硬盘坏掉换硬盘的时候,顺便改用case-sensitive分区了。

但是还是Blizzard面子比较大,因为SC2,我决定换回case-insensitive了!于是我就上网订了个500G的硬盘回来换上,然后开始装系统倒数据。

在Mac下想要换硬盘倒数据,有这么几种方法:

  1. 原来的数据备份,然后安装的时候选从Time Machine备份恢复;
  2. 原来的盘接上安装的时候直接用disk utility的restore功能全盘复制;
  3. 装一个新系统,装好后接上原来的盘用Migration Assistance。

因为以前我有过从Time Machine备份恢复的成功经历,于是这次首选的是这个方案。结果悲剧发生了,恢复到一半的时候,安装程序崩了。。。

于是接下来尝试restore的方案,结果虽然我先创建了case-insensitive分区然后从之前的case-sensitive分区恢复,最后恢复的结果还是case-sensitive的。。。于是又是失败。

最后只好选择重新安装然后用Migration Assistance。装完系统后装更新,然后用Migration Assistance。第二天早上起来看这个东西到底给我转移了哪些文件:

  • ~(用户目录)下,所有的.开头的配置文件全部转移过来了,然后Documents和Downloads被转移过来了,甚至连Boxer创建的DOS Games目录也转移过来了,但是其它所有的目录都没有转移,包括Apple自己的Movies、Music和Pictures这样的目录。这实在是个很无厘头的结果,我想不通为啥他连DOS Games这样的目录都转,却不转那些他推荐用来保存音乐照片的目录。
  • /(系统目录)下,基本上啥都转过来了,VMWare Fusion不需要重装可以直接用(之前10.5升10.6的时候还需要重新安装一次的),我装在/Library下面的POPFile也直接可以工作,甚至连/etc/hosts文件也保留了。但是MacPorts挂了需要重新来(可以参考官方的升级Snow Leopard指南),然后重装MacPorts的时候发现,Xcode装到/usr/bin下面的东西全没了。考虑到我只有Xcode往/usr/bin下面写了东西,应该是/usr/bin没有被转移。但是/usr/local/bin是安全的。

于是我又挂着老硬盘rsync了半天,最后终于搞定。搞定后顺便也装了个Steam,不过啥游戏都没从那上面买。。。


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sun 08 August, 2010

Click here to bookmark this link.Channel Image07:50 看过Der Untergang» fishy 的收藏
Der Untergang

推荐: 推荐

备注: 终于看到了那段被恶搞了无数版本的元首发飚的原版了。。。


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sat 07 August, 2010

Wed 04 August, 2010

Click here to bookmark this link.Channel Image08:52 看过Les aventures extraordinaires d'Adèle Blanc-Sec» fishy 的收藏
Les aventures extraordinaires d'Adèle Blanc-Sec

推荐: 推荐

备注: 好冷的笑话


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 02 August, 2010

Click here to bookmark this link.Channel Image20:42 MiaoIntro» yhsif.com - HomePage
2010-08-02 20:42:24 by YuxuanWang - Reverting last edit by SamSunghi [108] to previous version [107]
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sat 31 July, 2010

Click here to bookmark this link.Channel Image07:53 看过Kick-Ass» fishy 的收藏
Kick-Ass

推荐: 力荐

备注: 配乐好棒


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Thu 29 July, 2010

Click here to bookmark this link.Channel Image08:49 看过Bright Star» fishy 的收藏
Bright Star

推荐: 还行

备注: 过于女性化了。另外片尾的cast里面居然有the cat...


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sat 03 July, 2010

Click here to bookmark this link.Channel Image06:25 2010 Q2 电影总结» Big Fish

最近看世界杯看得天昏地暗,我都差点忘了这个事情了。。。

另外刚刚还看了Toy Story 2,恶搞了好多电影。。。等着看Toy Story 3了。


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Fri 02 July, 2010

Click here to bookmark this link.Channel Image00:50 荷兰的(英文)名字» Big Fish

今天骂德花女的时候翻了下Wikipedia,发现荷兰这个国家的名字很有意思。除了我之前就知道的Holland和the Netherlands有区别外,the Kingdom of the Netherlands也是不同的:

  • the Netherlands(Nederland)是荷兰在欧洲的部分,也就是跟比利时和德国接壤的那个国家。
  • Holland这个词准确的说其实只是the Netherlands中的两个省(最早是一个省,后来拆成了南北两个),但是也被广泛用于指代整个the Netherlands。
  • the Kingdom of the Netherlands(Koninkrijk der Nederlanden)是荷兰的正式国名,除了欧洲部分的the Netherlands外还包含了加勒比海的两个国家。加勒比的那两个国家的公民拿的是荷兰王国护照(与荷兰本土的护照没有区别),属于欧盟公民,但是那两块区域不属于欧盟。在联合国和欧盟,the Kingdom of the Netherlands也都是作为一个整体成员的。

add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 28 June, 2010

Click here to bookmark this link.Channel Image19:22 HomePage» yhsif.com - HomePage
2010-06-28 19:22:31 by YuxuanWang - * patch->patches
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sun 20 June, 2010

Click here to bookmark this link.Channel Image13:19 北京百老汇电影中心» Big Fish

这是一家香港影院的北京分店,据说是北京唯一一个放粤语原声电影的地方。今天(昨天)跑去看了粤语版的志明与春娇

位置是在东直门附近,但是具体位置不是那么明确。Google Maps上能搜到两个,地址写的都是香河园路1号,但是一个标在了机场高速旁边另一个标在了香河园路旁边,因此我当然信了路边的那个。于是出地铁后打了个车过去,到了地方下车开始找人问路,然后往会走,走回到离东直门更近的那一头发现了一个巨大的小区,叫做香河园路1号院。然后围着这个小区转了一圈,到了机场高速边上,又问了一次路,告诉我电影院在马路对面。。。马路对面根本就跟这条路不挨也,后来才知道原来那个叫做“香河园路1号院北区”。。。就是Google Maps上标的另一个。好吧,我第一次知道了门牌号还能这么标的,北京你又赢了。

由于13号线地铁开得实在太慢,加上找地方找了半天,到的时候迟到了一点没看到开头,是从他们讲那个停车场惊魂故事开始的。。。另外最后的演员表第一条就是说那个停车场里只有声音没有露脸的演员就是肥彭自己了,所以还好我去的还没有太晚,不然就完全看不到了。

电影很不错,笑点满塞,比如春娇的手机铃声、扮日本人韩国人等。肥彭就是品质保证。不过这个虽然是粤语版但也还是删减过的,看了一下对照跟内地国语版也还是一样的,该没有的镜头一个都没有。当然,生在兲朝本来对这个也不用期待的。。。

这个电影院很小,一共就没几个厅每个厅也不大。人也很少,我买票的时候看了一眼也就坐了一半人左右。卖票的地方还摆了无数海报和电影相关的书籍和杂志,感觉不像是个电影院,更像是小区里面的一个大一点的放电影的咖啡馆。。。

从影院出来能看到不错的夜景:

Night

Night

最后,影院大概的坐标是39.949063N, 116.430806E。悲剧的GPS track在此


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image12:53 Beijing Broadway Cinema» fishy GPSed tracks
Country:  China (Beijing Shi)
City: Beijing

add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Fri 18 June, 2010

Click here to bookmark this link.Channel Image08:42 Eddy Wedding» fishy GPSed tracks
Country:  China (Hubei)
City: Wuhan

add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image08:35 有谱的靠枕» Big Fish

Handmade pillow

全手工缝制。靠在上面我就靠谱了!

Handmade pillow

btw, 新的汉口火车站修得还挺好看的,那个大天花板很有沧桑感:

Hankou Railway Station


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image08:03 Eddy大婚» Big Fish

Buddie5第三个,2010年6月14日。本人贡献出来了第二次伴郞名额。

一大早来到了著名的白玫瑰酒店接新娘。在等待新娘梳妆打扮的时候,大家就在酒店大堂拍照玩。

新郎和伴郞一号:

Groom with Max

新郎和伴郞二号,我觉得我那个领带很像泊车的小弟。。。

Groom and me

春风得意的新郎:

Groom

跟一群妹妹一起就更加春风得意了:

Groom with sisters

作为伴郞,拍照少了很多,不过下面这张也不是我拍的:

Let's go!

然后大家就坐上车开往汉口上海路天主堂:

Church

不过新人人品大爆发,一路没有堵车,我们比预定时间早了半小时到达教堂,教堂还没准备好。。。于是大家只好继续在教堂门口拍照:

Peoples

Buddie5近几年难得聚这么齐,于是赶紧合影一张:

Buddie5

新郎新娘摆pose亲嘴儿:

Kiss

然后抢镜头的出现了!美女带着小美女出现,抢了新郎新娘的镜头:

Beauty and little beauty

小美女表情多变:

Little beauty

然后进入教堂准备行礼。教堂里面剪影一张,那个地方隐藏了一个唱诗班:

Church

然后是神父的布道和祝福。下面这个视频只有祝福:

礼成!新郎新娘摆pose接受众人围观:

Done!

然后大家来到酒店,八一路湖锦。我在门口收了半小时红包,结果一个都没收到,真是悲剧。

上桌子后看到伟大的红酒瓶子:

Wine

然后跟着新人去敬酒,结果几个大叔灌完新郎灌伴郞,我和max都被灌了点白酒。

最后再来一张小萝莉照片:

Little beauty

下午大家各自回家醒酒,晚上相聚在武胜路边上的一家小饭馆吃虾:

Shrimps

当然做好的虾子不是这样的,不过吃的太忙了,没空拍照。

这家店还养了只猫,生了个小奶猫:

Kitty

后来大猫也出现了——是被一只狗给吓到了树上:

Cat on tree

这家店的虾子真的很好吃,不过也很贵就是了,坐标可以看照片的geotag。

更多婚礼照片可以看婚礼的GPS trackflickr set。再次恭喜Eddy!


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Wed 02 June, 2010

Click here to bookmark this link.Channel Image09:43 Matrix Blu-ray Collection» Big Fish

我终于开始屯蓝光了。。。感谢Eddy同学辛苦从米国帮我扛回来。当然辛苦主要不是因为这套碟,而是给某人带的E-PL1。

盒子:

The front of the box

里面的5个小盒子:

The mini boxes

Matrix,左边那张Digital Copy不知道到底是啥,貌似我的MBP光驱也能读,读出来的容量是1.7G左右,按说也不可能是四部电影的copy...请忽略我的脚:

Matrix

Matrix Reloaded,同样请忽略我的脚,另外这个没有Digital Copy了:

Matrix Reloaded

Matrix Revolutions:

Matrix Revolutions

Animatrix:

Animatrix

还有两张号称一共35小时的花絮碟,这个是DVD的,估计是用蓝光盘装的SD内容的意思。。。另外左边那张是双面的,第一次见到这种双面的盘:

Matrix Experience

炫耀完毕。现在就等着Lucas出Star Wars蓝光碟来骗我的钱了。。。


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sun 16 May, 2010

Click here to bookmark this link.Channel Image04:20 奥林匹克森林公园» Big Fish

昨天去了奥林匹克森林公园参加煎饼摄影版版聚。本来我对于所有奥他妈的运相关的东西都没什么兴趣的,不过这个公园实在是很大很不错。另外虽然这次来了3个女模特而且我也拍了不少照片,不过由于模特的要求所有有女模特的照片我都没有公开,让大家失望了。想看美女照片的可以按cmd+w或者j或者alt+f4等键离开。

这个公园很大,我们走了3个半小时6公里多,但是只是绕着奥海走了一圈。这也就是公园的一半而已:

Map

坐地铁到公园南门集合,然后在植物学家MJ的带领下进门以后先右转(往东),这里有一大片漫山遍野的二月兰:

Orychophragmus violaceus (二月兰)

然后植物学家就去北园找植物去了。我们就在这里拍照,大饼和梁总轮流举反光板。微软旗帜梁总:

lby

吐舌头的大饼:

bigpizza

在这里拍完后梁总和一个模特有事就先走了(哦,是分别有事。。。),剩下的人继续向前,路上看到了路边的紫鸢,甚至还有花苞:

Iris tectorum Maxim (紫鸢)

走了两步后看到几棵叶子金黄的树,我实在是不明白为什么夏天了还有金黄色叶子的树。。。

Tree

继续走,路上大饼和版大终于研究出来了怎么收起反光板,于是大饼很高兴的把反光板顶在头上。。。

然后我们看到路边出现了一片竹林,而且竹子都是给人感觉要枯死的金黄色:

Bamboo

竹林里面有条小径:

Path in the bamboo

我们本来以为里面会是个八卦阵什么的。。。结果不是,穿过后是另一片二月兰

然后继续向前。这里出现了悲剧一:大饼在路边的水中看到了一只鸭子,于是我开始换长焦镜头准备拍,结果等我换完镜头抬头,发现鸭子已经消失了。。。真是煮熟的鸭子也飞走了啊。

然后又过了若干个桥后,终于来到了目的地天元。天元其实就是一个湖边的木制圆形平台,与南门隔湖相望。(我知道其实是隔着“奥海”,但是我实在是很不感冒北京人屁大一点人工湖也要叫“海”的习惯,按照这么叫,东湖就只能叫太平洋了。。。)

在天元拍了一下旁边游来游去的鱼:

Fish

和天上的风筝:

Kite

从天元出来,看到了中英法日四种语言介绍天元的铁牌,我们在那儿研究了半天法语。。。

继续向前,遇到了一大片草坪:

Lawn

不过不让上,妈的。草坪边缘有一大片三叶草,我和大饼在那儿找了半天四叶草,也没找到。。。

Clover

再往前走一点,惊喜出现了。我们发现了一片蒲公英:

Dandelion (蒲公英)

对,我刚才说的是“一片”!很大很大的一片:

Dandelion (蒲公英)

版大吹了一口,不过拍失败了,基本看不到吹下来的降落伞:

Dandelion (蒲公英)

这片蒲公英的位置大概在40.0153274536133N, 116.384353637695E

从这片蒲公英出来后没走多远,悲剧二出现了:我的相机彻底没电拒绝开机了。看来电力强劲就是让人容易忘记充电啊。。。不过还好时间也不早了,大家已经开始往外走了。

路上路过了湿地,不过没有看见太多鸟,倒是有不少人在喂鱼,我只好用手机拍了一张

最后走出南门,坐上地铁,奔赴五道口吃晚饭。

GPS track更多照片见flickr


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sat 15 May, 2010

Click here to bookmark this link.Channel Image07:30 Beijing Olympic Park» fishy GPSed tracks
Country:  China (Beijing Shi)
City: Beijing

add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sat 13 March, 2010

Click here to bookmark this link.Channel Image11:47 YuxuanWang» yhsif.com - HomePage
2010-03-13 11:47:52 by YuxuanWang - - company
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Tue 02 March, 2010

Click here to bookmark this link.Channel Image04:58 More tips about my projtags.vim» La Vita è Bella

I wrote a vim plugin named projtags, initially for loading tags file for projects. But as I can "set tags+=tags;" in my vimrc, it's not that useful on the tags file way. I expanded its feature to support commands for per projects, and this is much more useful razz Here are some examples:

Case 1: different coding styles

I did some squid hacking before. My coding style is as below:

set cindent
set autoindent
set smartindent
set tabstop=8
set softtabstop=8
set shiftwidth=8
set noexpandtab
set smarttab
set cino=:0,g0,t0

But squid coding style is different. They use 4 for shiftwidth. As hacking some project, you should always follow the original coding style. But add vim modeline into every file is also unacceptable. So I use projtags.vim to do this job:

let g:ProjTags += [["~/work/squid", ":set sw=4"]]

So that every time I'm editing a file within squid, vim will use 4 instead of 8 for shiftwidth, now I'm happy with both my own codes and squid codes.

Case 2: use ant as makeprg for java projects

First, I use a autocmd to set ant as makeprg for java files:

autocmd BufNewFile,BufRead *.java :setlocal makeprg=ant\ -s\ build.xml

It works well for java files. But as I did some Android development these days, I also have lots of xml files to edit (and then make to see the result). I can't use such a autocmd for xml's, as not all xml's are in a java project. So projtags.vim is again the answer:

let g:ProjTags += [["~/work/pmats", ":set mp=ant\\ -s\\ build.xml"]]

So I can always use ":make" for ant under my Android project now, no matter it's .java or .xml.

My vimrc segment for tags and projtags

set tags+=/usr/local/include/tags
set tags+=/usr/include/tags
set tags+=/opt/local/include/tags
set tags+=tags;

let g:ProjTags = []
let g:ProjTags += [["~/work/squid", ":set sw=4"]]
let g:ProjTags += [["~/work/pmats", ":set mp=ant\\ -s\\ build.xml"]]

Patches for projtags.vim (e.g. Windows support, I haven't tested it but I guess it won't work under Windows now) are welcomed biggrin You can get the code from the git repo for my various scripts.



tags: , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 22 February, 2010

Click here to bookmark this link.Channel Image04:00 Wuhan Railway Station» fishy GPSed tracks
Country:  China (Hubei)
City: Wuhan

add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sat 06 February, 2010

Click here to bookmark this link.Channel Image08:15 Phuket to Phi.Phi» fishy GPSed tracks
Country:  Thailand (Changwat Phuket)
City: Kathu

add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image08:15 Patong Beach» fishy GPSed tracks
Country:  Thailand (Changwat Phuket)
City: Kathu

add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image08:15 Bangkok Canal Tour» fishy GPSed tracks
Country:  Thailand (Changwat Phra Nakhon)
City: Bangkok

add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image08:15 Bangkok Airport» fishy GPSed tracks
Country:  Thailand (Changwat Phra Nakhon)
City: Bangkok

add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Wed 13 January, 2010

Click here to bookmark this link.Channel Image17:58 FormattingRules» yhsif.com - HomePage
2010-01-13 17:58:00 by YuxuanWang - Reverting last edit by JosephBehr [99] to previous version [89]
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sun 11 October, 2009

Click here to bookmark this link.Channel Image07:06 Modified Pwitter to support 3rd party twitter API» La Vita è Bella

Pwitter is a good open source Twitter client for Mac. I just added supporting for 3rd party twitter API to it to make it better.

You can get my patch here or my build here.

There's no GUI for setting 3rd party twitter API address. Instead, you need to change the configuration file. You can use either Property List Editor or the Terminal "defaults write" way. Here's an example:

$ defaults write com.aki.Pwitter twitter_https -bool NO
$ defaults write com.aki.Pwitter twitter_base "teewt.yhsif.com"

To restore the default settings ( https and "twitter.com" ), you can just delete the custom settings by:

$ defaults delete com.aki.Pwitter twitter_https
$ defaults delete com.aki.Pwitter twitter_base

It's useful when you can't connect to twitter.com directly, like me in China. Enjoy it.



tags: , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 24 August, 2009

Click here to bookmark this link.Channel Image20:50 TableMarkup» yhsif.com - HomePage
2009-08-24 20:50:09 by WikkaInstaller
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image20:50 TableMarkupReference» yhsif.com - HomePage
2009-08-24 20:50:09 by WikkaInstaller
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Fri 01 May, 2009

Click here to bookmark this link.Channel Image22:59 jTimelineIntro» yhsif.com - HomePage
2009-05-01 22:59:27 by YuxuanWang - + license and source
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image22:52 jTimelineChangelog» yhsif.com - HomePage
2009-05-01 22:52:59 by YuxuanWang - * initial v0.1
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 27 April, 2009

Click here to bookmark this link.Channel Image20:47 A script for Columbus V-900 GPS» La Vita è Bella

Columbus V-900 is so far the GPS that best fit my requirements: it can log, it can take waypoints while logging, and it (can) have a big storage for logging (via TF card). I got one from WC, a friend to give it a try.

It log GPS tracks to CSV format, WC wrote a script to convert it to the GPX format, but without waypoints. So I rewrote a Python script (as I'm not so familiar with perl), to add the waypoints to the GPX file.

Get the script here, it will use the voice record filename as the name of the waypoint if available, or otherwise just "Waypoint #N". You may want to edit the converted GPX file to rename the waypoints.



tags: , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Thu 02 April, 2009

Click here to bookmark this link.Channel Image03:57 Python script to convert from IP range to IP mask» La Vita è Bella

This script will convert a line contains start and end IP separated by space like:

221.192.0.0 221.199.207.255

Into IP mask format (with comment) like:

#221.192.0.0 - 221.199.207.255
221.192.0.0/14
221.196.0.0/15
221.198.0.0/16
221.199.0.0/17
221.199.128.0/18
221.199.192.0/20

The script is:

 1 #!/usr/bin/env python
 2
 3 import sys
 4 import re
 5
 6 def ip2int(ip) :
 7         ret = 0
 8         match = re.match("(\d*)\.(\d*)\.(\d*)\.(\d*)", ip)
 9         if not match : return 0
10         for i in xrange(4) : ret = (ret << 8) + int(match.groups()[i])
11         return ret
12
13 def int2ip(ipnum) :
14         ip1 = ipnum >> 24
15         ip2 = ipnum >> 16 & 0xFF
16         ip3 = ipnum >> 8 & 0xFF
17         ip4 = ipnum & 0xFF
18         return "%d.%d.%d.%d" % (ip1, ip2, ip3, ip4)
19
20 def printrange(startip, endip) :
21         bits = 1
22         mask = 1
23         while bits < 32 :
24                 newip = startip | mask
25                 if (newip>endip) or (((startip>>bits) << bits) != startip) :
26                         bits = bits - 1
27                         mask = mask >> 1
28                         break
29                 bits = bits + 1
30                 mask = (mask<<1) + 1
31         newip = startip | mask
32         bits = 32 - bits
33         print "%s/%d" % (int2ip(startip), bits)
34         if newip < endip :
35                 printrange(newip + 1, endip)
36
37 while 1 :
38         line = sys.stdin.readline().strip()
39         if not line : break
40         chars = line.split(" ")
41         print "#%s - %s" % (chars[0], chars[1])
42         ip1 = ip2int(chars[0])
43         ip2 = ip2int(chars[1])
44         printrange(ip1, ip2)
45



tags: , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Fri 27 March, 2009

Click here to bookmark this link.Channel Image09:10 NucleusCMS patch: use UTF-8 base64 to encode email subject» La Vita è Bella

The emails sent by NucleusCMS (e.g. new comment notification) didn't encode the subject, but just put the raw text there. For english language file, that's OK. But for other languages such as Chinese, it's not that good. It will produce garbled text on the subject (but not always garbled, weird).

So I wrote this patch to resolve this problem. Google tell me that if I want to encode an email subject in PHP, I should use the mb_encode_mimeheader() function. But Dreamhost just didn't provide any mb_ functions in PHP. I dug more about email subject encoding, and found that a hardcoded base64 should just do the trick. As the original sending mail code in NucleusCMS hardcoded UTF-8 in the Content-Type, I assume that hardcode UTF-8 in the subject is fine, too.



tags: , , , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Wed 25 February, 2009

Click here to bookmark this link.Channel Image05:07 Note: dhcpd configuration» La Vita è Bella

Although I've got 802.11n working on my Asus Eee Box, copy big files between Eee Box and my lap-top over WiFi is slow (as my Time Capsule is far away). So I use a cable for file copying, that's gigabit!

But I have to set my lap-top's ethernet to use DHCP in office, to avoid 2 network configurations on my lap-top, I need my Eee Box to act as a dhcpd, that can automatically assign an IP to my lap-top, but don't harm the router/nameserver configurations on my lap-top, and the existing DHCP in the WiFi network.

I aptituded the dhcp3-server package, and look into the default configuration file, got this code:

subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.100 192.168.1.254;
}

And it works!



tags: , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 05 January, 2009

Click here to bookmark this link.Channel Image03:09 The high memory usage of Squid with external acl» La Vita è Bella

We configured some Squid 2.6 servers that use external_acl_type to use some headers sent by client for access control. And the authentication isn't username/password routine, but use some tag to calculate hash. When running, the memory used by Squid just keep increasing from time to time, just like it have a memory leak. We tried to disable the acl on some server, and these servers runs just fine.

As external acl run in individual process, even if the acl program have memory leak, the memory used by the squid process shouldn't be growing.

We tried many ways to figure out the problem, but all fails. Finally someone noticed that in the external_acl_type documentation, there's a parameter named "cache", with this description:

result cache size, 0 is unbounded (default)

"unbounded"! So this is the problem. For username/password routine, cache is useful. the next time some user with the same username/password comes, Squid can get the result from cache without communicate with acl program. But for our authentication method, as the headers used to calculate hash is differ from every request, cache is totally useless.

I really hope that "0" means no cache and "-1" means unbounded. But anyway, set "cache" to 1 can do the trick. Now the Squids don't have memory problems anymore, although cache replace will slow them down a bit.



tags: , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Fri 07 November, 2008

Click here to bookmark this link.Channel Image20:01 Got 802.11n working on Asus Eee Box!» La Vita è Bella

In my last blog, I use ndiswrapper for wireless driver and it can only use 802.11g, but not 802.11n. But today I've got the solution!

According to this article on EeeUser forum, the rt2860 chipset released the source code for Linux driver! Download them from the official website, and build it. You will need kernel header package to build the driver.

After successfully build, use "modprobe rt2860sta" to install this module, and you may also add the line "rt2860sta" to your "/etc/mmodules" file to load it automatically every time (but seems that modprobe have done this, you may don't need this step).

Now here's a problem: seems that wpa_supplicant didn't support this driver. So you need to set wireless parameters by iwpriv manually. And the biggest problem is WPAPSK, you can't just input your passphrase to do it. Luckily there's a webpage that can calculate the WPAPSK for us. I'm using WPA2 and it works. I'm not sure about WPA. But WPA is broken! Why don't you move to WPA2? wink

Save the below script to "/etc/restart_wireless.sh" and give it execute privilege:

iface=ra0
w="iwpriv $iface"

total_start=$(date +%s)

init_start=$(date +%s)
echo -en "iwpriv config..."
$w set NetworkType=Infra
$w set AuthMode=WPA2PSK
$w set EncrypType=AES
$w set SSID=Your SSID
# get WPAPSK from http://www.wireshark.org/tools/wpa-psk.html
$w set WPAPSK=Your WPAPSK
echo "done"
init_end=$(date +%s)
init_time=$(($init_end-$init_start))

assoc_start=$(date +%s)
assoc=0
assoc_report=10
assoc_loop=310
echo -n "Associating..."
for ((i=0; $i < $assoc_loop; i++)); do
        if [ "$(iwconfig ra0 2>/dev/null | head -1 | cut -f2 -d: | cut -f1 -d" ")" == "\"\"" ]; then
                if [[ $(( ($i+1) % $assoc_report )) == 0 ]]; then
                        echo -n .
                fi
        else
                echo done
                assoc=1
                break
        fi
        sleep 1
done

if [[ $assoc != 1 ]]; then
        echo failed
        exit 1
fi
assoc_end=$(date +%s)
assoc_time=$(($assoc_end-$assoc_start))

total_end=$(date +%s)
total_time=$(($total_end-$total_start))

echo -e "Time spent (sesconds)\n\tinit: $init_time\n\tassociation: $assoc_time\n\tTotal: $total_time"

Credit to a1l0a2k9, the above script is also from EeeUser forum, but I removed the DHCP part and modprobe part. If you are using DHCP, then you may need the DHCP part and modprobe part from the original script.

Now the "/etc/network/interfaces" part, add the following lines for the ra0 interface:

iface ra0 inet static
up /etc/restart_wireless.sh
address 10.0.14.14
netmask 255.255.255.0
gateway 10.0.14.1
auto ra0

(for DHCP users: change "static" to "manual" and remove the "address", "netmask" and "gateway" lines.)

And now, "ifup ra0", then you're done!



tags: , , , , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Wed 05 November, 2008

Click here to bookmark this link.Channel Image23:31 Debian Lenny on Asus Eee Box» La Vita è Bella

UPDATE: now we have 802.11n!

My old home server is dying these days, so I bought a new Asus Eee Box B202 to replace it. It uses Intel Atom N270 CPU, 1G memory, 80G harddisk, 10/100/1000 Ethernet and 802.11n wireless.

The first thing I do on it is install Debian Lenny, my favourite system for server.

Preparing USB flash for net install

As it didn't come with a cd-rom, I choose USB flash. I use the SD card from my camera and a USB card reader to combine a USB flash, and it can be used to boot successfully.

I prepared the USB flash according to the Debian Lenny documentation, but meet some problems:

  1. Google for hd-media returned the hd-media link for Sarge as the first result, I used the boot.img.gz from Sarge and lenny-businesscard iso but the iso can't be found by the installer, so the installer (boot.img.gz) and the iso must match.
  2. The hd-media from Lenny and the Lenny beta2 iso didn't match, neither. The installer can recognize the iso, but complain about mismatched kernel version, and prompt you that it need network update. But the installer from boot.img.gz didn't come with ethernet driver, so it will fail and can't continue.

So finally I have to use "the flexible way" and net install. I use the initrd.gz that have ethernet driver, and the vmlinuz from Lenny hd-media. None of the iso is needed (and you can't use them), all packages will be downloaded from one of the Debian mirrors.

After prepared the USB flash, DON'T FORGET to lock the write protection lock before boot. It will save your life later.

Install Debian

Boot from the prepared USB flash, and it contains only GRUB CLI, so you need to boot the installer manually:

root (hd0,0)
kernel /vmlinuz
initrd /initrd.gz
boot

Now you have a Debian Installer that can drive your ethernet card, so you're ready to install.

Install steps are normal, nothing more to say until the grub-install step.

grub-install failure

On the grub-install step, it will complain that grub-install (hd0) failed. Why? cause (hd0) is your USB flash and (hd1) is your harddisk! That's why lock the write-protection lock is important, or otherwise it may succeed without write your harddisk mbr. That's really stupid. Manually install grub on (hd1) and it will continue.

And the installation completes.

The X problem

After installation, you may find that your X didn't work. This is because it uses a Intel Graphic chipset for lap-top, but it's not lap-top. Ubuntu wiki have the solution, and it works.

Wireless driver

UPDATE: follow my next blog article for official driver and 802.11n!

After installation, the first important thing to do is to drive the wireless card. It uses AzureWare card which uses a rt2860 chipset. And luckily, ndiswrapper can do it.

Follow the instructions on Debian wiki to install ndiswrapper. The Windows driver is on the CD (you have another computer to read the CD and copy the driver to the Eee Box, do you?), I used the WIN2KXP one. After install ndiswrapper, it works.

But there are some problem in the /etc/network/interfaces, if you use WPA (I didn't get thie problem when using WEP):

auto wlan0
iface wlan0 inet static
address 10.0.14.14
netmask 255.255.255.0
gateway 10.0.14.1
wpa-conf /etc/wpa_supplicant.conf

The configure above can be used to connect router (that I can see it from router admin), but the IP 10.0.14.14 can't be reached by another computer in the subnet. But if you execute an extra:

# ifconfig wlan0 10.0.14.14

Then it will be OK. I don't know why but if I move the "auto wlan0" line after the "wpa-conf" line, it works fine. Maybe it must wait wpa-supplicant to do something first?

Another problem is that it can only use 802.11g wireless, if anyone knows how to drive it to 802.11n, please tell me smile

The end and photos

Finally, I have a new home server now.

Asus Eee Box

Asus Eee Box

Asus Eee Box

Asus Eee Box



tags: , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Thu 09 October, 2008

Click here to bookmark this link.Channel Image01:40 Note: git-svn recover from svn failures» La Vita è Bella

My company uses svn, and a VPN without Mac client. So I can't commit from home. In order to manage my off-time works, I use git-svn on my MacBook Pro.

Today I'm going to sync my 2 commits in git to svn, using:

$ git svn dcommit

But after committed the first change, the svn server have no spaces left! So the second commit was failed:

End of file found: Can't read file '/tmp/report.tmp': End of file found at /usr/bin/git-svn line 3856

After svn admin resolved this problem, and I dcommit again, but it still fails:

Merge conflict during commit: File or directory '***.cpp' is out of date; try updating: The version resource does not correspond to the resource within the transaction. Either the requested version resource is out of date (needs to be updated), or the requested version resource is newer than the transaction root (restart the commit). at /usr/bin/git-svn line 461

And I've tried

$ git svn fetch

but the problem remains. So I decided to manually commit that change.

First, generate a patch from git ("HEAD^" means make a patch against the parent of HEAD, so it's my last change):

$ git format-patch HEAD^

And this command will generate a 0001--***.patch file. Then, use "svn co" to checkout a svn working copy, and apply that patch:

$ patch -i /path/to/0001--***.patch -p1

Then, get my last commit log from "git log", then use "svn ci" to commit it.

Now back to the git working copy, rebase svn:

$ git svn fetch
$ git svn rebase

Then try dcommit again, no conflicts and no commit made (as the svn repository is already up to date).

Hooray!



tags: , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 11 August, 2008

Click here to bookmark this link.Channel Image09:51 Note: how to delete an error calendar in Lightning» La Vita è Bella

As Bug #428274, I can't accept any meeting requests sent to my work mailbox, and have to add the meetings into Lightning manually. This is really annoying. As the bug got fixed, I decided to upgrade Lightning to a 0.9pre nightly to get it working.

After upgrading, the following error dialog will greet me every time I start Thunderbird:

The error message after I upgrade Lightning to 0.9pre nightly

I googled this error message and found that it was caused by the incompatible extension ThunderBirthDay. OK, delete the calendar should fix it. No! The calendar was hide from Lightning's calendar list!

Fine, downgrade Lightning and then remove the calendar should work. But unfortunately, Lightning 0.9 have changed the storage format and can't downgrade to 0.8 anymore.

So how to delete that calendar? Maybe I should delete the calendar direct from Lightning's storage. According to the official FAQ, it's stored as an SQLite database file.

Under Thunderbird's profile directory, I got a "storage.sdb" file. I tried to use the command line sqlite to open it, and it works:

$ sqlite3 storage.sdb 
SQLite version 3.5.0
Enter ".help" for instructions
sqlite> .tables
cal_attachments              cal_metadata               
cal_attendees                cal_properties             
cal_calendar_schema_version  cal_recurrence             
cal_calendars                cal_relations              
cal_calendars_prefs          cal_todos                  
cal_calmgr_schema_version    cal_tz_version             
cal_events                 

The "cal_calendars" table seems to be the one I'm looking for:

sqlite> select * from cal_calendars;
1|storage|moz-profile-calendar://
2|thunderbirthday|moz-abmdbdirectory://abook.mab

Yes it is! so I need to know how to delete that record:

sqlite> .schema cal_calendars
CREATE TABLE cal_calendars (id INTEGER PRIMARY KEY, type TEXT, uri TEXT);

OK, then this should work:

sqlite> delete from cal_calendars where type = "thunderbirthday";
sqlite> select * from cal_calendars;
1|storage|moz-profile-calendar://

It DOES work!

Now my Thunderbird is quiet on starting.

But, the guys in Lightning really should give a chance to delete calendars that aren't compatible. I should file a bug for it. I've filed Bug #450121!



tags: , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Thu 10 July, 2008

Click here to bookmark this link.Channel Image21:25 Don't try to fool compilers» La Vita è Bella

There's a macro in ACE to eliminate a compiler warning:

379 // Some compilers complain about "statement with no effect" with (a).
380 // This eliminates the warnings, and no code is generated for the null
381 // conditional statement.  @note that may only be true if -O is enabled,
382 // such as with GreenHills (ghs) 1.8.8.
383 # define ACE_UNUSED_ARG(a) do {/* null */} while (&a == 0)

But when I use this macro, gcc 4.3 will complain:

warning: the address of ‘a’ will never be NULL



tags: , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 26 May, 2008

Click here to bookmark this link.Channel Image05:33 MiaoIntroZh» yhsif.com - HomePage
2008-05-26 05:33:10 by YuxuanWang - + cancelled
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image05:29 Miao cancelled» La Vita è Bella

I've started the Miao project one year ago, aim to build a smart pinyin input method for Mac. But I just got a new job 2 weeks after I started this project. This is quite a busy year, and I haven't really wrote much code for it.

A month ago Yong Sun from Sun begin to port SunPinyin to Mac, and now it's more than just works. I'm satisfied with the Mac port and use it everyday. As the Miao project is scratching my own itch, and I'm not itchy anymore, I should call it a day.

Sorry for anyone who waits for Miao, but I'm not going to reinvent the wheel.



tags: , , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Wed 07 May, 2008

Click here to bookmark this link.Channel Image08:19 Some facts about Apple Time Capsule performance» La Vita è Bella

On the Mac side, the initial backup takes me about 6 hours to backup 126GB data, by ethernet cable, so the speed is about 20GB/hr.

The writing speed via 802.11n wireless is as below:

fishy@Makelele:~/Video$ dd if=Pixar\ -\ Lifted.wmv of=/Volumes/Cacapa-1/foo.wmv
91582+1 records in
91582+1 records out
46890385 bytes transferred in 15.478993 secs (3029292 bytes/sec)

That's about 3MB/s. So I think the speed on Mac is acceptable, but it should be faster.

On the Linux side, I use Debian Lenny, with samba, afpfs-ng and a 100M ethernet cable (my Linux machine didn't come with a Gigabit ethernet port). The facts are:

Writing via AFP:

root@deBoer:~# dd if=prog03.mdb of=foo/foo.mdb
8736+0 records in
8736+0 records out
4472832 bytes (4.5 MB) copied, 6.89061 s, 649 kB/s

Writing via SMB:

root@deBoer:~# dd if=prog03.mdb of=/media/cacapa/bar.mdb
8736+0 records in
8736+0 records out
4472832 bytes (4.5 MB) copied, 6.57683 s, 680 kB/s

Reading via AFP:

root@deBoer:~# dd if=foo/bar.mdb of=bar.mdb
8736+0 records in
8736+0 records out
4472832 bytes (4.5 MB) copied, 8.87068 s, 504 kB/s

Reading via SMB:

root@deBoer:~# dd if=/media/cacapa/foo.mdb of=foo.mdb
8736+0 records in
8736+0 records out
4472832 bytes (4.5 MB) copied, 0.919922 s, 4.9 MB/s

So the conclusion is that, for writing, AFP and SMB are both slow. But for reading, SMB is much much faster than AFP, so you should use SMB to connect a Time Capsule on Linux.



tags: , , , , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Tue 29 April, 2008

Click here to bookmark this link.Channel Image05:28 Apple Time Capsule hand on» La Vita è Bella

After long waiting, I got one finally.

The box:

Time Capsule - the box

Unboxing:

Time Capsule - unboxing

And then working!

Time Capsule - working

And here's a note, the command to limit my 1TB Time Capsule use only 500G for backup (so that I can use the other 500G for other stuffs), according to the comment of this hint:

hdiutil resize -size 500g -shrinkonly /Volumes/path/to/sparsebundle/

But the speed of backup is really really slow, that disappointed me. What a shame! It would be perfect if the backup speed up.



tags: , , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 14 April, 2008

Click here to bookmark this link.Channel Image07:03 Flickr Video vs. Youtube» La Vita è Bella

Finally, Video on Flickr!

I've uploaded a test video:

And here's the same video on youtube, to be compared:

So here's the comparison:

  • Speed: youtube is much much faster than flickr, anyway, youtube consumed half of California's bandwidth, so it's no surprise.
  • Who can upload: everybody, every free users can upload to youtube, but only pro users ($24.95/y) can upload videos to flickr now.
  • Geotag: you can geotag your video on flickr, but seems that you can't do it on youtube.
  • Original file: you can download the original file of your video in flickr's embed page, so in case you lost your original file, it's a way to get it back.
  • Sizes: there's only 1 size on youtube, but many sizes on flickr to embed.
  • Group: on flickr, you can group your videos along with your photos, so the photos/videos can be grouped together.
  • Privacy control: you can filter viewers with your flickr contacts, as I already have a community on flickr, but not on youtube.

So, from now on, I may move from youtube to flickr, flickr rocks!



tags: , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Fri 21 March, 2008

Click here to bookmark this link.Channel Image11:01 WikiCategory» yhsif.com - HomePage
2008-03-21 11:01:36 by WikkaInstaller - Upgrading from 1.1.6.3 to 1.1.6.4
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sat 01 December, 2007

Click here to bookmark this link.Channel Image21:35 Yet another NP_Trackback hack» La Vita è Bella

I've got an email from my host administrator to warn me that one of my MySQL table consumed lots of system load, and the table is nucleus_trackback.

But I haven't got any "real" trackbacks, so they are all spams, and more accurate, crazy spams, that simply too much to overload my DB.

So I have to wrote this patch to add an option to NP_Trackback: drop blocked trackbacks directly. After enabled, trackbacks that blocked by NP_Trackback (failed spam test or no link) will not be stored into the DB.



tags: , , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 19 November, 2007

Click here to bookmark this link.Channel Image07:38 AFP versus SMB» La Vita è Bella

I have a Linux file server in my home running Debian Lenny, and I always use SMB for file sharing, it have a very very bad performance. Today I suddenly remember Apple have an AFP protocol, so gave it a try.

I use "apt-cache search afp" to find out that there's a package named "netatalk" can provide AFP file sharing, so install it. But I can only login use guest account, not my system user, from Leopard.

I googled it and found that the problem is: on the Debian side, as a license issue, the Debian package didn't come with SSL support; on the Leopard side, it didn't allow you exchange your password with AFP server without SSL. So the solution is build netatalk yourself, with SSL.

The building steps are described on this blog, and I also disabled atalkd as the author suggested, it caused netatalk to start-up much faster than before.

So finally I got a AFP server for my Mac (compare this icon to the famous BSOD icon for SMB servers in Leopard razz ):

AFP server icon in Leopard

And as expected, AFP is much much faster than SMB, here's the write test:

For AFP:

fishy@McManaman:~$ dd if=/dev/zero of=/Volumes/Home\ Directory/foo
^C57345+0 records in
57345+0 records out
29360640 bytes (29 MB) copied, 11.0833 s, 2.6 MB/s

And for SMB:

fishy@McManaman:~$ dd if=/dev/zero of=/Volumes/fishy/bar
^C4235+0 records in
4235+0 records out
2168320 bytes (2.2 MB) copied, 10.6889 s, 203 kB/s

I'm impressed!



tags: , , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sat 27 October, 2007

Click here to bookmark this link.Channel Image01:54 Gmail IMAP and Date in emails» La Vita è Bella

UPDATE: As in RFC 2822, the format Gmail used is "obsolete", which means although it's not recommended, clients such as Thunderbird should support it.

Finally I've got my Gmail account with IMAP access. I use Thunderbird as the mail client, and find that the "date" of many mails are the time I retrieved them via IMAP, which is incorrect.

These mails including gtalk chat logs and Gmail invitation accepted responses, that means most of the mails are sent/generated by Gmail.

An incorrect date mail have a Date line in the headers like this:

Date: Fri, 1 Dec 2006 05:35:25 -0800 (PST)

And a normal mail have a Date line in the headers like this:

Date: Thu, 21 Dec 2006 19:16:34 +0800

Seems that the problem is, Thunderbird didn't recognize a Date line with a 3-letter timezone description(the "PST" in this example), so it use the date retrieved instead.

As most of mail clients (even Gmail itself) didn't add this timezone description in the Date line while sending a mail, I guess it's Gmail's fault to add it into the chat logs and invitation responses to make it unstandard? Anyone can tell me what's the definition in the RFC?



tags: , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sun 16 September, 2007

Click here to bookmark this link.Channel Image07:06 Patches to make NucleusCMS plugins multi-blog ready» La Vita è Bella

I was struggling to find a good multi-blog system to replace LifeType used on buddie5.com in the past few weeks. I've tried Movable Type but didn't feel satisfy with it. Finally I found that NucleusCMS, which is used here, have good support for multi-blog, so I think it's the solution for me.

Although NucleusCMS itself have good support for multi-blog, as it's mainly used as a single blog system like WordPress, nearly none of the plugins considered the multi-blog situation.

So I made patches for the plugins I used, to make them multi-blog ready.

These patches generally move some option from global to blog, so that every blog can have its own setting. And for some plugins that have an admin area, I also filtered the things it can admin to avoid security risk.

  • patch for NP_TrackBack 2.1.0:
    1. move notify options into blog settings (Notify, NotifyEmail and NoNotifyBlocked)
    2. show admin area when user is blog admin (copied from NP_Referer 1.0 code biggrin )
    3. in admin area, user can only see/manage the trackbacks in a blog he have admin privilege
  • patch for NP_Referrer 1.0.1:
    1. roll back to 1.0 to show admin area for non-admin users
    2. in admin area, user can only see/modify the referrers in a blog he have admin privilege
  • patch for NP_Calendar: move the locale option into blog option
  • patch for NP_RSSItem: move lang, RSSLink and RSSImage option into blog option.
  • patch for NP_WeatherReport: move city_name, city_id and unit option into blog option.


tags: , , , , , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Tue 14 August, 2007

Click here to bookmark this link.Channel Image06:18 Sync your Lightning with your iCal» La Vita è Bella

I love Thunderbird, so I use Thunderbird + Lightning instead of Mail.app + iCal as my personal schedule and mail solution.

Also it's promised to have a syncing feature, it didn't have now. But I need the ability to sync my schedule with my Palm Treo 680. I can sync my Palm with iCal, so getting the linkage between Lightning and iCal is a good way to do this.

First, I installed the Provider for Google Calendar extension to get the bidirectional access to Google Calendar to Lightning.

Then, I use GCALDaemon to sync my iCal with Google Calendar. It can also sync Google Calendar with Lightning, but Provider for Google Calendar is much better at this.

Now if I add/modify/remove an event in Lightning, Provider for Google Calendar will update my Google Calendar immediately. Later, GCALDaemon will find the update, and update iCal. Now I sync my Palm with my computer, it will get the update.

If I update an event in my Palm, and sync it to iCal, GCALDaemon will update Google Calendar later, and then Lightning will update it later.

So it works.

Make a symbolic link with the ics file of Lightning and iCal may also work, but I can't find the ics file for Lightning razz

You can subscribe my busy/available status on Google Calendar now smile

This should also works for Mozilla Sunbird.



tags: , , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Wed 01 August, 2007

Click here to bookmark this link.Channel Image02:55 The reversed diff» La Vita è Bella

We use diff to find out the different lines in 2 files, but sometimes we also need to find out the same lines in 2 files. So we need the "reversed diff"

And this command can be used as the reversed diff:

cat file1 file2 | sort | uniq -d



tags: , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 09 July, 2007

Click here to bookmark this link.Channel Image00:58 Deal with 2 versions of iconv.h» La Vita è Bella

There're 2 versions of iconv.h in which the iconv() have different prototypes.

In Debian, it's:

43 extern size_t iconv (iconv_t __cd, char **__restrict __inbuf,
44                      size_t *__restrict __inbytesleft,
45                      char **__restrict __outbuf,
46                      size_t *__restrict __outbytesleft);

And in other systems, such as Mac OS X, it's:

83 extern size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);

So you can see that the second parameter, "inbuf", can be "const char **" or "char **"

It will make a big problem while writing code for both systems. One resolution is to use condition compile ("#ifdef" blah blah...), but RoachCock@newsmth give me another (and much better) resolution: use operator overload (so it's C++ only):

133 struct iconv_param_adapter {
134         iconv_param_adapter(const char**p) : p(p) {}
135         iconv_param_adapter(char**p) : p((const char**)p) {}
136         operator char**() const
137         {
138                 return (char**)p;
139         }
140         operator const char**() const
141         {
142                 return (const char**)p;
143         }
144         const char** p;
145 };

When you calling "iconv()", call it like this:

111         size_t res = iconv(data, iconv_param_adapter(&s), &inbytesleft, &outnew, &outbytesleft);

Thank you RoachCock!



tags: , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 18 June, 2007

Click here to bookmark this link.Channel Image03:46 Add GBK encoding support to expat» La Vita è Bella

expat is a good XML parser, light and quick. But it only support latin1, UTF-8 and UTF-16 naturally, if you want to use it to deal with other encoding XML's, you need to set a unknown encoding handler.

I use libiconv to convert the GBK string to Unicode for expat.

First, implement a function to pass to XML_SetUnknownEncodingHandler:

int
XML_Stream_Parser::xml_unknown_encoding(void* data, const char* name, XML_Encoding* info) {
        iconv_t cd;
        if(strncasecmp(name, "GB", 2) != 0 || (cd = iconv_open("UCS-2BE", name)) == (iconv_t)-1) {     // not GB, unsupported
                fprintf(stderr, "can't convert %s\n", name);
                return 0;
        }
        for(size_t i=0; i<128; i++) info->map[i] = i;
        for(size_t i=128; i<256; i++) info->map[i] = -2;
        info->convert = XML_Stream_Parser::xml_convert_gb;
        info->release = XML_Stream_Parser::xml_convert_release;
        info->data = cd;
        return 1;
}

In this function, I tell expat that for GBK encoding, ASCII 0~127 is left as is, and ASCII 128~255 will need to be dealt together with the next byte.

Then implement the "convert" and "release" functions:

int
XML_Stream_Parser::xml_convert_gb(void* data, const char* s) {
        const size_t out_initial = 4;
        size_t inbytesleft = 2, outbytesleft = out_initial;
        char *out = new char[out_initial], *outnew = out;
        size_t res = iconv(data, &s, &inbytesleft, &outnew, &outbytesleft);
        int ret = 0;
        if(res == (size_t)-1) {
                fprintf(stderr, "error in conversion\n");
                delete []out;
                return '?';
        }
        for(size_t i = 0; i < out_initial - outbytesleft; i++)
                ret = (ret<<8) + (unsigned char)out[i];
        delete []out;
        return ret;
}

void
XML_Stream_Parser::xml_convert_release(void* data) {
        iconv_close(data);
}

In "convert", I use iconv to convert the string to unicode, and return the unicode to expat.

The limitation in this interface is that it can't deal with 4-byte GB18030 codes, as I can't judge whether it's a 4-byte code just by the first code.

Anyway, I suggest that all XML should be encoded to UTF-8, so that this is unneeded razz



tags: , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sat 09 June, 2007

Click here to bookmark this link.Channel Image20:43 Farmr» La Vita è Bella

farmr is a GreaseMonkey script.

It's purpose is to recover some image source URL that was f'ed by some firewall, with the URL with web proxy.

I used the web proxy code from gladder, credit to gneheix.

For Camino users that can't use GreaseMonkey directly, you can use GeekMonkey.

Enjoy it and f' back.



tags: , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 21 May, 2007

Click here to bookmark this link.Channel Image09:38 Simple SQLite test C program, without callbacks» La Vita è Bella

I need some efficient way for Miao for word database, and I guess SQLite is the solution. So I wrote this simple test program to get familiar with SQLite API. (read more for the program)

And there's something should be kept in mind: don't use "`"s.

As I used to use MySQL before, I always put "`" in SQL statements, for example:

create table `foo` (`bar` int)

It's OK in SQLite command line program, but not in the C library.

When I execute a SQL query with "`", I'll get this error message:

sql error #1: unrecognized token: "`"

So I deleted "`"s in the SQL statement, but still get this error message:

sql error #4: malformed database schema - unrecognized token: "`"

This really drive me crazy, as I don't know what's wrong. But finally I've got the reason: that's because there's "`" in the "create table" statement. So I recreated the table and rerun the program, it's finally OK now.

The program:

 1 #include <stdio.h>
 2 #include <stdlib.h>
 3 #include <sqlite3.h>
 4
 5 #define NAME "miao.db"
 6
 7 int main() {
 8         sqlite3 *db;
 9         sqlite3_stmt *stmt;
10         int rc;
11         char *errmsg = 0;
12
13         rc = sqlite3_open(NAME, &db);
14         if(rc) {
15                 fprintf(stderr, "can't open db %s: %s\n", NAME, sqlite3_errmsg(db));
16                 sqlite3_close(db);
17                 exit(1);
18         }
19         rc = sqlite3_prepare(db, "select * from words", 0, &stmt, 0);
20         if(rc!=SQLITE_OK) {
21                 fprintf(stderr, "sql error #%d: %s\n", rc, sqlite3_errmsg(db));
22         } else while((rc = sqlite3_step(stmt)) != SQLITE_DONE) {
23                 switch(rc) {
24                 case SQLITE_BUSY:
25                         fprintf(stderr, "busy, wait 1 seconds\n");
26                         sleep(1);
27                         break;
28                 case SQLITE_ERROR:
29                         fprintf(stderr, "step error: %s\n", sqlite3_errmsg(db));
30                         break;
31                 case SQLITE_ROW:
32                         {
33                                 int n = sqlite3_column_count(stmt);
34                                 int i;
35                                 for(i=0; i<n; i++) {
36                                         printf("%s = ", sqlite3_column_name(stmt, i));
37                                         switch(sqlite3_column_type(stmt, i)) {
38                                         case SQLITE_TEXT:
39                                                 printf("%s", sqlite3_column_text(stmt, i));
40                                                 break;
41                                         case SQLITE_INTEGER:
42                                                 printf("%d", sqlite3_column_int(stmt, i));
43                                                 break;
44                                         case SQLITE_FLOAT:
45                                                 printf("%f", sqlite3_column_double(stmt, i));
46                                                 break;
47                                         case SQLITE_BLOB:
48                                                 printf("(blob)");
49                                                 break;
50                                         case SQLITE_NULL:
51                                                 printf("(null)");
52                                                 break;
53                                         default:
54                                                 printf("(unknown: %d)", sqlite3_column_type(stmt, i));
55                                         }
56                                         printf("\n");
57                                 }
58                         }
59                         break;
60                 }
61         }
62         sqlite3_finalize(stmt);
63         sqlite3_close(db);
64 }
65



tags: , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Fri 18 May, 2007

Click here to bookmark this link.Channel Image11:25 Add emacs mode line support to vim, and call for help» La Vita è Bella

Different editor configurations, especially tabstops are always pain for co-work. So if everyone uses vim, you can specify some vim instruction to override one's vim configuration in your file, just like:

// vim:tabstop=4:

And if everyone uses emacs, you can also specify emacs mode line like:

// -*- tab-width: 2 -*-

But what about make vim to read emacs mode line? I've wrote a script to do so.

As I didn't use emacs at all, I don't know which instructions can be specified in the emacs mode line. I just wrote a handler for "tab-width" as an example. If you are familiar with both emacs and vim, please help me to add more handlers into this script.

After more handlers added, I'll submit this script to vim.org.



tags: , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 14 May, 2007

Click here to bookmark this link.Channel Image01:30 Miao: (will be) a new smart pinyin input method for Mac OS X» La Vita è Bella

Why another pinyin input method?

The answer is simple: the current pinyin input methods on Mac doesn't satisfy me. I'm going to scratch my own itch razz

ITABC (comes with Mac) and Pinyin Module in OpenVanilla isn't a smart input method; QIM is smart but it's a shareware, and a expensive shareware (USD 19.99 or RMB 69.00, but only for one major version free update); FIT is smarter than ITABC and free (for charge), but is not smart enough and I don't like some of its feature but can't turn them off.

Miao will be a smart pinyin input method, designed for people who likes to input a whole sentence once. It will learn user's accustoming and finally become a essential tool in inputing (after some training).

The idea and feature

I won't focus on pre-train dictionaries, just like Sogou Pinyin or Google Pinyin. My focus will be on "learning"

For each sentence you input, it will record the words within the sentence, including continuos words and non-continuos words, and calculated for probability.

Continuos word probability will be used to auto-learn new words, that is, if there's a high probability that two known words will comes together, they will be formed as a new word.

Non-continuos word probability will be used for candidate word sorting. The word with the highest probability will get ordered first. As a instance, for the pinyin word "yaoming", if the sentence comes with "huojian"(火箭/Rockets), "maidi"(麦迪/McGrady), it's more likely to be "姚明"(Yao Ming the NBA player); If the sentence comes with "can"(惨/misery), it's more likely to be "要命"(Kill me!).

The license

It may be licensed under GPL or BSD license, it's not decided yet. But I can assume that it will be certainly free, as freedom!

About the name

"Miao" is the pinyin of the Chinese character "", which just like "meow" in English, is "the characteristic crying sound of a cat" (from Oxford American Dictionaries).

It's a pinyin input method, so I choose a pinyin word as its name razz

Other informations

I should write it as a module for OpenVanilla, instead of stand-alone. The reason is that I'm not going to reinvent the wheel. I want to focus on the learning algorithm, but not the system interfaces. And this may make it easier to port into other platforms, for example Linux.

The project homepage will be http://oaim.yhsif.com. I'll start it soon, any contribution, e.g. codes, ideas or artworks, are appreciated.



tags: , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Tue 24 April, 2007

Click here to bookmark this link.Channel Image11:37 Vim Tip: vim and ctags» La Vita è Bella

If you use vim for programming, then you can't live without ctags (can you?). ctags generate the "tags" file, vim and its plugins use this file to help your programming more efficiently.

By default, vim will only use the "tags" file under your current working directory. You can use this command to see it:

:set tags?

Generally, your "tags" file under you current working directory won't contain informations about system libraries (glibc, stl, etc.). If you miss them, you can generate tags file for your system libraries, and ask your vim to load them:

set tags+=/usr/local/include/tags
set tags+=/usr/include/tags

If you are working on a big project, which have many subdirectories, the "tags" file under each working directory may be not enough, as you also need some information about the functions under other subdirectories. So you can generate a "tags" file under your project root, and ask vim to load it when editing a file within your project:

autocmd BufEnter ~/work/myproj/* :setlocal tags+=~/work/myproj/tags

Thanks for Ryan Phillips, you can also add "tags;" (notice the semicolon) to your tags so that vim will automatically look up "tags" file in the file tree (":help file-searching" for document):

set tags+=tags;

To make it easier to use, I've also made a script named "projtags.vim" so that you need only set your project directories in your vimrc:

let g:ProjTags = ["~/work/proj1"]
let g:ProjTags+= [["~/work/proj2", "~/work/proj2.tags"]]

Happy vimming razz



tags: , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 23 April, 2007

Click here to bookmark this link.Channel Image12:18 Live Spaces suck, one more time» La Vita è Bella

Live Spaces made some change days before, and that makes me unable to see any live space pages.

When I use Camino to visit live spaces pages, I always get a "XML Parsing Error", even the page I'm visiting is not the RSS but a html. When I use Firefox or Safari, I always get a HTTP 500 error.

The "XML Parsing Error" is really weird. It seems that the live spaces server send a wrong "Content-Type" so that Camino treat it as a XML document and try to parse it use a XML tree, and that failed (with "view source" I can see the html source corretly).

But Camino didn't have a extension like live HTTP headers to see what Content-Type do the server send, thanks to smorgan on MozillaZine Forums, I can see it using curl.

This is what curl get:

McManaman:~ fishy$ curl -v http://spaces.live.com -o /dev/null 2>&1 | grep Content-Type
< Content-Type: application/xhtml+xml; charset=utf-8

This is what Camino will get:

McManaman:~ fishy$ curl -v http://spaces.live.com -o /dev/null -A "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en; rv:1.8.1.4pre) Gecko/20070408 Camino/1.1b+" 2>&1 | grep Content-Type
< Content-Type: application/xhtml+xml; charset=utf-8

This is what Firefox will get:

McManaman:~ fishy$ curl -v http://spaces.live.com -o /dev/null -A "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0" 2>&1 | grep Content-Type
< Content-Type: text/html; charset=utf-8

And this is what Safari will get:

McManaman:~ fishy$ curl -v http://spaces.live.com -o /dev/null -A "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/418.9.1 (KHTML, like Gecko) Safari/419.3" 2>&1 | grep Content-Type
< Content-Type: text/html; charset=utf-8

As you can see, for some common browsers, such as Firefox or Safari, live spaces server send the right Content-Type. For unknown browsers (including curl, Camino, etc.), it claims that it's "application/xhtml+xml". Oh my god, what did they think they are doing? What can they get from this Content-Type? I can't understand this at all.

So the only word I can say is, "live spaces suck, one more time"



tags: , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Wed 18 April, 2007

Click here to bookmark this link.Channel Image10:24 Note: make ISO image of your disks on Mac OS X» La Vita è Bella

If you prefer DMG or CDR format, then you can just use Disk Utilities to make image of your disks. But if you prefer ISO format, then this is the way.

  1. Insert your disk into your driver, of course.
  2. Unmount it but didn't eject it. To do so, you need to type this command in your Terminal: "sudo umount /dev/disk1". "disk1" may vary depends on your other drivers.
  3. Use dd to create the image: "dd if=/dev/disk1 of=/path/to/foo.iso". Again, "disk1" may vary.
  4. When it's done, you've got the ISO image file, and you may eject the disk now. But as a bug in Finder, you can't eject a volume which you unmounted in Terminal in normal ways. Instead, you need to type this command in Terminal to eject it: "sudo diskutil eject /dev/disk1"

The Finder bug is really annoying, even a logout can't eject the disk, you must reboot your machine. But fortunately I've found the workaround on macosxhints.



tags: , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Wed 21 March, 2007

Click here to bookmark this link.Channel Image06:28 Bash script: batch resize your photos» La Vita è Bella

If you toke some photos by your camera, and want to post them to somewhere (for example, I want to post the photo of my Treo 650 because I'm going to sell it), you may need to batch resize your photos.

This bash script shows how to uses ImageMagick to batch resize your photos:

1 #!/bin/sh
2
3 for file in *.JPG; do
4         convert -resize 1024x768 $file ${file%.JPG}_resize.jpg
5 done



tags: , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 19 March, 2007

Click here to bookmark this link.Channel Image09:42 Note: set proxy for wget» La Vita è Bella

wget -Y -e "http_proxy=host:port" url

"How to set proxy for wget?" I've been asked this question for many times, but it seems didn't appears in the "-h" output nor man page, so I always forgot it.

That's why I'm making a note here smile



tags: , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sun 11 March, 2007

Click here to bookmark this link.Channel Image06:13 My first ever Obj-C hack: Google Reader Notifier» La Vita è Bella

UPDATED: Troels Bay have use another way to do it, please wait for his official build razz

Google Reader Notifier by Troels Bay is a great open source application that provide a desktop notifier for Google Reader, the online feed reader, and also a feed subscriber. As I'm using Camino as my browser, which didn't have a build-in RSS support, I need it even more to subscribe feeds to Google Reader with one click. (not just "notifier" biggrin )

But when subscribe with preview, if there's a "?" in the URL, the problem is that Google Reader will ignore the part after "?". So that for example my photos on Flickr, "http://api.flickr.com/services/feeds/photos_public.gne?id=76236359@N00&format=rss_200" , will be recognised by Google as "http://api.flickr.com/services/feeds/photos_public.gne".

So I wrote this patch to escape URL before submit to Google.

 1 --- Google Reader copy/GRController.m   2007-03-11 18:45:56.000000000 +0800
 2 +++ Google Reader/GRController.m        2007-03-11 18:49:46.000000000 +0800
 3 @@ -1610,7 +1610,15 @@
 4  
 5         if ([[prefs valueForKey:@"dontVerifySubscription"] boolValue] != YES) {
 6  
 7 -               [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[[NSString stringWithFormat:@"%@://www.google.com/reader/preview/*/feed/", [self getURLPrefix]] stringByAppendingString:url]]];                    
 8 +               NSMutableString * escapedUrl = [NSMutableString stringWithCapacity: ([url length]*3)];   // for the worst case the length will growth to 3 times
 9 +               [escapedUrl setString:url];
10 +               [escapedUrl replaceOccurrencesOfString:@"?" withString:@"%3F" options:0 range:NSMakeRange(0, [escapedUrl length])];
11 +               [escapedUrl replaceOccurrencesOfString:@"&" withString:@"%26" options:0 range:NSMakeRange(0, [escapedUrl length])];
12 +               [escapedUrl replaceOccurrencesOfString:@":" withString:@"%3A" options:0 range:NSMakeRange(0, [escapedUrl length])];
13 +               [escapedUrl replaceOccurrencesOfString:@"/" withString:@"%2F" options:0 range:NSMakeRange(0, [escapedUrl length])];
14 +               [escapedUrl replaceOccurrencesOfString:@"=" withString:@"%3D" options:0 range:NSMakeRange(0, [escapedUrl length])];
15 +
16 +               [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[[NSString stringWithFormat:@"%@://www.google.com/reader/preview/*/feed/", [self getURLPrefix]] stringByAppendingString:escapedUrl]]];                      
17                         
18         } else {
19  



tags: , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Fri 02 March, 2007

Click here to bookmark this link.Channel Image06:25 Some (not so many) handy aliases» La Vita è Bella

Under my Debian Linux, when I use screen, I always get some keymap/TERM setting problems, for example, the backspace key never work.

But if I set TERM to "vt100" before launch screen, it's OK, so this alias can resolve the problem:

alias screen='env TERM=vt100 screen'

For the poor network, I always need a multi-thread http downloader. Firefox has a extension DownThemAll!, but after I finish surfing websites (but didn't finish downloading yet), I used to press Command+Q to quit Firefox, and the download was interrupted. lftp has a built-in downloader: pget, so use pget is a good idea:

alias pget="lftp -c pget"

Put the codes into your bashrc file, and restart your terminal, it's done.



tags: , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Fri 26 January, 2007

Click here to bookmark this link.Channel Image07:47 MySQL collation charset problem and patch for NucleusCMS and WikkaWiki» La Vita è Bella

First of all, I must say MySQL sucks!

As from MySQL 4.1, if the database default charset is UTF8 but the default charset setting in my.cnf is not UTF8, you must do a "SET NAMES UTF8" query after connection, to make sure that in this mysql connection, all query will be handled as UTF8. otherwise seems that it will use latin1 as default.

If the "SET NAMES" isn't queried, the articles and comments won't be malformed, but the data that stored in MySQL database isn't actually in UTF8 encoding, so that for example mysqldump, or phpmyadmin, won't get the right data.

So what we need to do is check database's charset setting, and send a "SET NAME" query to ensure we're using the database's charset setting.

I've found that LifeType did this thing, so I copied its detecting code and made patches for NucleusCMS and Wikka Wiki (and also my custom homepage for LifeType, of course!).

But before downloading the patches, I should tell you that:

First, you MUST convert your database. Cause before you patch NucleusCMS or Wikka Wiki, your articles, comments, etc. that already posted, was stored in the old way in the db.

To do that, follow the following steps (this is in case the my.cnf indicate "latin1" but your database was in "utf8", if you're using other charsets, modify them):

  1. mysqldump -h host -u username -ppassword database --default-character-set=latin1 > dump.sql
  2. Edit dump.sql, on Line 10, replace "latin1" with "utf8"
  3. mysql -h host -u username -ppassword database < dump.sql

Second, you must ensure that in your database, ALL charset settings are set to "utf8". The word "ALL" means databases, tables and fields.

Finally, here're the patches: for nucleus, for wikka, released under GPL. WARNING: Use it on your own risk, and make backup before patching.



tags: , , , , , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Tue 23 January, 2007

Click here to bookmark this link.Channel Image05:04 A patch for Gecko based browsers on Mac for buttons» La Vita è Bella

Gecko based browsers, including Mozilla Firefox, Mozilla Camino, Mozilla Seamonkey, optimized 3rd-party builds of Firefox and etc. , didn't display buttons on webpages well on Mac OS X.

For aqua buttons, that shown in Camino and some optimized 3rd-party builds of Firefox, the CJK buttons often be malformed and cause you can't see the text on the button well. For common buttons, they're just ugly.

I've found a hack through the internet, and I'm not so sure what did it actually do (seems to be some dirty tricks), but it works. So I cut off some unnecessary codes and made this patch. To use it, just execute the following command under terminal (Terminal.app or iTerm.app, replace "/Applications/Camino.app" to the path of the app you want to patch):

cd /Applications/Camino.app/Contents/MacOS/res/
patch -i /path/to/moz-forms.patch

And it's done.

Before:
A patch for Gecko browsers on Mac: Aqua buttons, before
A patch for Gecko browsers on Mac: common buttons, before

After:
A patch for Gecko browsers on Mac: Aqua buttons, after
A patch for Gecko browsers on Mac: common buttons, before

I didn't write this patch. I just found it and made it easier to use.



tags: , , , , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sat 20 January, 2007

Click here to bookmark this link.Channel Image11:48 Trying Camino» La Vita è Bella

Camino is superb fast. Much much faster than Firefox and maybe a bit faster than Safari.

Compare to Firefox, it comes with some good system integrations, including Address Book integration, Keychain Access integration, etc. And compare to Safari, it's much closer to Firefox, it also have a "about:config" thing (though a little different from Firefox), and a powerful ad-blocking engine.

So I'm going to give it a week's trial, to see if I can be used to it.

Although it's close to Firefox, it didn't have extensions. So there's something I missing in Firefox:

  1. It can't force links that open a new window to open in new tab. I can use about:config to set "browser.link.open_newwindow" to "1" to disable links that opens a new window, but can't use a new tab instead. Anyway, this is acceptable. At least they won't open lots of new windows to annoy me.
  2. I can't type a site name (e.g. "google" ) and press cmd+enter to automatically surround it with "www." and ".com", this will open it in new tab and use "I'm feeling lucky" search. So I must type more words to input a address.
  3. Keyboard short-cut is different from Firefox, it mixed some Firefox short-cuts and Safari short-cuts up. I don't like this. I prefer a configurable keyboard short-cuts. Maybe I can configure it in System Preferences? UPDATED: Oh yes, I can configure them in System Preferences. This makes me feel much better.
  4. I can't specify the text encoding of the keyword in the search tool-box. Some search engines in China only accept GBK keywords but Camino can only encode keyword in UTF-8.
  5. Lack of spell checkers. It can't use the system spell check for standard text editors (cause it didn't use the standard text editor?), nor the spell checker provided by Google Toolbar for Firefox or Firefox 2.

Anyway, a impressive thing is that the build-in ad-blocking engine is powerful, and the default black-list is very useful that it filtered out almost all the ad from the pages I visited. And if the black-list isn't powerful enough, I can edit it myself.



tags: , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Thu 11 January, 2007

Click here to bookmark this link.Channel Image07:09 Mac is for geeks?» La Vita è Bella

Or at least, Skype for Mac is for geeks? There are some cool stuffs in Skype for Mac, but not available on other platform versions of Skype.

  1. In the chat style tweak window, the chat example is from George Orwell's 1984. Maybe because of Mac begins from 1984?
    "1984" in Skype
  2. In the newest beta (currently) version, the history events was brought on and off with a cool effect, similar to the water wave effect of dashboard.
    Skype for mac: the history effect


tags: , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Fri 05 January, 2007

Click here to bookmark this link.Channel Image08:59 Selective unlink script (to uninstall TeXLive)» La Vita è Bella

In fact, to uninstall TeXLive should be very easy: "rm -Rf /usr/local/texlive", that's all.

But things are sometimes not so easy. If you've chosen to make symbolic links to your system path (/usr/bin) during the installation, like I had, then you have to unlink all the links TeXLive created.

It's hard to do that manually, so I wrote the following script. You just need to run it under your /usr/bin directory and it will unlink all links that pointed to /usr/local/texlive.

 1 #!/bin/sh
 2
 3 tlprefix="^/usr/local/texlive/"
 4
 5 for file in *; do
 6         if [ -L ${file} ]; then
 7                 link=`readlink ${file}`
 8                 tllink=`echo "${link}" | grep "${tlprefix}"`
 9                 if [ -n "${tllink}" ]; then
10                         echo "going to unlink \"${file}\" that links to \"${link}\"..."
11                         unlink ${file}
12                 fi
13         fi
14 done

It unlinked 240 symbolic links from my /usr/bin directory, horrible! I'll never choose the "make symbolic links to your system path" option again during the installation of TeXLive.



tags: , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Wed 06 December, 2006

Click here to bookmark this link.Channel Image22:41 Make sure your often crash daemon is still running» La Vita è Bella

I have used my old lap-top as a home server. Cause I'm using ADSL at home, I have to use a dynamic DNS.

I choosed a Chinese dynamic DNS provider "Peanut Shell", they've provided a Linux client to commit your IP.

But the Linux client they provided is close-source and often crashes. After it crashed, my domain name can't be kept up-to-date.

So I have to write a script to make sure it's still running:

1 #!/bin/sh
2 pid=`pidof phlinux`
3 if [ -z "$pid" ]; then
4         echo "phlinux not running, start it as daemon now..." >&2
5         /usr/local/phlinux/phlinux -d
6 else
7         echo "phlinux is running"
8 fi

Save this script in some place, and make a link to your "/etc/cron.hourly", so it will be checked every hour.

UPDATED: or maybe you don't want to get mail report on every check, I've updated the script, and you should write a script in your "/etc/cron.hourly" instead of link the script, and writes "/path/to/your/script > /dev/null"



tags: , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Wed 22 November, 2006

Click here to bookmark this link.Channel Image04:13 Too cool to refuse: NP_Revision» La Vita è Bella

Yesterday I made a patch for NucleusCMS plugin NP_TrackBack, and post in into the forum. On the forum, I've found another amazing plugin from the same author: NP_Revision

It's amazing because, it can track all your changes, just like a wiki (or CVS/svn)! It can show the old version, and show the diff's.

For instance, this is the diff between revision 1.0 and revision 1.1 of my last post.

But seems for the posts post before installation of this plugin, the time was wrong. I'll try to fix it later.

btw: I've changed the url here from Fancy URL to Fancier URL. So if you're using bloglines or google reader or some RSS reader that track changes, you'll get notify for old items. My apologize for that. Old stuff fancy URLs still works.



tags: , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Tue 21 November, 2006

Click here to bookmark this link.Channel Image11:20 A hack for NP_TrackBack» La Vita è Bella

You are visiting a NucleusCMS powered blog. NucleusCMS is a good blog system, the only (?) problem is that it doesn't support trackbacks itself. So I use the plugin NP_TrackBack to add trackback support.

NP_TrackBack was good, especially on its anti-spam ability. It blocks nearly all my received trackback pings automatically (I haven't got any real trackback yet, all I got were spams).

NP_TrackBack can also send a notification to me when a trackback ping received. But the problem is, that it also send me notification about blocked trackback pings.

I have faith on its anti-spam ability, so I don't wanna get notifications about blocked trackbacks. But I do hope get a notification on real trackbacks. So finally, I've made this hack.

I've added a option to NP_TrackBack not to send notification on blocked pings (see the screenshot below), so that my mailbox won't be spammed instead of my blog. And its default value is "no", so that it won't change your default settings.

NP_TrackBack hack

Here's the patch file and the plugin php file itself (don't forget to replace the ".txt" extension with ".php" ). Cause I've added a option, you can't simply replace your old file if you are currently using NP_TrackBack plugin. You may need to uninstall your old one and install your new one to make it work.



tags: , , , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Fri 03 November, 2006

Click here to bookmark this link.Channel Image03:15 How to install ie in Mac via Darwine» La Vita è Bella
  1. Get the latest darwine distribution from sf, and install it. Files on sf seems differ from files on darwine homepage
  2. Get IEs4Linux
  3. Install wget, cabextract, etc. from MacPorts
  4. Run the ies4linux script. You should need to add wine path into PATH before that. The wine path should normally be: "/Applications/Darwine/Wine.bundle/Contents/bin".
  5. After ies4linux script finished, edit the generated "ie6" script, add the following line(you can also add this line into your bashrc):

    export DISPLAY=":0.0"

After that, you'll be able to use "ie6" to start-up ie 6 via Darwine. Remember to open X11.app first.

Internet Explorer 6 in Darwine

As you can see, the font is really, really ugly, and Chinese characters can't be displayed properly.



tags: , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sat 14 October, 2006

Click here to bookmark this link.Channel Image13:00 Mac OS X Tip: Set 24-hour format time» La Vita è Bella

I hate times that in the "am/pm" format. It's a big waste of screen space, especially when I am using a 13.3 inch screen. I miss the 24-hour format time, but I didn't find it in Mac.

But finally I've found the way:

  1. Open System Preferences
  2. Open International
  3. Click the Format tab
  4. Click the Customize button beside "Times"
  5. Hover your mouse over the hour indicator, and it will show a arrow. Click on the arrow you'll get a drop-down list to choose hour formats.

Here's my snapshot:

Set 24 hour format time in Mac OS X

So I get my 24-hour format time back, in my iCal, Mail, anywhere.



tags: , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Wed 13 September, 2006

Click here to bookmark this link.Channel Image07:51 virtual class in c++» La Vita è Bella

Here's a example to make a virtual class in c++, similar to "interface" in Pascal and Java:

 1 #include <stdio.h>
 2 #include <string>
 3 #include <vector>
 4
 5 class base_foo {
 6 public:
 7         virtual std::string name() { return "base_foo"; }
 8 };
 9
10 class foo: public base_foo {
11 public:
12         std::string name() { return "foo"; }
13 };
14
15 class bar: public base_foo {
16 public:
17         std::string name() { return "bar"; }
18 };
19
20 int main() {
21         std::vector<base_foo*> foo_list;
22         foo f;
23         bar b;
24         foo_list.push_back(&f);
25         foo_list.push_back(&b);
26         printf("%s\n%s\n",
27                         foo_list[0]->name().c_str(),
28                         foo_list[1]->name().c_str());
29         return 0;
30 }

The result of this program is:

foo
bar



tags: , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sat 19 August, 2006

Click here to bookmark this link.Channel Image13:50 QTerm 0.4.0 Intel Mac build(s)» La Vita è Bella

QTerm is a Qt based open source BBS client

I've made a static build of the latest release (0.4.0) on my MacBook. It's a static build, that means you don't need Qt installed, you need just this app to run stand alone. And it's not a Universal Binary, it can only run on Intel Macs

QTerm is designed to be primarily ran on Linux platforms, so that the keyboard shortcuts are in Linux-style. I've also made a modified version to change some of the keyboard shortcuts into Mac-style. The changes include:

  1. alt+0~9 -> cmd+0~9
  2. alt+up, alt+down, alt+left, alt+right -> cmd+up, cmd+down, cmd+left, cmd+right
  3. copy: cmd+c, paste: cmd+v

Here are my builds: original version, modified version. They are bzipped tarballs of ".app", extract them and move qterm.app to your Applications folder.



tags: , , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Thu 13 July, 2006

Click here to bookmark this link.Channel Image06:22 Can google search it out?» La Vita è Bella

Here's a funny domain name: http://www.mamashuojiusuannizhucedeyumingzaichanggoogledounengsousuochulai.cn/

This domain is in Chinese pinyin, which means:

Mom says that, whatever how long your domain name is, Google can also search it out

But, can google really search it out? wink



tags: , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Wed 12 July, 2006

Click here to bookmark this link.Channel Image07:34 libmysqlclient didn't report error while insert duplicate data in primary keys.» La Vita è Bella

Sat 01 July, 2006

Click here to bookmark this link.Channel Image12:58 Name my computers» La Vita è Bella

I've got my new MacBook (hooray!), and decide to name my computers, base on their system.

For my new MacBook, the name's McManaman, he's one of my favorite players razz

Based on this rule, I named my old lap-top with Debian to deBoer.

And finally, I decided to name my router Routledge, this name is perfect for a router, isn't it? wink



tags: , ,
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl