Month: 八月, 2006

django的外键查询

30 八月, 2006 (13:15) | django, Uncategorized

假设我有两个表(model),分别叫useraccount和userrole:
class UserAccount(meta.Model):
person  = meta.ForeignKey(Person, core=True)
account = meta.ForeignKey(User,   core=True)
class UserRole(meta.Model):
...

如何产生[1,1,2,2,3,3,4,4,….100,100]这样的列表

29 八月, 2006 (14:18) | python

在水木的python版看到这样一个题目,很多人给出了很多方法,其中有两个很pythonic,而且比较通用,作为一个小trick记下来:
一种方法是用itertools里的chain方法,chain的作用是将多个迭代组...

在debian下安装Emacs23

23 八月, 2006 (13:35) | emacs, debian

参考了这几篇文章:Emacs23安装配置慢慢来、EmacsCvsAndDebian、Emacs CVS on Debian、HOWTO: Install GNU Emacs with antialiasing,在debian sid上安装了emacs23,把安装的步骤写一下:
1. 准备工作,要安装ssh和tex...

delete multiple space in file

16 八月, 2006 (10:49) | emacs

move to the place of first space, M+\, done :p

...

aptitude is better than apt-get

11 八月, 2006 (11:39) | ubuntu, debian, linux

I just find this article aptitude versus apt-get , as it said, aptitude will remove dependencies when you remove a package, apt-get not.

...

check program is already running before launch it

9 八月, 2006 (15:16) | linux

For example I want to start gedit, but i want to check whether it is running already
pidof gedit > /dev/null || gedit &

...

debian and ubuntu repositories for opera

1 八月, 2006 (10:48) | opera, ubuntu, debian

debian repositories:
deb http://deb.opera.com/opera/ unstable non-free
ubuntu repositories:
deb http://archive.canonical.com/ubuntu dapper-commercial main

...