星期日, 一月 24, 2010

Compiz-fusion on Thinkpad SL400, NVIDIA Card.

1 - Set USE flags


x11-libs/libX11 and media-libs/mesa with xcb enabled.
x11-libs/cairo with glitz, xcb and svg enabled.
x11-wm/compiz-fusion with emerald enabled.

2 - Keywords

dev-python/compizconfig-python
x11-wm/compiz
x11-wm/compiz-fusion
x11-plugins/compiz-plugins-main
x11-plugins/compiz-plugins-extra
x11-plugins/compiz-plugins-unsupported
x11-wm/emerald
x11-themes/emerald-themes
x11-apps/ccsm
x11-libs/libcompizconfig
x11-libs/compizconfig-backend-gconf
x11-libs/compizconfig-backend-kconfig
x11-libs/compiz-bcop


3 - Emerge

emerge compiz-fusion



4 - Usage for nvidia card


LIBGL_ALWAYS_INDIRECT=1 INTEL_BATCH=1 compiz --replace --indirect-rendering --sm-disable ccp

5 - GNOME setting

Navigate to System > Preferences > Startup Applications
Add a new Program to the session list named Compiz-Fusion and path /usr/bin/compiz-manager
Add a new Program to the session list named Emerald and in command "emerald --replace"
Save the settings and relog to test.




reference: http://en.gentoo-wiki.com/wiki/Compiz-Fusion

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

标签:

星期四, 十二月 10, 2009

Ruby让你成为一个愉悦的开发者

在最近工作的几个项目中,我有意无意的采用了Ruby语言。作为一种介于主流与非主流之间的动态语言(TIOBE排名10左右),采用ruby的开发者群体在一度暴涨之后,一直处于一个相当稳定的水平。


从效率来看,ruby确实不是一个让人完全满意的选择。在我以前一个项目中实现的一个搜索项目,最先采用了一个PHP的版本,运行起来显示了php一贯的高效和稳定特性。后来采用了ruby进行功能扩展,开发的过程让人愉悦,少量的代码实现了全部功能,并且增加了灵活性,但是在数据量急遽增加的时候,ruby的表现并不如php那样轻松自在。jruby等正在尝试通过新的手段来对这个方面进行改进,前面的路还有很长,值得期待。


而抛开这个瑕疵,Ruby语言本身的优雅简洁,却能将开发者吸引到它的圈子。


ruby强调代码的质量,在ruby的世界里,到处看到的是短小精悍的代码,寥寥几行,可以清晰看到进程的脉络。那比较负责的任务怎么实现呢?Ruby的解决方案是将问题分解,在单独的块里实现复杂的功能。其实这个单独的块也是一个清晰的框架,复杂的功能还会继续分块下去,直到所有的功能的实现都在一个简洁的块中实现。不用卖弄任何技巧,问题在逐步自然而优雅的分解过程中,已经有了一个完美的解决。
大多数语言支持完善的函数,大都有代码重用的机制。而Ruby所特有的灵活高效的block机制,让它出类拔萃。在你需要的时候,方便地def你的方法;采用block/closure,对进程进行有效的控制。通过引入这种灵活性,使Ruby的代码更加简洁。开发者会发现这种语言不会因为严格的语法规则来限制他/她的思维,怎么能不爱它呢?


Ruby的社区也比其它的社区更为友善一些,很少能看到其它社区常见的那句RTFM。这一方面可以归因于ruby是个后起之秀,很多问题都在解决之中,文档中并没有成熟的解决方案。而另一方面,ruby开发者一直处于一种愉悦的开发心情中,大都应该不会以那种暴躁的方式来对待有相同兴趣的吧。



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

标签:

星期五, 九月 25, 2009

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/ .
------

星期四, 九月 24, 2009

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/ .
------

星期三, 九月 16, 2009

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/ .
------

星期一, 九月 07, 2009

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/ .
------

星期日, 九月 06, 2009

西四新开的一家奶酪魏


奶酪魏,西四店,今年入夏新开的店。老字号的牌子,进去店面不大,装修得简单,但是也干净整洁。奶酪白色小瓷碗,一般是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/ .
------

星期三, 九月 02, 2009

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/ .
------