Visual Studio + Version Control

前言

    Visual Studio 是 Windows 上大家常用的 IDE ,它以專案的方式管理你的程式,因此儲存時會有一些額外的檔案出現,並以 Microsoft 自訂的格式儲存著,如果這些檔案都是檔案都是純文字也就還好,要是以 binary 存在,除了會吃掉較多 repository 空間外,也容易造成 version control 上的麻煩…


一些 Version Control 的限制

    以 CVS 為例,它對 binary 的支援較不完善 [1],例如說: cvs diff、conflct 呈現是以 plain text 為原則而設計的,它會以 new line 的方式去逐行比對、進行呈現,因此,我們往往需要使用額外的指令 [2] 去操控 CVS,而有些指令則無法用於 binary 檔上。Essential CVS [3] 一書整理了一些 CVS 無法處理的檔案: 裝置檔、符號連結、無法開啟或修改的檔案;要想處理這類檔案,我們可以用間接的方式:改將用來建立或連接它們的命令檔存入 CVS。
    而 SVN 呢?根據 SVN 的 features [4] ,雖然它號稱處理 binary 的相當有效率,不過它有著和 CVS 類似的不便:

例如 [5] 所說:

  1. Not attempt to automatically merge received changes with local changes during svn update or svn merge
  2. Not show the differences as part of svn diff
  3. Not show line-by-line attribution for svn blame

結論與 Visual Studio

    因此,我們使用 Version Control System 時,通常會盡量不讓 binary 檔存入 repository 以避免一些麻煩和不便。而為了讓 Visual Studio 能讓 Version Control System 合作無間,我們當然也希望過濾一些 binary file,常見的檔案類型與副檔名可以在 MSDN 上找到,如 VS 2005 可參考 [7]。而 VC 常見的 binary file  有: *.ncb (Intellisense Database),用在自動完成、查詢上, VC 會自動更新產生可不必加入 repository 以及 *.suo (Solution User ptions),根據 [6][8] 也可不必加入監控行列。

Reference

  1. CVS and binary files
    http://ximbiot.com/cvs/cvshome/cyclic/cvs/dev-binary.html
  2. CVS and binary files
    http://durak.org/sean/pubs/software/cvsbook/CVS-And-Binary-Files.html
  3. Essential CVS
    http://www.oreilly.com/catalog/cvs/
  4. Subversion's Features
    http://subversion.tigris.org/
  5. Subversion FAQ - How does Subversion handle binary files?
    http://subversion.tigris.org/faq.html#binary-files
  6. 請勿將某些檔案類型的檔案簽入到 Subversion 版本庫
    http://blog.miniasp.com/category/e5b088e6a188e7aea1e79086.aspx
  7. File Types and File Extensions in Visual Studio
    http://msdn2.microsoft.com/en-us/library/xhkhh4zs.aspx
  8. Introducing Source Control
    http://msdn2.microsoft.com/en-us/library/ms171339(VS.80).aspx

混亂的一週

自從買了眼罩後,晚上睡覺就輕鬆多了,不必顧慮向右側睡時,走廊光線會透入;也不必想到向左側睡,早上會被陽光亮醒!後來又買了耳塞,從此睡覺彷彿與世隔絕,但一個禮拜前,我發現只要戴著眼罩睡,那晚就會作惡夢 -_-|| 而且是那種緊張刺激的夢,夢中的我,幾乎每次都在逃難,逃離戰爭、逃離仇家追殺…此外,還有歷經身離死別的劇情,害我睡醒後,都覺得肩膀、背部酸疼,還有一種腦袋動了一晚沒休息到的感覺…

兩個禮拜前的感冒使我拉了兩天的肚子,洗澡時發現自己瘦了,而四、五個月後,又將舉行畢業口試,口試完就要當兵了。頓時間,有種內憂外患的感覺,似乎告訴我該規律運動了,想起老爸每年都會對我說,我對你只有三個期望:多吃、多睡、多運動。

希望自己這學期能每天吃三餐、睡八個小時、慢跑半小時!

什麼是 Arity

記得以前在研究 Boost.function 的實做時,遇到一個有趣的 static class member ,名叫 arity 。由於沒看過這個單字,譯典通也找不到這個字,只好先猜猜它的意思!後來透過 Google 才知道這個字的意思是:一個函式的參數個數;wiki 的解釋更加清楚:

The arity of a function or operations is the number of arguments or operands that the function takes.

後記

  1. 記得當初上 wiki 查,沒找到這個單字,沒想到今天就出現了!出現的原因是:上 wiki 看 Tcl 的資料,找到 variadic ;看 variadic ,理所當然就會看到 arity 啦!網路的更新真的是快速又有趣,熱心的人們加上搜尋引擎內部會進行長期的資料分析,讓網路彷彿就像個有機體一樣,會成長、進化!
  2. 附帶一提,Tcl 在 wiki 的資料也更新了,更完整囉!

參考

  1. Arity - wikipedia: http://en.wikipedia.org/wiki/Arity
  2. Variadic - wikipedia: http://en.wikipedia.org/wiki/Variadic
  3. Tcl - wikipedia: http://en.wikipedia.org/wiki/Tcl

Windows + Visual Studio + VSCode + CMake 的疑難雜症

Environment Windows 10 Visual Studio 2019 CMake 3.27.7 VSCode VSCode CMake Tools 1. CMAKE_BUILD_TYPE 是空的 參考一下 這篇 的處理。 大致上因為 Visual...