Dec 27

Washington (dpa) - What’s ahead in the world of technology in 2007? No one can say for sure, but that doesn’t make the tradition of making predictions any less enjoyable. More than many other areas, technology is all about transition. And the year ahead promises transitions in tech that are nothing short of dramatic.

— Windows Vista uptake slow

Microsoft’s much-ballyhooed Windows Vista operating system will be available to everyone early in 2007, but don’t expect the earth to move when it’s released.

People are tired of upgrading - especially when the benefits of doing so are difficult to articulate or uninspiring. That’s the problem with Microsoft’s Vista operating system in a nutshell.

When you hear talk of Vista, the focus is on a pretty new interface. Is that enough to tempt the masses to disrupt their current setup and face the inevitable incompatibilities and loss of productivity that switching to Vista will entail? It’s a tough sell - except to those who enjoy technology for technology’s sake. For the rest of the population, though - those who actually use computer to accomplish tasks - Vista is a yawner.

— Spyware and malware

Forget computer viruses. The real threat to your productivity in 2007 and beyond will be spyware and malware, which will come at you from every corner of the Internet and threaten to slow your work to a halt - not to mention steal your identity and financial account information.

The antivirus software makers, focused as they are on traditional computer viruses, have been slow to respond - and when they have, their solutions have fallen short. So currently users are forced to rely on a smattering of programs like the free Ad-Aware that root out these Internet-borne threats. Expect the spyware problem to get worse before good tools come along to fix the mess.

— Spam under control

Spam won’t be going away in 2007 - far from it. One recent report indicated that spam now accounts for over 90 per cent of all e-mail messages that e-mail users receive.

But because spam catching technologies are becoming close to fool- proof, you’ll probably see less spam if you take reasonable measures to circumvent it. And even if you don’t, the amount of spam that reaches your inbox should decline in 2007. That’s because e-mail authentication technologies used by Internet service providers have changed for the better how spam is identified. And once spammers are identified, the strict policies in place at most service providers can be used to clamp down on spamming activities.

— User-based content is king

Traditional news media are already reeling, trying to cope with the loss of readership and ad revenue as the sources of news and information proliferate on the Internet. Google’s YouTube and the myriad blogging sites around the Internet have put individuals in control of “creating” news and information of interest to the public. You can expect such sites to continue to gain popularity in 2007, further intensifying the competition for readers’ time.

— Wi-fi gets serious

The dream of “Internet everywhere” is going to come a good deal closer to reality in 2007, as the global rollout of wi-fi hotspots picks up steam. Offering wireless Internet connectivity is good for everyone - for municipalities whose citizens benefit from it, for businesses that attract customers and good-will by offering it, and certainly for the roaming masses that use it.

On the home front, wi-fi products that conform to the new, speedy 802.11n wireless transmission standard will hit the market, offering wireless speeds that truly rival today’s wired networks.

— It’s all about the Web

As Internet connectivity becomes ubiquitous, the Internet itself will be host to more of the applications we use on a daily basis. 2007 will see the clear emergence of that trend. Web-based word processors, spreadsheets, collaboration tools, wikis, blogs, and user-generated applications will begin to blur the distinction between what’s on our PCs and what’s on the Web. Already Google has trotted out a host of Web-based office applications. Expect to see other companies follow suit.

— No clear winner in HD-DVD and Blu-Ray wars

Right now in the world of video and television, it’s all about high definition. But whose version? That’s the question. Right now when it comes to high-def DVDs, there are two competing standards: HD-DVD, championed by Toshiba and others, and Blu-Ray, championed by Sony and others. Only foolhardy consumers with lots of money are choosing sides at this point - since DVD players that use either standard are expensive and, of course, not compatible with the other standard.

In 2007, expect no clear winner to emerge out of this battle of standards. The reason: the highly available and reasonably-priced “upconverting” DVD players, which take today’s DVDs and upsample them for the high-def televisions, are plenty good enough for most people. That leaves the high-def DVD standard bearers fighting it out for a public that is increasingly apathetic about who emerges victorious.

If the battle between HD-DVD and Blu-Ray goes on long enough, another solution or option altogether is likely to emerge to make the standards war meaningless. // ? 2006 DPA

Dec 25

People swarm into streets. It’s crowded everywhere. Maybe the climate is more chilly than South China. Beijing streets are not as crowded as Shanghai.

Last year,?we spent Christmas Eve with many south korean Christians. It was interesting. Last year, a few friends complained that most Asian don’t take it as a religious day, but a holiday. I think that it is very good! For example, Chinese has our own cultures. It’s bad if the cultures were replaced or substutited by ab extra stuff.?Inspiringly Chinese cultures draws more and more attentions from kids/youth today. BTW, Chinese cultures are not Confucius theory, but a much superset of it.

?

Below is a classic red wall near to Tian’anmen, taken by a mobile phone:

?



Dec 25

Photo by a Nokia mobile set:





Dec 24

如果使用过UpdatePanel,可能已经注意到,当一个页面有多个UpdatePanel的时候,异步页面请求同时只能有一个请求(callback),而且后发起的请求会取消先发的请求。怎么改变这个次序呢,比如一个异步请求已经在进行,怎么阻止其它请求呢?这就要用到PageRequestManager。(让多个请求并发进行,以后会介绍)

通过PageRequestMangaer还能提供更多的feature:提供取消callback的选项,自定义错误处理消息,访问底层进行异步请求的request/response对象。

总的来看,PageRequestManager是运行在浏览器端的协调者,它和服务器端的UpdatePanel一起,把局部页面更新的复杂性抽象化,提供给开发者方面的使用接口。

PageRequestManager提供了以下事件,让开发者能加入自己的Javascript脚本来改变缺省的行为:

1. initializeRequest

Raised before the request is initialized for an asynchronous postback. Event data is passed to handlers as an InitializeRequestEventArgs object. The object makes available the element that caused the postback and the underlying request object.

2. beginRequest

Raised just before the asynchronous postback is sent to the server. Event data is passed to handlers as a BeginRequestEventArgs object. The object makes available the element that caused the postback and the underlying request object.

3. pageLoading

Raised after the response to the last asynchronous postback has been received but before any updates to the page have been made. Event data is passed to handlers as a PageLoadingEventArgs object. The object makes available information about what panels will be deleted and updated as a result of the last asynchronous postback

4. pageLoaded

Raised after page regions are updated after the last asynchronous postback. Event data is passed to handlers as a PageLoadedEventArgs object. The object makes available information about what panels were created and updated. For synchronous postbacks, panels are only created, but for asynchronous postbacks panels can be both created and updated.

5. endRequest

Raised when request processing is finished. Event data is passed to handlers as an EndRequestEventArgs object. The object makes available information about errors that have occurred and whether the error was handled. It also makes available the response object.

?

我们来分析一个使用PageRequestManager的例子:

Run the example ( view source)

这个例子中,使用了PageRequestManager来定制Update状态显示,也提供了取消请求的方法,这主要是从下面的代码中展示出来:

<script type=”text/javascript”>
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
var postBackElement;
function InitializeRequest(sender, args) {
if (prm.get_isInAsyncPostBack())
{
???args.set_cancel(true);
}
postBackElement = args.get_postBackElement();
if (postBackElement.id == ‘ButtonTrigger’)
{
???$get(’UpdateProgress1′).style.display = “block”;
}
}
function EndRequest (sender, args) {
if (postBackElement.id == ‘ButtonTrigger’)
{
???$get(’UpdateProgress1′).style.display = “none”;
}
}
function AbortPostBack() {
if (prm.get_isInAsyncPostBack()) {
???prm.abortPostBack();
}
}
</script>

在例子中,通过给PageRequestManager的initializeRequest事件和endRequest事件加入自定义的javascript代码,实现了定制的行为。

对于PageRequestManager,使用get_isInAsyncPostBack方法或isInAsyncPostBack属性能得到当前异步请求状态;使用abortPostBack可以取消当前的请求;使用add_initializeRequest和add_endRequest分别将用户编写的javascript处理函数注册到initializeRequest事件和endRequest事件中。

另外,在函数InitializeRequest中,args.set_cancel(true)用来让先发的请求被执行,改变缺省的后发具优的行为。



得到PageRequestManager的所有方法和事件列表,请参见:


Sys.WebForms.PageRequestManager Class

Dec 23


[说明]:由于播放时间改变,最新的上映时间请看这里:


Dec 22

吃完午饭,开始写一个程序,需求描述是:自动从网络上搜集数据,主要是各种新闻资讯;将收集到的资讯,自动发布到一个内容管理系统中。

为了加快速度,如果可能尽量使用已经存在的工具,到刚才终于全部编写完毕。总结一下用到的东西:

  • dasblog - Blog开源管理引擎,我用它来做内容管理。
  • iBATIS - O/R Mapping开源库,和数据库有关的操作主要使用它来完成,感谢老雷介绍iBATIS给我。
  • OpenSmtp - Email发送开源库,最开始想通过发送email的方式,发布搜集到的资讯。后来发现,dasblog不能很好处理邮件正文的编码问题,考虑到改dasblog的时间比较旧,就想了另外一个方法:利用XML-RPC。
  • XML-RPC.NET - XML RPC的.NET开源实现。因为dasblog支持MetaWeblog API,所以在email发布遇到麻烦的时候,决定使用XML-RPC之上的MetaWeblog API来发布内容。

利用MetaWeblog API来发布内容,于dasblog还有一些问题,就是文章没有出现在首页上,而需要点击tag才能看到,不知道是不是dasblog的页面更新有延迟。有时间的话,应该把dasblog的代码check out来学习一下,它是一个非常好的blog管理引擎。

Dec 22

I need to publish blog entries using an automated program. The first idea is to do it by email. However, it turned out that DasBlog doesn’t support unicode well. For exmaple, Chinese articles posted via email are in wrong encoding.

After trying virous encoding method, I came to think that it will be more convenient to do it via the Metaweblog API. Trying to patch dasblog is not pratical to me, due to time limitation. Then I installed Windows Live Writer, and proved that dasblog supports Metaweblog API.

The next thing to do is find a XML-RPC library. After surfing around the Internet, XML-RPC.NET comes into my sight. Actually I also found that it’s already used in dasblog. It has been developed ever since 2001, and is still active. Many thanks to the lead programmer, Charles Cook.?If you are also interested in employing XML-RPC in C#, you can find it here: http://www.xml-rpc.net/

?


Some useful articles that are relevant:

Dec 22

英国《金融时报》中文网专栏作家 许知远
2006年12月21日 星期四

纪念红军长征胜利70周年的演出舞台上那些战士的面孔,一排排电脑桌,贵阳市警察们的12
00辆摩托车,广东一家工厂的职工的宿舍楼阳台,一家胡椒厂的黑色的原料缸、一家购物中
心的扶手电梯……这些人与物,数量庞大、整齐划一、每个个体模糊不清。TIME.com将这组
照片命名为“中国模式”,在这个标题下是一句简单的说明:“A unique look more than
a billion overlapping lives”。

这组照片给我的感觉既清晰又复杂。我们早已熟悉了西方媒体热衷象征手法,在网络热席卷
中国时,杂志的封面上一个绿色军帽,原来的红色五角星,被置换成@;在SARS流行时
,则是戴上了口罩的毛泽东画像;在形容台湾海峡两岸的紧张情绪时,是一条红色的大龙和
一条绿色小龙的纠缠……

一个国家对自己的形象的认识,和一个旁观者的看法往往截然不同。我记得日本历史学家梅
棹忠夫关于世界地图的有趣发现,在美国出售的世界地图,是以北美与拉美这块大陆为中心
的,或者以大西洋为中心来描绘地球形象的;而在日本的世界地图上,日本跑到了中央位置
,英国和北美则被安排到边缘。而在中国,我们都知道,那只雄鸡才是世界的中心。

我对于外来者对中国做出的过分概念化的描述,不再感到不安。因为我们也在粗暴的理解对
方,谁能说我们对于美国、对于日本或是任何一个国家与地区的看法不充满着深深的偏见。

人们总是容易把握住那些最显而易见的元素,尽管很有可能,这种元素在生活在其中的人们
眼中,早已习以为常,甚至进行某种自我欺骗式对此视而不见。我可以想象,中国人在第一
次看到安东尼奥尼的《中国》时的震惊和愤怒——我们将你视作中国人民的朋友,你呈现出
的却不是那个火红的革命热忱,而是在一个包裹在蓝色服装下刻板的中国。因此,重要的是
,你如何学会站在别人的角度,观察自己,获得对自身的新见解。

我知道这组照片在表面的戏剧性背后的真实性,在告别了那个全民一致性年代至少30年后
,集体主义、趋同的、单调的思维模式仍在我们的日常生活中发挥着主导作用。我们在欢呼
一个多元化社会的出现,却发现这种表面的多元化,在本质上存在着多么强的一致性。我们
的社会的确像是一个个雷同的复制品的集合,几乎每个城市都修建了空旷、却无人使用的人
民广场;几乎每家电视台都在进行某种选秀活动;在江浙一代的富裕起来的乡村里,每一户
的小楼上都有同样的圆形的加顶;我家楼下的一家餐厅的员工每天早晨要集合、喊口令,与
学生时代的军训一模一样;一家公司在进行一场商业活动时,采取的方式像是电影中的解放
战争,销售区域被划分为华北区、华东区、华南区;当我们的国家认定需要创新时,所有的
人就开始谈论创意,以至于“创意”这个词变得泛滥和陈旧……

你可以说我的观点和TIME.com上那一组照片同样充满了偏见,对于中国人的这种看法,自1
9世纪以来,始终是西方世界的主流看法。我记得1938年的美国一幅漫画,它的主题是“从
前,中国有五兄弟,长的一模一样”,我也记得狂妄的历史学家斯宾格勒也说“他们处在整
齐划一观念的同样永恒的环圈中,没有变化,也没有改良”。

是的,这些观察被证明是过分表面化,并充满了“政治不正确”,但偏见并非总是全然错误
的。我不得不说,在我们日渐相信中国正在震撼世界时,中国给予世界的首要影响是来自于
数量上的,而非其他什么原因。“印度+中国”的狂热在全球的媒体与学术讨论会上的蔓延
着,但到目前为止,人们一想起印度仍是她的呼叫中心的印度英语,而中国则是沃尔玛超市
里的海量廉价商品,它们可能让人惊诧,却不会引人尊敬。

当然,历史的进程经常出人意料。17世纪的法国人相信只有专制主义才能促进社会进步,他
们不会相信那个由斤斤计较的小店主构成的英国日后会领导世界;19世纪的英国人也不会相
信,那个粗俗不堪的美国,日后会成为世界政治与文化的中心;即使到了1960年代,日本的
产品还是廉价与质量差的代名词,人们不会想到她将创造新的消费潮流……

中国必然在这一序列中吗,她的发展将为世界历史带来某种全新的启示吗?一部叫《大国崛
起》的专题片正在中国社会激起了广泛的讨论,人们想知道中国有何种经验可以借鉴。因为
很有可能,中国正处于某种历史的十字路口,她像一个蒙着眼的巨人一样,匆匆的赶了几十
年的路,它取得的成就可能既伟大,也充满了致命缺陷,一些时候,她比人们想象的更智慧
,但在另一些时刻,她可能愚蠢得自己也不相信。在接下来的三篇文章中,我们将讨论几位
学者对于中国的道路与方向的看法,他们可能帮助我们从另一个侧面认识我们的国家。先让
我们从彼得·诺兰的著作《中国在十字路口》和张艺谋最近的电影说起。

Dec 21
1. Server Controls

—————————–
按上一节的步骤,安装好AJAX软件包以后(除ASP.NET AJAX Control Toolkit外),我们就可以进行开发了。
先观察一下Visual Studio 2005的控件工具箱,多了一个类别:AJAX Extensions。其中包含了5个控件,分别是:
  1. Timer
  2. ScriptManager
  3. ScriptManagerProxy
  4. UpdateProgress
  5. UpdatePanel
?

?
?
来认识一下它们:
?
a). ScriptManager
管理页面中和客户端组件、局部页面刷新、本地化等有关系的脚本资源。ScriptManager必须位于WebForm中,即含有<form runat=”server”>标签。一个WebForm中只能含有一个ScriptManager,不论是直接使用,还是用过它的子组件使用。必须添加ScriptManager后,才能使用Timer, UpdatePanel, UpdateProgress等Server Controls。
?
b). UpdatePanel
是我们能够只刷新部分页面,而不是原来ASP.NET那样提交整个页面。一个页面中能含有多个UpdatePanel,UpdatePanel也可以嵌套。
?
c). UpdateProgress
对UpdatePanel的局部刷新,提供一个用户友好的状态信息。
?
d). Timer
用来定期触发一些事件,比如提交整个页面,或者刷新部分页面。

2. 认识UpdatePanel

—————————–
ASP.NET AJAX使我们能够通过声明的方式,来引入AJAX风格的控件、行为,而不必编写JavaScript代码。UpdatePanel就是这样一个例子,它的声明格式是:
?
<asp:UpdatePanel ID=”UpdatePanel_ID” runat=”server”>
<ContentTemplate>
… please put your controls and codes here…
</ContentTemplate>
</asp:UpdatePanel>
?
下面已经列出和AJAX相关的那段代码,可以看到,ContentTemplate中有:一个服务器端运行的显示时间的代码,一个Calendar控件。运行代码,点击Calendar控件中的任何链接,都不再把整个页面发送给服务器。实际上,使用Fiddler监视,会发现根本没有数据被发送回服务器端。也就是说,微软已经尽可能的把ContentTemplate中的局部更新计算,转移到用户浏览器中了。
?
????? <asp:ScriptManager ID=”ScriptManager1″ runat=”server” />
????? <asp:UpdatePanel ID=”UpdatePanel1″ runat=”server”>
????? <ContentTemplate>
??????? <fieldset>
??????? <legend>UpdatePanel</legend>
??????? Content to update incrementally without a full
??????? page refresh.
??????? <br />
??????? Last update:? <%=DateTime.Now.ToString() %>
??????? <br />
??????? <asp:Calendar ID=”Calendar” runat=”server”/>
??????? </fieldset>
????? </ContentTemplate>
????? </asp:UpdatePanel>
?
在一个设计好的AJAX页面中,比如Windows Live Mail或Gmail,我们可以把页面分成几个区域,分别作为UpdatePanel区域,比如email列表区域、邮件正文区域、运行信息区域等。当然,一个页面中可以有多个UpdatePanel。UpdatePanel也可用嵌套,子控件的更新不会导致整个父控件的更新,但会引起父控件的UpdateProgress显示刷新正在进行。那什么是UpdateProgress呢?请向下看。

3. 认识UpdateProgress
—————————–
使用Gmail的时候,你一定注意到了右上角的”Loading…”提示;而使用Windows Live Mail时,你一定注意到了“正在加载…”提示,当然还有一个pp的动画图片。
?
有时候,局部页面的刷新比较慢,为了给用户友好的提示,我们可以使用UpdateProgress控件。
?
在页面加入UpdateProgress控件后,只要设置它的AssociatedUpdatePanelID属性为页面关联的UpdatePanel的ID,那么UpdatePanel的异步提交(postback),都会显示UpdateProgress控件。
?
如果UpdateProgress控件的AssociatedUpdatePanelID没有设置,则整个页面的任何异步提交,都会显示这个控件。
?
多个UpdateProgress控件都可以关联到一个UpdatePanel控件上。而UpdateProgress控件也可以嵌套入UpdatePanel控件,做为子控件出现。
?
使用UpdateProgress是非常简单的,声明的格式是:
??????? <asp:UpdateProgress ID=”UpdateProgress_ID” runat=”server” AssociatedUpdatePanelID=”Related_UpdatePanel_ID”>
??????????? <ProgressTemplate>
??????????????? Update in progress….(or other info, including image, text, buttons etc.)
??????????? </ProgressTemplate>
??????? </asp:UpdateProgress>
?
下面是3个使用UpdateProgress的例子和源代码,非常明了:
?
?
?

Dec 21
Part A. 安装ASP.NET AJAX 1.0
RC


—————————–
到下面的页面下载ASP.NET AJAX 1.0
RC,运行安装程序,按照提示完成安装:
http://go.microsoft.com/fwlink/?LinkID=77296


Part B. ASP.NET AJAX Control
Toolkit


—————————–
对于Control
Toolkit我们等到用它的时候再安装,这里先不安装。

Part C. 安装AJAX Features December
CTP


—————————–
下载、运行安装程序,并按照提示完成安装
http://go.microsoft.com/fwlink/?LinkID=77294

Part D. 安装ASP.NET AJAX Sample
Applications


—————————–
1. 下载Sample
Application程序,运行安装程序,并按照提示完成安装
http://go.microsoft.com/fwlink/?LinkID=77295
2.
将文件Microsoft.Web.Preview.dll(%Program Files%\Microsoft ASP.NET\ASP.NET 2.0 AJAX
Futures December CTP\v1.0.61025)拷贝到每个Sample Application的bin目录中。