在 Banshee 1.0 裡使用 BooScript

有兩種方法:

  1. 執行 Banshee 時,加上 –run-scripts your_boo_scripts.boo 表示要執行指定的 boo script
  2. 將 boo script 檔案放在 ~/.config/banshee-1/boo-scripts/

如果你會 Boo 的話,基本上就不難幫 Banshee 增加功能。不過難就難在你必須要對 Banshee 的原始碼有一定程度的了解…除了看原始碼以外,也可以看看官方提供的 extension 怎麼寫…

幾個 launchpad 上的 apt repository

要衝 banshee 1.0 版的話,可以試試這個:
deb http://ppa.launchpad.net/banshee-team/ubuntu hardy main multiverse restricted universe
上星期(2008/6/5)已經釋出了 1.0.0 版,跟 0.13 比起來,速度可說是兔子與烏龜,主要原因是 1.0 在資料庫上做了適當的索引與調整。
目前 ubuntu 上的 mono 是 1.2.6,要試最新版,除了下載官方網站的 installer 來安裝與 Mono for Debian(Mono – General – Mono 1.9.1 and MonoDevelop 1.0 Packages for Debian Etch) 之外,只能試這個了:
deb http://ppa.launchpad.net/mono-edge/ubuntu hardy main multiverse restricted universe
http://ppa.launchpad.net 上還蠻多 repository 可以試試看的,有遇到沒打包的軟體,就進去找找,或許已經有人在實驗了。

LXPanel Plugin in Managed code?

看到 Fred 寫的Fred’s blog: 讓我們輕鬆自在設計自己的 LXPanel Plugin,心想,應該也可以用 mono c#、boo 等來寫吧~
於是想到gimp-sharp,這個 library 讓你可以使用 c#、vb.net、boo 寫給 gimp 使用的 plugin,下載來看以後,真是令人驚訝~
原來 gimp 是使用外部執行的方式去呼叫這些 plugin,而這些 plugin 以收取參數與呼叫 gimp library 的方式來與 gimp 主體進行溝通。
那麼這樣,似乎就行不通了。一般 C/C++ plugin 的處理方式,都是以 dl_xxxx 系列函數來開啟 plugin(.so) 進行操作,對於 managed code 來說,assembly(.dll)並沒有開放這些介面。
從 C/C++ 呼叫 Managed code 是可行的,目前只適用於 Mono,請參閱這裡:Embedding Mono
這裡有幾個範例,應該是夠用了。
看起來如果要作 Plugin 給 lxpanel 用的話,還是得用 C 寫一個 Plugin,然後這個 Plugin 負責載入 mono 的 assembly,再把必要的資訊傳進去給 managed code。
有可能作成 chain-loader 的形式,由這個 Plugin 再去把其他用 Managed code 做的 Plugin 載入嗎??
恐怕還是得再看 lxpanel 內部如何用 plugin 才能決定。

LXDE in Ubuntu

如果你想在 Ubuntu 裡試試 LXDE 的話,加入這個軟體來源:

deb http://ppa.launchpad.net/lxde/ubuntu/ hardy main universe multiverse restricted

,然後安裝 lxde、lxsession 即可 (sudo apt-get install lxde lxsession)。接下來登出,將作業階段選為 LXDE,再登入即可。
LXDE 的確速度蠻快的,不過,不能瀏覽網路上的芳鄰,這實在是讓我無法下定決心跳槽啊…
補充:啊,LXDE 的下載網頁也有提到一個來源:

deb http://people.linux.org.tw/~pcman/ubuntu/ ./ 

gnome-settings-daemon 無法啟動

由於很勇敢地衝了Ubuntu Hardy 的緣故,常常會有很多驚喜~
這幾天是遇到 gnome-settings-daemon 無法啟動的問題,開啟終端機試著以手動方式啟動會出現如下訊息:

The program 'gnome-settings-daemon' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadRequest (invalid request code or no such operation)'.
(Details: serial 107 error_code 1 request_code 151 minor_code 6)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)

爬文以後,發現已經有人回報,從 2.21.9 以後就是如此,但是都還沒有解。
依照訊息的建議,改以如下指令再試試:

gnome-settings-daemon --debug --no-daemon --sync

這樣會丟出比較多的錯誤訊息,這邊只列出關鍵部份:

** (gnome-settings-daemon:20265): DEBUG: Registering GsdXrandrPlugin
** (gnome-settings-daemon:20265): DEBUG: Creating object of type GsdXrandrPlugin
** (gnome-settings-daemon:20265): DEBUG: GsdXrandrPlugin initializing
** (gnome-settings-daemon:20265): DEBUG: Activating xrandr plugin
** (gnome-settings-daemon:20265): DEBUG: Starting xrandr manager
The program 'gnome-settings-daemon' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadRequest (invalid request code or no such operation)'.
(Details: serial 107 error_code 1 request_code 151 minor_code 6)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)

喔~這樣看來應該是是 xrandr 的關係~
xrandr 是用來動態切換螢幕用的,舉例來說,接投影機或是額外螢幕時,就會用到~
不過,我現在用不到,那麼,要怎麼停用這個 plugin 呢?
這就得用 gconf-editor 了,使用 gconf-editor 去把 /apps/gnome_settings_daemon/plugins/xrandr/active 機碼改為 0,然後重新啟動 XServer 即可。

如何在 CentOS 安裝 Ruby on Rails

如果你照著這篇:在 CentOS 安裝 Ruby on Rails,卻怎麼樣也裝不起來的話,我想你碰到跟我一樣的問題了。錯誤訊息可能會是這樣子的:

ERROR: While executing gem … (Gem::GemNotFoundException)
Could not find rails (> 0) in any repository

研究了一下,發現應該是因為 RubyWorks 所提供的Source 沒有 rails gem 的關係,這也跟 RubyWorks 定位為 Production server 有關係。
總之如果你想把 CentOS 當作開發環境的話,不妨用

$sudo gem sources -a http://gems.rubyforge.org

把官方的 gem source 加進去,然後再輸入

$sudo gem install rails -y

即可。

Show your bootchart

之前安裝 bootchart 以後,就一直沒管他,沒有認真去研究該怎麼去把圖弄出來。
前幾天把圖弄出來了,這裡把步驟紀錄一下,我的環境是 Ubuntu 7.10(Gusty):

  1. 安裝 bootchart,安裝完成以後,得重開機,讓 bootchart 能獲取必要的資訊。
    $sudo apt-get -y install bootchart
  2. 重開機之後,bootchart 會把必要的資訊紀錄在 /var/log/bootchart.tgz。由於 bootchart 所提供的工具是用 Java 程式(/usr/share/bootchart/bootchart.jar)寫的,所以你還得確定有安裝 Java 或是 IKVM,我這邊是使用 ikvm。ikvm 是一個可以利用Mono(Linux 下的 .Net 執行環境)來執行 Java 程式的工具,一般來說,如果你有使用 Tomboy 或是 Beagle 的話,Mono就已經安裝了。
    $sudo apt-get -y install ikvm
  3. 執行 bootchart.jar,這會解析 /var/log/bootchart.tgz,然後產生 bootchart.svgz 在當前目錄下。
    $ikvm -jar /usr/share/bootchart/bootchart.jar
  4. 有了 bootchart.svgz,該怎麼去看這個圖呢?這邊提供兩種方法:
    • 利用 Firefox:把 bootchart.svgz 以 zcat 解開,再用 Firefox 打開即可。
      $zcat bootchart.svgz > bootchart.svg
    • 用 Inkscape 開啟檔案。
      $sudo apt-get -y install inkscape

How to purge at once in Debian/Ubuntu?

經常性地安裝、移除套件,可是卻發現有些套件還留了一些設定沒刪掉?
試試這個指令,一次搞定:

sudo aptitude purge `dpkg -l | grep ^r | awk '{print $2}'`

Ubuntu Gusty 播放影片不順 (如何關掉 Xgl)

這幾天在更新 Gusty 以後,發現 SMPlayer 播放影片變得不順了。
傷腦筋,這下子影片不能看了,早知道就不要重開機。
不過問題還是要解決,我以為是 SMPlayer 的關係,但是在更新 SMPlayer 以後,仍然不行。
仔細再分析一下,我想應該是 xserver 設定的問題,所以就看了 xorg.conf
看來是沒什麼問題,於是加上 DRI 試試看,可是仍然沒用,甚至 xserver 還會無法啟動。
Google大神也沒什麼線索。
用 ps -ef 看了一下,發現 Xgl 有在執行,可是,這應該是在有支援 3D 加速繪圖晶片的環境下用的啊。我的 Intel i915G 似乎不需要這個,決定把Xgl關掉試試看。
參考 /etc/X11/Xsession.d/98xserver-xgl_start-server 以後,發現只要這樣作即可。

$mkdir ~/.config/xserver-xgl
$touch ~/.config/xserver-xgl/disable

果然重新啟動 xserver 以後,天下太平。
所以如果你的顯示晶片不夠力的話,不妨把 Xgl 關掉試試吧~

如何在 CentOS 安裝 mod_proxy_html

  1. 先到官方網站下載源碼,或是利用 subversion 直接 checkout 最新的 code。這裡直接 checkout 最新的 3.0:
    #svn co http://apache.webthing.com/svn/apache/filters/proxy_html/ mod_proxy_html
  2. 安裝必要的開發套件:
    #yum install httpd-devel libxml2-devel
  3. 進行安裝:
    #apxs -I /usr/include/libxml2 -c -i mod_proxy_html.c
  4. 在 httpd.conf 裡面加上
    LoadFile /usr/lib/libxml2.so
    LoadModule proxy_html_module modules/mod_proxy_html.so
  5. 重新啟動 httpd 之後,就大功告成。(當然還是要參考官方文件,自己加上必要的設定啦。)

參考資料:

備註:曾幾何時,我居然也看懂希臘文了~ =_="