WinCVS branch and merge

CVS 該怎麼 branch 與 merge ??
其實 CVS 手冊上都蠻清楚的…
只是看起來很模糊,再加上我用的是 WinCVS … 網路上對 WinCVS 的著墨實在是不多….
如何 branch ??
進入 WinCVS 以後, 選 [Remote][Create a branch]
把 Branch name 與 Module name 填一填就好了.
Branch name 你可以自訂,但第一個字母不能是數字.
Module name 就是你的專案名稱…
接下來,該怎麼在 branch 上開發呢??
首先你要先把原先的內容備份,然後重新以新的 branch name checkout, 也就是選[Remote][Checkout module] 的時候,得特別選到 “Update Options”, 勾選 “By revision/tag/branch”, 並填入你剛剛建立的 branch 名稱, 這樣就行了.
接下來,就照一般的開發步驟就行了,每次 commit 以後,你會發現 Rev 欄的號碼跟 Main trunk 的 rev 不太一樣,這表示是正確的.
最後要怎麼 merge 呢??
一般來說,不會有 branch 去 merge main trunk 的狀況….我當初就想幹這蠢事,結果發現根本沒辦法做…. >_<
都是從某一 branch 去 merge 某 branch, 或是從 Main trunk 去 merge branch.
首先,得先 checkout Main trunk 下來,接著選 Update, Update 的時候要特別去選 "Merge Options", 把 Merge type 選為 "Merge with one rev/tag", 填入你要 merge 的 brankch name 即可,其他地方不需要特別勾選.
這邊有一個地方要特別注意,就是該 branch 一定要有更動過 (也就是有 commit 新東西上去 ), 才可以 merge, 否則會都沒反應…
Merge 完以後,你就可以去處理 conflict 或是測試看看有沒有問題,然後把有更動的檔案都 commit 上去就好, 換言之, merge 以後並不會馬上生效,而是還要再 merge 才生效.

直接存取Windows上的某Device

蠻簡單的,跟 Linux 上的概念很像,首先你要先 CreateFile.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/createfile.asp
然後使用 DeviceIOControl 去存取即可.
以機器上的第一顆硬碟來說,裝置的代號是 \\.\PHYSICALDRIVE0
所以你要把這個傳入 CreateFile(), 再去參考相關的 Platform SDK API 使用 DeviceIOControl存取即可.
參考資料:
*http://www.csdn.com.cn/program/5546.htm
*Platform SDK 的 Storage / Disk Management.

Software requirements specifications

IEEE Standard 830
IEEE recommended practice for software requirements specifications
A good example: http://www.fsai.fh-trier.de/~federhen/dippaper/docu/11_Software_Requirements_Sp.html
In “Software Requirements – MS Press”, Page 155
1. Introduction
1.1 Purpose
1.2 Document conventions
1.3 intended audience and reading suggestions
1.4 project scope
1.5 references
2 overall description
2.1 product perspective (展望,roadmap)
2.2. product functions (一般以條列為主)
2.3 user classes and characteristics (誰會用這產品)
2.4 operating environment
2.5 design and implementation constraints
2.6 assumptions and dependencies (可能會用到的 library/components…)
3 external interface requirements
3.1 user interfaces
*GUI standards or product family style guides that are to be followed
*Screen layout or resolution constraints
*standard buttons, functions, or navigation links that will appear on every screen( such as help button)
*shortcut keys
*error message display standards
more details can be describe in a separate user interface specifications, not here.
3.2 hardware interfaces
3.3. software interfaces
the interfaces which export to other software or component
3.4 communications interfaces
4. system features
organize this section by use case, mode of operation, user class, object class, or functional hierarchy.
4.x system feature X
4.x.1 description and priority
4.x.2 stimulus / response sequences
4.x.3 functional requirements
5. other nonfunctional requirements
5.1 performance requirements
5.2 safety requirements
5.4 software quality attributes
5.5 business rules
5.6 user documentation
6. other requirements
appendix a: glossary
appendix b: analysis models
appendix c: to-be-determinded list

Code Project 隨手記

以前逛 Code Project 所記錄下來的一些連結…..
對網站的一些建議
http://www.codeproject.com/aspnet/SitePerf.asp


相簿
http://www.thecodeproject.com/aspnet/NetPix.asp


一個 portal
http://www.thecodeproject.com/aspnet/AspNetPortalArticle.asp


custom web control 的 data binding
http://www.thecodeproject.com/aspnet/webcontrolsdatabinding.asp


有checkall 的
http://www.thecodeproject.com/aspnet/Multi-select_Dataagrid.asp


grid 中的 grid
http://www.thecodeproject.com/aspnet/masterdetailgrid.asp


自己搞一個 textbox control,然後裡面自己做 validate
http://www.thecodeproject.com/aspnet/selfvalidatingtextbox.asp


splash screen
http://www.codeproject.com/csharp/PrettyGoodSplashScreen.asp?target=Dynamic%7CUI%7CCreation


http://www.codeproject.com/cs/miscctrl/magicdocking.asp
講到一個不錯的 magic library, 不知道能不能做到自動編排 control 位置?!
正在實驗中~~
發現 MagicLibrary? 是要 $$ 的(USD 299大洋),之前 sharpdevelop 也是用這套~~後來改用 DockManager?, http://www.freewebs.com/weifenluo/DockManager.htm
為了避免侵犯版權,看來是不能用 MagicLibrary? 的了~~


http://www.codeproject.com/csharp/HardLinks.asp
這篇有介紹到一個檔案要怎麼給其他專案用,在 linux 下可以用 symlink 去連,在 windows 就要透過 ntfs 的 hardlink 去弄了,有提供工具~


http://www.codeproject.com/csharp/ZedGraph.asp
A flexible line graph class library in C#
提供一個 graphpane ,可以畫出漂亮的 chart…


http://www.codeproject.com/csharp/ftpdriver1.asp
FTP console tool…


http://www.codeproject.com/cs/miscctrl/treeviewexplorer.asp
一個 powerful 的 treeview control, 用來顯示 folders


http://www.codeproject.com/aspnet/Multi-select_Dataagrid.asp
asp.net datagrid 的 checkbox, 打勾以後可以反白該列,也可以勾選多個~


http://www.codeproject.com/w2k/BfObjectSelection2.asp
目前用不太到的東西~可以選擇 windows 內部的物件,透過 ado 去抓的~


http://www.codeproject.com/csharp/WaitCursor.asp
講到 c# using 這個關鍵字的用法,還有作者的一些發想~~


http://www.codeproject.com/csharp/PluginsInCSharp.asp
講解 plugin 的文章~~還不錯,可以快速套用~~


http://www.codeproject.com/csharp/GlobalSystemHook.asp
講 system hooking 的,可以把系統的一些特殊事件都 hook 起來,反正就是先過自己,自己再決定要不要繼續處理就對了~~


http://www.codeproject.com/vcpp/stl/PGIL.asp
有點深了這個~~是講 stl 的~
作 serialization ~~


產生 toolbar 的工具
http://www.codeproject.com/tools/TBar.asp


todolist,
http://www.codeproject.com/useritems/ToDoList2.asp


從 class 轉為 database
http://www.codeproject.com/useritems/Schema.asp


用 .Net 寫 COM+ 元件
http://www.thecodeproject.com/csharp/ESTransactions.asp


.Net 安裝工具
http://www.codeproject.com/dotnet/dotNetInstaller.asp


An extension for a configuration settings class in .NET
http://www.codeproject.com/csharp/config_settings.asp


.NET Database Class Generator
http://www.codeproject.com/tools/data_access_layer.asp


Adding Balloon Windows to a .NET Application
http://www.codeproject.com/cs/miscctrl/balloonwindow.asp


regular expression 工具
http://www.codeproject.com/dotnet/expresso.asp


可以動態編譯並執行 c# 或 vb.net 的 code
http://www.codeproject.com/dotnet/DynamicCompileAndRun.asp


類似 vs.net toolbar 的 toolbar control
http://www.codeproject.com/cs/miscctrl/yatoolbox.asp


Transparency Tutorial,想搞畫圖或一些特效的話,這篇得看一看.
http://www.codeproject.com/cs/media/CSTranspTutorial1.asp
http://www.codeproject.com/cs/media/CsTranspTutorial2.asp
http://www.codeproject.com/cs/media/CsTranspTutorial3.asp


Open source 的 grid control
http://www.codeproject.com/cs/miscctrl/csharpgridcontrol.asp


單一登入的方法
http://www.codeproject.com/aspnet/aspnetsinglesignon.asp
蠻簡單的,就是利用 cookie 來做.裡面對認證的用法也很簡單~~


可以 Monitor 一個檔案變動情況的方法,簡單的說就是類似 linux 下的 tail -f
http://www.codeproject.com/csharp/MkFileContentsWatcher.asp

開發可重用導向的碼

來源:http://weblogs.asp.net/ngur/archive/2004/09/17/230604.aspx
那是 Natty Gur blog 上的文章
這篇文章提出了幾點關於開發可重用導向碼的建議,有心的人可以參考一下.
大致翻譯一下~~建議還是看原文,我省略蠻多的~~
-盡量以 interface 來表達元件與類別間的關係.而不要直接呼叫.
-類別或元件可以實作所需的許多介面以突顯多種行為.
-使用可以插入的架構,類似 plug-in 那樣.主要是為了可以輕易變更元件,而不需要重新編譯系統.
-如果可插入的架構太複雜,可以考慮改用 Factory 來從類別建立物件,以替代直接建立物件.
-使用 refection 和 attributes 來建立 abstract 導向程式. AOP 是一個很好的參考方向.
-試著不要在非 data access layer 的類別中移動或使用 DB 架構.
-試著不要在方法裡面使用參考. 因為會在類別間產生強烈的耦合關係.
-在系統元件間傳遞 value 物件. value 物件可以打散類別間的耦合,並且可以在任何系統中使用.
-value 物件原則運作的很好.只接受 value 物件的表單可以在任何系統中被使用,並且也確保他只能提供所需要的 value 物件出來.
-使用MVC 2.

網路文件

網路上一些不錯的書,年初在整理離職同事留下的文件時看到的.
這些網路上應該都可以找到~~
RTLinux POSIX API for IO and Real-time FIFO and Shared Memory
KURT-Linux User Manual
http://home.earthlink.net/~jknapka/linux-mm/
Programming guide for Linux USB Device Driver
如何在C語言下使用I/O埠
My Experence getting Linux BIOS working on a PC-Chips M810LR motherboard with a M-Systems Millenium MD-2800-D08 Disk-on-Chip

Logging

Log 也可以很 OO…
一般來說,一般的 Log 就只是利用 stdout 的 function 印出訊息而已.
以 Linux 來說,有專門的 syslog() function 與 syslogd, klogd 的配套措施.
以 Java 來說,則有 log4j
以 .Net 來說,則有 log4net
後兩者是比較專門的 classlibrary, 當你使用了這玩意,那麼你只要在程式的組態檔裡面指定 log 的對象,那麼,程式就會自動 log 到該地方去…所以這樣的彈性很大喔,除了可以 log 到文字檔,也可以 log 到資料庫,或 xml 之類的檔案裡面去…
這樣子,除了可以 debug,也可以當作系統運行的一份日誌…可說是非常方便….
相關網址:
log4j教學(DevX)
log4net Introduction
log4j Introduction