2010年3月15日星期一

正在做的twitter"客户端"的截图

项目主页: http://code.google.com/p/twiterm/
CodeName: Darter

把截图放出来给大家预览一下.
目前只有阅读Home时间线的功能.
欢迎提意见和建议!

From Twitter

2010年2月27日星期六

[Twisted学习笔记] Deferred机制

参考阅读:
[1] Deferred Reference
[2] Deferreds are beautiful! (A Tutorial)


最近在研究Twisted, 其中一个会把像我这样的初学者吓住的概念就是Deferred.

我们知道, Twisted是一个异步(asynchronous)基于事件回调(callback-based)的框架, 而Deferred是实现这一特性的关键之一.

Twisted使用Deferred对象来管理回调函数序列(callback sequence).
具体来说:
1) 通过Deferred对象可以为某个事件增加一个或多个事件处理函数(即回调函数);
2) 多个回调函数构成了函数链(callback chain);
3) 增加回调函数的顺序决定了事件响应的"相对顺序";
4) 增加回调函数的方式决定了回调函数的调用时机.

当Deferred对象的请求得到满足, 添加的第一个callback会被调用, 并且其输出会作为第二个callback的输入, 然后像这样沿着函数链依次传递下去. 如下图所示:

[以下为翻译Deferred Reference中的相关段落]
  • 当请求得到结果后, 如果操作成功, 会通过Deferred.callback(result)传递到Deferred Object; 如果失败则通过Deferred.errback(failure).
  • Deferred Object将结果传递给此前注册的回调函数链, 规则如下:
    • 一个callback的输出总是作为下一个callback的第一个参数, 这样就构成了一个处理器链.
    • 如果一个callback产生异常, 则立即转到下一个errback.
    • 如果errback内部产生了异常, 则转到下一个errback.
    • 如果errback没有产生异常, 或者返回了一个twisted.python.failure.Failure实例, 则回到下一个callback.








上图可能会有些误导性, 我又画了一幅示意图:

deferred

2010年1月18日星期一

[攻略]使命召唤-现代战争2-Special Ops-CHARLIE-Homeland Security

参考:
http://tieba.baidu.com/f?kz=667762334
http://tieba.baidu.com/f?kz=679642109
http://3dmgame.chnren.com/bbs/showtopic-1026140.html

其实不用以上攻略中说得这么麻烦,我是这样过关的(Veteran级):
1. 拿到地雷,然后抓住自动机枪左转90°,跑到餐厅里;
2. 把自动机枪架在柜台后面;
3. 把柜台右前方的另一台自动机枪也架到柜台后面,二者保持一定距离;
4. 把手枪换成柜台上的机枪,从后门跑出餐厅;
5. 在后门口和后门口旁边的墙角放置两个地雷;
6. 往巷子里面跑,躲在网后面的那个柱子后面;
7. 用机枪对准后门,然后就等没有被自动机枪消灭的漏网之鱼吧。

用以上方法可以消灭全部的步兵。步兵被灭之后,可以跑到餐厅里,用火箭弹消灭直升机和装甲车。
这种方法比较简单,不用拼命跑来跑去。但是耗时会长一些。

2010年1月17日星期日

Hello World!

Across the Great Wall we can reach every corner in the world. (越过长城,走向世界)

原来的博客挂掉了,可能是暂时的,不过鉴于某国当前的互联网状况,我还是早做打算,干脆迁到blogspot吧。
虽然blogspot频频被墙奸,但是由于“翻墙”已经逐渐成为某国网民除了上QQ之外的基本技能,而且GReader已经被普遍使用,blogspot是一个还不错的选择。

最近谷歌退出中国的事情闹得沸沸扬扬,不知道最后如何收场。
无论如何,could it be any worse?
亲身经历了中国互联网这一年来的各种闹剧,还有什么无耻的做法不能承受,还有什么无耻的人不能忍受?!
在这里引用一下狄更斯的《双城记》开头的一段话:

这是最好的时代,这是最坏的时代;
这是智慧的时代,这是愚蠢的时代;
这是信仰的时期,这是怀疑的时期;
这是光明的季节,这是黑暗的季节;
这是希望之春,这是失望之冬;
人们面前有着各样事物,人们面前一无所有;
人们正在直登天堂,人们正在直下地狱。

很高兴活在这样一个时代。

2007年4月16日星期一

新BLOG

在yo2.cn申请了一个blog:
world.yo2.cn
竟然可以方便地从blogger导入数据,hohoho~
所以我决定搬家了,
从Bokee搬到yo2,
从此world.yo2.cn就是我的主战场了。
呵呵

不过还是有点小小的伤感……
5555555555……

这里(Blogger)老是被屏蔽,所以郁闷,只能写文章却打不开页面。
考虑在这里写文章,然后同步到yo2,
不过这样挺麻烦的,恐怕不会实施。

这里可以编辑字体哎,虽然只有英文字体,
wordpress却不可以。

乱七八糟的我都不知自己说了些什么。
好了,不说了。

2007年3月24日星期六

My Proposal for Summer of Code 2007

Abstract

Those functions will be included:
1. Import (update the data via scanning the libraries)
2. Monitor the directories.
3. Sort (according to the artist/album/genre/year/songs/rating/etc)
4. Display album covers (search and display the cover of the albums)
5. Search (search some song)
6. Playlist management (deliver some songs to some playlist)
7. Update the data of media library manually
Some other functions will be added if necessary.That depends on the suggestions of the users.

And I have enough patience.


Detailed Description
I am familiar with many media players, such as foobar2000, amarok, wmp, etc. The media library is one of the most useful functions. But I find that if the media library function is enabled, the program would become a little slower when it's started, so I would try to improve this.
I will also work on some other details to improve the users' experience.

Project Details:
Those basic functions will be included:
1. Import
Update the data via scanning the libraries.
2. Monitor the directories
When the player is started, scans the directories to check the possible changes, and update the data.
3. Sort
Sort the songs according to artist/album/genre/year/songs/rating/length/etc
4. Display album covers
Search album covers in the directories and display them.
5. Search
Search some song in the database and display them in real time.
6. Playlist management
Add the selected songs to some playlist.
7. Update the data of media library
Update manually.

Some other necessary functions maybe added. But now I have no any idea. I will discuss with the develop team about it.

Rough Road Map
1. (Now – 5/28/2007)
Discuss the details with the develop team.
I hope to get familiar with the team members, the develop environment and the APIs.
2. (5/29/2007 – 6/30/2007)
Implement and test the 1st, 2nd and the 3rd function.
3. (7/1/2007 – 7/31/2007)
Implement and test the 4th, 5th, 6th, and the 7th function.
4. (8/1/2007 – 8/15/2007)
Test and release.
5. after that
I’m happy to continue to maintain my code.

About Me
I am a Chinese student.
Now I study in the Southeast University, Nanjing, China.
I major in the Computer Science and Engineering.
I am interested in Open source, Linux, C++, C, Java and etc.
My GMail: shinysky1986(at)gmail(dot)com
My MSN: d.zw(at)hotmail(dot)com
My blog:http://www.pkblogs.com/shinysky1986/

2006年11月26日星期日

My Favourite Cars !!

 Posted by Picasa