2007.5.1

读书期间最后一个五一,虽然对于我来说,和平常的日子一样,但依然有些伤感的,离工作的日子又近了一天。节日独自听听歌,不过和同学吃的午饭和晚饭,还是有些热闹的。

明天会有同学聚会,有些期待但感觉又不是那么强烈,也许是因为其中好些人这3年来陆陆续续回校团聚过的原因吧。

老爸电话打来,依然老生长谈练字,无奈,随意附和吧,不过感觉他心情不错,终于从车子被偷的阴影中走出来了,将来一定要买辆好车孝敬他,努力!

开始尝试HomeFinance试验田计划,Django+JQuery的组合蛮激动人心的。学到了些技巧。不过进度太慢,加快!
More......

gconf-editor

先前在桌面上一直存在着NTFS下的几个盘符,不常用,在笔记本上看又特别占空间。曾经尝试过卸载文件卷,那样又不方便了,万一要使用的话还要mount过来,今天尝试Ubuntu下的注册表


gconf-editor


在/apps/nautilus/desktop/下去掉volumes_visible前面的复选框。

即可把文件卷隐藏掉,如果想把回收站、我的电脑都图标显示到桌面上,只要打勾即可。





More......

IBM R50 Ubuntu7.04 Beryl

用了几天Compiz,稳定性不用说,但对于我这种喜欢酷东西的人来说,依然不习惯。再次决定尝试Beryl。先罗列下上一次安装时的问题:



  • beryl-manager启动后,没有标题栏,运行后即刻屏幕冻结。


  • 系统进入recovery mod,beryl-manager正常运行。


  • beryl和beryl-manager不能从官方beryl的svn中安装,只能从ubuntu7.04源中安装。


  • 升级beryl后,系统提示部分未升级,升级后导致compiz运行失效。


  • ubuntu7.04源中ati开源驱动安装后导致compiz和beryl运行后屏幕冻结。




今天重新执行了一遍安装过程:


  1. udo apt-get install beryl beryl-manager


  2. sudo apt-get install emerald-themes


  3. 添加源
    sudo gedit /etc/apt/sources.list
    在里面添加
    deb http://download.tuxfamily.org/3v1deb edgy beryl-svn


  4. wget http://download.tuxfamily.org/3v1deb/DD800CD9.gpg -O- | sudo apt-key add -


  5. 系统管理->更新管理器->安装更新
    ps: 不可以进行部分升级,系统会把compiz从0.3.6升级到0.5.0,导致compiz无法运行


  6. sudo cp -r /root/.beryl/ ./.beryl
    sudo cp /root/.beryl-managerrc ./
    修改所有者权限
    chown -R cjj.cjj ./.beryl
    chown cjj.cjj ./.beryl-managerrc

    由于在recovery mode中可以正常运行beryl,所以有可能是用户环境下的beryl配置出现错误。



More......

Python Descriptor

在学习Python的过程中,碰到一些奇怪的结果输出,后来参考一些资料后,才知道这是Descriptor特性。现来看一下遇到的问题。


class RevealAccess(object):
def __init__(self,initval,name):
self.val=initval
self.name=name

def __get__(self,obj,objtype):
print "Retrieving:",self.name
return self.val

def __set__(self,obj,val):
print "Updating:",self.name
self.val=val

class C(object):
x=RevealAccess(10,"A test variable")





Case 1:


>>>b = C() # 类C的实例化
>>>b.x # 打印内容
Retrieving A test variable
10
>>> C.x # 输出
Retrieving A test variable
10
>>>




Case 2:


>>>b = C() # 类C的实例化
>>> b.x=100 # 赋值,注意输出结果
Updating A test variable
>>> b.x # 打印内容
Retrieving A test variable
100
>>> C.x # 打印内容
Retrieving A test variable
100
>>>




Case 3:


>>>b = C() # 类C的实例化
>>> C.x=1000 # 同样是赋值,没有输出 Updating A test variable?
>>>
>>> b.x # 没有打印输出Retrieving内容?
1000
>>> C.x # 没有打印输出Retrieving内容?
1000
>>>




Case 4:


>>>b = C() # 类C的实例化
>>> C.x = RevealAccess(999,"The second var") #同样是赋值,没有输出 Updating A test variable?
>>> b.x # 下面有打印输出内容了
Retrieving The second var
999
>>> C.x # 下面有打印输出内容了
Retrieving The second var
999
>>>



以上出现的4种不同情况,引用下文档说明:

The following methods only apply when an instance of the class containing the method (a so-called descriptor class) appears in the class dictionary of another new-style class, known as the owner class. In the examples below, ``the attribute'' refers to the attribute whose name is the key of the property in the owner class' __dict__. Descriptors can only be implemented as new-style classes themselves.



  1. __get__( self, instance, owner)

    Called to get the attribute of the owner class (class attribute access) or of an instance of that class (instance attribute access). owner is always the owner class, while instance is the instance that the attribute was accessed through, or None when the attribute is accessed through the owner. This method should return the (computed) attribute value or raise an AttributeError exception.


    ps: obj.x、class.x均会导致该调用。


  2. __set__( self, instance, value)

    Called to set the attribute on an instance instance of the owner class to a new value, value.


    ps: 仅obj.x=ttt均会导致该调用;class.x=ttt直接绑定到另外一个对象上,这里x已经不是RevealAccess的实例


  3. __delete__( self, instance)

    Called to delete the attribute on an instance instance of the owner class.





参考建议:为简化以及方面理解,在实际应用中,尽量避免obj.__dict__与class.__dict__拥有同名的属性。


More......

Compiz? Beryl?

升级至Ubuntu7.04以后,徘徊在CompizBeryl之间,虽然Compiz速度上比较快,但是功能上没有Beryl强大。可是目前cn99源上的Beryl中已经不支持Desktop Wall了。桌面立方体不是太习惯。最后只能讲究在Compiz环境下。


今天早上发现系统更新(看见更新现在就比较兴奋了:P),然后发现提示有部分系统升级时的遗留包没有完全更新,选择部分升级后,便删除了compiz-core,重新安装了一个compiz-core高版本,这下导致了我一天的折腾,发现桌面特效使用不起来了。换成Beryl后,装口标题栏消失,桌面立方体没有,而且极不稳定,google了好多,试了好多解决办法都不成功,最后选择降低compiz-core版本,原来通过软件包管理器->软件包->强制版本,选择包的安装版本。

另外在IBM R50上安装fglrx的开源驱动,然后启动桌面特效会发生合成扩展(composite extension)不可用。编辑/etc/X11/xorg.conf:

Section "Extensions"
Option "Composite" "Enable"
EndSection


More......