Skip navigation.
Home
Write anything I want to write...

My Eee PC 4G (701)

My lovely Eee PC

I bought an Eee PC [eeepc.asus.com] 4G (701) last month and had been playing and using it. It is quite a lovely machine.

I have also installed Ubuntu 7.10 on it, and make all peripherals (except the modem) to function properly. There are a lot of good resources online, including the excellent EeeUser.com. I will install Xubuntu 8.04 on it when it is officially released next week, and write an installation HOWTO if time permits.

巧遇小辣椒

前几天经过一警察局时见到一大群警察们正举办某些活动。有乐团表演,也有照片展览。再走前一看,咦?巧遇到了大选期间在这一带的红人:现任沙登区国会议员`小辣椒'张念群 [www.wretch.cc]。也见到了无拉港区州议员叶南进律师。

巧遇张念群及叶南进

仅用手提电话远远地拍了一张照片,不打扰伊人用膳。 (^_^)

(四月二十二日注:标题原为“巧遇YB”,但张念群本人说“別叫我YB!” [www.wretch.cc],所以改标题了。若你不知道YB是什么:那是马来语 Yang Berhormat 的缩写,直译为 The Honourable 或`尊敬的'。马来西亚人常尊称国会议员为“Y.B.”。详见http://en.wikipedia.org/wiki/Malay_titles#Honorary_styles。)

Setup Extlinux Instead of GRUB for Booting Ubuntu 7.10

Note: Please check out the new post here if you use Ubuntu, as this post has become obsolete since the Ubuntu Live CD / USB stick is now shipped with extlinux. This post is however still useful for those distros that are not shipped with extlinux.

After installing Ubuntu on a desktop PC, you may want use a bootloader other than GRUB for some reasons. You can choose to use extlinux [syslinux.zytor.com], which is a variant of the famous syslinux [syslinux.zytor.com] bootloader for ext2/ext3 filesystems. The steps here have been tested on an Ubuntu system but should be applicable to other Linux distros as well.

1. Preparation

Prepare these:

  • Prepare a working SystemRescueCd [www.sysresccd.org], an excellent GNU/Linux system specifically design for repairing computer system and recovering data after a crash.
  • To be safe, the /boot directory of the GNU/Linux installed should reside in a primary partition. (It has been reported that extlinux may not always be able to locate a bootable logical partition successfully.)

Guard My DVD Drive against Destruction!

My kid likes to press the 'Eject' button of my DVD drive (or, to be precise, my *previous* drive) to open and close the drive's door. Recently he learned from observing how to put VCDs into the drives and watch them on my Ubuntu-powered computer! However, he still did not know how to use it properly, and I suspected that he had accidentally put some CD attached with some dirty sticky things and that spoiled my DVD drive! The drive was still usable, but whenever you wanted to eject the CD inside, the tray did not eject properly, and somehow almost all CDs put inside will be badly scratched when you eject them and rendered them unusable!

Luckily I found the problem early and only 3 CDs became victims. The DVD drive was already 3-year-old if I am not mistaken and suffered from some minor problems. So I decided to spend RM85 to buy a new one. Oh wait! I also need some program to lock the door of the drive to prevent similar tragedy! I tried to google some good Linux software for this but failed to find one. No choice, I finally delved into the Linux kernel's ioctl() for CD/DVD drives and wrote my own program to do the job. I did it and here it is. It's GPLv3-ed so get it if you need.

To lock the computer when it boots up, I add the following line in /etc/rc.local:

/usr/local/bin/cdlock

Of course, this loose safety control is not tight. If my kid discovers that

  • he can perform a "zero-day attack" which lasts for about half a minute before the execution of cdlock during boot up, or
  • he can simply issue cdunlock to unlock the door, (Update: The Unix's file ownership and permission can be used to protect against this. In Ubuntu, a CD drive's device file (under /dev/) has ownership root:cdrom and 660 permission. A user can use cdlock/cdunlock on a drive if and only if he is a cdrom group member.)

then the magic is gone. But when he discovers the loopholes someday, I think he should be smart enough to use the drives properly then.

cdlock: CD/DVD Drive Door Locking Control

CD/DVD Drives

1. What is This?

cdlock includes utilities for locking and unlocking the door of your CD/DVD drives. Once the door is locked, you should not be able to eject the tray by pressing the 'Eject' button located at the front side of the drive (even the tray is empty). It works on Linux with 2.6.x kernel.

Scroll down for technical notes. I implemented this to guard my DVD drive!

2. Source Code

cdlock-0.1.tar.bz2

To install it, simply do:

\$ make && sudo make install

The code is distributed under the terms of GPL.

3. Usage

To lock the door of a CD/DVD drive:

\$ cdlock [<device>]

The program assumes /dev/cdrom by default. The program returns zero if and only if it does not detect any error.

To unlock the door:

\$ cdunlock [<device>]

4. Technical Notes

The program is so simple and it basically does an ioctl() with CDROM_LOCKDOOR. I write this because I fail to find a handy utility just to do this simple task. Tell me if you are aware of any utility that has included this feature, or you want to include this program under the umbrella of a more sophisticated and GPL-compatible software.

I have tested the program with three CD/DVD drives. All of them work in the sense that, once I have run the utility to lock the door, the function of the 'Eject' button is virtually disabled. However, there are some weird behaviors I do not understand yet:

  • On some computers, the eject command fails to eject the tray after I have locked the door. Good. But while I expect eject to return 1 since the operation has failed, it returns 0 instead. Is it a feature or a bug?
  • I use DVD writers of the same model (LITE-ON DVDRW SOHW-1673S) on two different computers instead with Ubuntu 7.10. After locking the drives' doors, I can eject successfully on one computer but fail on another. Why is it so? I don't think I have change any setting related to the drives. Is there anything to do with the IDE cables?

Tell me if you know the answers.

2008 Resolutions

I better write down some things I want to do this year. Human beings tend to get lazy without targets. People always find 10 targets for such things, not less and not more, don't know why. So I try to do the same here, in no particular order:

  • Work out more, be healthier. I stopped practicing Yoga for some time since I was too busy last year. I just went to renew my membership card early this month. Have to start before my body getting too 'rigid'.
  • Organize my belongings properly. I like to keep things. But over the years I have learned to throw or donate the things I really don't need. I have organized a lot of them recently, but there are still a lot of them yet.
  • Produce a human-digestible English text-to-speech rules and learn them. This needs some explanations. I just want to improve my English pronunciation with this 'hard' but probably systematic way. I don't know how this sounds but I'll probably explain this more later...
  • Revive my analytical thinking by playing chess games. I played Chinese chess often in my secondary school more than ten years ago. While I was not a very strong player, I played reasonably, played blind chess too, understood the intentions of most moves in others' games, and enjoyed the intensive thinking to figure out a good move. However, I played less and less after that, and my brain is getting rusty! I cannot play blind chess now as I cannot remember even one position well! I could see a lot of things when I saw a chess game position, but my brain is quite blank now if you show me one! So I need to start playing some games this year, with humans or computers. I need to clear the rusts in my brain to revive my analytical thinking.
  • Extend my solar system simulation program to be able to calculate the positions of all planets and Pluto in our solar system. My program is now able to calculate the Earth and moon positions well. After the extension I can use my program in many areas.
  • Extend my program for Astrological charts. When my program is able to calculate planet positions, it is just a step away from producing Astrological charts. Astrological interpretation? Not sure. If time permits, I may study it and see how much I can do.
  • Read at least ten new books. Any book less than 100 pages is not counted.
  • Write a program to help earn some money, if I am lucky! This is a secret but totally legal project. Keep it for myself at the moment!
  • Write computer-related articles for general public. Hope to write some articles, probably related to the free software stuffs, for the general public.
  • Organize this home page better.

"Four Fish" or "Four Fishes"?

A few days ago I saw the following phrase from a book for kids:

... caught four fish.

I grinned at the low quality of the book: How can such an easy-to-spot typo allowed? "Four Fishes" not "Four Fish", please! But as I continued to read further, the same phrase appeared again in another page:

... she has four fish.

What?! Two similar typos? Hmm... I grinned no more and thought that I might be wrong!

Yes, I was wrong! I did some research and just learned the proper way to use "fish" and "fishes":

  • Only one fish: use Fish;
  • A quantity of fish from the same kind (i.e., many from a single species): use Fish, not Fishes! (This is the 'trap' I didn't know!)
  • A quantity of fish with variety (i.e., many from more than one species): use Fishes.

Did you know about this?

Syndicate content