2009年12月12日 星期六

Dev-C++ 無法 debug

問題說明

我在寫一些 C/C++ 小程式,使用 Dev-C++ 這個免費又好用的 IDE 開發工具。我用的版本是 Dev-C++ 5.0 beta 9.2 (4.9.9.2) with Mingw/GCC 3.4.2。在 debug 程式時,Dev-C++ 一直出現 “Your project does not have debugging information, do you want to enable debugging and rebuild your project?” 這個訊息:

image

不管按多少次 Yes,就是沒辦法 debug。我想這應該是 Dev-C++ 的臭蟲,它沒有正確傳達要產生 debug information 的訊息給 gcc。

解法

  • 方法一:修改 “Project Options” (Project→Project Options→Compiler→Linker),把 “Generate debugging information” 改成 Yes。不過這個方法有個缺點,每個需要 debug 的專案都做同樣的動作:

image

  • 方法二:修改 “Compiler Options” (Tools→Compiler Options→Settings→Linker),在底下視窗的兩個 textbox 中都輸入 -g,並把兩個 chekbox 都打勾,讓 gcc 每次編譯時都產生 debugging information,一勞永逸:

image

VisualSVN Server 簡介

VisualSVN Server 是什麼

VisualSVN Server 是 Subversion, Apache 和 MMC(MS Management Console) 的統包(Turnkey),好處有:

  • 免費下載
  • 檔案小,V1.7 版才 3.77MB
  • GUI-based 介面,操作簡單
  • 內建帳戶管理,亦支援 Windows, Active Directory 認證

image

安裝步驟

image

  • 開始安裝, 完成時安裝精靈會詢問你要不要開啟 VisualSVN Server Manager

image

使用範例

  • VisualSVN Server Manager 首次執行的畫面

image

  • 先按 Create new user 建個帳號來試試

image

  • 用剛剛建好的帳號瀏覽網頁,登入畫面如下:

image

VisualSVN Server 顯示目前還沒有 Repositories:

image

  • 來建個 Repository 試試:

image

image

網頁上可看到剛建好的 sample repository:

image image

  • 也可以用 TortoiseSVN Client checkout

image

參考資料

  • VisualSVN Server

  • VisualSVN - A Visual Studio plug-in that integrates Subversion and TortoiseSVN seamlessly with Visual Studio.

後記

  • VisualSVN 宣稱支援 Active Directory 認證,在 VisualSVN Server Properties 視窗的 Authentication 這裏有看到兩種認證方式 (1) 內建認證 和 (2)Windows 認證,但卻沒看到 Active Directory 的認證方式,不曉得 Active Directory 認證要怎麼做?

image

2008年10月20日 星期一

Singleton in SNIT(SNIT's Not Incr Tcl)

在 SNIT 中要怎麼實作 Singleton pattern 呢?可以參考這段程式:

package require snit

snit::type Singleton {
    typevariable _instance {}
    
    typeconstructor {
        set _instance [Singleton %AUTO%]
    }
    
    constructor {args} {
        if {$_instance != {}} {
            error "Singleton can only be accessed through \"getInstance\""
        }
    }
    
    typemethod getInstance {} { 
        return $_instance
    }
}