Kanru’s 探險日誌

這裡應該會放一些我每日遊覽的站台及一些心得,就當作是我的學習筆記吧^^。

Archive for the ‘Programming’ Category

org.freedesktop.Notifications

with 2 comments

這東西可有趣了,freedesktop 定義了這個 dbus 介面,只要有支援的程式都可以透過它來顯示 notifywindow,比如說,我可以簡單的幫 xchat 加上有人跟我說話時自動提醒的 plugin

org.freedesktop.Notifications

下載這隻 plugin 後只需要把它放在 $HOME/.xchat2/ 底下,這樣每次開啟 xchat 時就會自動讀取了。它目前還很簡單,如果要設定圖示或是顯示樣式或秒數等等,自己看 code 改應該很快 :P

其中 class Notification 是從這裡抄來的。

Written by Kanru Chen

September 1st, 2006 at 4:13 am

Posted in Linux, Programming, 小工具, 爬網探險

Tagged with

Fancy Conversation Layout of Gaim

with 3 comments

從以前就覺得 gaim 的 conversaiton 的視窗做的像 IRC 的樣子很奇怪,因為有時候對方會發送多行訊息,這時候在 gaim 的視窗中就會斷的很奇怪,或是有人同時發送多個訊息時,視窗一大部分都被 nick 佔滿了。

所以才會出現底下這個 hack,把 gaim 的文字多做了一層縮排,單獨顯示,每個人每次的發言會串連在一起,而不是每次顯示一行。

Fancy MSN layout of gaim.

BTW, gaim 的 FAQ 提到不要使用 SVN 版,不過我改了 code,所以應該可以用吧?wahaha

Update:

補上 patch 的連結 ;-)

這個 patch 只能用在 svn trunk 的 gaim 喔,不會用的,最好先看一下上面那個 FAQ XD

Written by Kanru Chen

August 20th, 2006 at 2:19 am

Posted in Linux, Programming

Tagged with

Tomboy Plugin - CJKDisableSpell

with 2 comments

平常已經習慣使用 Tomboy 來記東西,介面還算好用,隨時都可以開新 Note 或是搜尋舊的 Note。用到現在唯一不滿意的地方是 tomboy 會對文章做 spelling check,無論內容是什麼,結果就是中文的 Note 會變成滿江紅。

花了一點時間寫了這個 plugin,可以針對 CJK 的部份取消 spelling check,效果還滿不錯 :)

使用前:

Screenshot

使用後:

Screenshot-1

使用方法,下載 CJKDisableSpellPlugin.cs 後自己編譯:

    mcs -t:library CJKDisableSpellPlugin.cs -r:/usr/lib/tomboy/Tomboy.exe -pkg:GTK-sharp-2.0

或是直接下載編譯好的 CJKDisableSpellPlugin.dll

將 dll 放置在 ~/.tomboy/Plugins/ 後,重新啟動 Tomboy 即可。

Written by Kanru Chen

July 10th, 2006 at 2:36 pm

Posted in Programming, 小工具, 爬網探險

Tagged with ,

Cairo Clock without composite manager

with one comment

The cairo-clock from MackSlow is indeed has very good look and feel. But it’s transparent background is depend on cairo’s alpha channel and Xorg’s composite extension. I did not enable this extension defautly because gnome doesn’t have it’s own composite manager and rely on xcompmgr. But xcompmgr always cause gnome-panel to be overlayed by other window. Then I think, “this clock almost won’t move after it was lauched, why not make a fake transparent background for it?” So that’s it, the screenshot:

Cairo Clock

Written by Kanru Chen

May 1st, 2006 at 10:08 am

Posted in Linux, Programming, 小工具, 爬網探險

Tagged with

Google Summer of Code 2006

without comments

Google Summer of Code 又來了,獎金可觀的 Google Summer of Code 今年也有舉辦,這是個由 google 贊助的學生 open source 計畫,去年的計畫有許多成功的案例,今年,各個組織也紛紛開始丟出題目。

jserv 提供了兩個網址,分別是 GCJ 的和 GNU Classpath 的。

有興趣的學生可以趕快報名參加!

Written by Kanru Chen

April 18th, 2006 at 12:57 am

Posted in Programming

Tagged with

MonoDevelop 0.10

without comments

MonoDevelop 0.10 Release 了,裡面整合了最新的 GUI Designer — Stetic

Stetic-in-monodevelop

實際試用的感覺不錯,而且跟 IDE 整合在一起,是使用 auto generated code ,而不是用 .glade 檔。 很有潛力的開發環境。

Written by Kanru Chen

April 16th, 2006 at 8:56 am

Posted in Programming

Tagged with

Bibot3 新功能

without comments

好吧,拖了很久才寫。

自從 bibot2 從 zion 人間蒸發之後[1],就開始了用 mono 寫新的 bibot3 的計畫,但是對於到底要有什麼功能一直沒有什麼好點子。從 bibot2 的經驗來看,網址自動紀錄大概是最多人在用的功能,我從來沒想到 URL.dot 掛掉之後會有那麼多人詢問…

某天跟 chihchun 閒聊,討論到把網址丟到某個 social bookmarks 服務(像是 del.icio.us) 的可能性,既然 del.icio.us 有公開 API,那麼應該不難實做,甚至比自己刻資料庫還簡單。

於是,在某天下課後查了一下 API 研究怎麼使用,然後就誕生了 http://del.icio.us/bibot。結果比想像中的有趣,因為 del.icio.us 有 tag 的功能,所以可以根據 tag 來判斷某網址是誰、在哪個 channel 提到的,也會自動紀錄時間和更新 title。

附帶一提,tinyurl.com 也有 API 可以呼叫,所以短網址的功能也可以輕鬆完成,不用再自己 parse 網頁的 output。

[1]: 某次停電之後,位在 zion 的 lvm 上的某 vserver 整個消失,只剩下 lost+found ,至今找不到原因。

Written by Kanru Chen

April 2nd, 2006 at 1:21 am

Posted in Programming

Tagged with ,

借書

without comments

今天去圖書館挖寶,又借了三本書:

本來還要借 Advanced .NET Remoting 的,可是應該是看不完,就先留給別人了…

很喜歡逛圖書館,在裡面搜刮的感覺很棒… 面對永遠都看不完的書,有時後會想:住在圖書館裡面好了 XD

BTW, 似乎應該要找一些文學類的來看阿 @@

Written by Kanru Chen

March 2nd, 2006 at 9:34 pm

Posted in Programming

Tagged with

.NET - Plugin

with 2 comments

我之前在 .NET - Load Plugins 寫過如何實做簡單的 plugin interface,最近真正在用的時候才發現問題。

Assembly.Load* 雖然可以把 .dll 檔案動態載入,可是卻找不到任何方法可以 unload.. Assembly 在被載入之後是處於鎖定的狀態,如果這時候把檔案換掉的話,Assembly.Load 便無法再重新載入,會出現 Exception

這樣就沒辦法在後端偷偷換掉 backend 了 -_-

要實做動態的 load, unload 好像是要使用 System.AppDomain 來做(時際上是用 Remoting 的技術),看似簡單,可是我試到現在還沒成功過… 還變成好像 Assembly 被 Cache 起來的情況,怎麼 load, unload 都是用到舊的 Assembly… 天阿

參考:通过应用程序域AppDomain加载和卸载程序集之后,如何再返回原来的主程序域

Written by Kanru Chen

February 18th, 2006 at 10:11 pm

Posted in Programming

Tagged with ,

Short, Int, 加加減減

with one comment

short x = 32767;
x = x + 2;

在 C 裡面,我們可能不小心寫出這樣的 code 而不自覺會造成 overflow,但是在 C# 則會得到

error CS0266: Cannot implicitly convert type ‘int’ to ’short’. An explicit conversion exists (are you missing a cast?)

要改成

x = (short)(x +2);

才行; 不過神奇的是,如果寫成

x += 2;

則不會有任何問題的直接 overflow… 這究竟是什麼樣的設計考量呢?

Written by Kanru Chen

February 16th, 2006 at 12:26 pm

Posted in Programming

Tagged with