2011年9月25日 星期日

讓 Windows 系統使用遠端 CUPS 印表機

如果你要用 Windows 系統使用網路上以 CUPS 架的網路印表機的話,你需要安裝 CUPS 的 Windows driver。安裝只需要把 source tarball 解開,然後在 Windows 的控制台新增網路印表機就可以了。

新增印表機的時候請選網路連結(http://開頭的),連結內容可以到印表機伺服器的 CUPS 網頁取得(http://remote.server:631 => Administration => Manage printers => 印表機連結),印表機連結格式如下:
http://remote.server:631/printers/Remote_Printer_ID

接下來  Windows 會要你選擇 driver,請給它之前下載的 source tarball 裡的 cups6.inf,安裝 CUPS test driver 後就大功告成了。


2011年9月20日 星期二

valgrind 的其他用途

valgrind 是一個常被 programmer 拿來偵測 memory leaks 的利器。不過除了偵測記憶體錯誤以外,其實它還提供了其他有用的工具,只是 valgrind 以 memcheck 作為預設工具。

以下是 valgrind 提供的工具清單:

  1. memcheck
    偵測 runtime 記憶體錯誤與 memory leaks。
  2. callgrind
    提供類似 gprof 的 profiling 功能,記錄函數被呼叫的次數。不同的是它可以在 runtime 即時監控。
  3. cachegrind
    快取命中的 profiler,改善快取失誤可以提昇程式效能。
  4. massif
    heap 的 profiler,記錄記憶體使用量。
  5. helgrind
    thread 的 debugger,主要是用來偵測資料的 race condition。