Monthly Archives: December 2005

虫虫危机2?业界面临Y2038新问题

大家一定还记得上个世纪末给IT业界带来不少麻烦的Y2K bug吧,很不幸的是,我们很快又将面临另一个和时间有关的bug——Y2038问题。
 
专家警告说,Y2038 bug将于2038年1月19日(星期二)03:14:07am(GMT)正式爆发,届时人们对千年虫问题的预言可能将一一实现,比如手机网络工作不正常,卫星脱离轨道,型号较老的电脑软件软硬件无法正常工作等。
 
什么是Y2038 bug
 
Time_t是C/C++ 等编程语言在内部代表/存储日期和时间的一种数据类型。Time_t实际上是一个代表秒数的整数,当它的值为0时,代表的时间是1970年1月1日12:00:00;当Time_t=60时,则表示1970年1月1日12:01:00,依此类推。
 
所有32位电脑系统都用带符号32位整型来存储time_t的值,也就是说t_time只能用31位二进制数来表示(第一位用来表示正负号),而其最大值转换为十进制是2147483647,换算成日期和时间刚好是2038年1月19日03:14:07am(GMT),而这一秒过后,t_time的值将变成-2147483647,代表的是1901年12月13日8:45:52pm,这样32位软硬件系统的日期时间显示就都乱套了。另外,无法接受time_t为负值的其他功能也将返回错误。
 
举个实际的例子来说,登陆上Yahoo messenger,给好友发个消息,恩没问题,现在把系统时间更改为2038年1月19日03:14:07am,此时如果再发消息Yahoo messenger就将崩溃。
 
为何担忧?
 
也许有人觉得2038年还早着,无需担心这个问题。不幸的是,上世纪60年代的程序开发人员也抱有类似的错误想法,并由此导致了Y2K问题,给全球IT页带来数十亿美元的损失。
 
要知道时间对于许多电脑程序来说都非常重要,操作系统、数据库程序、电子表格软件、实时控制系统等无不涉及到时间。因此我们必须在Y2038 bug爆发前做好充足的准备。
 
尽管到2038年,桌面PC和服务器基本上都将升级到64位甚至128位,但仍会有许多使用中的32位甚至更古老的系统。即使是在32位系统盛行的今天,大多数嵌入式系统仍是8位或16位的,而小型嵌入式系统的数量其实比台式机更多。
 
如何应对?
 
Y2038问题和Y2K一样难缠,其中一种解决办法就是用位数更多的数据类型来存储日期和时间。如果使用64位数据类型,time_t最大可以表示公元292000000000年,是宇宙估计年龄的20倍,最起码看到这篇文章的各位都不会再遇到什么YXXXX问题了。
 
目前对于Y2038 bug的影响有多大还存在争论,但有一点可以肯定的是:有备无患。相信我们能像克服Y2K问题那样圆满解决Y2038问题。
Remember the Y2k bug and the hype surrounding it? It seems the hype is back. Only this time, it is not about Y2k but about Y2038, the latest bug to take the virtual world by storm.
 
According to experts, in January 2038 many computers and electronic systems will come across a new date-related problem. This will create havoc among many systems around the globe. For example:
 
 
?Cellular networks could see interruption in normal operations;
 
?Life support systems in hospitals may collapse;
 
?Massive blackouts or brownouts may occur;
 
?Satellites in space may depart from their orbits;
 
?The 8/16-bit embedded systems will crash, and;
 
?Old software/hardware will be unable to perform efficiently.
 
Many of the predictions for the Y2K bug are likely to come true in the year 2038. The bug is predicted to hit exactly at 03:14:07GMT on Tuesday, Jan 19, 2038.
 
The Y2038 bug
 
Time_t is a data type used in C/C++ and other languages based on C/C++ to represent/store dates and times internally. Time_t is actually just an integer that counts the number of seconds since January 1, 1970, at 12:00am GMT. If time_t is set to 0, it means the date and time is Jan 1, 1970, 12:00:00am. If the value of time_t is 60, the date and time will be Jan 1, 1970, 12:01:00am, and so on.
 
On Jan 19, 2038, 03:14:07am GMT, the t_time value will be 2147483647. This is the problem. All 32-bit computer systems store time_t in signed 32-bit integer. In other words, time_t can use a maximum of 32 bits. The first bit is used to indicate positive or negative state of the number, while other 31 bits are used to store the number itself. We can store no more than 2147483647 in 31 bits.
 
Table 1 shows how on 19th Jan 2038, at 03:14:07, t_time will be set to 2147483647, which is the maximum number a 32-bit integer can store. Therefore, when t_time will hit the aforementioned value, 32-bit hardware/ software will be unable to handle date and time correctly.
 
When an integer reaches its maximum value and then gets incremented, it drops to its lowest possible negative value. This means if time_t value is set to 2147483647 and then increased by one, the value become negative 2147483648, which represents Dec 13, 1901, at 8:45:52pm.
 
Furthermore, other functions that use time_t cannot handle negative values and return an error.
 
Just to present a clearer picture, here is an example: Sign in to your Yahoo account using Yahoo messenger. Now check to see if you can send messages to your friends. Change your system抯 date to 19th Jan, 2038, 03:14:07 am and try sending an instant message. Your Yahoo messenger will crash.
 
Why worry?
 
Most people like to believe that the year 2038 is still far enough to begin worrying about the bug now.
 
Unfortunately, this is the same mistake the software developers of the 60s had made which resulted in the Y2k bug.
 
We have to keep in mind that 憈ime?is a highly prevalent factor in many computer applications. It is used in operating systems, database applications, spreadsheet software, real-time control systems and just about everywhere else. This makes it doubly important for us to ensure that we are well prepared before the bug finally hits the virtual world.
 
Although, all desktop PCs and servers will likely be 64-bit or even 128-bit ones by the year 2038, many systems may still be of 32-bit or less. Today a majority of the embedded systems are still 8-bit or 16-bit. The point is that small-embedded systems are more common than desktop computers.
 
What to do
 
This problem is not as difficult to resolve as the Y2K was. One can resolve this issue by using large data type to store date and time. In C language Long data type can store 64-bits. In a 64-bit program, time_t can represent maximum 292000000000 AD ?20 times the currently estimated age of the universe.
 
If you are a software developer, you can take these steps to avoid the year 2038 bug in your software:
 
?Always store data and time in large data types.
 
?Do not cast date and time from large data type to small data type.
 
?Use standard functions or APIs (Application programme interface) provided by operating systems to convert date and time. A few organizations have already begun using API in their software in order to avoid the bug.
 
?Use newer versions of compiler to compile your program.
 
Now that the issue has been cited, the developers will hopefully address it within the next ten to 20 years, and come out with a suitable solution. In that case, there is nothing much to worry about. But just to be on the safe side, you should at least distance yourself from functions related to time.
 
Although, there are conflicting reports on how dangerous the Y2038 bug is going to be, there is a consensus that it will create quite a stir for computer users. Precautions taken now can make a huge difference.
 
 

Carlito’s Way

carlitosway.jpg
 
  岁月如流,旧歌如梦。有些电影看过就忘了,有些永远的留在记忆中。于是找出来再看一遍。从前看觉得是好的,现在知道了为什么好,好在哪里。前天夜里百无聊赖,手边刚好有一部Al Pacino的‘Carlito’s Way’,重温之后伤感的像一只断翅的蝴蝶。生死与爱情是永恒的让你看了睡不着觉的主题。比如’Love Story’,比如‘Titanic’。但是就像Jack Daniels加一些Coke才更有味道,这类电影掺些别的元素,比如黑帮,往往更耐人寻味。’Carlito’s Way’就是一杯比例完美的Jack Daniels + Coke。
 
  本该蹲30年,5年就神奇假释的亡命之徒Carlito (Al Pacino)出得牢来,发现有两件事情不太对头。第一件是5年不见,女孩子的裙子短的连屁股都遮不住。(他出狱的时候是公元1975年)第二件是,自己居然成了黑社会里年轻一代顶礼膜拜的传奇前辈。(纽约黑帮竞争激烈,五年人事几翻新-作者注)第一件还好说,这第二件对于胆气已颇为消磨的Carlito真是个要命的好消息。不想立马就碰上毒贩子火拼,Carlito奋起自卫,把子弹打光后屁滚尿流的一头钻进厕所,死活不敢出来。过了半天发现没动静,探头张望原来一不小心把所有人都灭了。好吧,威名又竖起来了,那就继续在刀口上讨生活吧。本来打定主意洗手不干的他,买了家黑社会club经营,准备攒够一笔钱就远走高飞-还有什么放不下的呢?这座城市,这个自由世界?-什么都放得下,除了她。Gail。他曾经的恋人。他想忘记她,偏偏还是想起;他知道不该再去找她,可他还是去了。于是悲剧在这一刻就已注定-他飘然去见她的那一刻。因为若不是为了牵绊她,在最后他就不用赶到火车站,去投奔那个陷阱,一个人他有一千种方法能安全的离开美国。
 
  这让我想起了同样没跨过这道坎儿的另一条好汉,‘Leon’里的Leon。Leon和小女孩在一起的第一个晚上,小女孩睡着后Leon从椅子里暴起荷枪实弹潜至她身边,以枪指其头,犹豫再三而终未下手。于是最后Leon只好为她死。当然Leon对于小女孩爱和同情哪一个更多些很难说,但这更证明了’英雄难过美人关‘的此言非虚性-有一些些情意都尚且如此,情深意厚那还了得?!类似的其他好汉还有很多,个个都是生龙活虎,敢爱敢恨的性情中人。在此就不进一步提供黑名单,免得没看过的同志看起来没了悬念,要我承担责任。
 
  好吧,我们的主人公Carlito不幸的也是此类好汉之一,所以在片尾,他为了Gail,不能逃脱肚子上挨几枪的命运。他倒下之后的一段堪称经典。火车站墙上贴的一幅写着’Escape to Paradise‘的某海岛广告画慢慢地活了。金色的夕阳斜照岸边,风物如画,似乎都闻得到风中湿润的海的湿气,却又时辰已晚,一切朦朦胧胧,亦幻亦真。棕榈树下依稀看得出是Gail在翩翩起舞,姿态曼妙,风韵无限。她身边有几个小孩子正玩耍嬉戏,无忧无虑。Carlito的独白贯穿这最后一幕。他没有回顾任何事情,他只是在展望,在想象。他相信他的遗腹子会被Gail养育成一个更棒的Carlito;他幻想他若真的和Gail去到了那个天堂般的小岛,会是什么情境。收尾的几句真是连英雄听了都要掉几滴虎泪,几乎不忍再写一遍:’Get the milkshakes baby, last call for the drinks. The bar is closed and down. Sun is out. Where we go for breakfast? Don’t wanna go far, rough night. Tired baby, Tired………’(插一句,此等意境颇似我中土之两句古词‘为君沉醉又何妨,只恐酒醒时候断人肠’)
 
  一夜狂欢,直至酒肆闭门。小寐片刻,便已天亮。亲爱的,最亲爱的,你想我们去哪儿吃早饭呢?不要去太远的地方吧,宿醉仍未过去。昨夜很开心,却也很伤神。去个近的地方,叫‘天堂’的地方好么。我累了,亲爱的,真的累了……….这段话若不是因为他就要死了,也许就不那么回肠荡气。可它分明是一语双关,明写在世外小岛上彻夜狂欢,次晨慵懒,‘我醉欲眠君且去’;实写他人生最后的感受。这一辈子就像瞎折腾了一夜,好不容易熬到天亮了,该有新的生活了,却发现已疲惫不堪,寸步难移。找个地方休息一下吧,不想在人生的荆棘路上再跋涉的更远了。有个近的,容易的去处,叫天堂……….. 何必呢,Carlito。何必呢,Leon。当初你明明能选择,避开这种结局。都是为了女人,为了放不开的真挚的爱。也许还不如像’Age of Innocence’里的男主人公(Daniel Day Louis),毅然抛弃了他的真爱,与家族安排的女子结婚(Wyona Ryder),成功的避免了身败名裂,横死非命等等观众喜闻乐见的下场。可是有一天,他老了,他走到他真正爱的女子年轻时住过的小楼下举头凝望,她真情的眼神,盈盈的笑靥,在他心里仍栩栩如生,活色生香,宛若当年。他呆在那儿,良久,良久,无语凝噎。
 
  所以我以为那不是真正的人生,对得起自己的路。想做的事情,就去做。想要的东西,就去抢。做不到,抢不来,毋宁死。
 
  莫待无花空折枝。

覆雨翻云,苍天啊

看到“覆雨翻云”,以为黄易的最有名的作品终于可以搬上荧屏了。。。。
结果看到下面的剧本。。
改编的,什么不说了,简直是对原著的一种侮辱。从剧情到主人公,全部都改变了,苍天哪!!
 
故事简介:
 
王者剑覆雨 中原刀翻云
两大神兵利器 背负民族恩仇
 
因缘际会
 
明朝,社会安定。风行烈(林峰饰)虽为蒙古王族后人,但因短暂失忆,对国仇家恨,没有概念,反培养出逍遥的个性,追求爱情、希望逍遥山林。风行烈为搏红颜靳冰云(郭羡妮饰)一笑,决定盗取重现江湖的覆雨剑,结果遇上了韩柏(黄宗泽饰)。韩柏,燕王府内的小厮,不懂武功,却因缘际会得到覆雨剑,谁料宝剑被风行烈盗去。韩柏誓要取回宝剑,二人不打不相识。世事多变,韩柏遇上当世高手赤尊信(郭峰饰)把毕生内力传授给他,令他一夜之间成为高手。相反,风行烈却被靳冰云出卖,成为大魔头庞班(郭政鸿饰)的练功炉鼎,结果庞班练成绝世魔功。风行烈却武功尽失,更被庞班追杀,险境中幸得韩柏相救。
 
情义两难存
 
韩柏和失散的生父虚若无(许绍雄饰)大将军相认。虚若无更将韩柏引荐到朱元璋(高雄饰)面前,自此,韩柏飞黄腾达。另边厢,原来庞班正是当年元朝的国师,他苦练魔功,密谋复国,并选了风行烈为领导同胞的王者。于是,他把风行烈迫到绝路,让他深切体会到在朱元璋统治底下,蒙古族人被迫害的惨况,让风行烈背起民族的责任。风行烈要颠覆明室江山,韩柏却是朱元璋身边红人,二人的矛盾立场,逐渐显现。
 
覆雨剑.翻云刀
 
风行烈知道要复国,最大的障碍是韩柏。韩柏的翻云刀法,出神入化,而且他接掌了浪翻云(姜大卫饰)的江湖第一帮:怒蛟帮。风行烈要打胜他,并无胜算。此时,庞班道出覆雨剑的秘密。原来覆雨剑乃王者之剑,内藏绝世武功:战神图录。开启战神图录,要倚靠「剑心通明」这种上乘心法,修练到「剑心通明」境界的,当今武林唯秦梦瑶(佘诗曼饰)一人。然而梦瑶乃慈航静斋大弟子,亦是明室江山的梁柱。风行烈唯有以爱情为手段,打动梦瑶。
 
同室操戈
 
朱元璋步入垂暮之年,明室中,最有才能者是燕王朱棣(麦包饰)。于是,风行烈利用离间计,嫁祸朱棣行刺父皇,令朱元璋对朱棣下格杀令。谁不知太孙允炆(李天翔饰)早已勾结了蒙古人,他才是内奸。允炆登基,下令禁军围捕朱棣,韩柏、梦瑶拼死突围,保护朱棣离开京师。允炆委任风行烈为削藩主帅,朱棣成立靖难军,演变成明室内讧,同室操戈。这时的风行烈已修练成覆雨剑法,武功比韩柏的翻云刀更高,两雄相遇,谁胜谁负?江山又会落入谁人之手?

20051227201841961.jpg

让mt支持按日归档

mt默认没有启用按日归档,启用的方法很简单,在Settings -> Publishing Settings -> Archive Mapping中,选中“Daily”。就可以了
同时,如果启用了按日归档,就可以让blog的日历链接到一天的文章,而不是一篇文章了,这样也更符合我们的习惯。
修改日历代码中的“<a href="<$MTEntryPermalink$>"><$MTCalendarDay$></a>”改成“<a href="<$MTCalendarDate format="%Y/%m/%d/"$>"><$MTCalendarDay$></a>”。

用Autoruns来检查你机器的启动项

不多说了,软件说明贴到下面了。强烈推荐
 
 
This utility, which has the most comprehensive knowledge of auto-starting locations of any startup monitor (A starting list of auto-run locations was obtained from David Solomon’s "Windows Internals" seminar), shows you what programs are configured to run during system bootup or login, and shows you the entries in the order Windows processes them. These programs include ones in your startup folder, Run, RunOnce, and other Registry keys. You can configure Autoruns to show other locations, including Explorer shell extensions, toolbars, browser helper objects, Winlogon notifications, auto-start services, and much more. Autoruns goes way beyond the MSConfig utility bundled with Windows Me and XP.
 
Autoruns’ Hide Signed Microsoft Entries option helps you to zoom in on third-party auto-starting images that have been added to your system and it has support for looking at the auto-starting images configured for other accounts configured on a system. Also included in the download package is a command-line equivalent that can output in CSV format, Autorunsc.
 
You’ll probably be surprised at how many executables are launched automatically!
 
Autoruns works on all versions of Windows including Windows XP 64-bit Edition (for x64) and Windows Server 2003 64-bit Edition (for x64).
 Autoruns.gif
 
 
Autorunsc Usage
Autorunsc is the command-line version of Autoruns. Its usage syntax is:
 
Usage: autorunsc [-a] | [-c] [-b] [-d] [-e] [-h] [-i] [-l] [-m] [-n] [-p] [-s] [-v] [-w] [user]
 
-a
Show all entries.
-b
Boot execute.
-c
Print output as CSV.
-d
Appinit DLLs.
-e
Explorer addons.
-h
Image hijacks.
-i
Internet Explorer addons.
-l
Logon startups (this is the default).
-m
Hide signed Microsoft entries.
-n
Winsock protocol providers.
-p
Printer monitor drivers.
-s
Autostart services and non-disabled drivers.
-t
Scheduled tasks.
-v
Verify digital signatures.
-w
Winlogon entries.
user
Dump autoruns for the specified user account