Thursday, June 25, 2009

disable beep in emacs

使用 Emacs 也有一段時間,在 Mac 的 GUI 環境下使用 touch panel 撥弄 emacs 的 scroll bar,總會有令人中斷思緒的嗶嗶聲。Emacs Wiki: AlarmBell 這頁把處理警告的設定方式寫的頗為清楚。

要把警示聲換成視覺警示,可以寫成

(custom-set-variables '(visible-bell t))

在 GNU Emacs,這樣預設是閃爍第一行或最後一行,端看 touch panel 是轉哪一邊,XEmacs 則是閃爍整個螢幕,要讓 XEmacs 僅閃爍一行,則要寫成

(custom-set-variables '(visible-bell 'top-bottom))

完全關閉警告,可以設成

(custom-set-variables '(ring-bell-function 'ignore))

ring-bell-function 還可以設定成一個 lambda,指定警示聲去播放某個音效檔案。
(setq ring-bell-function (lambda ()
(call-process "audioplay" nil 0 nil
"/this/is/my/errorsound.au")))

或是送出訊息
(setq ring-bell-function (lambda ()
(message "use the message to replace beep")))


Emacs is awesome :D

 

Connect to SQLServer(MSSQL) in php5 with FreeTDS

In Debian It needs to

$ aptitude install freetds-common php5-sybase

Then add configuration about SQLServer to /etc/freetds/freetds.conf
[ConfigName]
host = host_of_sql_server
port = port_of_sql_server
tds version = correct_version
client charset = use_utf8_as_better

All thing done.

 

Monday, June 8, 2009

Pseudo-OO syntax in C

總是會忘記的 syntax