2009/09/25

curl -4 --head -H "Host 203.166.178.9" http://www.liulantao.com/images/lax_shetou.gif


lax@homex ~ $ host www.liulantao.com
www.liulantao.com has address 203.166.178.9
lax@homex ~ $ curl -4 --head -H "Host 203.166.178.9" http://www.liulantao.com/images/lax_shetou.gif
HTTP/1.1 200 OK
Date: Fri, 25 Sep 2009 13:19:45 GMT
Server: Apache/2.0.52 (Red Hat)
Last-Modified: Sat, 07 Feb 2009 07:30:15 GMT
ETag: "1208ae-16be-1bc9efc0"
Accept-Ranges: bytes
Content-Length: 5822
Connection: close
Content-Type: image/gif

--
Liu Lantao
College of Information Science and Technology, Beijing Normal University
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------

What is Test-Driven Development in Ruby?

TDD steps:

1, Write a test that describes some shortcoming or missing feature in the code.

2, Run the tests.

3, Write just enough code to make this test pass.

4, Run the tests again.

5, Refactor.

6, Write a test to define a new feature and start the process all over again.


Always remember:

1, Code doesn't exist yet until it's tested.

2, Run tests religiously.


see more:
1, http://ruby.about.com/od/advancedruby/a/tdd.htm

--
Liu Lantao
College of Information Science and Technology, Beijing Normal University
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------

2009/09/24

rake db:drop with permission denied error.

>rake db:drop
Couldn't drop db/development.sqlite3 : #<Errno::EACCES: Permission denied - db/development.sqlite3>

maybe you run script/console and didn't exit.

--
Liu Lantao
College of Information Science and Technology, Beijing Normal University
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------

2009/09/16

A journey to Gentoo: Intel video card and xorg installed.

config intel video card on Gentoo Linux.

first, make sure the kernel module option, "Device Drivers --> Graphics support --> Direct Rendering Manager --> Intel 810" should be checked for my i810 card.

then set  VIDEO_CARDS="intel"  in /etc/make.conf.

now, reinstall xorg-x11:  # sudo emerge -uDNva xorg-x11.

when all above steps were finished, remove /etc/X11/xorg.conf, run $ startx, and everything is fine.

Though, there is neither any input method nor web browser installed, a easy journey to go.

--
Liu Lantao, Oaks Pacific Corp.
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------

2009/09/07

Installing Chromium Web Browser on Fedora 11.

[lax@homex ~]$ sudo vim /etc/yum.repos.d/chromium.repo
[chromium]
name=Chromium Test Packages
baseurl=http://spot.fedorapeople.org/chromium/F$releasever/
enabled=0
gpgcheck=0

[lax@homex ~]$ sudo yum install *chromium* --enablerepo=chromium
Loaded plugins: aliases, fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
 * fedora: ftp.cuhk.edu.hk
 * rpmfusion-free: mirrors.cat.pdx.edu
 * rpmfusion-free-updates: mirrors.cat.pdx.edu
 * rpmfusion-nonfree: mirrors.cat.pdx.edu
 * rpmfusion-nonfree-updates: mirrors.cat.pdx.edu
 * updates: ftp.cuhk.edu.hk
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package chromium.i586 0:4.0.204.0-0.1.20090827svn24640.fc11 set to be updated
--> Processing Dependency: libv8.so.1 for package: chromium-4.0.204.0-0.1.20090827svn24640.fc11.i586
--> Processing Dependency: libminizip.so.1 for package: chromium-4.0.204.0-0.1.20090827svn24640.fc11.i586
--> Processing Dependency: nss-mdns(x86-32) for package: chromium-4.0.204.0-0.1.20090827svn24640.fc11.i586
--> Running transaction check
---> Package minizip.i586 0:1.2.3-22.fc11 set to be updated
---> Package nss-mdns.i586 0:0.10-7.fc11 set to be updated
---> Package v8.i586 0:1.3.8-1.20090827svn2777.fc11 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package     Arch    Version                                  Repository   Size
================================================================================
Installing:
 chromium    i586    4.0.204.0-0.1.20090827svn24640.fc11      chromium     15 M
Installing for dependencies:
 minizip     i586    1.2.3-22.fc11                            fedora       25 k
 nss-mdns    i586    0.10-7.fc11                              fedora       25 k
 v8          i586    1.3.8-1.20090827svn2777.fc11             chromium    914 k

Transaction Summary
================================================================================
Install      4 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        

Total download size: 16 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): chromium-4.0.204.0-0.1.20090827svn24640.fc11.i586 |  15 MB     02:15    
(2/4): minizip-1.2.3-22.fc11.i586.rpm                    |  25 kB     00:01    
(3/4): nss-mdns-0.10-7.fc11.i586.rpm                     |  25 kB     00:00    
(4/4): v8-1.3.8-1.20090827svn2777.fc11.i586.rpm          | 914 kB     00:09    
--------------------------------------------------------------------------------
Total                                           100 kB/s |  16 MB     02:43    
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : v8-1.3.8-1.20090827svn2777.fc11.i586                     1/4
  Installing     : minizip-1.2.3-22.fc11.i586                               2/4
  Installing     : nss-mdns-0.10-7.fc11.i586                                3/4
  Installing     : chromium-4.0.204.0-0.1.20090827svn24640.fc11.i586        4/4

Installed:
  chromium.i586 0:4.0.204.0-0.1.20090827svn24640.fc11                          

Dependency Installed:
  minizip.i586 0:1.2.3-22.fc11                 nss-mdns.i586 0:0.10-7.fc11     
  v8.i586 0:1.3.8-1.20090827svn2777.fc11     

Complete!


--
Liu Lantao
College of Information Science and Technology, Beijing Normal University
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------

Output of an Array to sentence, the ruby way

@contacts.collect{|s| s.name}.to_sentence.concat(".")


--
Liu Lantao
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------

2009/09/06

西四新开的一家奶酪魏


奶酪魏,西四店,今年入夏新开的店。老字号的牌子,进去店面不大,装修得简单,但是也干净整洁。奶酪白色小瓷碗,一般是7元。此外还有奶酪卷、奶酪干等品种。

我要了一碗原味的,很好吃,入口滑而不腻,奶的香醇之气全在其中,回味很久。平时吃的现酿酸奶与它相比,瞬间就没有了一点儿吸引力。

地点嘛,22路、826路等公交车在平安里路口南,路东。过段时间西四的地铁开通,应该更方便了。

奶酪魏第一家店位于前门门框胡同15号,名字为麟记酪铺,在经常是极为有名的了,梁实秋的文章中曾有描述。

--
Liu Lantao
College of Information Science and Technology, Beijing Normal University
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------

2009/09/02

Config rubygems and rails in ubuntu.

 sudo apt-get install rubygems
 sudo gem install rubygems-update
 sudo update_rubygems
 sudo apt-get install libsqlite3-dev
 sudo gem install sqlite3-ruby rails

--
Liu Lantao
College of Information Science and Technology, Beijing Normal University
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------