Tuesday, October 31, 2006

微软雅黑

用了几天微软雅黑
现在在看Simsun,发觉非常不习惯
很淡很淡
即使是通过开启antialias使用了内嵌位图,也是一样的感觉
恐怕我是回不去了

刚刚了解到一个有关emacs 23的字体问题
其实仅仅用了这样的命令来启动是不够的
emacs --enable-font-backend -fn "Dejavu Sans Mono-12"
这样的话,非英文字体emacs还有可能用X核心字体
需要在~/.Xdefaults里加上这样一句才能保证emacs 23使用xft作为字体后端,仅仅启用字体后端是不够的。
Emacs.FontBackend: xft
这样一来,~/.emacs里就不需要任何配置字体的信息了
不过又发现一个问题,似乎emacs 23对~/.fonts.conf里的字体顺序反应迟钝?
gtk+2程序的反应是即时的,只需要关掉并重新启动程序
qt程序可以用qtconfig来改字体替换表
emacs 23却没辙了,想不起来还可以改什么?即使~/.fonts.conf里Simsun排在前面,也还是只能用Microsoft Yahei。

参考:
http://www.nabble.com/Xresource-of-enable-font-backend--t2349798.html
http://zhllg.spaces.live.com/blog/cns!956A48A2D7ED7265!1475.entry

Labels: , , , ,

Monday, October 30, 2006

HOWTO Compile Kernel

HOWTO Compile Kernel

From Gentoo Linux Wiki

Jump to: navigation, search

目录

[隐藏]

安装内核源代码

代码: 安装内核源代码
$ USE=symlink emerge gentoo-sources

使用symlink的目的是建立符号连接/usr/src/linux,以指向安装好的内核源代码目录。

配置

配置内核对于新手来说是一个噩梦。不过事实上,配置过程要远比一般人想象的容易。只是有些技巧了解的人不多。

配置命令介绍

make menuconfig

配置内核的命令很多,不过make menuconfig应该是最通用的。它的运行几乎不限环境,远程登录也可以用它配置,所以我们重点介绍。 用法:

  • 方向键选择菜单项/按钮
  • 回车进入子菜单
  • 按高亮字母直接选择相应菜单项
  • Y键包含,N键排除,M键配置成模块
  • 退出,?键查看当前菜单项帮助信息,/键搜索
  • 图例:[*] 包含 [ ] 排除 模块 < > 可配置成模块

make oldconfig

利用已有的.config来生成新的.config。如果遇到新内核新增的选项,会挨个提示你是否启用。建议选择默认,即直接按回车。同时记录下有疑问的选项,以便下面再make menuconfig手工配置。

第一次配置

代码: 第一次配置
$ cd /usr/src/linux
$ make defconfig
$ make menuconfig

make defconfig的作用生成一个缺省的配置文件。这个配置文件里各内核组件基本完整,只需修改硬件和文件系统即可。这步不是交互式的。 make menuconfig这一步就是要修改硬件和文件配置。需要关注的主要有这么几个部分,分别是

  • IDE驱动(默认是CONFIG_BLK_DEV_VIA82CXXX)
  • 网卡(CONFIG_E100)
  • AGP(CONFIG_AGP_VIA)
  • DRM(CONFIG_DRM_RADEON,建议不要启用,使用portage里的x11-drm)
  • Framebuffer(CONFIG_FB_RADEON)
  • 声卡(CONFIG_SND_VIA82XX)
  • 文件系统(只有CONFIG_EXT2_FS/CONFIG_[V]FAT_FS,ext3/reiserfs/xfs/jfs均未设置)
  • NLS CODEPAGE(需手工增加CONFIG_NLS_CODEPAGE_936)

以上括号里是默认配置情况。虽然不知道这是谁的配置,不过可以看出这个人的主板是VIA的,显卡是ATI Radeon,只用ext2/fat32文件系统,且不是中文用户。

注意: 善用make menuconfig的搜索功能。如果你因为需要使用内核的其他功能,请参阅相关的官方文档或wiki来配置内核。

升级时配置

代码: 升级时配置
$ cd /usr/src/linux
$ cp /boot/config .config
$ make oldconfig
$ make menuconfig[可选]

编译和安装

代码: 编译和安装
$ make
$ make modules_install
$ make install

Friday, October 27, 2006

Psychic mode plugin of gaim 2.0.0dev

Psychic mode plugin is a very interesting plugin.
It could cause conversation windows to appear as other users begin to message you, before they press "enter".
The notification message is very funny:
You feel a disturbance in the force...

Updates:
MSN protocol could use this plugin too, although it is not mentioned in the plugin's description.

Labels: ,

Wednesday, October 25, 2006

[转载] QT 3.3.6 及以后版本的字体替换设置

http://wiki.chrischou.org/freeware:qtfont3.3.6

摘要:
QT 3.3.6 及以后版本的字体替换规则发生了微小的变化,为此使用QT的应用程序(包括KDE)可能无法使用fontconfig的替换规则。QT 3.3.6 及以后的版本,除非指定sans-serif、serif、monospace其中的一个作为QT程序的默认字体,否则这些程序的中文将无法保证使用 fonts.conf 中指定的支持中文编码的字体来渲染中文字符(QT会使用第一个查找到的具有中文编码的字体来渲染中文字符)。而这些在 QT 3.3.5 及以前的版本是可行的。

PS:
在我这里一定要把SimSun写为“宋体”才可以。
不过还是有一个问题是,粗体出不来。
搞什么啊???!!!

Labels: , ,

Sunday, October 22, 2006

zhcon 0.2.6 will be in portage soon

UTF-8 support is added in this version. To enable it, you have to use "zhcon --utf8" to start zhcon. zhcon's homepage is here: zhcon.sf.net
This version is already in gentoo-china overlay.
"layman -a gentoo-china" to check it out.
Or you could see it here: http://www.gentoo.org/proj/en/overlays/layman-global.txt
flameeyes said too much overlays will bring us down. I agree, to some extent. But that requires the maintainers response in a timely fashion. Otherwise, users can only resort to overlays.
Fortunately, I am now become the proxy maintainer of zhcon. That situation won't happen to zhcon again as long as I remain as zhcon's proxy maintainer.

EDIT: now it is in portage, so I have deleted it from gentoo-china overlay.

Saturday, October 21, 2006

wall_john's desktop


I have already uploaded the picture to blogspot. So now everyone could be able to see it.

Labels:

Friday, October 20, 2006

screen之detach/reattach的一个应用

如果因为某个原因,X需要重起
那么可以先detach
然后X重新启动后,或者可以干脆直接在console里,再reattach
刚刚想到,有点莫名的兴奋,:-D

detach是C-a C-d
reattach是screen -r 然后按tab即可补齐。前提自然是要启用bash-completion

如果不了解screen,可以看看GWN里的报道。一定要试一下!

Labels: ,

prelink's segfault problem

The latest prelink in current portage has a problem. That is it segfaults if you run it with -q option.
This patch fixed the problem. Thanks to Martin von Gagern.
http://bugs.gentoo.org/attachment.cgi?id=95051&action=view

Labels: , ,

Thursday, October 19, 2006

bayonne VS. asterisk

Asterisk is better?
http://software.newsforge.com/comments.pl?sid=50233&cid=118555
I haven't touched asterisk. So I have nothing to say about it.
However, I am looking at bayonne. I have contributed some patches to bayonne and I am taking care of bayonne2's ebuild in gentoo-voip overlay. So I know there are something that need to be improved in bayonne, for example the documentation.

Labels: , , ,

Flash player 9 for Linux

http://labs.adobe.com/downloads/flashplayer9.html

I have tried it on www.metacafe.com
My firefox was crashed on the first try.
After that, it works well.

Wednesday, October 18, 2006

FREE international call

Use your regular phone to make local/international call.
http://www.jajah.com/

Hans Reiser accused of murder

http://www.linux-watch.com/news/NS3021902234.html
Sigh!

Tuesday, October 17, 2006

SUSE's pronunciation

http://www.novell.com/linux/demos/desktop.html
Sounds like suser

Labels:

Buffer Overflow in NVIDIA Binary Graphics Driver For Linux (with exploit)

http://lwn.net/Articles/204542/
It's a pity that I don't have a nvida card to try the exploit. :)
I am so admire those who could create an exploit all on his own. It requires a lot of skill. A famous Chinese Poet Lu You (陆游) from Song Dynasty has once said, if you do want to learn poem, you should learn beyond poem (汝果欲学诗,功夫在诗外).
Take this exploit as an example, I myself know little on Xlib programming, so although I have some basic idea on shellcode/exploitation, it's still impossilbe for me to write an exploit of nvidia driver at this moment.

Labels: , , ,

Linux系统及程序的启动速度

这篇文章写了有段时间了,不过没有在这里贴过。现在拿出来和大家分享一下。如果有理解错误的地方,还望指正。

Linux(包括其上运行的应用程序)的启动速度相比Windows要慢,这是个不争的事实。不过未来这种状况必将会发生变化。lwn.net上有两篇文章与此话题有关。
首先,要明确的一点是,导致这种状况的根本原因与内核关系不大。两个主要原因,一个是用户层程序启动时往往会做很多无谓的动作,可以从strace的结果里体会到;一个是ELF(现代*nix系统所采用的可执行文件和共享库文件格式)格式的二进制程序在符号解析时要耗费不少时间。lwn.net上的这两篇文章就分别针对这两个问题。
第一篇是http://lwn.net/Articles/192214/
第二篇是http://lwn.net/Articles/192624/
第一篇是Dave Jones在渥太华Linux研讨会(Ottawa Linux Symposium)的一个演讲,这个pdf的第441页 http://www.linuxsymposium.org/2006/linuxsymposium_procv1.pdf 就有这篇文章,题目是"Why user space sucks"。Dave观察了他的Fedora系统的启动过程,结果发现整个过程调用了stat() 79000次,打开过27000个文件和运行了1382个程序。但实际上不一定需要这么多动作。他还具体分析了很多程序的表现,比如gamin(fam ——file alteration monitor——的后继者),Xorg,CUPS,HAL等等。虽然Dave没有提出具体的解决方案,但是自此以后这个问题必定会引起人们的重视。
第二篇题目是Optimizing linker load times。文章开头提到目前很多发行版都在想尽办法提高系统启动速度,目前已有一些途径,比如预读取(readahead),启动重排序(boot reordering),还有并行执行init脚本。还有一个途径就是文章的主题,提高连接器动态连接的速度,主要是符号解析的速度。符号解析的目的,是把在程序里未定义的函数名解析为运行时该函数的内存地址。解析的过程就是查hash表,按惯常做法表里hash值相同的符号(就是未定义的函数名)组成链表。文章提到目前已经有的一个策略,就是prelink,这种方法的本质是修改二进制程序文件,在程序运行前就确定下来每个共享库文件在程序执行时的地址空间里的位置,当然包括每个函数的地址。但是prelink有一定的安全隐患。同一个共享库在prelink过的所有程序的地址空间里的位置都是一样的。虽然prelink也可以做地址空间随机化(address space randomization),但是这只能保证你的系统和其他人的系统里的应用程序的地址空间分布不一样,你的系统里所有的程序的地址空间虽然随机化了,但所有程序的随机化结果都是一样的。这样我们就能通过一些普通的程序推知将以root权限运行的程序的地址空间分布。地址空间分布的信息的暴露会使 return-to-libc攻击变得容易。文章的主体介绍了4种其他形式的动态连接优化形式。其中一种是旧的,已经获的广泛使用的-Wl,-O1选项。其他三种是新的,由Michael Meeks提出的新的机制。分别是-Bdirect, -zdynsort和预先计算hash值。第一种的解决方式是扩大hash表的大小,以减少链表的长度。-Bdirect的策略是在可执行文件里记录下每个符号来自于哪个共享库。以前没有-Bdirect的时候需要搜索地址空间里所有的共享库。-zdynsort的策略是把ELF文件里的.dynsym 和.dynstr段排序,以减少CPU cache miss的几率。预先计算hash值的策略很易懂,就是在生成可执行文件的时候就把hash值算出来,保存在文件里。这样执行时的动态连接过程中就不要再算了。这3个新策略里后两个很有可能马上就可以用上。目前,gentoo用户可以利用后面这个连接里提供的overlay来尝试这些新特性。 http://forums.gentoo.org/viewtopic-t-435659.html

Monday, October 16, 2006

scim-1.4.5 works again

I didn't mask it in /etc/portage/package.mask when I emerge =scim-1.4.4. So it was upgraded to 1.4.5 in the lastest update.
And now it works.
Don't know why. Anyway, it works. This is the most important thing.

Saturday, October 14, 2006

异体字?

我找你找了好久 别人都说我们会分开
我找你找了好久 别人都说我们会分开

这两对,看似一模一样,实则不同
第一对不同的字是“了”
第二对不同的字是“都”

第一行是我在转用utf8字符集的时候用convmv改的
看来还有点问题

Friday, October 13, 2006

Feed from feedburner

I have created a feed on feedburner.
You may subscribe to that as well.
http://feeds.feedburner.com/zhllg

使用GDB/Emacs debug C++程序

使用GDB/Emacs debug C++程序

Date: 2006-09-26
Version: 1.0
Authors: 张乐

gdb使用技巧

注意事项

  1. gdb使用 Readline
  1. 可以使用bash快捷键,tab补齐
  2. 清除inputrc里有冲突的设置

准备工作

  1. 重新编译安装程序。系统里现有的程序一般不适合直接拿来跟踪。需要使用合理的CFLAGS重新编译安装后再跟踪。
./configure
find -name "Makefile" | xargs sed -i -e 's/^CFLAGS = /CFLAGS = -g3 -ggdb3 -gdwarf-2 /'
make && make install

运行

  1. 启动gdb
a. gdb bayonne
b. gdb --args bayonne -vvv script.scr
  1. 利用帮助
a. help 命令类别名
b. help 命令名
  1. 运行程序
a. r[un]
b. r[un] -vvv script.scr

设置断点

  1. 按照函数名设置断点
b[reak] main
b[reak] 'namespace::Class::func()'
  1. 按照文件名和行数设置断点
b[reak] methods.cpp:523

检查状态

  1. 检查堆栈
b[ack]t[race]
up
down
  1. 检查当前函数的源代码
list
  1. 检查/改变变量值
p[rint] var
p[rint] ptr->mem
p[rint] *ptr
p[rint] ('namespace::Class') *this
p[rint] (('namespace::Class') *this)->a.b.c

p[rint] var=value
  1. 检查类
ptype ptr

set print object on
whatis ptr
  1. 检查并启用/禁用断点
set breakpoint pending on
info b[reakpoints]
enable [N]
disable [N]
  1. 检查并切换线程
info th[reads]
thread N
  1. 检查寄存器
info reg
info reg esp
  1. 检查内存
x/10s *0xaabbccdd
x/5x var

继续运行

  1. 运行到某一行即停止,当前函数返回时也停止
advance source.cpp:123
  1. 运行到当前函数返回为止
fin[ish]
  1. 继续运行直到程序结束或下一个断点
c[ontinue]

信号

  1. 检查当前的信号处理策略
info signals
  1. 改变信号处理策略
handle SIGINT pass
handle SIGINT nostop

与Emacs配合使用

  1. 建议使用Emacs-23。设定别名
alias emacs='emacs --enable-font-backend -fn "Dejavu Sans Mono-12"'
  1. 修改~/.emacs,把下面这一行加入
(defvar gdb-many-windows t)
  1. 在Emacs里启动gdb
M-x gdb
  1. 开启多窗口模式
M-x gdb-many-windows
  1. 进入gud-tooltip-mode
M-x gud-tooltip-mode

Labels: , , ,

Thursday, October 12, 2006

Latest News on scim and glibc

According to my own experience, scim 1.4.4 works fine with glibc 2.5!
Scim 1.4.5 must have used something which is changed from glibc 2.4 to 2.5.

Labels: ,

scim doesn't work after glibc 2.5 being emerged

I am not sure about the cause at this moment. Thanks to fcitx, I still can input Chinese. However I can't get used to it, there is some difference between the two input methods. For example in fcitx you need to press 2 keys when switching between English/Chinese, while in scim you just need to press "shift", which is the same as in MS Pinyin.

Updates:
Anyway, I have come back to scim (1.4.4). So good bye to fcitx!
http://zhllg.blogspot.com/2006/10/latest-news-on-scim-and-glibc.html

Labels: , ,

scim-pinyin @MKINSTALLDIRS@ problem

Background:
http://www.linuxsir.org/bbs/showthread.php?t=266936&highlight=mkinstalldirs
http://bugs.gentoo.org/show_bug.cgi?id=144930#c3

Solution:
layman -a gentoo-china
layman -S
emerge -1 scim-pinyin

PS: some info about gentoo-china-overlay
http://www.linuxsir.org/bbs/showthread.php?t=272832

Labels: , , , ,

Tuesday, October 10, 2006

Non-dev could not assign bug to individual dev?

I have been translating GWN to Simplified Chinese with my teammates since May 2006. Originally, I sent translated GWN to gwn-feedback. Several weeks ago I started to send to neysx, because neysx will be my mentor.
At the beginning, I sent translated GWN via email. However, the attachment was lost several times. Then I began to use bugs.gentoo.org. Neysx gave me a link.
http://bugs.gentoo.org/show_bug.cgi?id=147686#c4
I was supposed to use this link to assign bugs directly to neysx. I have tried it 3 times. Each time the assignee will be changed from neysx to docs-team. Like this one:
http://bugs.gentoo.org/show_bug.cgi?id=150726
However, dev's seem never know this. This explains why words like "Whatever you do, you do it wrong" would come out.
Later, neysx verified this fact himself:
http://bugs.gentoo.org/show_bug.cgi?id=150743
Then neysx said sorry to me.
Problem solved.

Monday, October 02, 2006

libglitz.la

I did some housekeeping work today, unmerged glitz.
I have disabled glitz USE flag for a long time. Don't know why it still exists today. Of course, I do --depclean regularly.
Then disaster happened as you may guess.
All the apps previously linked with glitz ceased to work.
So I have to resort to revdep-rebuild.
However, many program still failed to emerge, as "/usr/lib/libglitz.la" exists in many la files under /usr/lib.
Honestly, I still don't know exactly la files' functionality. But I guess it plays an important role in the linking process.
I used the following command to wipe out all the "/usr/lib/libglitz.la" string from la files under /usr/lib.
sudo find /usr/lib -name "*.la" | xargs sudo sed -i -e 's# /usr/lib/libglitz.la##'
Not sure whether this is the right way to go, but it works here.

Sunday, October 01, 2006

[video] aiglx + beryl on ati r200

http://www.youtube.com/watch?v=KoRozMganNQ