Archive

Archive for January, 2009

切换留言系统到Disqus

January 17th, 2009 No comments

由于之前 Blog 的留言经常受 Spam 的攻击,自己又没有那么多的时间去再优化留言系统,于是就关闭了留言系统。

前几天看到 http://gitready.com/ 的留言是 Disqus 系统的留言系统,就去 disqus.com 网站上看了些介绍,感觉不错就把这个Blog的留言系统也换成 Disqus。

切换起来也挺方便,只要在 Disqus.com 注册,添加个站点,在你留言的地方替换成 Disqus 的代码.

Update: 2009.4.1
1. 目前Blog已有原来的基于Django的blog-app切换到Wordpress.

Categories: SiteLog Tags: , ,

微软 Zune 30 又现千年虫Bug

January 1st, 2009 No comments

在2008年的最后一天,无数的Zune 30 用户忽然发现自己的MP3无法正常播放,而专家给出的解决方法是:

“let the Zune run out of battery and the clock bug will essentially fix itself”

(让电池耗尽或这一天不要用Zune,到第二天就会自己好起来),但是这个Bug会四年后的今天再现。

在国外的一个论坛上看到一个帖子说Bug产生的原因, 当时闰年的时候天数是366天,下面的是Zune的 时钟驱动:

year = ORIGINYEAR; /* = 1980 */

while (days > 365)
{
    if (IsLeapYear(year))
    {
        if (days > 366)  // 当在闰年的时候,days = 366 是出现死循环
        {
            days -= 366;
            year += 1;
        }
    }
    else
    {
        days -= 365;
        year += 1;
    }
}

我们会发现当 days = 366 天的时候,while 就会进入死循环,直到24小时过后,才能正常工作。

当然还有一种修改驱动的方法:

year = ORIGINYEAR; /* = 1980 */

while (days > 365)
{
    if (IsLeapYear(year))
    {
        if (days > 366)
        {
            days -= 366;
            year += 1;
        }
        else  // 可以修复Bug
        {
            break;
        }
    }
    else
    {
        days -= 365;
        year += 1;
    }
}
参考:
1.Cause of Zune 30 leapyear problem ISOLATED!
http://www.zuneboards.com/forums/zune-news/38143-cause-zune-30-leapyear-problem-isolated.html
2.Zune 时钟驱动
http://pastie.org/349916
3.The Day the Zunes Stood Still: Update
http://www.crunchgear.com/2008/12/31/the-day-the-zunes-stood-still-update/

–EOF–

Categories: Geek Tags: ,