jump to navigation

Junk characters in Emacs January 30, 2006

Posted by Chen Yufei in Emacs.

The newly installed Emacs 23 on my Gentoo displays some junk characters in the emacs shell when I use “ls” in it.(some thing like “^[01[03m…”) Really annoying at first but after gooled, I found the solution, just add this in .emacs file:

(add-hook ‘shell-mode-hook ‘ansi-color-for-comint-mode-on)

All goes well then and you can see different colors to indicate different kinds of files in emacs shell when you use “ls”. I didn’t see this feature when I were using Emacs 23 on SuSE. These junk characters should be something related to the colors.

现在居然也要用代理才能上wordpress了,我的天那…… January 30, 2006

Posted by Chen Yufei in Uncategorized.


以前用blogger.com的blog,后来因为被封换到这里。现在我可不想再换了, 不过找代理服务器有时候要试好多次,太不方便了……

为什么…… My God!

From Windows to Linux January 30, 2006

Posted by Chen Yufei in Linux.
1 comment so far

This article was written when I was installing Gentoo on my notebook. The compiling time was really looong (I installed it from stage 1, because I wanted to use gcc 3.4.5 to build my system.) And then I began to thought whether I should switch to Linux and whether it deserved to spend so much time on this lovely operating system 😉 Obviously, you know my answer is positively “YES”. In this article, I looked back the time when I was switching from Windows to Linux, I tried to write down the reason why I switch to Linux and the experience I had on some Linux distributions I’ve used. I am not good at writing and I should write this article in Chinese to make it batter, but there is no Chinese input method at that time, so I used my poor English and this is just an record of my personal experience. It’s a little long though I have used Linux for only 4 months so far. It’s sure there will be many mistakes, forgive me 😉

  • Windows — Begin to feel it boring.

I owned my own computer when I was 18 because my parents were afraid that computer will have some bad influnce on my study. So they bought me one after I finished the National Colleage Entrance Examination. Then I began to use Windows a lot since this is the only OS on my computer. In fact, before I had my own computer, I had been using Windows for much time. At that time, computer games were my favourate(Star Craft, War Craft & Need for speed, I just like the three and never play RPG or online games). On my 19 year’s birthday(2005), I had my own note book, an acer TravelMate 3202. Again the OS on it is Windows. At that time, I had been less interested in computer games though I choose this notebook is because it has an ATI 9700 graphic card which should be good for playing 3D games.

Maybe I am a strange man. Since when I could play computer games any time I wanted to, I began to found that I was losing interest in them. And later in 2005.6, I seldom played computer games any more and then I found Windows is boring. Yes, Windows can meet all my needs, but as my major is software engineering, I want to know more about an OS and I want get more control over the system. To me, the OS itself is also a computer game.(not very suitable) And then, just before the summer vocation began, I downloaded Fedora Core 4 and installed it on my notebook. That’s that’s the first time I saw a computer whose OS is not MS Windows or MS-DOS. (shamed)

  • Fedora Core — the begin of my Linux experience

I have no experience on Linux/Unix, and when I’ve installed FC4 on my notebook, all I did was to find the count-parter software which I used on Windows, not to learn the basic commands used on Linux/Unix. Lots of painful experience because I was doing things in a wrong way! Very
soon I found it’s hard to install these software because of the dependencies. And very soon I go back to Windows and just left FC4 on my notebook just because… I’m afraid I can’t boot Windows if I delete the Linux partition.

Just after the Nation Day of 2005, I read the article written by Ying Wang titled “Do all the job under Linux, throw away Windows completely” (I don’t know is this translation correct.) This article says a lot of benefits about using Linux and Linux itself. The article is a little bit over rating Linux but is really convince-able. And I also read an article in “Joel on software” which compared Windows and UNIX. The conclusion of this article is that UNIX is good for programmers while Windows is good for the general users.(hope I didn’t misunderstand it.) And in this article I found Eric S. Raymond. I visited his web site and read some of his excellent articles(like “How to become a hacker”, “How to ask questions”). All these things made me decide to switch to Linux. Special thanks to those authors, it’s them that made me take the decision and it’s that decision made me found a great world of sharing!

As I decided to switch to Linux, I decide to learn from scratch. I borrowed “Unix The text book” and began to read it. At the same time I tried to install some software that are really needed for my daily use. Still I encountered some problems but fortunately they were all solved. (When you have problem using Linux, you can always find people who’d like to help you, while if you’re using Windows, I don’t know whether MS will treated you seriously.) These basic commands made life easier and I began to be used to manipulate files at the console instead of using Natuils and I thought it’s much efficient. Gradually, I logged in Windows less than Linux. Though there were still something awful, I can bear them. But these small awful things made me switch to SuSE.

  • SuSE Linux 10 — Let’s throw away Windows!

I DO NOT mean SuSE is better than FC4 here! I just think FC4 is not so suitable for beginners like me, while SuSE is really suitable for people who want to switch from Windows to Linux or are finding an substitute for Windows. (It’s also suitable for development.) It’s not fair to compare SuSE and FC4 because the FC4 is released long before SuSE 10.

The first time I saw SuSE is on my roommate’s computer. He installed SuSE in VMWare. And when I saw it, the first idea comes in mind is that it’s much more beautiful than my FC4(though my roommate used GNOME, but KDE under SuSE is even more beautiful). And what better, the default Chinese input method is SCIM, the Chinese characters displayed very well. Hesitated for a couple of days, I decided to delete FC4 and install SuSE on my notebook. At first I chose GNOME, and later I tried KDE and I immediately reinstalled SuSE choosing KDE.(I reinstalled it because I want to have a cleaner system.) GNOME is simple, but to me KDE is more suitable(at that time 😛 ). While reinstalling some software I used under FC4, I found that the GUI package management tool YaST in SuSE is quite good. When there are dependency problems, it will tell you where is the problem and suggest you how to solve the problem. You can just ignore the problem and take the risk yourself! It’s simple to use and is also flexible in some degree. In addition, the repository is easy to find, this makes life really much easier. I used those repositories to install many software, like mplayer, xmms-mad, bluefish… The problem with this tool is that it takes a long time to start up, so I installed apt4rpm(it is included in the SuSE Linux CD sets) and then use apt-get when I like. After using SuSE for some time and successfully solved some problems, I seldomly used Windows. Only when I have to visit some
web site which can only be visited by IE will I use Windows.(Damn those web sites! I will never visit them any more unless they fix the problem) It’s about the time to complete throw away Windows, there will be no needs to it.(In fact, I deleted Windows just before I began to install Gentoo.)

  • Gentoo — want to know more about Linux and get more control

Yes, SuSE is great and I love it! It’s almost perfect for every day use and especially for those who want to switch from Windows to Linux. But to me, it still has a problem. The reason I switch to Gentoo is that I want know more about the OS, and I want to get more control over it. SuSE does a lot of configuration for you and you don’t need to do them yourself because the default one is usually OK. And when I was using it, I relay on the graphic tools too much to
do the configuration so that I don’t know how to edit the configuration file manully and even didn’t know where it is stored. I think I have to know how to edit these configuration file by myself because this is the common way and can get more control.(Maybe I am wrong.) Then I heard Gentoo and know the soul of it is to give you the choice. And this article made me even sure that I should give Gentoo a try. And later I found Gentoo perfectly meets my needs.(LFS can give you more control over the system, but it’s too hard for me)

The installation took me a long time. One was because I had to compile almost every thing. From the compiler to the base system, and then the kernel, xorg-x11 and other software I needed like Emacs, firefox(I love them ;-)) The more important reason was that I was not so
experienced. I began to install Gentoo on Jan 15, 2006, and at that time I had used Linux for only 4 months. What worse, I chose the harder way: install from stage 1. I spent about 2 weeks time to set up the whole system.(shamed, but this includes the software I need to use) Of course I had a lot of problems during the installation, or I wouldn’t have to spent so much time. Luckily, Gentoo’s document is excellent! Really excellent!! These document helped a lot. And when the document didn’t help, I could google and could always find something helpful in the Gentoo forum. Without these things, I can’t imagine how I can set up Gentoo on my notebook. Most time troubleshooting is painful, but once you solved the problem you will be really happy! During the installation, I had much painful time and also much pleasant time. The more important thing is, I learnt a lot!

The first thing is about the compiler. Gentoo’s stage 1 tar-ball contains gcc-3.3.5 but I want to use gcc-3.4.5. I noticed that during the bootstrap, portage used gcc-3.3.5(this time use the flag march=pentium3) to built gcc-3.4.5. And when I emerge the system, portage used gcc-3.4.5(this time use the flag march=pentium-m) to build another gcc-3.4.5 so I will get an optimized compiler for my system!

Another thing is the kernel configuration. At first I used the configuration file the installation CD used to make things easier and to have a working system as soon as possible. And later I read a lot of articles about the kernel configuration in order to have an tailored configuration for my kernel and take full advantage of my hardware.(Most of them are Gentoo’s document, these articles includes things about alsa, wireless network, dri, power management, usb devices, software suspend and something else.) When I am not sure about one hardware support is needed for my notebook, I will compile it as a module and later use “lsmod” to see whether it is really needed. Now I think my kernel is some what tailored for my system.(Of cause there will be some thing that is not needed, but won’t be much and that’s OK) And I make the wireless card work, and successfully installed the ATI’s video card driver which I failed to when I was using SuSE.(Though SuSE’s document points out how to install the driver.)

Other things includes how to configure the Xorg, how to modify the font configuration file and many other things.

Many many thanks to the authors of these documents and these articles! They did really a great job! Portage is the most flexible software management tool I’ve used! It’s simple to use, just one command “emerge” and it will do things automatically. It’s flexible to use, just edit some flags and the software will be tailored for you. Gentoo gives you the choice, you just make the decision and wait for some time for the downloading and compiling. I really LOVE it! And I don’t think I will switch to any other distribution for my own use. What about Windows? Are you joking? I am not a fool and I like the feeling to control my system!

装Gentoo终于到可用的程度了,发个贴图先,最近弄她弄得又辛苦又幸福…… January 24, 2006

Posted by Chen Yufei in Linux.
add a comment

fvwm-crystal 真是很漂亮!


firefox and mrxvt


昨天到家,路上终于又看课外书了 January 16, 2006

Posted by Chen Yufei in personal.
add a comment

进了大学以后看过的唯一的课外书(专业书不算)就只有《挪威的森林》了,不知道为什么以后就再没有看过什么非专业类的课外书了。总感觉这样不太好, 搞的自 己一点人文方面的训练也没有了。所以这次回家之前专门去图书馆借课外书,找了2个小时以后才拿下现在的这本《萤》,因为不知道应该看什么书了。又是村上春 树的,不过这次是5个短篇。昨天回家的火车上看了2篇,《萤》和《烧仓房》。《萤》很让人怀念吧,因为它是《挪威的森林》的“源”,其中一些话很让回味。



还有几个月自己就要20岁了,一点都没有注意到自己马上就要20岁了,总感觉那应该是很遥远的事情。真希望自己永远是18或19岁啊!倒不是说自己在这两 岁中有什么特别值得怀念的事情,只是没有想到那么快就20了,有点无法接受……

日本的作家我只看过川端康成,三岛尤纪夫,还有就是春上村树。感觉日本作家的小说文字都很美,很纯净,但是都给人一种空虚的感觉(或许应该说是空灵 吧), 尤其是春上村树。川端康成是我接触过的第一个日本作家,《千只鹤》给我映像很深,第一次感受到那么纯净,美丽的文字。而三岛尤纪夫的《潮骚》真的是给人一 种很美的意境。他们的作品都很有特色,或许是日本独特的自然环境造就的吧。这只是我的胡乱猜测而已,我不是那种有什么文学功底的人,是学理的人,这些只是 自己的感受罢了。


Emacs 23 and unicode support January 16, 2006

Posted by Chen Yufei in Emacs.
add a comment

I am using UTF-8 encoding on my system. I have to do so because: (1) I speak Chinese and I have to mix Chinese and English. (2) I have a FAT32 partition which uses UTF-8 encoding and I have some files using Chinese names in it. I don’t know how to change it’s encoding. (3) UTF-8 encoding has many benefits and I hope it will become the mainstream.
But here comes the problem. Emacs 21 doesn’t have support for Chinese UTF-8 encoding, when I open a Chinese text file which is encoded in UTF-8, all I got are backslashes and digitals… Luckily enough, there is already Emacs supporting what I need though not very stable stable—that’s Emacs 23. It’s internal encoding is based on UTF-8. So far, it can only be got from the Emacs CVS repository. Using the following command:

$: export CVS_RSH=ssh

$: cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/emacs co -r emacs-unicode-2 emacs

After getting the source code, use make bootstrap && make install to compile and install it. Now it’s working quite well on my system. Really great! But I still don’t know how to make LaTeX work with UTF-8 encoded Chinese text files, so sometimes I have to use iconv to convert from UTF-8 to GB2312 or directly edit files encoded in GB2312 with Emacs. It’s not so convenient but I can bear it :-(. Things will be even greater if I can use UTF-8 encoding for all my files!

JDEE compile time error: “buffer is read only” January 12, 2006

Posted by Chen Yufei in Emacs.
1 comment so far

I use JDEE to write Java programs in emacs. The problem I encountered is that when I compile the program(C-c C-v C-c), the JDEE compile buffer has nothing to display and actually nothing was compiled. The mini buffer is saying “buffer is read only”. After googled some articles, I solved the problem.

Open the file compile.el in /usr/share/emacs/lisp/progmodes, search “buffer-read-only”, change all the value to nil, then byte compile and reload it, things will be right now.

This solution surely is not very good. The compile buffer should be read only after things is displayed. I don’t know whether this is the problem of JDEE or of emacs, but since I can get things done now, it’s OK. Hope to find better solution later.

呵呵,今天考完试了 January 10, 2006

Posted by Chen Yufei in Uncategorized.



回 家准备开始装Gentoo,已经看了它的安装文档,一下好光盘镜像马上就开工。windows要重装了,准备只给他3到4个G的空间了,因为现在已经几乎 不用了,除了有些网站非要用IE才会用进windows。SuSE还留着,等Gentoo可以满足我的一切需求以后再考虑SuSE该怎么处理。SuSE的 确非常好用!!!问题在于我现在很多时候都只知道用图形化的工具来修改配置,甚至连配置文件在哪里都不知道,汗……(毕竟我开始用Linux到现在还只有 3个月,为自己开脱一下)总感觉这样不能成为高手,至少说对Linux的了解不会得到深入吧,这就是在SuSE用的好好的情况下还要装Gentoo的原 因。