2010年3月31日星期三

[Achieve][Jon Skeet: Coding Blog]Generic constraints for enums and delegates

Generic constraints for enums and delegates

As most readers probably know, C# prohibits generic type constraints from referring to System.Object, System.Enum, System.Array, System.Delegate and System.ValueType. In other words, this method declaration is illegal:

public static T[]GetValues<T>() where T : struct, System.Enum
{
    return (T[]) Enum.GetValues(typeof(T));
}

This is a pity, as such a method could be useful. (In fact there are better things we can do... such as returning a read-only collection. That way we don't have to create a new array each time the method is called.) As far as I can tell, there is no reason why this should be prohibited. Eric Lippert has stated that he believes the CLR doesn't support this - but I think he's wrong. I can't remember the last time I had cause to believe Eric to be wrong about something, and I'm somewhat nervous of even mentioning it, but section 10.1.7 of the CLI spec (ECMA-335) partition II (p40) specifically gives examples of type parameter constraints involving System.Delegate and System.Enum. It introduces the table with "The following table shows the valid combinations of type and special constraints for a representative set of types." It was only due to reading this table that I realized that the value type constraint on the above is required (or a constructor constraint would do equally well) - otherwise System.Enum itself satisfies the constraint, which would be a Bad Thing.

It's possible (but unlikely) that the CLI doesn't fully implement this part of the CLR spec. I'm hoping that Eric's just wrong on this occasion, and that actually there's nothing to stop the C# language from allowing such constraints in the future. (It would be nice to get keyword support, such that a constraint of "T : enum" would be equivalent to the above, but hey...)

The good news is that ilasm/ildasm have no problem with this. The better news is that if you add a reference to a library which uses those constraints, the C# compiler applies them sensibly, as far as I can tell...

Introducing UnconstrainedMelody

(Okay, the name will almost surely have to change. But I like the idea of it removing the constraints of C# around which constraints are valid... and yet still being in the key of C#. Better suggestions welcome.)

I have a plan - I want to write a utility library which does useful things for enums and delegates (and arrays if I can think of anything sensible to do with them). It will be written in C#, with methods like this:

public static T[]GetValues<T>() where T : struct, IEnumConstraint
{
    return (T[]) Enum.GetValues(typeof(T));
}

(IEnumConstraint has to be an interface of course, as otherwise the constraint would be invalid.)

As a post-build step, I will:

  • Run ildasm on the resulting binary
  • Replace every constraint using EnumConstraint with System.Enum
  • Run ilasm to build the binary again

If anyone has a simple binary rewriter (I've looked at PostSharp and CCI;

both
both look way more complicated than the above) which would do this, that would be great. Otherwise ildasm/ilasm will be fine. It's not like consumers will need to perform this step.

As soon as the name is finalized I'll add a project on Google Code. Once the infrastructure is in place, adding utility methods should be very straightforward. Suggestions for utility methods would be useful, or just join the project when it's up and running.

Am I being silly? Have I overlooked something?

A couple of hours later...

Okay, I decided not to wait for a better name. The first cut - which does basically nothing but validate the idea, and the fact that I can still unit test it - is in. The UnconstrainedMelody Google Code project is live!

Published Thu, Sep 10 2009 21:09 by skeet

Posted via web from 米良的实验室

【转载】【铂程斋】山西杀人犯胡文海的最后一段话

警察:知道为什么逮你吗?

胡文海:知道,杀了点人。

警察:杀了一点?你杀了十四个!

胡文海:不止十四个吧?

警察:那你说多少?

胡文海:我记着是十七个。

警察:死了十四个!

胡文海;我不记的还有活的,我都拨拉过,看谁象没死的,就再给两枪。——那就是没杀净。

警察:你知道后果吗?

胡文海:(对警察满脸媚笑)知道、知道,我得给人家抵命。

警察:后悔不后悔?

胡文海:咋不后悔?有个娃娃不该杀人家,你们一说,才知道人家是串门的。再就是,该杀的没杀净。

警察:你还想杀谁?

胡文海:就那几家的男人。

警察:你为啥杀人家?

胡文海:他们当村支书和村主任时,三年挥霍贪污了至少五百万。三个煤矿让他们卖了两个。我到镇上告状没人管。他们就恨的我不行,就想整死我。99年6月19号,我到地里浇水,xxx兄弟(其中一个满门被杀)借口和我吵架,往我头上劈了三铁锹,我缝了几十针。要不是头硬,早让他们劈死了。xxx(村支书)派人找我,要出钱私了,我不干。从那时起,我就起了杀心,本来准备今年三十晚上下手,那时都看春节晚会,能杀干净。6月19号,我把xxx(支书)和村会计叫来,让他们写贪污了多少,他们不干,这时外面有警笛声(路过的警车),xx(会计)就气粗了,指着自己的脑门说:“文海,有本事朝这里打。”我就给他脑门上一枪,把他打死了。他还以为我不敢。没有办法,只能提前动手。……

  后来,当记者再问他后悔不后悔时,他理直气壮的回答:“不后悔,一点不后悔!就是遗憾,没有把该杀的都杀了。”遗憾、没有死净的话,胡文海在不同场合多次提到。据分析,他是担心给他父母妻儿留下后患。

记者问他为什么连孩子一起杀时,他蛮有道理的讲:“不把他们也杀了,他们长大要欺负我家娃娃……”

  法院审判胡文海时,他站的笔直,捧着自辩书大声朗读,就象农村劳模发言。共同受审的还有一个帮他杀人的朋友,胡答辩时说,他朋友没有杀人,跟着他是一直劝他不要杀。这时,控方指出,一个受害者(装死躲过)指证他朋友拿斧子砍过他。胡答辩,我一枪打的他趴在地上,他就再没回头看过,是我捡起斧子砍他的。控方又指出,他朋友拿钳子夹受害者。胡文海当即辩道:是我拿枪逼他干的,他不夹受害者,我就****打他。明目张胆的大包大揽。

  判胡文海死刑后,退庭时,胡逮着一个审过他的干警就握手,边握边说:“先走一步,先走一步。”那么些警察,躲也躲不及他,实是滑稽。

  2001年的12月25日,也是西方人的圣诞节。那天,山西晋中法院依法公开审理了特大枪杀14人案的3名被告人。最后,有2人判处死刑、1人判处无期徒刑。第一被告人胡文海依法定程序在最后陈述中说到:“我生在新社会,长在红旗下……,我希望自己成为一个正直善良的人,为此,我不断的去努力实现自己的理想,自己从小的性格就是仗义执言,敢做敢为。村里的那些无权无势的善良的村民和我和睦相处,有时,我就成了他们利益的代言人。然而,近年来,历任村干部贪污行贿,欺压百姓,村里的小煤矿(村民冒着生命危险)等企业上交的400余万元被他们瓜分。4年来,我多次和村民向有关部门检举反映都石沉大海,公安、纪检、检察、省、市、区的官老爷们给尽了我们冷漠与白眼……。可是,我们到那里去说理呢?谁又为我们做主呢?我去公安机关报案,那些只挣着工资的人民的公务员开着30多万元买的小车耀武扬威,根本顾不上办案,甚至和村干部相互勾结欺压老百姓……。我只有以暴制暴了,我只能自己来维护老百姓的利益了……。实际上,我每年的收入都有4、5万元,我完全可以不管这些事!但是,我不能!我的良心告诉我不能这样做,我不能对此置之度外。官逼民反,我不能让这些蛀虫们再欺压人了……。我知道我将死去,如果我的死能够引起官老爷们的注意,能够查办了那些贪官污吏,我将死而无憾,否则我将变成厉鬼也不放过他们……”听众席上爆发出一阵掌声,审判长急忙制止……

来源:左小祖咒

Posted via web from 米良的草窝

2010年3月30日星期二

【转载】【RFI Chinese】重庆扫黑牵出太子党内讧传闻

重庆扫黑牵出太子党内讧传闻
作者 香港特约记者 郑汉良

本台香港特约记者郑汉良援引香港媒体报道, 重庆扫黑一案牵出太子党内讧的传闻。由重庆市委薄熙来亲自督率的扫黑行动,多名涉案的官员相继出庭受审,日前一名叫李庄的律师,因为涉嫌教唆他的委托人龚刚模伪造证据而被公安拘捕,而李庄的老板不是别人,而是早期中共政法的掌门人彭真的儿子傅洋。香港的苹果日报引述内地知情人士报道,李庄被捕已引发中共太子党的内讧。

李庄于13日被捕,公安指他教唆在扫黑案被捕的一名亿万富豪龚刚模做假证,佯称因为公安严刑逼供才承认控罪,因此在法庭上翻供。但由于李庄所属的北京康达律师事务所,其老板是彭真的儿子傅洋,事务所的副主任郑小虎则是前最高人民法院院长郑天翔的儿子,另一位副主任林星玉则是前人大副委员长林枫之女。知情人士相信,李庄被捕可能涉及太子党的内部矛盾。

此外,有关重庆扫黑一案,官方媒体和法学界的看法也出现了矛盾,分别出现支持扫黑和质疑扫黑两派。央视的一个对话节目日前邀请中国政法大学教授何兵,对重庆做法提出质疑,批评重庆当局「以言定罪」,发布消息「误导舆论」。但《中国青年报》则支持重庆扫黑,连日发文揭露李庄恶行,指他喜欢炫耀自己「上面有人」,「知道我的背景是甚么吗」、「我们有很硬的关系」,矛头暗指李庄幕后的老板。</p><p>据报道,这次太子党的内部矛盾仍在发酵之中,结果可能波及中共高层。

Posted via web from 米良的草窝

Binding Visual Element Visibility to Mouse Over Event in WPF 4.0

I'm working on an user interface demo application in WPF.
I have a group of expander on the ui, and I want the expander show some descriptive text besides its caption while the mouse over it.
I used a TextBlock element to display the descriptive text, which is a child element in the control's visual tree.

At first, I tried to use Style and Trigger to achieve this effect, but failed. Since Style Trigger apply its modification to the exactly same element that fires the trigger, which means if I would like to modify the property TextBlock, I can only fire the trigger by moving mouse over the TextBlock it self but the control that contains the TextBlock.

I tried some other ways, but all failed. Finally, I found I can achieve the effect by Data Binding!
Since TextBlock's Visibility Property is a Dependency Property, and the TextBlock is contained by the Expander Control!
So we can Bind TextBlock's Visibility Property to Expander Control's IsMouseOver Property!
To achieve this, we need Relative Binding Source to locate TextBlock's ancestor element, Expander Control.
Then we need BooleanToVisibilityConverter to convert the bool type value to Visibility value.

Here is the Xaml Code:

<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />

<HierarchicalDataTemplate DataType="{x:Type m:CategoryItem}"
                              ItemsSource="{Binding Properties}">
        <Border>
            <Expander ToolTip="{Binding Tooltip}" IsExpanded="True">
                <Expander.Header>
                    <StackPanel Orientation="Horizontal" >
                        <TextBlock Text="{Binding Name}"/>
                        <TextBlock Name="HeaderDescription"
                                   Margin="10,0,0,0"
                                   Text="{Binding Description}"
                                   Foreground="Green" 
                                   Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Expander}}, Path=IsMouseOver, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                    </StackPanel>
                </Expander.Header>

                <ListBox 
                    DataContext="{Binding Properties}" 
                    ItemsSource="{Binding}"
                    IsSynchronizedWithCurrentItem="True"/>
            </Expander>
        </Border>
    </HierarchicalDataTemplate>

Posted via email from 米良的实验室

【存档】【 看中国】CCTV被封杀山西疫苗视频在网上流出(图)

CCTV被封杀山西疫苗视频在网上流出(图)

2010-03-29 11:03:11   发表评论

一段长约20分钟的关于山西疫苗丑闻的电视新闻采访视频,正在中文视频网站上流传。

"经济半小时"的主持人赵赫主持
“经济半小时”的主持人赵赫主持的“山西疫苗致死黑洞”(看中国视频截图)

该片是两年前,中央电视台二套的“经济半小时”栏目的记者采访制作,由“经济半小时”的主持人赵赫主持,话题正是最近引发许多争议,刚被中宣部禁止传媒跟进报道的山西疫苗丑闻。

目前还不知道,该视频是否由央视员工上传至网络,但可以确认的是,这段新闻片从未在中央电视台播出过。

该片除了采访此事举报人、山西省疾控中心官员陈涛安外,还采访了其他几名中层官员。并引述了刘万永等平面媒体记者对此事的相关报道。

知情人士称,该新闻片采访制作于两年前,即2008年。当时,在播出前一天,中央电视台接到卫生部、国家广电总局联合通知,禁止此片播出,最后,这段采访专题片,只能"当内参"上交相关部委。

官方组织的相关调查并无下文,山西省疾控中心主任栗文元则以澳大利亚旅游为理由出境后,不知所踪。

知情者说,此前"经济半小时"前段时间播出的北大医院医疗纠纷事件也是如此,"那个片子他们保密做得好,卫生部提前不知道。但第二天也不给再重播以及后续报道了。"

"于是,又有几百个孩子被他们害了。"视频后的网友这样评论。两年之后,中国经济时报的记者王克勤用时半年,采访了一百多名疑似因变质疫苗而致病、致残甚至致死的患儿家庭。采写了长篇调查报道,引发社会关注。

目前,中国卫生部已经对疫苗事件非正式表态,要求任何机构和个人,不得对疫苗相关问题作出诊断结论;而中共中宣部则下令中国媒体不得继续报道此事,有派出记者在山西采访的也要求立即召回。

记者发稿时,中文互联网上流传的这段视频还没有被删除。

看中国转贴大陆的这个还未和谐的视频:

http://www.secretchina.com/node/341890

Posted via web from 米良的草窝

【转载】【 FT中文网】【长平】中国需要网络特区吗?

Google撤离中国大陆的烽烟仍在弥漫,国内IT业又传来不和谐的声音。在深圳举行的IT领袖峰会的一个热身活动上,马化腾、王志东、丁健、王维嘉等四位业界高管都对政府的网络监管表达了不满,王志东、丁健还建议将深圳设成互联网监管特区。

将这几位先生的意见和Google事件稍加对比,你会发现很有意思的现象:Google是抗议,他们是抱怨;Google是抗争,他们是进谏;Google宣示自由,他们寻求市场。按照近年来中国舆论的流行说法,他们更具有“理性、建设性”。这到底是资本与权力的合谋意图呢,还是渐进改良的中国式道路?

其中最大的区别在于,很难想象Google会提出建立信息特区的构想。依仗行政权力分而治之,给予不同地区或者不同人群以不同的政策或物质资源,这在本质上是等级制度,与Google的信息自由宣言背道而驰。

在中央集权制国家建立特区,必然形成对于权力的依赖。政策的倾斜固然有利于本地区经济的发展,但是很难形成独立的文化品格。深圳特区三十年来的发展证明,在这个楼价最高的城市里,并没有产生更加独立的媒体、更具活力的艺术、更加繁荣的创意产业和更加自由的网络空间。尽管这个城市的民间社会也有了不可小视的发展,但是更多的时候,它的出产取决于权力的需求。权力需要经济,就让它经济发达;权力需要腐败,就让它腐败成风。

但是,我并不因此无视特区的价值。在整体上窒息的情况下,建立特区具有透风和试验的性质。从统治者的立场说,对互联网的严厉打压并不是为了追求信息窒息,而是为了维护政权稳定。这里面存在统治者权力的合法性及公民权利的基本保障问题,显然不是这几位IT大佬想要讨论的东西,因此丁健先生给出了在此范围内最大胆的建议:“互联网在深圳可以完全放开,不要防火墙过滤,应该看看再更加自由的环境里,互联网是更乱了还是怎么样,这样才可能探索出一个适合中国的互联网监管方式。”

这个呼吁透露出一个显而易见、却又容易被人忽略的信息,那就是信息严控对于IT产业前景的扼杀。尽管中国政府谴责Google把商业问题政治化,但是中国官方媒体在谈论此事时,使用的基本上都是政治语言和政治逻辑。这也难怪,信息自由问题本身就是政治问题,不政治化是不可能的事——事实上,政府所做的一切都是政治。不过,在这个讨论中,产业发展反而被搁置了。王维嘉先生指出,在此次网络严打中,“十几万家网站被关闭,这里面可能会有阿里巴巴、腾讯、百度这样的巨头被扼杀了”。

长期的集权政治下,中国社会流行这样的观念:政治不关我的事,我只是出来打酱油的。毋宁说,中国政府试图寻求这样的道路:政治上严管,经济上宽松。这在一定程度上是可行的,但是稍微拉开一点距离,你就会发现,社会的创造力是一个整体,只要其中一块木板短缺了,这只大桶就会漏水。我们的经济都是复制,我们的文化都很“山寨”,就是这个原因。

这几位先生的抱怨更让人们看到,Google事件并不像国内主流媒体普遍误导的那样,它仅仅是中国政府和美国公司、中国文化和美国文化甚至中国人和美国人之间的关系,是民族主义和帝国主义之间的关系;更重要的是,它就是政府和公司之间的关系,是权力管制和市场自由之间的关系。从这个意义上说,过度管制下的受害者,主要是国内的企业。Google可以抽身而去,国内的企业只能祈望特区。

(注:本文仅代表作者本人观点。)

Posted via web from 米良的草窝

【转载】【凤凰博报】【萧萧落木】挣扎中的中国人

世界上大概凡是有中国人聚集的地方,就非常脏,非常乱,非常难看,非常没有美感。我们在旧金山的中国城里吃饭,海鲜酒家一家挨着一家,挑了一家进去,坐下来,点的都是海鲜,饭菜真给不少,吃不了我们可以兜着走。饭还没吃完,我就开始恶心。因为闻见一股股的异味。我不说话,吃罢饭,我们出来,我呼吸外边的空气,说,这恐怕是我一生最后一次进任何地方的中国餐馆了。我真受不了了!

 

于是我们后来就到小意大利吃饭,饭菜好,服务也好,环境更好。服务人员全是男的,西服革履,黑头发黑眼睛的意大利人,文雅礼貌。世界上最知道如何享受生活的人是意大利人。他们的食物、人物、艺术、音乐都是世界一流的。他们人也好看,饭也好看和好吃。享受这些英俊的意大利人的服务,你觉得自己花的钱值,虽然饭菜的数量不多,但是吃起来也觉得自己文明,不是从饥荒的国家走出来的,吃饭总要实惠一大盘之类的。

 

再说,世界各种饭饭吃多了,觉得中国饭实在不是什么特别好吃的饭,我是在外面宁愿吃西餐也不吃中餐的人。中餐,除了我自己或家里人做的,餐馆的中餐我实在觉得恶心。吃中餐是因为习惯,习惯的东西总是好。可是现在我也习惯了吃西餐,我觉得其实大多数西餐比中餐好吃多了,难怪也比中餐贵多了。

 

我的孩子分析说:中国人的生活一直挣扎。挣扎中的人吃饱了就好,所以中国人吃饭就讲究实惠而不讲究美好。中国的餐馆是给饥饿和贫穷的人提供的,便宜、实惠、不讲究质量,只讲究数量。第二,中国来到美国的人,除了留学来的之外,大部分还是普通而贫困人,他们真的就是觉得大鱼大肉好,东西多就好,实惠就好。

 

我的孩子现在在这里找工作,住在一个中国人家出租的楼下。楼下四间房子,住着三户,大家共用厨房。我的孩子,一对夫妇,从桂林来的,一个母亲和孩子,从上海来的。我跟这对夫妇聊天,他们在这里五年了,租了两间房子,孩子在离这里开车四五个钟头外的大学里上学,刚上二年级。他们在这里打工,挣钱。说起中国,他们满怀怀念,可是又舍不得孩子,就在这里凑合着。孩子一回来,他们就大鱼大肉地做饭,给孩子吃,小小的油腻的厨房里全是猪肉的味道。中国的父母,包括我,都是用饭来表达爱的。另一个母亲带着孩子,孩子在这里上中学。她给孩子做饭等等,住在一个连阳光也不能见的小房间里。还有就是我的孩子。他单身一人。

 

我推开门就闻见中国的味道,鱼腥得恶心,还有人吸烟。我后来见到房东,他正在外边吸烟,大方块脸上全是横肉,看起来像个电影里坏人的打手,脸上全是大疙瘩,广东人的一张面容。我看了吓得直哆嗦,以为见了恶煞。进屋来我对孩子厉声说:你得搬走。这不是人住的地方!我的孩子还跟我顶嘴:“这个房间比其他房间还贵五十块,因为有阳光。你要我怎样?”我出去给他买了一个小暖气,房间里阴冷,我怀疑他会生病。果然他今天给我打电话:他开始吐血。不知道他吃了什么饭!

 

挣扎中的中国人。我不禁叹气。看看我的孩子的桌子上,全是诗歌。拿起一本,HartCrane 的诗歌,美国最难懂的诗人之一,才活了33岁。我觉得简直是噩兆。我说,你能不能别看诗歌了?他不理我。我把诗扔到桌子上,再拿一本,福克纳的小说《我躺着要死的时候》(AsI Lay Dying),也是坏兆。我看看消瘦得比去年秋天掉了二十磅肉的儿子,几乎是绝望地问:“这里有什么好,你非要在这里?”“为什么不来华盛顿找工作,偏在美国失业率最高的地方找工作?”无论我说什么,他都不理我。我们家的这位浪漫主义的下决心当农民的有硕士学位的年轻的诗人,在这个大城市里找不到工作,吃最简单的饭,甚至说自己尽量不吃饭,省得浪费世界上的粮食。

 

邻居赞美我的孩子:你的儿子真好,就是吃饭,都看书。我们天天看见他手里拿着书。他爱看书。我看儿子,却是悲伤:挣扎中的中国人。儿子自十八岁离开家就没有跟我在一起呆过。去年冬天研究生毕业,来旧金山找工作。我这次度假,也是来看看他。结果我到这里,看到他的生活,心里却非常沉重。挣扎中的中国人,包括我的儿子, 也大概包括我。

 

3/19/2010

Posted via web from 米良的草窝

【转载】【萧萧落木】不许进国,不许出国,这个穷折腾……

不许进国,不许出国,这个穷折腾…… 

2010-3-27 10:45:00 BY 沈睿

去年年底今年年初,上海的冯正虎先生不被允许进国。我每天看新闻,看看冯正虎在做什么。我还特地上推特,看他在说什么,看他描述自己每天的日子,每时每刻跟别人的交流,很有意思。冯正虎自己解释说他不被允许进国门是因为他为二十年前的民主运动说了话。我看新闻中描述他为维权人士。进国不久,二月二十八号,冯正虎被上海的警察用车撞;三月三号居然被传讯,指责他被撞则是妨碍了警察的公务。我看中国的新闻,知道那里是一个能把黑的说成是白的地方。

昨天在费城开始持续到周末的亚洲年会,中国知名知识分子崔卫平也是与会参与者。她本来该前天到的,结果被不让出国,不能来参加会议。我今天看新闻,“China Bans Poet from Traveling to US Conference”,觉得十分震惊,亚洲年会,一年一度,是我们这行的人一年一度的聚集,我几乎年年都去,今年因为下个星期要去美国比较文学学会年会,就决定不去了。这样的一学术会议,不让崔卫平来,真说不过去,真给中国政府脸上抹黑。

我上周的文字《挣扎中的中国人》在凤凰网的博客上有一百八九十个读者反应和留言。我看看这些留言,大部分都是骂我是卖国,不爱国的,指出我看不到中国的伟大的,不知道中国饭多好吃的。让我震惊的是难道这些中国人真的不知道中国是第三世界国家?在政治制度、全民生活水平、教育水平上等等落后于第一和第二世界的国家?中国的进步很大,那是跟中国自己比,但是跟别的国家比,中国仍然很落后。骂我喜欢吃西餐是卖国的人是否常吃西餐?一个不常吃西餐的人,不知道西餐的好处。饮食是一种习惯,习惯了就好吃。我吃惊的是中国弥漫的夜郎自大的心理。我以前以为互联网打开了中国的眼界,我现在知道我过高地估计了互联网的作用,过低估计了中国教育的成果。

我的孩子大概昨天晚上看了看我的博客,给我写来一个短信,用了六个问号:“真有中国人民就是不承认中国是一个穷国???WTF???”他十二岁半来美国,他印象中的中国虽然恶劣,但是还是没那么糟糕。看了这些留言他很震惊,忍不住说国骂了。

中国真的是一个穷国,很穷的国家。这种穷,首先是政治的贫穷。中国的政体是一个专制的政体,专制——即使是名声好听的人民民主专制的国家,也是专制。专制就是有些人以人民的名义说了算,其他人民没名义也没份说任何话。就是有些人想不让冯正虎进国,冯正虎就是到了国门口,也被抬回去,抬回飞机里去;有些人想不让崔卫平出国参加一个学术会议,崔卫平就是拿着护照机票也上不了飞机。这种专制迫使整个国家处于政治上的贫穷状态。中国的老百姓哪里有可能参与国家决策和政治?我们就是想,都没门。中国的政治是由少数寡头控制的,老百姓在政治权利上处于赤贫状态。

中国也是一个经济贫穷的国家。大国崛起我们都听多了。我也相信中国在崛起和进步,但是,那是自己和自己比,不是和别人比。我也常常听到中国崛起论者认为中国会成为二十一世纪的超级大国。我不那么乐观。每当别人问我,我就摇头:中国太穷了。你看看那些穷的地方,老百姓的生活刚刚好一点,但是还没有富足,刚刚吃饱或进一步到吃好,还没有从生存的水平提高到生活的水平上,谈什么超级大国?就是大城市,在高楼大厦后的破烂街区,老百姓的生活也是在生存面上挣扎呢。我相信中国作为国家可能是超级大国,但是作为人民却生活得完全没有超级大国的水平。中国的确是美国的债主,那是中国不拿这些钱用于自己的教育、民生民富投资的结果。用本该提高中国老百姓的生活水平的钱,去买美国的国债,让美国人借钱过好日子,逻辑何在?

中国穷还穷在根本没有对自己的自信上。这么大的国家,进步如此巨大,世界都看着和看到中国的进步。可是中国的当局就是不会做自我形象树立的工作。用美国著名记者詹姆斯·法罗的话说,中国当局是世界上最不会做公关的政府,楞能把自己做的好事当成坏事让全世界知道。他不理解为什么。我理解,那是因为本质上对自己的所作所为没有自信,总觉得自己是土改后搬进刘文彩家大院的贫农,活得不踏实,担心别人说他过去是贫农,担心别人说他住在那里不合法。他的其中一招就是不让人进国门,也不让出去,穷折腾。我真不知道崔卫平来美国对参加一个学术会议能对中国有什么危害?不让她出来,到显出中国是一个真正的穷折腾国。

这样的穷国,穷折腾国,真值得网上那么多人表忠诚?不解。

3/26/2010

Posted via web from 米良的草窝

【存档】【CPALives】《尽管去做:无压工作的艺术》GTD洋葱修订奇客审核中文版下载

《尽管去做:无压工作的艺术》GTD洋葱修订奇客审核中文版下载

  最近刚刚读完GTD一书,这本书几年前就已经流入国内,现在国内已经有不少GTD达人达到了“道”的境界,而我还是个刚刚入门的新手。

  现在我已经开始在我的Blackberry手机上使用GTD理念进行实践,在这个过程中,国内很多GTD达人的博客给了我很大的帮助,GTD的入门很容易,但是想要达到和个人习惯的完全融合,这个修炼过程至少要2~3年的时间,但是正因为GTD能够真正提升个人的价值,并且已经经过无数的实例证明它是有效的,才有这么多人加入GTD 的队伍!

什么是GTD?

  GTD,Getting Things Done(完成每一件事)的缩写,来自于David Allen 的一本畅销书《Getting Things Done》,国内的中文翻译本《尽管去做:无压工作的艺术》由中信出版,而在网络上流传的《搞定!-2分钟轻松管理工作与生活》的中文名则是台湾译本的名称。GTD是一个被广泛采用的赋予实际行动的时间管理系统。

GTD的核心理念

  GTD的核心理念在于只有将你心中所想的所有的事情都写下来并且安排好下一步的计划,你才能够心无挂念,全力以赴地做好目前的工作,提高效率。而当你总是有些事萦绕在心头,悬而未决的时候,你要么就是会不时地想起它而影响现在的工作,要么就是会忘记了去做。而GTD通过将所有的这些事都罗列出来再进行分类,确定下一步的处理方法,将所有这些悬而未决之事都纳入我们可控制的一个管理体系中。

  GTD的创始人David Allen提倡建立一个详细的to-do列表,比如说:列出要打的电话,去市区要完成的任务。他还提出一个“二分钟法则”:如果任何一件可以在二分钟内完成的事情,那么就必须马上完成。

GTD流程

收集(Collect)

加工处理(Process)

组织整理(Organize)

回顾(Review)

行动/执行(Do)!

  收集(Collect)就是将你能够想到的所有的未尽事宜(未整理的念头)(GTD中称为stuff)统统罗列出来,放入inbox(收集篮)中,这个inbox既可以是用来放置各种实物的实际的文件夹或者篮子,也需要有用来记录各种事项的纸张或PDA。收集的关键在于把一切赶出你的大脑,记录下所有的工作 。

  加工处理(Process)将stuff放入inbox之后,就需要定期或不定期地进行整理,清空inbox。将这些stuff按是否可以付诸行动进行区分整理,对于不能付诸行动的内容,可以进一步分为参考资料、日后可能需要处理以及垃圾类,而对可行动的内容再考虑是否可在两分钟内完成,如果可以则立即行动完成它,如果不行对下一步行动进行组织。

  组织整理(Organize):个人感觉组织整理是GTD中的最核心的步骤,组织整理主要分成对参考资料的组织与对下一步行动的组织。对参考资料的组织主要就是一个文档管理系统,而对下一步行动的组织则一般可分为:下一步行动清单,等待清单和未来/某天清单。
  等待清单主要是记录那些委派他人去做的工作,未来/某天清单则是记录延迟处理且没有具体的完成日期的未来计划等等。而下一步清单则是具体的下一步行动,而且如果一个项目涉及到多个行动,那么需要将其细化成具体的行动。
  GTD对下一步清单的处理与一般的to-do list最大的不同在于,它作了进一步的细化,比如按照情景(context)(电脑旁、办公室、电话旁、家里、超市)分类管理只有在这些地方才可以执行的行动,而当你到这些地点后也就能够一目了然地知道应该做哪些事情。

  回顾(Review):回顾也是GTD中的一个重要步骤,一般需要每周进行回顾与检查,通过回顾及检查你的所有清单并进行更新,可以确保GTD系统的运作,而且在回顾的同时可能还需要进行未来一周的计划工作。

  行动/执行(Do):现在你可以按照每份清单开始行动了,在具体行动中可能会需要根据所处的环境,时间的多少,精力情况以及重要性来选择清单以及清单上的事项来行动。

  下面是一张由高效率 慢生活博主吴若童同学亲自汉化的新GTD总流程图,十分精美。通过这张图(点击查看大图),可以让你清晰地了解GTD的整个流程是怎样的。

GTD总流程图:点击查看大图

  如果您想对GTD 进行更深入的学习和时间,请您看褪墨GTD资源汇总,以下是我收集的国内一些GTD 达人的博客和论坛:

  最后给大家提供由洋葱修订,我审核校对的《Get Things Done》一书:

  文件信息:1.35MB,最后更新:2010-3-13
  下载地址:GTD-洋葱修订奇客审核版[DOC].rar

  文件信息:2.68MB,最后更新:2010-3-13
  下载地址:GTD-洋葱修订奇客审核版[PDF].rar

下载方法:

  点击上面的链接,在打开页面选择“迅雷专用高速下载”,如下图所示:

  或者选择“千脑网通/电信普通下载地址”,如下图所示:

千脑电信普通下载

  如果您在下载或使用方面有任何问题,欢迎留言。

Posted via web from 米良的草窝

[☭脑瘫党群☭] 关于某张崩盘时间表

From: 雪人
Date: 2010/3/30
Subject: [☭脑瘫党群☭][13971] 关于某张崩盘时间表- .-
To: ntparty@googlegroups.com


图片

  没有哪一个产业能像房地产一样让人爱恨交加。网上流传的中国“房地产崩盘时间表”,是这种“爱恨交加”的又一例证。当人们对一个涉及切身利益的产业的不满以希望它崩盘的形式表现出来时,这需要高度重视。

  这是一个耸人听闻的时间表,是一个恨到牙根的时间表。现实生活中,只有对一个人恨到无法言说的时候,人们才会以极端的语言去攻击那个人。如果不是被高房价刺激得难以忍受,人们不会去细致梳理中日两国房地产背后的相似,并提出这样一个有些诅咒意味的时间表。

  笔者认为,人们的本意并不是真的希望房地产业崩溃,因为这一崩溃带来的影响是深远的,是无法预估的,会给每一个人的生活带来或多或少的影响。作为一个兼具居住和投资的双重属性,又是一个关联着上下游50多个行业的产业,房地产业可谓牵一发而动全身,它的过快上涨和快速下跌都会带来严重的伤害。

  值得重视的是,房地产崩盘表背后的那一份沉甸甸的民意。通过专家的分析,我们可以发现崩盘可能只是一个武断的预言。但这个崩盘表在网上的流传已充分显示了越来越高的房价已超过了多数人的承受能力,他们甚至在“幻想”着房地产的崩溃来表达不满。

  房地产崩盘时间表的流行也是人们对历次调控越调越高的一种心理宣泄。这种带有明显情绪化的宣泄虽然存在着不合理的成分,但也值得高度重视。在万千人瞩目并涉及万千人利益的房价问题上,需要有治标又治本的调控。当然,中国房地产如何调控,恐怕不是一篇文章可以解决的。

  预言总会引起人们对自身的反思。电影《2012》演绎的环境灾难的预言引起了人们对自身生存家园状况的关注,房地产崩盘表作为另外一个预言,也应该得到足够的重视。这种重视不能只是语言上的或者简单的表态,它需要真的以民生为本的调控。

曾在亚洲开发银行任职的经济学家、现任中国发展研究基金会副秘书长汤敏不无忧虑地表示:“现在的楼市,确实和当年的日本非常相似。树长不到天上去,这样下去早晚要出问题。”
图片


影帝威武

我朝威武



【形势要点:国土官僚腐败的前赴后继如何管理好土地资源?】

国土资源部又一官员落马!《华夏时报》

323日从权威渠道获悉,国土资源部地籍管理司监测统计处处长沙志刚于127日被中纪委带走并双规。一位接近国土资源部人士表示,此案很可能与第二次土地调查有关,估计涉案金额在千万以上,甚至有可能超过两千万。由于涉及金额庞大、人员众多,此案或将牵涉到其他官员以及企业,案情至今并未由官方公开,尚在进一步审理中。据悉,时任地籍管理司监测统计处处长的沙志刚,在被带走时已经被提升为地籍管理司副司长,正在等待宣布上任。国土资源部内部流传沙志刚落马还源于一笔9000万的项目。未经证实的细节是,中国测绘科学研究院的前任党委书记、副院长张双占从沙志刚处拿到9000万的项目,张双占未通过中国测绘科学研究院就把该项目转到他自己的私人公司。《华夏时报》从可靠渠道了解到,沙志刚被抓后,中纪委找张双占问过话。而在此之前不久,张还被免去了副院长职务。上述人士还透露,其他涉案人员,还包括北京天目创新科技有限公司总裁程晓阳。由于此案目前仍处于高度保密状态,程晓阳与外界几乎没有任何联系。国土系统的腐败已是公开的秘密,近年来更是高烧不退。几年前,国土资源部原部长田凤山就曾因收受17笔贿赂近500万落马;而国土资源部办公厅原主任、部直属机关党委常委吕国平,也因涉嫌经济与作风问题在2008年被挖出;现在又爆出掌管地籍管理的重要官员出事,国土系统官员上至部长,中有司长,下至处长的腐败可谓是一个都没有少了。只是让如此腐败的国土官僚来掌控中国的土地资源,如何能管理好呢?(ACHW

Posted via email from 米良的草窝

2010年3月29日星期一

【存档】【草民網站】華澤:声援起诉凯迪 还我说话权利

  Normal  0    0  2    false  false  false                                          MicrosoftInternetExplorer4


今天,在北京,一位名叫华泽的女士,向北京市东城区人民法院递交起诉书,起诉凯迪猫眼删帖行为。作为原告的华泽女士,诉求只有一项:被告赔礼道歉,尽快恢复帖子。要求简单明确,无任何其它附带条件。

华泽女士的这一行为,令人惊叹,促人深思,更使人倍感鼓舞。

长久以来,网站、论坛、博客等网络媒体删除屏蔽网民的帖子、留言、博文已经成为常态,这些网媒置广大网民的心声和心血于不顾,肆意妄为,以各种莫名其妙的理由随意删除屏蔽网民的帖子,它们对待网民粗暴蛮横,对待帖子毫不手软,严重压制和歪曲了正常的民意表达,这种行为,令人痛绝。

生存状况和空间日趋逼仄。我们算什么东西?屁民而已。像匍匐在马路上的蝼蚁,仰望星空,满眼尽是倾轧而来的靴底和履带。我们被嘲笑,被羞辱,被消失,毫无尊严可谈。谁为我们说话?电台电视,报纸杂志,喧嚣聒噪,与我们无关。我们在那儿说话?楼堂馆所,街头广场,岂是我们能去的地方。我们退无可退,网络成为我们最后的家园。

然而,就是这个虚拟的地方,也变成了他们狂欢的围猎场,他们围追堵截,跨省猎杀,网民们在舆情员的叫嚣和网特的窥视下,如入雷区,诚惶诚恐,小心翼翼地在布满敏感词陷阱的文字堆挣扎,最终仍是厄运难逃。

他们删掉的不是帖子,是无数为国家前途思忖的拳拳之心,他们屏蔽的也不是留言,是一群为民族未来忧虑的铮铮铁骨,谁来执刀?以开胸查验他们的真诚!谁来举斧?以剁指宣示他们的坦荡!

此时,我敲打的不是键盘,声声敲打的是潜水在屏幕后那一具具麻木、恐惧的躯体,急促的指键声欲唤醒冷漠的血液里那一息尚存的良知。

今天,华泽女士勇敢的站出来,走向了法庭。她要捍卫的不仅仅是她个人的权利,也是我们每一个人最后的权利----让我们说话的权利。让我们支持她,声援她,支持她就是支持我们自己!

请网友联署签名,支持咱们这位勇敢的女性,我们不是要求去一同坐牢,也不要什么政治诉求,我们要的只是拒绝删帖,还我们说话的权利。

今天,面对这张无形的网,让我们一起发出声音,千万网民的呐喊声形成的冲击波,或许可以企望能够震塌一截薄弱的墙垣。或许可以给我们带来更大的喘息空间。

面对屏蔽,多年痛苦的抉择后,google最终还是选择了“NO”,果敢的转身而去。面对删帖,长期无奈的忍受后,网民还要永远的麻木下去吗???

: ------------------------------

Posted via web from 米良的草窝

【转载】【凤凰博报】【秦建中】睢宁“良民证”是美国文化的怪胎

睢宁“良民证”是美国文化的怪胎

 

                                      秦建中

 

江苏睢宁,一个人口超过130万的县级行政单位,因为一张“良民证”而成为目前诸多新闻热点中的热点。

媒体报道称,在酝酿半年后,全国首家由政府直接给公民信用打分评级的系统在江苏睢宁正式实施。在这个系统中,注入了个人生活的各个方面,从银行欠贷到早点摆摊,从官员受贿到司机闯红灯,从欠缴水费到家庭道德等无所不包。这些行为全部被量化为分数,并将公民个人评为ABCD四个等级。

虽然有人说江苏省徐州市睢宁县的公民信用打分评级系统是一个发明创造,可稍具一些历史和文化知识的人都清楚,通过信用打分将人分为三六九等毫无新意,只不过是古代等级制度的现代版而已。

我不同意将睢宁的信用等级打分看成是上个世纪日军侵华时所发放的“良民证”,尽管二者的形式相似,但却有着实质的不同。那时的“良民证”是被侵略者驯服的象征,而今天的“良民证”则是权力之下的顺民符号。

一些人不是用早已被无数事实证明了的法治制度来管理社会,而是绞尽脑汁、朝思暮想地以权力来干预社会生活。可以说,睢宁“良民证”制度虽然别具一格,但为何会遭到公众诟病,其原因就在于这种早已过时了等级制度已不为颇具公民意识的人民群众所接受。

虽然睢宁官方高调宣称要“严管民风”,要让群众“一处守信,处处受益;一处失信,处处受约”,但明眼人一看便知,这还是中国传统株连文化在新的形式下的变种。

一个人违章驾车了,他的子女升学就业就要受到影响,一个人不按规定摆摊设点了,他的家人生育计划就有可能被改动,一个人因为一时冲动打人被判刑了,他的生活今后就有可能被改变,由此来看,睢宁的现代株连比祖宗们的灭九族还要厉害百倍。

众所周知,一个文明的社会必须要保障人的生活自由,每个人的行为准则应该由社会的法律来规范。因为传统社会与现代社会的明显区别就在于,一个人的不法行为是由道德来充当审判长还是由法官敲击法槌来判决就是二者迥异的分水岭。

可以认为,睢宁“良民证”横空出世是其有着丰厚的文化与社会土壤,一张“良民证”上写着的还是封建传统文化的丑陋。但是,在中国社会现代化的进程中,古老的“良民证”以现代化的电脑打分系统的面目出现,这不能不说外来文化在本土上转基因的成果。

一篇报道中这样写道:记者了解到,以分数等级评价个人信用的做法,源自美国FICO信用分制度。不过国际上通行的个人信用评价体系主要应用于金融领域,而由政府以信用分数的形式给个人打分评级、规范个人行为,极有可能是睢宁首创。

美国人的信用分制度是用来规范个人的金融消费行为的,而睢宁的信用打分则是用来管理整个社会生活。这又应了一句老话,在淮南长什么,到了淮北就不一定长什么,明白了这一点,也就知道了为什么在海外学成的海归们在异国他乡非常具有先进理念,可一旦回国,所表现出的文化劣根性比土生土长的中国人还要严重。

一百多年前,中国人就引进过外国文化,可移植过来后却发生了可怕的变异。就拿睢宁的信用打分制度来说,美国人发明的个人信用制度使其成为世界上消费信贷最成熟的国家之一,可在睢宁,美国文化却长出一个“良民证”的怪胎,这不能不让人感慨万千。看来,如果我们自己不具备科学的文化观念,引进来的是水稻品种,可在我们的一亩三分地里就有可能长出“谷子”来。

Posted via web from 米良的草窝

我的Chrome Desktop Application

【Archieve】【Joel on Software】How Microsoft Lost the API War

How Microsoft Lost the API War

by Joel Spolsky
Sunday, June 13, 2004

Here's a theory you hear a lot these days: "Microsoft is finished. As soon as Linux makes some inroads on the desktop and web applications replace desktop applications, the mighty empire will topple."

Although there is some truth to the fact that Linux is a huge threat to Microsoft, predictions of the Redmond company's demise are, to say the least, premature. Microsoft has an incredible amount of cash money in the bank and is still incredibly profitable. It has a long way to fall. It could do everything wrong for a decade before it started to be in remote danger, and you never know... they could reinvent themselves as a shaved-ice company at the last minute. So don't be so quick to write them off. In the early 90s everyone thought IBM was completely over: mainframes were history! Back then, Robert X. Cringely predicted that the era of the mainframe would end on January 1, 2000 when all the applications written in COBOL would seize up, and rather than fix those applications, for which, allegedly, the source code had long since been lost, everybody would rewrite those applications for client-server platforms.

Well, guess what. Mainframes are still with us,  nothing happened on January 1, 2000, and IBM reinvented itself as a big ol' technology consulting company that also happens to make cheap plastic telephones. So extrapolating from a few data points to the theory that Microsoft is finished is really quite a severe exaggeration.

However, there is a less understood phenomenon which is going largely unnoticed: Microsoft's crown strategic jewel, the Windows API, is lost. The cornerstone of Microsoft's monopoly power and incredibly profitable Windows and Office franchises, which account for virtually all of Microsoft's income and covers up a huge array of unprofitable or marginally profitable product lines, the Windows API  is no longer of much interest to developers. The goose that lays the golden eggs is not quite dead, but it does have a terminal disease, one that nobody noticed yet.

Now that I've said that, allow me to apologize for the grandiloquence and pomposity of that preceding paragraph. I think I'm starting to sound like those editorial writers in the trade rags who go on and on about Microsoft's strategic asset, the Windows API. It's going to take me a few pages, here, to explain what I'm really talking about and justify my arguments. Please don't jump to any conclusions until I explain what I'm talking about. This will be a long article. I need to explain what the Windows API is; I need to demonstrate why it's the most important strategic asset to Microsoft; I need to explain how it was lost and what the implications of that are in the long term. And because I'm talking about big trends, I need to exaggerate and generalize.

Developers, Developers, Developers, Developers

Remember the definition of an operating system? It's the thing that manages a computer's resources so that application programs can run. People don't really care much about operating systems; they care about those application programs that the operating system makes possible. Word Processors. Instant Messaging. Email. Accounts Payable. Web sites with pictures of Paris Hilton. By itself, an operating system is not that useful. People buy operating systems because of the useful applications that run on it. And therefore the most useful operating system is the one that has the most useful applications.

The logical conclusion of this is that if you're trying to sell operating systems, the most important thing to do is make software developers want to develop software for your operating system. That's why Steve Ballmer was jumping around the stage shouting "Developers, developers, developers, developers." It's so important for Microsoft that the only reason they don't outright give away development tools for Windows is because they don't want to inadvertently cut off the oxygen to competitive development tools vendors (well, those that are left) because having a variety of development tools available for their platform makes it that much more attractive to developers. But they really want to give away the development tools. Through their Empower ISV program you can get five complete sets of MSDN Universal (otherwise known as "basically every Microsoft product except Flight Simulator") for about $375. Command line compilers for the .NET languages are included with the free .NET runtime... also free. The C++ compiler is now free. Anything to encourage developers to build for the .NET platform, and holding just short of wiping out companies like Borland.

Why Apple and Sun Can't Sell Computers

Well, of course, that's a little bit silly: of course Apple and Sun can sell computers, but not to the two most lucrative markets for computers, namely, the corporate desktop and the home computer. Apple is still down there in the very low single digits of market share and the only people with Suns on their desktops are at Sun. (Please understand that I'm talking about large trends here, and therefore when I say things like "nobody" I really mean "fewer than 10,000,000 people," and so on and so forth.)

Why? Because Apple and Sun computers don't run Windows programs, or, if they do, it's in some kind of expensive emulation mode that doesn't work so great. Remember, people buy computers for the applications that they run, and there's so much more great desktop software available for Windows than Mac that it's very hard to be a Mac user.

Sidebar What is this "API" thing?

If you're writing a program, say, a word processor, and you want to display a menu, or write a file, you have to ask the operating system to do it for you, using a very specific set of function calls which are different on every operating system. These function calls are called the API: it's the interface that an operating system, like Windows, provides to application developers, like the programmers building word processors and spreadsheets and whatnot. It's a set of thousands and thousands of detailed and fussy functions and subroutines that programmers can use, which cause the operating system to do interesting things like display a menu, read and write files, and more esoteric things like find out how to spell out a given date in Serbian, or extremely complex things like display a web page in a window. If your program uses the API calls for Windows, it's not going to work on Linux, which has different API calls. Sometimes they do approximately the same thing. That's one important reason Windows software doesn't run on Linux. If you wanted to get a Windows program to run under Linux, you'd have to reimplement the entire Windows API, which consists of thousands of complicated functions: this is almost as much work as implementing Windows itself, something which took Microsoft thousands of person-years. And if you make one tiny mistake or leave out one function that an application needs, that application will crash.

And that's why the Windows API is such an important asset to Microsoft.

(I know, I know, at this point the 2.3% of the world that uses Macintoshes are warming up their email programs to send me a scathing letter about how much they love their Macs. Once again, I'm speaking in large trends and generalizing, so don't waste your time. I know you love your Mac. I know it runs everything you need. I love you, you're a Pepper, but you're only 2.3% of the world, so this article isn't about you.)

The Two Forces at Microsoft

There are two opposing forces inside Microsoft, which I will refer to, somewhat tongue-in-cheek, as The Raymond Chen Camp and The MSDN Magazine Camp.

Raymond Chen is a developer on the Windows team at Microsoft. He's been there since 1992, and his weblog The Old New Thing is chock-full of detailed technical stories about why certain things are the way they are in Windows, even silly things, which turn out to have very good reasons.

The most impressive things to read on Raymond's weblog are the stories of the incredible efforts the Windows team has made over the years to support backwards compatibility:

Look at the scenario from the customer's standpoint. You bought programs X, Y and Z. You then upgraded to Windows XP. Your computer now crashes randomly, and program Z doesn't work at all. You're going to tell your friends, "Don't upgrade to Windows XP. It crashes randomly, and it's not compatible with program Z." Are you going to debug your system to determine that program X is causing the crashes, and that program Z doesn't work because it is using undocumented window messages? Of course not. You're going to return the Windows XP box for a refund. (You bought programs X, Y, and Z some months ago. The 30-day return policy no longer applies to them. The only thing you can return is Windows XP.)

I first heard about this from one of the developers of the hit game SimCity, who told me that there was a critical bug in his application: it used memory right after freeing it, a major no-no that happened to work OK on DOS but would not work under Windows where memory that is freed is likely to be snatched up by another running application right away. The testers on the Windows team were going through various popular applications, testing them to make sure they worked OK, but SimCity kept crashing. They reported this to the Windows developers, who disassembled SimCity, stepped through it in a debugger, found the bug, and added special code that checked if SimCity was running, and if it did, ran the memory allocator in a special mode in which you could still use memory after freeing it.

This was not an unusual case. The Windows testing team is huge and one of their most important responsibilities is guaranteeing that everyone can safely upgrade their operating system, no matter what applications they have installed, and those applications will continue to run, even if those applications do bad things or use undocumented functions or rely on buggy behavior that happens to be buggy in Windows n but is no longer buggy in Windows n+1. In fact if you poke around in the AppCompatibility section of your registry you'll see a whole list of applications that Windows treats specially, emulating various old bugs and quirky behaviors so they'll continue to work. Raymond Chen writes, "I get particularly furious when people accuse Microsoft of maliciously breaking applications during OS upgrades. If any application failed to run on Windows 95, I took it as a personal failure. I spent many sleepless nights fixing bugs in third-party programs just so they could keep running on Windows 95."

A lot of developers and engineers don't agree with this way of working. If the application did something bad, or relied on some undocumented behavior, they think, it should just break when the OS gets upgraded. The developers of the Macintosh OS at Apple have always been in this camp. It's why so few applications from the early days of the Macintosh still work. For example, a lot of developers used to try to make their Macintosh applications run faster by copying pointers out of the jump table and calling them directly instead of using the interrupt feature of the processor like they were supposed to. Even though somewhere in Inside Macintosh, Apple's official Bible of Macintosh programming, there was a tech note saying "you can't do this," they did it, and it worked, and their programs ran faster... until the next version of the OS came out and they didn't run at all. If the company that made the application went out of business (and most of them did), well, tough luck, bubby.

To contrast, I've got DOS applications that I wrote in 1983 for the very original IBM PC that still run flawlessly, thanks to the Raymond Chen Camp at Microsoft. I know, it's not just Raymond, of course: it's the whole modus operandi of the core Windows API team. But Raymond has publicized it the most through his excellent website The Old New Thing so I'll name it after him.

That's one camp. The other camp is what I'm going to call the MSDN Magazine camp, which I will name after the developer's magazine full of exciting articles about all the different ways you can shoot yourself in the foot by using esoteric combinations of Microsoft products in your own software. The MSDN Magazine Camp is always trying to convince you to use new and complicated external technology like COM+, MSMQ, MSDE, Microsoft Office, Internet Explorer and its components, MSXML, DirectX (the very latest version, please), Windows Media Player, and Sharepoint... Sharepoint! which nobody has; a veritable panoply of external dependencies each one of which is going to be a huge headache when you ship your application to a paying customer and it doesn't work right. The technical name for this is DLL Hell. It works here: why doesn't it work there?

The Raymond Chen Camp believes in making things easy for developers by making it easy to write once and run anywhere (well, on any Windows box). The MSDN Magazine Camp believes in making things easy for developers by giving them really powerful chunks of code which they can leverage, if they are willing to pay the price of incredibly complicated deployment and installation headaches, not to mention the huge learning curve. The Raymond Chen camp is all about consolidation. Please, don't make things any worse, let's just keep making what we already have still work. The MSDN Magazine Camp needs to keep churning out new gigantic pieces of technology that nobody can keep up with.

Here's why this matters.

Microsoft Lost the Backwards Compatibility Religion

Inside Microsoft, the MSDN Magazine Camp has won the battle.

The first big win was making Visual Basic.NET not backwards-compatible with VB 6.0. This was literally the first time in living memory that when you bought an upgrade to a Microsoft product, your old data (i.e. the code you had written in VB6) could not be imported perfectly and silently. It was the first time a Microsoft upgrade did not respect the work that users did using the previous version of a product.

And the sky didn't seem to fall, not inside Microsoft. VB6 developers were up in arms, but they were disappearing anyway, because most of them were corporate developers who were migrating to web development anyway. The real long term damage was hidden.

With this major victory under their belts, the MSDN Magazine Camp took over. Suddenly it was OK to change things. IIS 6.0 came out with a different threading model that broke some old applications. I was shocked to discover that our customers with Windows Server 2003 were having trouble running FogBugz. Then .NET 1.1 was not perfectly backwards compatible with 1.0. And now that the cat was out of the bag, the OS team got into the spirit and decided that instead of adding features to the Windows API, they were going to completely replace it. Instead of Win32, we are told, we should now start getting ready for WinFX: the next generation Windows API. All different. Based on .NET with managed code. XAML. Avalon. Yes, vastly superior to Win32, I admit it. But not an upgrade: a break with the past.

Outside developers, who were never particularly happy with the complexity of Windows development, have defected from the Microsoft platform en-masse and are now developing for the web. Paul Graham, who created Yahoo! Stores in the early days of the dotcom boom, summarized it eloquently: "There is all the more reason for startups to write Web-based software now, because writing desktop software has become a lot less fun. If you want to write desktop software now you do it on Microsoft's terms, calling their APIs and working around their buggy OS. And if you manage to write something that takes off, you may find that you were merely doing market research for Microsoft."

Microsoft got big enough, with too many developers, and they were too addicted to upgrade revenues, so they suddenly decided that reinventing everything was not too big a project. Heck, we can do it twice. The old Microsoft, the Microsoft of Raymond Chen, might have implemented things like Avalon, the new graphics system, as a series of DLLs that can run on any version of Windows and which could be bundled with applications that need them. There's no technical reason not to do this. But Microsoft needs to give you a reason to buy Longhorn, and what they're trying to pull off is a sea change, similar to the sea change that occurred when Windows replaced DOS. The trouble is that Longhorn is not a very big advance over Windows XP; not nearly as big as Windows was over DOS. It probably won't be compelling enough to get people to buy all new computers and applications like they did for Windows. Well, maybe it will, Microsoft certainly needs it to be, but what I've seen so far is not very convincing. A lot of the bets Microsoft made are the wrong ones. For example, WinFS, advertised as a way to make searching work by making the file system be a relational database, ignores the fact that the real way to make searching work is by making searching work. Don't make me type metadata for all my files that I can search using a query language. Just do me a favor and search the damned hard drive, quickly, for the string I typed, using full-text indexes and other technologies that were boring in 1973.

Automatic Transmissions Win the Day

Don't get me wrong... I think .NET is a great development environment and Avalon with XAML is a tremendous advance over the old way of writing GUI apps for Windows. The biggest advantage of .NET is the fact that it has automatic memory management.

A lot of us thought in the 1990s that the big battle would be between procedural and object oriented programming, and we thought that object oriented programming would provide a big boost in programmer productivity. I thought that, too. Some people still think that. It turns out we were wrong. Object oriented programming is handy dandy, but it's not really the productivity booster that was promised. The real significant productivity advance we've had in programming has been from languages which manage memory for you automatically. It can be with reference counting or garbage collection; it can be Java, Lisp, Visual Basic (even 1.0), Smalltalk, or any of a number of scripting languages. If your programming language allows you to grab a chunk of memory without thinking about how it's going to be released when you're done with it, you're using a managed-memory language, and you are going to be much more efficient than someone using a language in which you have to explicitly manage memory. Whenever you hear someone bragging about how productive their language is, they're probably getting most of that productivity from the automated memory management, even if they misattribute it.

Sidebar
Why does automatic memory management make you so much more productive? 1) Because you can write f(g(x)) without worrying about how to free the return value from g, which means you can use functions which return interesting complex data types and functions which transform interesting complex data types, in turn allowing you to work at a higher level of abstraction. 2) Because you don't have to spend any time writing code to free memory or tracking down memory leaks. 3) Because you don't have to carefully coordinate the exit points from your functions to make sure things are cleaned up properly.

Racing car aficionados will probably send me hate mail for this, but my experience has been that there is only one case, in normal driving, where a good automatic transmission is inferior to a manual transmission. Similarly in software development: in almost every case, automatic memory management is superior to manual memory management and results in far greater programmer productivity.

If you were developing desktop applications in the early years of Windows, Microsoft offered you two ways to do it: writing C code which calls the Windows API directly and managing your own memory, or using Visual Basic and getting your memory managed for you. These are the two development environments I have used the most, personally, over the last 13 years or so, and I know them inside-out, and my experience has been that Visual Basic is significantly more productive. Often I've written the same code, once in C++ calling the Windows API and once in Visual Basic, and C++ always took three or four times as much work. Why? Memory management. The easiest way to see why is to look at the documentation for any Windows API function that needs to return a string. Look closely at how much discussion there is around the concept of who allocates the memory for the string, and how you negotiate how much memory will be needed. Typically, you have to call the function twice—on the first call, you tell it that you've allocated zero bytes, and it fails with a "not enough memory allocated" message and conveniently also tells you how much memory you need to allocate. That's if you're lucky enough not to be calling a function which returns a list of strings or a whole variable-length structure. In any case, simple operations like opening a file, writing a string, and closing it using the raw Windows API can take a page of code. In Visual Basic similar operations can take three lines.

So, you've got these two programming worlds. Everyone has pretty much decided that the world of managed code is far superior to the world of unmanaged code. Visual Basic was (and probably remains) the number one bestselling language product of all time and developers preferred it over C or C++ for Windows development, although the fact that "Basic" was in the name of the product made hardcore programmers shun it even though it was a fairly modern language with a handful of object-oriented features and very little leftover gunk (line numbers and the LET statement having gone the way of the hula hoop). The other problem with VB was that deployment required shipping a VB runtime, which was a big deal for shareware distributed over modems, and, worse, let other programmers see that your application was developed in (the shame!) Visual Basic.

One Runtime To Rule Them All

And along came .NET. This was a grand project, the super-duper unifying project to clean up the whole mess once and for all. It would have memory management, of course. It would still have Visual Basic, but it would gain a new language, one which is in spirit virtually the same as Visual Basic but with the C-like syntax of curly braces and semicolons. And best of all, the new Visual Basic/C hybrid would be called Visual C#, so you would not have to tell anyone you were a "Basic" programmer any more. All those horrid Windows functions with their tails and hooks and backwards-compatibility bugs and impossible-to-figure-out string-returning semantics would be wiped out, replaced by a single clean object oriented interface that only has one kind of string. One runtime to rule them all. It was beautiful. And they pulled it off, technically. .NET is a great programming environment that manages your memory and has a rich, complete, and consistent interface to the operating system and a rich, super complete, and elegant object library for basic operations.

And yet, people aren't really using .NET much.

Oh sure, some of them are.

But the idea of unifying the mess of Visual Basic and Windows API programming by creating a completely new, ground-up programming environment with not one, not two, but three languages (or are there four?) is sort of like the idea of getting two quarreling kids to stop arguing by shouting "shut up!" louder than either of them. It only works on TV. In real life when you shout "shut up!" to two people arguing loudly you just create a louder three-way argument.

(By the way, for those of you who follow the arcane but politically-charged world of blog syndication feed formats, you can see the same thing happening over there. RSS became fragmented with several different versions, inaccurate specs and lots of political fighting, and the attempt to clean everything up by creating yet another format called Atom has resulted in several different versions of RSS plus one version of Atom, inaccurate specs and lots of political fighting. When you try to unify two opposing forces by creating a third alternative, you just end up with three opposing forces. You haven't unified anything and you haven't really fixed anything.)

So now instead of .NET unifying and simplifying, we have a big 6-way mess, with everybody trying to figure out which development strategy to use and whether they can afford to port their existing applications to .NET.

No matter how consistent Microsoft is in their marketing message ("just use .NET—trust us!"), most of their customers are still using C, C++, Visual Basic 6.0, and classic ASP, not to mention all the other development tools from other companies. And the ones that are using .NET are using ASP.NET to develop web applications, which run on a Windows server but don't require Windows clients, which is a key point I'll talk about more when I talk about the web.

Oh, Wait, There's More Coming!

Now Microsoft has so many developers cranking away that it's not enough to reinvent the entire Windows API: they have to reinvent it twice. At last year's PDC they preannounced the next major version of their operating system, codenamed Longhorn, which will contain, among other things, a completely new user interface API, codenamed Avalon, rebuilt from the ground up to take advantage of modern computers' fast display adapters and realtime 3D rendering. And if you're developing a Windows GUI app today using Microsoft's "official" latest-and-greatest Windows programming environment, WinForms, you're going to have to start over again in two years to support Longhorn and Avalon. Which explains why WinForms is completely stillborn. Hope you haven't invested too much in it. Jon Udell found a slide from Microsoft labelled "How Do I Pick Between Windows Forms and Avalon?" and asks, "Why do I have to pick between Windows Forms and Avalon?" A good question, and one to which he finds no great answer.

So you've got the Windows API, you've got VB, and now you've got .NET, in several language flavors, and don't get too attached to any of that, because we're making Avalon, you see, which will only run on the newest Microsoft operating system, which nobody will have for a loooong time. And personally I still haven't had time to learn .NET very deeply, and we haven't ported Fog Creek's two applications from classic ASP and Visual Basic 6.0 to .NET because there's no return on investment for us. None. It's just Fire and Motion as far as I'm concerned: Microsoft would love for me to stop adding new features to our bug tracking software and content management software and instead waste a few months porting it to another programming environment, something which will not benefit a single customer and therefore will not gain us one additional sale, and therefore which is a complete waste of several months, which is great for Microsoft, because they have content management software and bug tracking software, too, so they'd like nothing better than for me to waste time spinning cycles catching up with the flavor du jour, and then waste another year or two doing an Avalon version, too, while they add features to their own competitive software. Riiiight.

No developer with a day job has time to keep up with all the new development tools coming out of Redmond, if only because there are too many dang employees at Microsoft making development tools!

It's Not 1990

Microsoft grew up during the 1980s and 1990s, when the growth in personal computers was so dramatic that every year there were more new computers sold than the entire installed base. That meant that if you made a product that only worked on new computers, within a year or two it could take over the world even if nobody switched to your product. That was one of the reasons Word and Excel displaced WordPerfect and Lotus so thoroughly: Microsoft just waited for the next big wave of hardware upgrades and sold Windows, Word and Excel to corporations buying their next round of desktop computers (in some cases their first round). So in many ways Microsoft never needed to learn how to get an installed base to switch from product N to product N+1. When people get new computers, they're happy to get all the latest Microsoft stuff on the new computer, but they're far less likely to upgrade. This didn't matter when the PC industry was growing like wildfire, but now that the world is saturated with PCs most of which are Just Fine, Thank You, Microsoft is suddenly realizing that it takes much longer for the latest thing to get out there. When they tried to "End Of Life" Windows 98, it turned out there were still so many people using it they had to promise to support that old creaking grandma for a few more years.

Unfortunately, these Brave New Strategies, things like .NET and Longhorn and Avalon, trying to create a new API to lock people into, can't work very well if everybody is still using their good-enough computers from 1998. Even if Longhorn ships when it's supposed to, in 2006, which I don't believe for a minute, it will take a couple of years before enough people have it that it's even worth considering as a development platform. Developers, developers, developers, and developers are not buying into Microsoft's multiple-personality-disordered suggestions for how we should develop software.

Enter the Web

I'm not sure how I managed to get this far without mentioning the Web. Every developer has a choice to make when they plan a new software application: they can build it for the web or they can build a "rich client" application that runs on PCs. The basic pros and cons are simple: Web applications are easier to deploy, while rich clients offer faster response time enabling much more interesting user interfaces.

Web Applications are easier to deploy because there's no installation involved. Installing a web application means typing a URL in the address bar. Today I installed Google's new email application by typing Alt+D, gmail, Ctrl+Enter. There are far fewer compatibility problems and problems coexisting with other software. Every user of your product is using the same version so you never have to support a mix of old versions. You can use any programming environment you want because you only have to get it up and running on your own server. Your application is automatically available at virtually every reasonable computer on the planet. Your customers' data, too, is automatically available at virtually every reasonable computer on the planet.

But there's a price to pay in the smoothness of the user interface. Here are a few examples of things you can't really do well in a web application:

  1. Create a fast drawing program
  2. Build a real-time spell checker with wavy red underlines
  3. Warn users that they are going to lose their work if they hit the close box of the browser
  4. Update a small part of the display based on a change that the user makes without a full roundtrip to the server
  5. Create a fast keyboard-driven interface that doesn't require the mouse
  6. Let people continue working when they are not connected to the Internet

These are not all big issues. Some of them will be solved very soon by witty Javascript developers. Two new web applications, Gmail and Oddpost, both email apps, do a really decent job of working around or completely solving some of these issues. And users don't seem to care about the little UI glitches and slowness of web interfaces. Almost all the normal people I know are perfectly happy with web-based email, for some reason, no matter how much I try to convince them that the rich client is, uh, richer.

So the Web user interface is about 80% there, and even without new web browsers we can probably get 95% there. This is Good Enough for most people and it's certainly good enough for developers, who have voted to develop almost every significant new application as a web application.

Which means, suddenly, Microsoft's API doesn't matter so much. Web applications don't require Windows.

It's not that Microsoft didn't notice this was happening. Of course they did, and when the implications became clear, they slammed on the brakes. Promising new technologies like HTAs and DHTML were stopped in their tracks. The Internet Explorer team seems to have disappeared; they have been completely missing in action for several years. There's no way Microsoft is going to allow DHTML to get any better than it already is: it's just too dangerous to their core business, the rich client. The big meme at Microsoft these days is: "Microsoft is betting the company on the rich client." You'll see that somewhere in every slide presentation about Longhorn. Joe Beda, from the Avalon team, says that "Avalon, and Longhorn in general, is Microsoft's stake in the ground, saying that we believe power on your desktop, locally sitting there doing cool stuff, is here to stay. We're investing on the desktop, we think it's a good place to be, and we hope we're going to start a wave of excitement..."

The trouble is: it's too late.

I'm a Little Bit Sad About This, Myself

I'm actually a little bit sad about this, myself. To me the Web is great but Web-based applications with their sucky, high-latency, inconsistent user interfaces are a huge step backwards in daily usability. I love my rich client applications and would go nuts if I had to use web versions of the applications I use daily: Visual Studio, CityDesk, Outlook, Corel PhotoPaint, QuickBooks. But that's what developers are going to give us. Nobody (by which, again, I mean "fewer than 10,000,000 people") wants to develop for the Windows API any more. Venture Capitalists won't invest in Windows applications because they're so afraid of competition from Microsoft. And most users don't seem to care about crappy Web UIs as much as I do.

And here's the clincher: I noticed (and confirmed this with a recruiter friend) that Windows API programmers here in New York City who know C++ and COM programming earn about $130,000 a year, while typical Web programmers using managed code languages (Java, PHP, Perl, even ASP.NET) earn about $80,000 a year. That's a huge difference, and when I talked to some friends from Microsoft Consulting Services about this they admitted that Microsoft had lost a whole generation of developers. The reason it takes $130,000 to hire someone with COM experience is because nobody bothered learning COM programming in the last eight years or so, so you have to find somebody really senior, usually they're already in management, and convince them to take a job as a grunt programmer, dealing with (God help me) marshalling and monikers and apartment threading and aggregates and tearoffs and a million other things that, basically, only Don Box ever understood, and even Don Box can't bear to look at them any more.

Much as I hate to say it, a huge chunk of developers have long since moved to the web and refuse to move back. Most .NET developers are ASP.NET developers, developing for Microsoft's web server. ASP.NET is brilliant; I've been working with web development for ten years and it's really just a generation ahead of everything out there. But it's a server technology, so clients can use any kind of desktop they want. And it runs pretty well under Linux using Mono.

None of this bodes well for Microsoft and the profits it enjoyed thanks to its API power. The new API is HTML, and the new winners in the application development marketplace will be the people who can make HTML sing.

Posted via web from 米良的实验室

【存档】微软是如何输掉API之战(下)

是的,这篇翻译是下篇,上篇是在:
http://www.blogwind.com/Wuvist/6984.shtml

我在2005年2月13日翻译的。如果你没有看过上篇,也没有看过原文(http://www.joelonsoftware.com/articles/APIWar.html),请先看上篇。而且建议去看原文,因为,我在翻译的时候去掉了一些附带说明与链接。

原文作者:Joel Spolsky
Sunday, June 13, 2004


 

一统天下的运行时

.Net降临了。这是一个浩大的工程;一个企图彻底根除所有混乱局面的工程。它自然有内存管理。它不仅有Visual Basic,还有一门新的语言。这语言继承了Visual Basic的精神,但却有着C风格的语法-大括号跟引号。最妙的是这门糅合了VBC的新语言叫C#,也就是说你再也不用跟别人说你是一个“Basic”基本程序员了。那些恐怖的拖泥带水的Window函数、钩子、向后兼容的Bug还有无从解释的字符串返回语法都被扫除了;取而代之的是一个崭新只有一种字符串并面向对象的接口。一统天下的运行时。这很美,在技术得赞下微软。.Net是一个超赞的程序开发环境,它可以帮你管理内存,拥有丰富、完整并统一的操作系统接口;而且还有丰富、超级完整还很优雅供基本操作的对象库。

但是,程序员不用.Net做太多开发。

当然,也有用.Net的人。

但,使用一个全新彻底革新的程序开发环境来统一VBWindows API开发并存造成的混乱是愚蠢的。现在,我们不是有一种或者是两种开发语言,而是有三种开发语言(还是四种?)!就跟对两个在吵架的小孩大喊:“你们都别吵了!”一样愚蠢。在电视里面,这样子大喊也许会有效;但在现实生活中这样搞法的必然结果就是你跟两个小孩三个人一起吵得更加大声。

(顺便说一下,那些有关注神秘但被政治所改变的网志聚合格式世界的朋友,你们可以发现同样的事情也发生了。RSS被分裂成为了几个版本-不准确的规则跟一堆政治性质的斗争。而企图解决这一切的做法竟然是定义一个新的叫ATOM的聚合格式。结果便是不同版本的RSS现在多了一个ATOM来搅局-不准确的规则跟一堆政治性质的斗争。当你企图引入第三方来解决对立的两方时,结果便是三足鼎立。你什么也没有统一而且你也没有解决任何事情。)

所以,.Net现在并没有统一并简化世界,我们现在反倒陷入了更大的混乱。所有的人都在犹豫他们的开发策略,究竟有没有足够能力把现有程序转到.Net上呢?

无论微软的市场信息是多么的统一(“用.Net吧!相信我们!”),它的大部分用户还是在使用C,C++,VB 6.0跟传统的ASP做开发。更不用说其它公司提供的开发工具了。然后,仅剩的使用.Net做开发的公司做的是ASP.NetASP.Net需要跑在Windows服务器上,但,它需要一个Windows做客户端。这就是我谈到Web时要强调的重点。

哦,等一下,还有其它的东西!

现在微软有了太多的开发人员搞得它重新发明一次整套Windows API还觉得不够爽,它竟然重新发明了两次!在去年(应该是03年,Wuvist注。)的PDC上,微软宣布了它们的下一代操作系统,代号长角。长角不仅有上述的东西,还有一套全新的用户界面API,代号AvalonAvalon再次把一起推倒从来以利用现在电脑高速的显卡跟实时三维渲染的优势。所以,如果你现在正在开发Windows界面程序,并且使用了微软现在“官方”宣称的最先进的开发环境:WinForms;那么两年后你得重新开始以支持长角跟Avalon。这解释了为什么WinForms在诞生之时便死翘翘了。但愿你还没有在WinForms上投入太多。Jon Udell从微软那找到了一个题为:“我如何在Windows FormsAvalon间做选择?”的幻灯片,并且问了这么个问题。这是个好问题,并且没有人可以很好的回答它。

所以,我们有了Windows API,有VB,现在还有了带若干种不同语言供选择的.Net;但,我们不能在这些环境下浸淫太久。因为,微软正在开发Avalon呢!注意到没?Avalon可只能在微软最新的操作系统上跑,但是,它得等很久很久以后才能开跑。对我个人来说,我没有时间很深入的学习.Net,并且,我们也没有把Fog Creek的两个应用程序从传统的ASPVB 6.0转到.Net上。因为投入做这么件事情对我们没有回馈。一点都没有。在我关心的范围里,它纯粹是一件“开火并动作”的事情:微软会爱死我们停止给Bug跟踪软件跟CMS开发新的功能,并浪费几个月的时间转移到新的开发环境里。这无法使我的任何一个客户获利,也没法让我多卖一套软件。但这对微软来说很妙,因为微软也有它自己的CMSBug跟踪软件。对微软来说,再也没有比使我为追时髦而浪费时间重新绕着.Net转,并且一两年后在为Avalon浪费一次时间的事情让它感到更的爽了。在我忙着转的时候,它却在给它的软件加新功能,懂了没?

没有一个有日常工作的程序员可以有时间可以去追赶所有从雷德蒙出来的新开发工具。因为,微软有太多该死的员工在研发新的开发工具!

现在不是1990

微软是在八十年代成长起来的,那正式个人电脑高速发展的年代:新出厂的电脑比现有的还多。这意味着如果你的产品只能够在新电脑上跑的话,过不了一两年它也可以占领市场,既便没有人刻意“转用”你的产品。这是WordExcel能如此彻底取代WordPerctLotus的原因之一。微软只需要等待下一波硬件升级的浪潮,然后把Windows,WordExcel一块卖给企业用户(有些企业还是第一次买电脑)。所以,从很多方面来说,微软从来没有学习如何促使用户从产品的N版升级到N1版的必要。当用户买了新电脑,他们会很高兴在新电脑上使用微软的各种最新产品,经管他们不太可能纯粹的做软件升级。这也无所谓,个人电脑市场当时在疯狂的增长。但是,现在的世界,个人电脑市场已经饱和了,并且现有的电脑都跑得不错。谢谢,微软突然意识到它花长时间等待最新的产品进入市场了。当它企图“终结”Windows 98的时候,现实是有太多的人还在使用着Windows 98,而微软得打破自己的诺言,无奈的继续给这老爷系统做多几年支持。

不幸的是,当所有人都用着98年产的电脑用得很开心的时候,像.Net、长角跟Avalon这些美丽的新技术锁定用户的企图便变得不容易实现了。即使长角真的在2006年如此发布(我此刻其实也并不相信这点),它也得花上几年的时间以获得足够的人认同它是新的开发平台。开发者,开发者,开发者跟开发者在开发软件的时候,并不卖微软那“人格分裂”开发建议的帐。

走进网络

我不能理解我说了这么多却没有提到网络。所有的开发者机会做新软件的时候都有一个选择:做网站或者做“胖客户端”在PC上跑的软件。两者的利弊很简单:网站更加容易配置(deploy),而胖客户端软件则能提供更快的反应时间以提供更有趣的用户界面。

网站更容易配置,因为它不需要安装。对用户来说,“安装”一个网络应用程序等于在浏览器地址栏里输入一个网址。我今天刚装了Google的新Email程序:按Alt+D,输入gmail,再按Ctrl+Enter。网络应用程序有着相当少的兼容性问题或者跟其它软件冲突的机会。所有使用你产品的用户都使用着你最新的版本,你不必为各种旧版本提供支持。你可以使用任何你喜欢的开发环境,只要你能够让程序在你自己的服务器上跑就好。你的程序实质上也能自动为所有地球上的电脑服务。而且,你用户的数据在实质上也能自动供地球上所有的电脑使用。

但,这些需要牺牲流畅的用户界面做代价。这边有一些网站无法做得很好的事情的例子:
1.
建立快速画图的程序

2.实时带红色下划线的拼写检查

3.警告用户说他们点浏览器的关闭按钮时会丢失手头的资料

4.根据用户的操作更新部分显示内容而不访问服务器

5.建立一个键盘按键驱动而不需要鼠标的程序

6.让用户在断开网络的情况下继续操作。

这些也并不是多大不了的事情。而且有些会很快被聪明的Javascript程序员搞定。GmailOddpost这两个新的网站正巧都是做Email应用的,并且巧妙的绕过或者彻底的解决了上述的一些问题。并且,用户似乎不是很在意UI上的不足以及界面迟钝的反应。几乎我认识的所有正常人都因为某种原因非常满意基于webEmail程,无论我多么努力的向他们推荐富客户端软件。唉~更富的客户端软件其实。

所以,Web用户界面已经有八成火候了,并且即使没有新的浏览器我们也很可能可以把它做到九成半。这对绝大多数人来说已经足够好了。而此用户基础对那些选择Web做新软件开发的程序员来说也足够好了。

这也就意味着,微软的API突然间变得无足轻重了。Web程序不需要Windows

这不是说微软并没有意识到这些事情的发生。他们当然清楚。而且,在事情表面化的时候,他们突然紧急刹车了。很有潜力的技术如HTADHTML停止发展了。Internet Explorer的整个开发团队似乎消失了;他们以及好几年没有任何作为了。微软没有理由让DHTML变得比现状更好;因为这对于它的核心业务-富客户端软件太危险了。微软这些日子来的口号是:“微软在富客户端软件开发公司上压了重注。”你可以在长角的幻灯片上看到这些。来自Avalon团队的Joe Beda说:“Avalon跟长角在整体上说,是微软的根基。这说明我们相信桌面软件的威力,坐在本机前就能够玩很酷的东西。这里,我们正对桌面软件做投资,我们认为这是跟很好的方向,并且我们希望开启新一轮激动人心的……”

问题是已经太晚了。

我自己对此是有点伤心的

我自己真的是对此有点伤心。对我来说,Web很棒;但是,基于Web的软件反应慢,用户界面不统一是对日常稳定操作的一大退步。我爱我的富客户端软件,而且当我需要去使用这些软件的Web版本的时候,我会呆掉的。我每天使用的这些 软件有:Visual Studio,CityDesk,Outlook,Corel PhotoPaint,QuickBooks。 但,这些却是程序员即将要带来给我们的。没有人(我再重复一次,没有人意味着少过一百万人)会再使用Windows API做开发。风险投资商不会给做Windows应用程序的公司钱的,因为他们担心来自微软的威胁。并且,绝大多数用户不像我这么在意蹩脚的Web界面。

这里有个铁证:我注意到(并且,我从人事部门的朋友处证实了)纽约的Windows API开发并懂得C++COM的程序员年薪大约是十三万美金;而典型的使用托管语言(包括Java,PHP,Perl甚至ASP.Net)的Web程序员年薪是八万美元。差距是巨大的。而且当我跟在微软做客服的朋友聊天时,他们承认微软已经错过了一整代的程序员。请一个有COM开发经验的程序员每年需要十三万美金,是因为在过去约八年的时间里没有人在乎去学COM开发了。所以,你一定得找到有相当资历的程序员,并说服这些往往已经处于管理人员的层次人去处理底层的程序(神啊!救救我吧!)如处理marshallingmonikersapartment线程跟aggregatestearoff跟其它一千万种基本上只有Don Box能理解的事情,事实上Don Box也受不了再跟这些玩意打交道了。

我讨厌说这点。但一堆开发人员已经转到Web上很久了,并且不愿转回去。大多数.Net的开发人员是开发ASP.Net的,做微软Web服务器端的开发。ASP.Net是卓越的;我已经做了十年的Web开发,但ASP.Net便硬是再往前夸了一步。但它是服务器端的技术,客户端可以使用任何桌面软件。更甚者,ASP.NetLinux中使用Mono也跑得很好。

所有的这些兆头都对微软不妙,它无法再从API垄断上获得巨额利润了。新的APIHTML,而市场的新胜利者将会是那些能玩转HTML的人。

Posted via web from 米良的草窝

【存档】微软是如何输掉API之战(下)

微软是如何输掉API之战(下)

是的,这篇翻译是下篇,上篇是在:
http://www.blogwind.com/Wuvist/6984.shtml

我在2005年2月13日翻译的。如果你没有看过上篇,也没有看过原文(http://www.joelonsoftware.com/articles/APIWar.html),请先看上篇。而且建议去看原文,因为,我在翻译的时候去掉了一些附带说明与链接。

原文作者:Joel Spolsky
Sunday, June 13, 2004


 

一统天下的运行时

.Net降临了。这是一个浩大的工程;一个企图彻底根除所有混乱局面的工程。它自然有内存管理。它不仅有Visual Basic,还有一门新的语言。这语言继承了Visual Basic的精神,但却有着C风格的语法-大括号跟引号。最妙的是这门糅合了VBC的新语言叫C#,也就是说你再也不用跟别人说你是一个“Basic”基本程序员了。那些恐怖的拖泥带水的Window函数、钩子、向后兼容的Bug还有无从解释的字符串返回语法都被扫除了;取而代之的是一个崭新只有一种字符串并面向对象的接口。一统天下的运行时。这很美,在技术得赞下微软。.Net是一个超赞的程序开发环境,它可以帮你管理内存,拥有丰富、完整并统一的操作系统接口;而且还有丰富、超级完整还很优雅供基本操作的对象库。

但是,程序员不用.Net做太多开发。

当然,也有用.Net的人。

但,使用一个全新彻底革新的程序开发环境来统一VBWindows API开发并存造成的混乱是愚蠢的。现在,我们不是有一种或者是两种开发语言,而是有三种开发语言(还是四种?)!就跟对两个在吵架的小孩大喊:“你们都别吵了!”一样愚蠢。在电视里面,这样子大喊也许会有效;但在现实生活中这样搞法的必然结果就是你跟两个小孩三个人一起吵得更加大声。

(顺便说一下,那些有关注神秘但被政治所改变的网志聚合格式世界的朋友,你们可以发现同样的事情也发生了。RSS被分裂成为了几个版本-不准确的规则跟一堆政治性质的斗争。而企图解决这一切的做法竟然是定义一个新的叫ATOM的聚合格式。结果便是不同版本的RSS现在多了一个ATOM来搅局-不准确的规则跟一堆政治性质的斗争。当你企图引入第三方来解决对立的两方时,结果便是三足鼎立。你什么也没有统一而且你也没有解决任何事情。)

所以,.Net现在并没有统一并简化世界,我们现在反倒陷入了更大的混乱。所有的人都在犹豫他们的开发策略,究竟有没有足够能力把现有程序转到.Net上呢?

无论微软的市场信息是多么的统一(“用.Net吧!相信我们!”),它的大部分用户还是在使用C,C++,VB 6.0跟传统的ASP做开发。更不用说其它公司提供的开发工具了。然后,仅剩的使用.Net做开发的公司做的是ASP.NetASP.Net需要跑在Windows服务器上,但,它需要一个Windows做客户端。这就是我谈到Web时要强调的重点。

哦,等一下,还有其它的东西!

现在微软有了太多的开发人员搞得它重新发明一次整套Windows API还觉得不够爽,它竟然重新发明了两次!在去年(应该是03年,Wuvist注。)的PDC上,微软宣布了它们的下一代操作系统,代号长角。长角不仅有上述的东西,还有一套全新的用户界面API,代号AvalonAvalon再次把一起推倒从来以利用现在电脑高速的显卡跟实时三维渲染的优势。所以,如果你现在正在开发Windows界面程序,并且使用了微软现在“官方”宣称的最先进的开发环境:WinForms;那么两年后你得重新开始以支持长角跟Avalon。这解释了为什么WinForms在诞生之时便死翘翘了。但愿你还没有在WinForms上投入太多。Jon Udell从微软那找到了一个题为:“我如何在Windows FormsAvalon间做选择?”的幻灯片,并且问了这么个问题。这是个好问题,并且没有人可以很好的回答它。

所以,我们有了Windows API,有VB,现在还有了带若干种不同语言供选择的.Net;但,我们不能在这些环境下浸淫太久。因为,微软正在开发Avalon呢!注意到没?Avalon可只能在微软最新的操作系统上跑,但是,它得等很久很久以后才能开跑。对我个人来说,我没有时间很深入的学习.Net,并且,我们也没有把Fog Creek的两个应用程序从传统的ASPVB 6.0转到.Net上。因为投入做这么件事情对我们没有回馈。一点都没有。在我关心的范围里,它纯粹是一件“开火并动作”的事情:微软会爱死我们停止给Bug跟踪软件跟CMS开发新的功能,并浪费几个月的时间转移到新的开发环境里。这无法使我的任何一个客户获利,也没法让我多卖一套软件。但这对微软来说很妙,因为微软也有它自己的CMSBug跟踪软件。对微软来说,再也没有比使我为追时髦而浪费时间重新绕着.Net转,并且一两年后在为Avalon浪费一次时间的事情让它感到更的爽了。在我忙着转的时候,它却在给它的软件加新功能,懂了没?

没有一个有日常工作的程序员可以有时间可以去追赶所有从雷德蒙出来的新开发工具。因为,微软有太多该死的员工在研发新的开发工具!

现在不是1990

微软是在八十年代成长起来的,那正式个人电脑高速发展的年代:新出厂的电脑比现有的还多。这意味着如果你的产品只能够在新电脑上跑的话,过不了一两年它也可以占领市场,既便没有人刻意“转用”你的产品。这是WordExcel能如此彻底取代WordPerctLotus的原因之一。微软只需要等待下一波硬件升级的浪潮,然后把Windows,WordExcel一块卖给企业用户(有些企业还是第一次买电脑)。所以,从很多方面来说,微软从来没有学习如何促使用户从产品的N版升级到N1版的必要。当用户买了新电脑,他们会很高兴在新电脑上使用微软的各种最新产品,经管他们不太可能纯粹的做软件升级。这也无所谓,个人电脑市场当时在疯狂的增长。但是,现在的世界,个人电脑市场已经饱和了,并且现有的电脑都跑得不错。谢谢,微软突然意识到它花长时间等待最新的产品进入市场了。当它企图“终结”Windows 98的时候,现实是有太多的人还在使用着Windows 98,而微软得打破自己的诺言,无奈的继续给这老爷系统做多几年支持。

不幸的是,当所有人都用着98年产的电脑用得很开心的时候,像.Net、长角跟Avalon这些美丽的新技术锁定用户的企图便变得不容易实现了。即使长角真的在2006年如此发布(我此刻其实也并不相信这点),它也得花上几年的时间以获得足够的人认同它是新的开发平台。开发者,开发者,开发者跟开发者在开发软件的时候,并不卖微软那“人格分裂”开发建议的帐。

走进网络

我不能理解我说了这么多却没有提到网络。所有的开发者机会做新软件的时候都有一个选择:做网站或者做“胖客户端”在PC上跑的软件。两者的利弊很简单:网站更加容易配置(deploy),而胖客户端软件则能提供更快的反应时间以提供更有趣的用户界面。

网站更容易配置,因为它不需要安装。对用户来说,“安装”一个网络应用程序等于在浏览器地址栏里输入一个网址。我今天刚装了Google的新Email程序:按Alt+D,输入gmail,再按Ctrl+Enter。网络应用程序有着相当少的兼容性问题或者跟其它软件冲突的机会。所有使用你产品的用户都使用着你最新的版本,你不必为各种旧版本提供支持。你可以使用任何你喜欢的开发环境,只要你能够让程序在你自己的服务器上跑就好。你的程序实质上也能自动为所有地球上的电脑服务。而且,你用户的数据在实质上也能自动供地球上所有的电脑使用。

但,这些需要牺牲流畅的用户界面做代价。这边有一些网站无法做得很好的事情的例子:
1.
建立快速画图的程序

2.实时带红色下划线的拼写检查

3.警告用户说他们点浏览器的关闭按钮时会丢失手头的资料

4.根据用户的操作更新部分显示内容而不访问服务器

5.建立一个键盘按键驱动而不需要鼠标的程序

6.让用户在断开网络的情况下继续操作。

这些也并不是多大不了的事情。而且有些会很快被聪明的Javascript程序员搞定。GmailOddpost这两个新的网站正巧都是做Email应用的,并且巧妙的绕过或者彻底的解决了上述的一些问题。并且,用户似乎不是很在意UI上的不足以及界面迟钝的反应。几乎我认识的所有正常人都因为某种原因非常满意基于webEmail程,无论我多么努力的向他们推荐富客户端软件。唉~更富的客户端软件其实。

所以,Web用户界面已经有八成火候了,并且即使没有新的浏览器我们也很可能可以把它做到九成半。这对绝大多数人来说已经足够好了。而此用户基础对那些选择Web做新软件开发的程序员来说也足够好了。

这也就意味着,微软的API突然间变得无足轻重了。Web程序不需要Windows

这不是说微软并没有意识到这些事情的发生。他们当然清楚。而且,在事情表面化的时候,他们突然紧急刹车了。很有潜力的技术如HTADHTML停止发展了。Internet Explorer的整个开发团队似乎消失了;他们以及好几年没有任何作为了。微软没有理由让DHTML变得比现状更好;因为这对于它的核心业务-富客户端软件太危险了。微软这些日子来的口号是:“微软在富客户端软件开发公司上压了重注。”你可以在长角的幻灯片上看到这些。来自Avalon团队的Joe Beda说:“Avalon跟长角在整体上说,是微软的根基。这说明我们相信桌面软件的威力,坐在本机前就能够玩很酷的东西。这里,我们正对桌面软件做投资,我们认为这是跟很好的方向,并且我们希望开启新一轮激动人心的……”

问题是已经太晚了。

我自己对此是有点伤心的

我自己真的是对此有点伤心。对我来说,Web很棒;但是,基于Web的软件反应慢,用户界面不统一是对日常稳定操作的一大退步。我爱我的富客户端软件,而且当我需要去使用这些软件的Web版本的时候,我会呆掉的。我每天使用的这些 软件有:Visual Studio,CityDesk,Outlook,Corel PhotoPaint,QuickBooks。 但,这些却是程序员即将要带来给我们的。没有人(我再重复一次,没有人意味着少过一百万人)会再使用Windows API做开发。风险投资商不会给做Windows应用程序的公司钱的,因为他们担心来自微软的威胁。并且,绝大多数用户不像我这么在意蹩脚的Web界面。

这里有个铁证:我注意到(并且,我从人事部门的朋友处证实了)纽约的Windows API开发并懂得C++COM的程序员年薪大约是十三万美金;而典型的使用托管语言(包括Java,PHP,Perl甚至ASP.Net)的Web程序员年薪是八万美元。差距是巨大的。而且当我跟在微软做客服的朋友聊天时,他们承认微软已经错过了一整代的程序员。请一个有COM开发经验的程序员每年需要十三万美金,是因为在过去约八年的时间里没有人在乎去学COM开发了。所以,你一定得找到有相当资历的程序员,并说服这些往往已经处于管理人员的层次人去处理底层的程序(神啊!救救我吧!)如处理marshallingmonikersapartment线程跟aggregatestearoff跟其它一千万种基本上只有Don Box能理解的事情,事实上Don Box也受不了再跟这些玩意打交道了。

我讨厌说这点。但一堆开发人员已经转到Web上很久了,并且不愿转回去。大多数.Net的开发人员是开发ASP.Net的,做微软Web服务器端的开发。ASP.Net是卓越的;我已经做了十年的Web开发,但ASP.Net便硬是再往前夸了一步。但它是服务器端的技术,客户端可以使用任何桌面软件。更甚者,ASP.NetLinux中使用Mono也跑得很好。

所有的这些兆头都对微软不妙,它无法再从API垄断上获得巨额利润了。新的APIHTML,而市场的新胜利者将会是那些能玩转HTML的人。

Posted via web from 米良的实验室