Wednesday, February 25, 2009

正式进实验室第一天

昨天去那把电脑装上,由于现在资源不足,额外抽出一台服务器给我,其实跟新机器差不多。而且上面只装了Centos,真实非常合俺的意思。这几天,披星戴月,累死劳活的把宿舍机子上的windows xp给换成了Gentoo,虽然说不容易,但用起来真的很爽,什么东西,都让你知道的清清楚楚,就好像知心的朋友,从此以后打心眼里瞧不起windows了。--总之,我宣布,彻底告别windows!

这段日子被折腾的晕头转向的。开学近两周了,貌似还没一天早上准时(更别说提前了)到过教室,更惭愧的是某日清晨走在上学的路上思量着迟到实在太久,不好意思去,便发生了早退现-_!

以后会更忙的,赶紧把emacs整好,好用org-mode来管理管理自己的时间。

Monday, February 23, 2009

Gentoo安装之二:安装中文字体

英文环境的gentoo自带的中文字体很陋,所以必须重新安装字体。

emerge arphicfonts wqy-bitmapfont corefonts ttf-bitstream-vera

下载后的字体,位于/usr/share/fonts 中,为了便于管理,可将其移到/usr/local/share/fonts下,一般下下来的字体文件夹内都自带了font.scale和font.dir,无须再用mkfontscale和mkfontdir生成索引,系统能自动识别。当然,前提是,你把字体文件夹的路径加入的/etc/xorg.conf的Files section的FontPath
Section "Files"
RgbPath "/usr/share/X11/rgb"
............#以下开始是中文字体,fontconfig默认会选择第一个
FontPath "/usr/local/share/fonts/ttf-bitstream-vera/"
FontPath "/usr/local/share/fonts/arphicfonts/"
FontPath "/usr/local/share/fonts/wqy-bitmapfont/"
FontPath "/usr/local/share/fonts/corefonts/"
EndSection

另外,再本地化时,/etc/locale.gen应加入:
en_US ISO-8859-1
en_US.UTF-8 UTF-8
zh_CN GB18030
zh_CN.GBK GBK
zh_CN.GB2312 GB2312
zh_CN.UTF-8 UTF-8
再用locale-gen生成以下locale,以便glibc使用。

Gentoo安装之三:fcitx在英文系统界面下的安装

为什么使用fcitx:支持双拼,配置性高,快,不和其他程序冲突(暂时没发现)。
这个问题折磨了了我一天有余,罪魁祸首是emerge下来的fictx是nostfx(fictx -v 可查看版本号)版的,装上之后,虽然可以勉强输入中文,但尽是些古怪的文字。网上也没找到到底什么是nostfx版,或许只有yuking自己知道吧。另外,最新的3.6.0测试版无法configure,没细究原因,后来emerge --unmerge fcitx,再到www.fcitx.org下了fictx-3.4.2稳定版

1.首先配置locale
其实fictx只要求LC_CTYPE=zh_CN,即可,所以为了可以这样设置,
LANG=C
LC_CTYPE=zh_CN
系统就可以仍为英文的。

2.到fictx源码目录下,./configure->make->make install

3.配置文件的GB2312编码
fcitx的配置文件~/.fcitx/config和profile默认是使用GB2312编码,用gedit读取时显示为乱码,可用gconftool-2来配置gedit让其自动识别(也可以在 gconf-editor 里面改):
$gconftool-2 --set /apps/gedit-2/preferences/encodings/auto_detected [UTF-8,CURRENT,GB18030,BIG5,ISO-8859-15,UTF-16] --type list --list-type string
注意,保存时,也要选择GB2312编码(再选择栏中有添加编码),否则fcitx无法读取。

4.让fcitx自动运行
按网上方法,我再~/.brashrc和/etc/env.d/99input中都添加了那三行代码,但都没成功,待进一步试验...

Sunday, February 15, 2009

在emacs中查字典

实验环境:windows下的emacs22.3,dictionary-1.8.7
1.下载dict mode支持包。

2.安装Windows下的make:
http://sourceforge.net/projects/gnuwin32/
这个开源项目就是要移植一些linux下的常用工具到windows下,其中包括make,grep等等。

3.然后安装dict mode。注意两点:
(1)为方便起见,应先把make的路径加到系统的环境变量中;
(2)修改dictionary-1.8.7的makefile中的EMACS变量的值为你的runemacs的路径。
2.在配置文件init.el或(.emacs)中添加如下代码:
;;-----------------dictionary------------------
(autoload 'dictionary-search "dictionary"
"Ask for a word and search it in all dictionaries" t)
(autoload 'dictionary-match-words "dictionary"
"Ask for a word and search all matching words in the dictionaries" t)
(autoload 'dictionary-lookup-definition "dictionary"
"Unconditionally lookup the word at point." t)
(autoload 'dictionary "dictionary"
"Create a new dictionary buffer" t)
(autoload 'dictionary-mouse-popup-matching-words "dictionary"
"Display entries matching the word at the cursor" t)
(autoload 'dictionary-popup-matching-words "dictionary"
"Display entries matching the word at the point" t)
(autoload 'dictionary-tooltip-mode "dictionary"
"Display tooltips for the current word" t)
(unless (boundp 'running-xemacs)
(autoload 'global-dictionary-tooltip-mode "dictionary"
"Enable/disable dictionary-tooltip-mode for all buffers" t))
;; key bindings
(global-set-key "\C-cs" 'dictionary-search)
(global-set-key "\C-cm" 'dictionary-match-words)
(global-set-key [mouse-3] 'dictionary-mouse-popup-matching-words)
(global-set-key "\C-cd" 'dictionary-lookup-definition)
;; for dictionary tooltip mode
;; "web1913" for Webster's Revised Unabridged Dictionary(1913)
;; 貌似在emacs 22.3中不支持tooltip,即鼠标取词,故去掉,节省内存
;;(setq dictionary-tooltip-dictionary "web1913")
;(global-dictionary-tooltip-mode t)
(setq dictionary-default-dictionary "web1913")

OK了,上面几个操作函数意思如下:
dictionary-search:请求输入一个单词,输出所有的解释条目。
dictionary-lookup-definition:查当前鼠标处的单词。
dictionary-match-words:输入一个匹配模式,输出匹配的单词。
dictionary-popup-matching-words:弹出一个菜单,显示各个字典中相的匹配单词(匹配策略点击按钮Select Match Strategy中选择)。
在查询结果窗口中,输入h可查看快捷键。

有了这个,看起英文文档来就方便多了,而且用的是原汁原味的英语词典,对英语水平的提升也很有帮助啦。

Saturday, February 14, 2009

Valentine's Day

此痛幽幽,十年不愈。云烟逝去,不再复返!

你一定要幸福...一定要!

Tell me why



这首歌是来自爱尔兰男孩declan galbraith 10岁的时候唱的。稚嫩的10岁男孩用自己的弱小但又十分有力的声音呼唤着战争的结束和平的到来。

很专业,很震撼!

归来

从家回到学校。

做人做事定理:不要为了做某事而做某事。

推论:不要为了爱而爱。否则,它将成为一种包袱,让人越来越累。好好吸取教训吧!

Insist On

English words
Go to bed at 23:30

About Me

Gtalk:l0he1g at gmail
Location:Beijing,China