Friday, February 29, 2008

colordiff and vim

Here mention a perl script package on Debian, colordiff. For highlighting output of diff just only pipe the output of diff to colordiff. For example, $ diff -rq /etc /var | colordiff | less -R or other similar commands as $svk diff | colordiff | less -R to get the highlighted. Otherwise we can use vim to got the same effect if syntax on has set in .vimrc. For example, $diff -rq /etc /var | vim -. Just only some difference between them. :p

Wednesday, February 27, 2008

Blueprint CSS 0.6 problem on IE

the class name "container" in IE have a problem: not align itself at center. Someway to fix it is set its parent element a property: { text-align: center; } to fix the problem.

Sunday, February 24, 2008

CPAN mirror SOP

3 steps note for how to mirror CPAN for fast installation in organization:

First, using rsync mirror whole CPAN to local machine. Write rsync -avHP --delete rsync.nic.funet.fi::CPAN /var/www/CPAN >> /var/log/rsync.log 2>&1 into crontab for daily synchronization. This step supposes mirror site root is put at /var/www/CPAN.

Second, write apache VirtualHost as below.
<VirtualHost *>
ServerName cpan.yourdomain

DocumentRoot /var/www/CPAN
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/CPAN/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ErrorLog /var/log/apache2/cpan-error.log

LogLevel warn

CustomLog /var/log/apache2/cpan-access.log combined
ServerSignature On

</VirtualHost>

Restart your apache and access cpan.yourdomain. you can see it.

Third, register your mirror site at mirrors.cpan.org if you want to become a official mirror site.

 

Saturday, February 23, 2008

Blueprint CSS 0.7.1 release

Quickly Note
There is many new feature in new release.New class name include alt, incr, quiet, small, large, showgrid...etc. Conversely, class name "column" is removed. Now div tag should be used as column. New directory structure come with new compressing ability through ruby script. Button's style move out from plugin and become an alone package put on download page

browser debuger note

Note for memory...

Safari:
Safari include a build-in debug menu, but default is off. To enable debug menu, command "defaults write com.apple.Safari IncludeDebugMenu 1" in shell, restart Safari to load it.

Debug menu with a javascript console. use Firebug compatible function console.log and console.info can print some infomation in it

Regretfully, build-in javascript console is not with javascript shell. There is a nice alternative choice at here. drag the link named shell in this page to safari bookmark bar. Click the bookmark to got a javascript shell.

Firefox:
Firebug add-on is the better choice for looking DOM, CSS. It also with a nice build-in javascript shell.

Internet Explorer 7:
internet explorer developer toolbar is a new tool. It still in beta and only for IE7. Appearance looks like firebug, But without javascript shell and couldn't modify CSS in it. Any way, It shows some aurora for debugging javascript in IE. XD

More information in blog.gugod.org

 

Sunday, February 17, 2008

the end of winter recess

這個寒假比預期的廢了很多,預定的事項,想讀的書,沒一件做完的,再來,三月一日就是研究所考試了,看著別人即將踏入考場,自己摸著鼻子甸甸自己剩下不到一年的時間儲備,真是難以說話。雖然沒有完成預定的事項,不過練習 perl/ruby 之餘還是寫了些 bot,cwbbot 是個簡單的 ruby 天氣預報機器人,提供他 twitter 的帳號和密碼,丟進 crontab,就可以每天自動取得明日溫度。

Saturday, February 16, 2008

perl 和 ruby 的 twitter shell

twitter 最近紅透半邊天,perl 和 ruby 都有了 twitter api,現在還有 twitter shell,perl 的 twitter shell 利用 cpan 下 install Twitter::Shell 就可以得到 /usr/local/bin/twittershell, 使用方式為新增一個 yaml,如: touch ~/.twittershell.yml , 裡面填入
username: yourtwitteraccount
password: yourtwitterpassword
在 shell 下 twittershell -c ~/.twittershell.yml 就進入該 shell, help 可以得到幫助。

ruby 版本內建在 twitter 這個 gem 內, sudo gem install twitter 就可以得到 /usr/bin/twitter,直接在 shell 下 twitter 就可以得到幫助。不過 ruby 版本對 unicode 沒有支援,無法顯示中文,嘗試在 twitter gem 內的 twitter.rb 加入
require 'jcode'
$KCODE = 'u'
,不過沒有效果,作者也表示暫時不會加入 unicode 支援。

Friday, February 15, 2008

land mine in file name extension of ruby

和 perl 不同, ruby 的 third party module package, 也就是 gems, 副檔名和一般 script 都一樣是 ".rb", ruby 搜尋 module 的 path 似乎又包含了 ".", 所以如果使用的 script 檔名和 script 引用的 gems 內的檔名相同的話, 就會衝突 :/

Sunday, February 10, 2008

vim tab 功能

今天逛 Cornelius 時偶然發現 Vim tab 的功能,是 7.0 開始加入的新功能,使用感覺相當方便,基本用法如下:
:tabe filename 在新標籤頁打開一個檔案
:tabc 關閉標籤頁
:tabo 關閉其他標籤頁
:tabn 下一個標籤頁 或是 gt, C-PageDown
:tabp 上一個標籤頁 或是 gT, C-PageUp
:tabr 第一個標籤頁
:tabl 最後一個標籤頁
:tabs 顯示所有標籤頁
:tabm [N] 移動到第N順位
還可以 :set tabline 來定義 tab 顯示方式

Thursday, February 7, 2008

dos2unix

因為有個 js 檔是從 windows 上來的,要更換換行字尾,遍尋不到 dos2unix,這裡寫到和我一樣的遭遇,google 排名還滿前面,看來許多人都有同樣需求?需要的套件是 sysutils。