2006-02-26 18:04:43

uni libtool env

最近 FreeBSD 上的 libtool 通通統一採用 libtool 1.5, 我發現我的環境要 update 會遇到一點問題. 稍微看了一下, 馬上就解決了.

首先先 pkg_info | grep libtool, 把除了 1.5 的給移除, 例如 pkg_deinstall libtool-1.3. 然後看一下 /usr/local/share/libtool 是不是一個 symbolic link 到別的地方, 是的話就把它移掉, 再 portupgrade libtool 就好了.

由 plasma 於 06:04 PM 所發表 | 迴響 (0)

2005-03-15 11:46:20

升級 net/dictd 1.9.15

因為最近 gnome 又自 2.8 升級至 2.10, 連 glib 都跟著要升級到 2.6. gnome 必須借用升級程式, 於是很多原本不打算升級的, 因為跟 glib 關聯到而被迫升級, 包括了 dictd.

這次的升級還不錯, /usr/local/etc/dictd.conf 不會被蓋過去, 但是很奇怪地, dictd 也跑不起來. 試著手動啟動也是一樣, 而且什麼錯誤訊息都沒有講. 後來在友人 priv 的建議下, 才以 dictd -v -L tmp/dictd.log -l all -d nofork -d nodetach 看到錯誤訊息:

:E: locale 'C' can not be used for utf-8 dictionaries. Exiting

同樣在友人 priv 的指點下, 再加上 --locale zh_TW.UTF-8 的參數, 就可以正常地啟動了.

不過 emacs 的 dictionary.el 變成無法正確顯示部份字典檔的中文. 檢查一下, 發現新版的 dictd 把它全都以 UTF-8 編碼方式送出來. 於是 .emacs 裡修改一下:

(setq dictionary-coding-systems-for-dictionaries
      (append '(("moecomp" . utf-8)
		("netterm" . utf-8)
		("pydict"  . utf-8)
		("cedict"  . utf-8)
                ("stardic" . utf-8)
                ("cpatch" . utf-8)
		)
	      dictionary-coding-systems-for-dictionaries ))

跟 dictionary.el 說全部都以 UTF-8 顯示. 正常了.

由 plasma 於 11:46 AM 所發表 | 迴響 (0)

2005-03-10 11:52:23

Bus error while compiling gstreamer-plugins

The error message bugs me a while while upgrading packages related to gstreamer-plugins:

...
Added plugin cdplayer with 1 feature.
Added plugin ossaudio with 3 features.
Bus error

And... google is our ally. Please refer to this post.

I modify the entry for 'multimedia/gstreamer-plugins' in /usr/local/etc/pkgtools.conf, adding an environment variable "CPUTYPE= " in it. Run portupgrade to upgrade gstreamer-plugins. The 'Bus error' goes away.

Nice. :)

由 plasma 於 11:52 AM 所發表 | 迴響 (0)

2004-05-03 12:50:36

Making Hibernation Partition On ThinkPad X23

This is not the frist time for me to create a hibernation partition on my laptop, and it's a bit annoying to search for the URL of the utility to do this.

So, I decide to write it down.

BTW, the OS is FreeBSD.

* Go to the following URL and fetch "Hibernation utility diskette II for standalone boot": http://www-307.ibm.com/pc/support/site.wss/document.do?lndocid=MIGR-4PESMK . Make the floppy.

* Boot from the floppy. Following the instructions on the screen and make a hibernation partition. Take out the diskette and reboot.

* FreeBSD is not able to boot up. The screen shows 'Read error'. Seems the boot manager is overwritten. Don't panic, your lovely FreeBSD isn't altered. It's time to take out your bootable FreeBSD CD-ROM. You do have it at hand, don't you?

* Configure -> Label. Don't change any parameter here. Press 'w' to write the untouched layout back onto hard disk. It's fine if you don't change anything. Then it'll ask you to select a boot manger. Choose one except 'none'. You have to do things this way to make the setup program to write boot manager onto HD.

* Reboot. Now we have our FreeBSD back (untouched), and hibernation by pressing Fn+F12 works now.

由 plasma 於 12:50 PM 所發表 | 迴響 (2)

2003-12-01 14:16:09

mozex 與 emacs

最近有許多人問我如何設定 mozex 與 emacs. 寫個 blog entry, 節省大家的時間好了.

首先, 要把 mozex 裝起來. 由於它有中文的問題, 請參考 mozex 與中文mozex installer wich T.Chinese fix 兩篇, 安裝已修正的 mozex.

重起 mozilla 後, 進 Preference, 可以看到有新的 mozex Category. 請在 Textareas 一欄中, 填入 emacsclient %t. 按下 OK.

Emacs 這裡也需要一些設定. 把以下加進 ~/.emacs:

;; activate emacs server
(server-start)

這樣, 我們就可以使用 emacsclient 了.

另外還要設定 Unicode. FreeBSD 請安裝 converters/mule-ucs. 以下是我的設定:

;; unicode related
(require 'un-define)
(require 'un-tools)
(un-define-change-charset-order 
 '(ascii
   latin-iso8859-1
   latin-iso8859-2 latin-iso8859-3 latin-iso8859-4 cyrillic-iso8859-5
   greek-iso8859-7 hebrew-iso8859-8 latin-iso8859-9 latin-iso8859-14
   latin-iso8859-15 ipa chinese-big5-1 chinese-big5-2 chinese-gb2312
   chinese-cns11643-1 chinese-cns11643-2 chinese-cns11643-3
   chinese-cns11643-4 chinese-cns11643-5 chinese-cns11643-6
   chinese-cns11643-7 japanese-jisx0208 japanese-jisx0212 korean-ksc5601
   latin-jisx0201 katakana-jisx0201 thai-tis620 ethiopic indian-is13194
   chinese-sisheng vietnamese-viscii-lower 
   vietnamese-viscii-upper))

重跑後, 就可以利用 mozex 對 textarea 以 emacs 進行編輯了.

有一點要注意. 如果原先該 textarea 是空白的, 那麼被叫用起來的 emacs 會開啟一個空白的 buffer. 請以 C-x [enter] f utf-8, 將該 buffer 的語系設為 UTF-8. Mozex 都是以 UTF-8 來溝通的. 如果本來就有問題的話, 那麼 emacs 應該能夠辨識出來.

由 plasma 於 02:16 PM 所發表 | 迴響 (0)

2003-11-20 12:04:19

Plasma 版的 Kwiki Formatter

最近在公司開始用力地使用 kwiki. 原先使用的是 OddMuse, 相較起來, kwiki 的語法就少多了. 這時候, 就該自己動手作.

成果就是 CGI::Kwiki::Formatter::Plasma. 更詳細的介紹在這裡. 最新版的源碼, 可在 藝立協的 Subversion 檔案庫 取得.

另外, 以下的說明文字可附加至 快紀文字格式語法 頁面, 說明新增的功能:

以下是本快紀的擴充語法.
----
[&AlignBegin center]這一段置中.[&AlignEnd]
[&AlignBegin center]這一段置中.[&AlignEnd]
[&AlignBegin right]這一段靠右.[&AlignEnd]
[&AlignBegin right]這一段靠右.[&AlignEnd]
[&AlignBegin center]
而且可跨超多段.

對不對?
[&AlignEnd]
[&AlignBegin center]
而且可跨超多段.

對不對?
[&AlignEnd]
----
這是 [&_ColorBegin red yellow]紅底黃字[&_ColorEnd] 的字串.
這是 [&_ColorBegin red yellow]紅底黃字[&_ColorEnd] 的字串.
也可以使用 [&_ColorBegin #923FED #FFFFFF]色碼[&_ColorEnd] 指定
也可以使用 [&_ColorBegin #923FED #FFFFFF]色碼[&_ColorEnd] 指定
----
[=Entity] 函式. 可以寫出有特殊用途的特殊字元.

要這樣寫都行: [=[&_Entity 91]&_Entity 91[&_Entity 93]].
要這樣寫都行: [=[&_Entity 91]&_Entity 91[&_Entity 93]].
----
定義清單:
;PC:個人電腦
;Mark-up Language:標記語言
;;XML:http://www.w3.org/XML/
;;HTML:http://www.w3.org/MarkUp/
;PC:個人電腦
;Mark-up Language:標記語言
;;XML:http://www.w3.org/XML/
;;HTML:http://www.w3.org/MarkUp/
----
表格中可以指定文字格式:
| 一般文字 | /斜體/ |
| _底線_ | /*粗體加斜體*/ |
| 一般文字 | /斜體/ |
| _底線_ | /*粗體加斜體*/ |
----
擴充版表格語法:
|跨越多欄的好長的一行文字|||
|跨越多列| 對中 | 對中 |
|^|靠左 |靠左 |
|^| 靠右| 靠右|
|跨越多欄的好長的一行文字|||
|跨越多列| 對中 | 對中 |
|^|靠左 |靠左 |
|^| 靠右| 靠右|
由 plasma 於 12:04 PM 所發表 | 迴響 (1)

2003-11-17 09:51:59

mozex installer wich T.Chinese fix

Some people said they don't know how to apply the patch, which fixes T.Chinese charcter problem, that I mentioned in the previous blog entry.

Ok, I made an .xpi installer, containing the patch stated my previous blog. You don't have to apply the patch manually, but you still have to install it manually. Automatic installing needs modifications to Apache's httpd.conf, but I don't have the authorization to do it.


  • Download the installer here. Mozilla should pop up a prompt, asking whether you want to install it or not..

  • After installed, restart Mozilla.

The file saved is in UTF-8, so your editor must recognize it.

由 plasma 於 09:51 AM 所發表 | 迴響 (505)

2003-11-14 09:31:32

mozex 與中文

mozex 是一個 Mozilla 的外掛模組. 它對 Mozilla 加強了許多功能, 像是使用外部編輯器來看 HTML 源碼, 以偏好的程式來處理不同的連結. 我最喜歡的, 是以外部編輯器來編輯 textarea 裡的資料.


Mozilla 本身雖然有提供一些基本的編輯功能, 但是畢竟不是文字編輯器, 用起來不甚順手. 而且每個人都有偏好的文字編輯器, 能夠使用自己順手的工具, 來編輯一篇較長的文字 (像是這一篇. :), 不是很好嗎?

可惜的是, mozex 存出來的文字檔, 無法被文字編輯器正確地辨識. 簡單地說, Mozilla 本身以 Unicode 來儲存內部的文字, 也就是兩個位元組. 但是寫出時, 卻只會寫入每個字的 低位元組! 例如以 快紀 兩個字作測試. 它在 Mozilla 中的表示為:

5feb 7d00

但是實際存進檔案時, 變成:

eb 00

我對它修改了一下, 在寫入檔案之前, 先轉成 UTF-8 的字元串流, 然後讀檔之後, 再轉回 Unicode. 這樣就可以正確地被可辨識 Unicode 的文字編輯器所使用. 以下是對 v1.07 的 mozex 的 patch (或者你可以從這裡下載):

diff -ruN content/mozex/mozex.js content.new/mozex/mozex.js
--- content/mozex/mozex.js	Sun Sep 21 17:14:58 2003
+++ content.new/mozex/mozex.js	Fri Nov 14 00:07:55 2003
@@ -865,11 +865,16 @@
             return false;
         }
        
+        var uc = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].
+          createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+        uc.charset = "UTF-8";
+        var data_stream = uc.ConvertFromUnicode( data );
+
         var stream = Components.classes["@mozilla.org/network/file-output-stream;1"].
                      createInstance(Components.interfaces.nsIFileOutputStream);
         var PR_WRONLY = 0x02;
         stream.init(file, PR_WRONLY, 0600, 0);
-        stream.write(data, data.length);
+        stream.write(data_stream, data_stream.length);
         stream.flush()
         stream.close();
     } 
@@ -898,7 +903,10 @@
             var data = sis.read(sis.available());
             sis.close();
             is.close();
-            return data;
+        var uc = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].
+          createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+        uc.charset = "UTF-8";
+            return uc.ConvertToUnicode( data );
         }
         else {
             mozexError("temporary file '" + filename + "' does not exist or is not readable");

使用方式:

  • 安裝 mozex.
  • ~/.mozilla/user_name/foobar.slt/chrome, 將 mozex.jar 以 unzip 解開來. 你會看到新產生一個 content 目錄.
  • 套用以上的 patch. 這個 patch 只會修改 content/mozex/mozex.js 而已.
  • 刪除原先的 mozex.jar, 將 content 目錄以 zip 再壓回 mozex.jar.
  • 重新啟動 Mozilla.

現在, mozex 應該就會輸出可正確被文字編輯器使用的 utf-8 檔案了. 本篇 blog 就是以 mozex, 在 Emacs 上寫成的. :)

由 plasma 於 09:31 AM 所發表 | 迴響 (1)

2003-08-22 16:16:04

RT 與 Apache 2 和 FastCGI (Update)

今天升級 RT, 結果 favicon.png 出不來. 奇怪, 為什麼呢?

花了一點時間, 確定 favicon.png 在機器上是正確的, 但是用瀏灠器抓回來的就不對. 比對內容的結果, 0d 0a 被轉成 0a 了.

Apache 設定沒動, 只有更新程式而已, 猜想是程式搞的鬼. 找了半天, 看不出有什麼地方是有疑問的. 後來在 IRC 上遇到 autrijus, 提供了幾個線索, 終於找到元兇.

請看 RT 與 Apache 2 和 FastCGI, 其中的

ScriptAlias / /opt/rt3/bin/mason_handler.fcgi/

要拿掉. 但是要加上加

ScriptAlias /REST /opt/rt3/bin/mason_handler.fcgi/REST

這樣 mailgate 才會正常. 於是全部變成

<VirtualHost *>
  ServerName rt.plasma.idv.tw
  DocumentRoot /opt/rt3/share/html
  AddDefaultCharset UTF-8
  AddHandler    fastcgi-script fcgi

FastCgiServer /opt/rt3/bin/mason_handler.fcgi
ScriptAlias /REST /opt/rt3/bin/mason_handler.fcgi/REST

ScriptAliasMatch (.*/)$ /opt/rt3/bin/mason_handler.fcgi$1
ScriptAliasMatch (.*\.html)$ /opt/rt3/bin/mason_handler.fcgi$1
</VirtualHost>

不過我覺得很好奇的是, 為什麼以前都正常工作呢?

由 plasma 於 04:16 PM 所發表 | 迴響 (0)

2003-07-23 19:11:27

RT 與 Apache 2 和 FastCGI

偉大的 PM hc 叫我要寫, 所以我就寫了.

Apache 2 + mod_perl 2 + RT 實在是太難設, 問題太多了, 所以請完全拋棄它吧. 我們有更好的選擇, 也就是 FastCGI.

在 FreeBSD 上, 請安裝以下的 port. 記得要開啟 WITH_APACHE2 的設定:

fcgi-devkit
mod_fastcgi
p5-FastCGI

然後在 Apache 2 的 httpd.conf 裡使用這樣的設定:

<VirtualHost *>
  ServerName rt.plasma.idv.tw
  DocumentRoot /opt/rt3/share/html
  AddDefaultCharset UTF-8
  AddHandler    fastcgi-script fcgi

FastCgiServer /opt/rt3/bin/mason_handler.fcgi
ScriptAlias / /opt/rt3/bin/mason_handler.fcgi/

ScriptAliasMatch (.*/)$ /opt/rt3/bin/mason_handler.fcgi$1
ScriptAliasMatch (.*\.html)$ /opt/rt3/bin/mason_handler.fcgi$1
</VirtualHost>

我這裡的設定是使用 named virtual host. 你可視需要修改.

由 plasma 於 07:11 PM 所發表 | 迴響 (1)

2003-07-17 10:40:13

RT 與 Apache2

在 Apache2 的 config 檔裡加上
PerlOptions +GlobalRequest
根本一點用都沒有!!! 你需要的是在 bin/webmux.pl 裡加上這個 patch:
--- /home/plasma/mywork/elixus/depot/RT/rt/bin/webmux.pl.in     Thu Jun 12 10:07:14 2003
+++ webmux.pl   Tue Jul  1 14:25:34 2003
@@ -33,7 +33,17 @@
     $ENV{'IFS'}    = '' if defined $ENV{'IFS'};
 }

+require Apache::RequestUtil;
+no warnings 'redefine';
+my $sub = *Apache::request{CODE};
+*Apache::request = sub {
+    my $r;
+    eval { $r = $sub->('Apache'); };
+    # warn $@ if $@;
+    return $r;
+};
+
 use RT;

 package RT::Mason;
由 plasma 於 10:40 AM 所發表 | 迴響 (1)

2003-05-20 09:29:51

Subversion 0.23 on freebsd

這兩天有人問我, 裝 subversion 要 devel/libtool14 嗎?

NO. 前一篇的迴響已經有說了, svn 0.22.1 已修正這個問題, 所以 ports 裡的是正常的.

大概沒有特別說明的關係. 希望以上大大的 no 能明確地說明. :-)

由 plasma 於 09:29 AM 所發表 | 迴響 (1)

2003-05-10 00:01:41

Subversion 0.22 on freebsd

這一版比較麻煩. Subversion 0.22 需要 libtool 1.4, 雖然有 devel/libtool14, 但是它是蓋過原先 libtool 1.3. 而且 這兩個看起來裝的是同一個檔案, 但是產生的結果不一樣......

因為不知道怎麼處理, 所以本版請手動處理. 首先先換到 libtool 1.4:

portupgrade -o devel/libtool14 -fv libtool

然後對 ports/devel/subversion 使用以下的 patch:

===================================================================
--- distinfo    (revision 677)
+++ distinfo    (working copy)
@@ -1 +1 @@
-MD5 (subversion-0.21.0.tar.gz) = b2ad91127fb652e764b750f4c0002528
+MD5 (subversion-0.22.0.tar.gz) = 13f00c5cca1e16b62fcd9dd6acc27641
Index: Makefile
===================================================================
--- Makefile    (revision 740)
+++ Makefile    (working copy)
@@ -5,9 +5,9 @@
 # $FreeBSD: ports/devel/subversion/Makefile,v 1.28 2003/05/02 18:23:08 bmah Exp $
 
 PORTNAME=      subversion
-PORTVERSION=   0.21.0
+PORTVERSION=   0.22.0
 CATEGORIES=    devel
-MASTER_SITES=  http://subversion.tigris.org/files/documents/15/3712/
+MASTER_SITES=  http://subversion.tigris.org/files/documents/15/4016/
 MASTER_SITES+= ${MASTER_SITE_LOCAL}
 MASTER_SITE_SUBDIR=            bmah
 

然後以

portupgrade -v subversion

更新. 安裝完了之後, 可以使用

portupgrade -o devel/libtool -fv libtool

把 libtool 換回來.

由 plasma 於 12:01 AM 所發表 | 迴響 (2)

2003-03-28 10:34:22

FreeBSD port for Subversion 0.20.1

FreeBSD port for Subversion 0.20.1 is out. You could download it at here

The diff is sent to the maintainer of devel/subversion. Before use this port, you have to apply pr #50309 to upgrade apr to 0.92-alpha.

由 plasma 於 10:34 AM 所發表 | 迴響 (6)

2003-03-26 11:38:51

FreeBSD port for Subversion 0.20

因為

08:21 <@plasmabal> jabbot: msg
08:21 <@jabbot> plasmabal: from gugod: 求求你, 做個 svn 0.2 package 吧 3_3

所以就有了這個 port .

請先刪掉 devel/aprdevel/subversion, 然後再把壓縮檔裡的內容解出來.

diff 已經送回給 maintainer 了. 看看什麼時候會送 ports 吧.

由 plasma 於 11:38 AM 所發表 | 迴響 (0)