it just strikes me odd that python’s structure depends on indentation … i started a function at a wrong place. by the time i realized and tried to move it, the code totally messed up
first python code
July 8, 2011A new dawn
November 4, 2010Just imported the old MSN blogs into the wordpress blog here. Lots of cleanup work waits ahead.
convert EPS to PDF with bounding box
June 3, 2010On my Ubuntu somehow epstopdf doesn’t do job — giving me a full-paged pdf file.
This can be solved by calling
ps2pdf -EPSCrop XXX.eps
流水账
May 31, 2010two “new” features in c
March 15, 2010Well, there are not really new at all. But still many beginners like me are totally unaware of them.
1. you can define an array with a variable length, e.g.
int i = 5; int a[i] = {0};
2. const is also a keyword in C.
matlab question
March 15, 2010Given a matrix A, say
0 0 20
0 5 10
4 9 4
0 0 0
and a vector
a =[0 0 0 0]
How to determine a is 4-th row in A?
A quick matlab code looks like
find(ismember(A,a,’rows’))
Here is another solution which is harder to understand
e = A-repmat(a, [size(A, 1), 1]);
i = find(sum(e==0, 2)==size(A, 2));
grub 2
March 14, 2010It’s pretty straightforward to upgrade from grub (legacy) to grub 2 (version 1.96) or later. Just be cautious that when running grub-pc, one needs to choose a proper device (by UP or DOWN or SPACE), even if you only have one hard drive. Otherwise it will cause error 15 and a boot failure. I think this is very import and should draw much more attention than it does now. But somehow the grub2 developers didn’t think that way. And I am one of the woeful users who learn the error 15 the hard way.

The good news is that it’s not so hard to fix the boot failure. You need a live CD, chroot to your hard disk, sth. like this
$ sudo mount /dev/sda1 /mnt$ sudo mount --bind /dev /mnt/dev $ sudo mount --bind /proc /mnt/proc $ sudo mount --bind /sys /mnt/sys $ sudo chroot /mnt
And reconfigure the grub-pc. And you get rewarded

This is one the default images in the debian repository. (grub2-splashimages), also my current splash image.



Avatar~~
December 24, 2009感恩节聚餐 + 海报栏忽悠
December 12, 2009哇哈哈~~
November 26, 2009刚才在 限速 60 英里 的 35W 上开 80 英里, 然后被警察拦了下来 ……
当时觉得完了感恩节要吃罚单了, 结果竟然只给了个警告, 哇哈哈~~
本来这个黑色礼拜五没有购物计划的,现在看来是没有也得有了。








