为四川人民祈祷! www.onefoundation.cn
logo of kjam.org
Archive: 2007-11

Blog in English

Now I'm beginning my weblog in English. The url is going to be kjam.org/en

Yes, when I made my decision to write weblog in English, the first thing I have to do is to modifty my current blog progrom to meet my demand.

There are functions in tag and categories in my current system. Because it is very difficult to decide which category does your post belong to, I drop this function. But now, I reuse the category again. There are two categories in my blog system: Chinses and English.

This blog is written in django. Following the DRY principles, I did not totally build it from zero. Thank to beyking he wrote a blog for himself and share the code to the opensource world. This blog is based on his work, althought about 80% code has been modified.
comments: 2  
by kernel1983

Middleware

我丝毫不怀疑Pylons的Middleware是不是符合WSGI的标准,那简直是一定的。我完全找不出Pylons需要重新发明一种标准的理由。从个性上来看,即使它不拥护标准,标准也会站在它那边的……

所以因此而困惑,django的middleware是什么?这个疑惑持续了很久,今天想起来,终于去看了手册。果然,并没有直接采用WSGI标准……但是,也很简单,简单到只需要一个眼神,就知道它是怎么工作的!

简单的说,就是写一个class,然后随便实现以下的几个方法之一
process_request(self, request)
process_view(self, request, view_func, view_args, view_kwargs)
process_response(self, request, response)
process_exception(self, request, exception)

我想这样的设计应该归功于Python的简单吧!
comments: 0  
by kernel1983

Routes Memory Disable

Routes是Python世界中仿rails的url dispatcher,在Pylons中被使用

使用过程中可以感受到很多魔法,很多的url参数被缓存了。比如,当前的controller是A,如果你要产生一个指向同样是A下面的另外一个view,那么A则可以省略
在一个规模不大的项目中,这样的设置极大的提高了生产力。但是随着项目的增大,我们不得不考虑重名的url参数产生的影响。

当我们不需要这样的特性的时候,在routing.py中这样写就可以了
    map = Mapper(explicit=True)
comments: 0  
by kernel1983

基础性工作

对于WPF的出现,我后知后觉

终于某一天,许多功力比我更加高深的老大们,在WPF的召唤下停止了冬眠,用睡眼朦胧的表情一脸不经意的表达着自己对于新事物的不解。他们说:

“这不是写html嘛!”

太精辟了

这个世界上的程序员们已经被折腾的要死,早知道社会如此繁荣昌盛,何必去搞那些深奥的ASM和深刻的API。其实聪明人早就看出来了,从该死的rc文件开始,那些产品的设计者就根本没把程序员放在眼里。

于是我开始开窍,虽然这一过程已经开始并且还将继续好几年,所以我已经准备好去挖煤,因为这是一项非常具有前途的基础性工作。
comments: 0  
by kernel1983
1