Fishpond 604x90

Sunday, December 25, 2005

Merry Christmas!

It is Christmas today. I just been back from East Coast of Singapore for the vacation with some friends. We rent a house there which is quite cheap. It only costs us S$15. This is a special benefit for NUS staff. We bought a lot of food to eat. At night, we walked on the beach. The sand is very soft. We also did some bicycling, skating and swimming. I'm not good at swimming, so it is a bit dangerous to swim in the sea. The taste of the water is terrible. However, I managed to survive. All in all, be calm is the most important thing, whatever the situation is.

Saturday, December 17, 2005

Some thoughts after today's training

This afternoon, as usual, I had a taekwondo training. During the sparing session, I had fought several rounds with juniors, and I noticed some problems of me. My left feet was injured last time, so it was a bit hurt when I kicked others. I finally gave up to use it any more to do front kick. As my left leg was quite weak in side kick, I had to rely on my right leg to do all the kickings. This is really a disadvantage for me. I found myself lack varieties in my kickings. This made me quite predictable. It is no good for sure if your opponents can predict what you would do next, and if the opponent is more skillful than you are, you will be a dead meat very soon. I think I have done so little training by myself recently. I no longer run at night and practice kickings afterwards. I have been weakened, both power and agility. If I still don't do anything, I will not be able to catch up. Tomorrow is Sunday, let's see if I will do some training then.

Thursday, December 15, 2005

Some tips on using regular expressions to download files

It is quite common that sometimes we want to download a bunch of files listed on a web page. Of course you can use your mouse to right click the link then save it to your hard disk. However, if there are so many links, it would be quite tedious to do so. For a lazy man like me, I would do the following things:

  1. Save the source code of the web page
  2. Use perl to filter out the relative links like this: perl -ne '@files = split /target=/; foreach(@files){ if (/(http*.mp3)/){ print $1,"\n" }' source_code > abc
  3. Use wget to download the files: wget -i abc
In the example, I have assumed we are going to download mp3 files, and they are seperated by 'target=' in the code. We first split the line into a list so that each element has only one string containing mp3, then we use regular expressions to seperate it out. In this way, we can download as many files as we like.

Wednesday, December 14, 2005

The coming IVP competition

There will be an annual Taekwondo Institute-Varsity-Polytechnic Tournament (IVP) at the end of next Feb. I will be in this time hopefully. I'm a bit nervous sometime when thinking about that. Sparing is fun for sure, but being killed or seriously injured is no fun at all. Even though the competition may not be that brutal, danger still exists. I need to do more training, more committed to it. To become a real fighter, no one can avoid the fight. Let this tournament be a good experience on my way to becoming a master.

Thursday, December 08, 2005

How to transform dos file to unix file?

We know that windoz and unix save files with different endings for each line. If you write a shell script under windoz, it will not work under unix. It may shows ": command not found" on the command line. To solve this problem, we need to change the file format. An easy way to do this is:

$ tr '\r\n' '\n' < dosfile > unixfile

This will replace all the '\r\n' at the end of each line with '\n'.

Workstations are down

Our department is under transformation. Machines have been shut down today. The power supply will be turned off soon. I have to stay at the library to work. It is so bad, really.

Wednesday, December 07, 2005

Carbon nanotubes

This picture shows three carbon nanotubes with different chirality and numbers of unit. The inner most is a (5,0) nanotube for a unit cell. The middle one is (5,5) armchair nanotube, also one unit cell. The outter most is a (10, 10) nanotube with 3 unit cells.

It all begins here

I finally decide that it may be helpful to have a blog of my own, both as a way to make money or to convey ideas of mine to others. I will try to update it regularly.

According to the bible, at the beginning of the world, the God said, "Let there be light", and there be light. While I'm an atheist, I can be a god here. I would say, "Let there be a post", and there will be one. So let it starts ...