- 判斷某東西是DSL還是一般API: http://www.oreillynet.com/onlamp/blog/2007/05/the_is_it_a_dsl_or_an_api_ten.html
- Anders Noras' Blog: http://andersnoras.com/blogs/anoras/default.aspx
星期一, 7月 30, 2007
DSL(Domain Specific Language)相關資訊
星期六, 7月 28, 2007
WindowsXP 系統登陸原理及其驗證機制概述
- http://www.dgi.com.tw/polo/Forum/detail.asp?TitleID=20&tid=112&postname=admin
星期五, 7月 27, 2007
常見檔案、目錄操作
- 不錯的整理:http://silenceangelwaitingfor.spaces.live.com/blog/cns!47F284FC052C0DE0!442.entry
- 檢驗帳號是否對某個檔案有NTFS存取權限:
這個問題似乎沒有好的解答
https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1851064&SiteID=1
也許從這篇可以得到解答: http://www.codeproject.com/csharp/accessctrl3.asp?df=100&forumid=180919&exp=0&select=1350552#Accesscheck - 存取檔案、目錄ACL
FileSecurity fSecurity = File.GetAccessControl(@"c:\temp");
fSecurity.AddAccessRule(
new FileSystemAccessRule(
"DomainA/UserB",
FileSystemRights.AppendData | FileSystemRights.CreateFiles,
AccessControlType.Allow)
);
File.SetAccessControl(@"c:\temp", fSecurity); - 設定檔案成ReadOnly
FileInfo f = new FileInfo(@"c:\temp\1.txt");
f.Attributes |= FileAttributes.ReadOnly;
星期日, 7月 22, 2007
在命令列編譯Visual Studio C++專案
devenv MyProject.vcproj /rebuild debug
如果需要參照到額外的include檔案或library檔案,則使用以下格式
devenv MyProject.vcproj /rebuild debug /useenv
同時記得設定INCLUDE以及LIB環境變數
使用VS2005的XML IntelliSense
XML檔案
- 使用適當的xml namespace, 如:
<rootelement xmlns=http://mysite/oo/> - 指定該namespace所對應的XML Schema檔案, 如:
<rootelement
xsi:http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation="http://mysite/oo c:\temp\ooxx.xsd"/>
表示http://mysite/oo這個namespace的Schema描述在ooxx.xsd這個檔案中。
XML Schema檔案
- 指定Target namespace, 如:
<xs:schema
targetNamespace="http://mysite/oo"
xmlns:xs="http://www.w3.org/2001/XMLSchema"> - 增加一些微軟專有的功能
XML Editor Intellisense Features
星期一, 7月 16, 2007
砍掉Process
在.NET中砍掉一個process最直覺的方法就是使用Process class的Kill method。如果測試幾次應該會發現,有些時候在Kill method回傳後,process事實上還沒真的被砍掉。為了確認process已經被砍掉可以在Kill之後呼叫WaitForExit,如下:
p.Kill();
p.WaitForExit();
不過在實際使用時,似乎還是有一些process還是沒有砍掉的狀況,需要再進一步地研究。
references:
* http://www.dotnet247.com/247reference/msgs/47/237175.aspx
p.Kill();
p.WaitForExit();
不過在實際使用時,似乎還是有一些process還是沒有砍掉的狀況,需要再進一步地研究。
references:
* http://www.dotnet247.com/247reference/msgs/47/237175.aspx
星期四, 7月 12, 2007
Code Snippet for C++
Visual Studio C++的程式設計師也能夠享用到C#與VB.NET才有的Code Snippet功能:
http://www.microsoft.com/downloads/details.aspx?FamilyID=CD7C6E48-E41B-48E3-881E-A0E6E97F9534&displaylang=en
http://www.microsoft.com/downloads/details.aspx?FamilyID=CD7C6E48-E41B-48E3-881E-A0E6E97F9534&displaylang=en
星期二, 7月 10, 2007
cout << string("str")為何能正確輸出結果
的確,在basic_ostream的member function中並不存在
operator<<(const string& str)
之類的function。可見cout << string("str")能夠正確輸出結果依賴的是其他機制。
答案就在basic_string的header中:
basic_ostream<_elem,>& __CLRCALL_OR_CDECL operator<<(
basic_ostream<_elem,>& _Ostr,
const basic_string<_elem,>& _Str)
operator<<(const string& str)
之類的function。可見cout << string("str")能夠正確輸出結果依賴的是其他機制。
答案就在basic_string的header中:
basic_ostream<_elem,>& __CLRCALL_OR_CDECL operator<<(
basic_ostream<_elem,>& _Ostr,
const basic_string<_elem,>& _Str)
很棒的LINQ原理說明
Daniel Moth所提供的教學,長約22分鐘。Daniel利用一個簡單的例子,以手工打造的方式來說明C#3.0的重要功能以及LINQ的原理
LINQ's relationship to the new C#3 and VB9 features
LINQ's relationship to the new C#3 and VB9 features
星期日, 7月 08, 2007
取得其他Process的command line arguments
錯誤(失敗)的作法:
- 在DotNET中使用Process class來取得ProcessStartInfo: 會得到一個空字串
- 使用Windows API (如GetStartupInfo): 只能夠抓到目前Process的command line arguments
- 在DotNET中reference System.Management, 使用WMI
ManagementObjectSearcher query = new ManagementObjectSearcher
("SELECT * FROM Win32_Process WHERE ProcessID=2860");
ManagementObjectCollection queryCollection = query.Get();
foreach (ManagementObject mo in queryCollection)
{
Console.WriteLine("PID [ {0} ] started With commandline - '{1}'",
mo["ProcessID"].ToString(), mo["CommandLine"].ToString());
}
WMI介紹: http://www.csharphelp.com/archives2/archive334.html - 利用CreateRemoteThread來完成: http://win32.mvps.org/processes/remthread.html
- 開啟目標process
- 在目標process中分配兩塊記憶體。一塊存放程式碼,一塊存放資料。
- 複製程式碼到目標process
- 初始化目標process的資料記憶體區塊
- 呼叫CreateRemoteThread()執行先前複製到目標process的程式碼
- 等待remote thread結束
- 將執行結果從目標process的資料區塊複製回來
星期日, 7月 01, 2007
CruiseControl 1.3 Dashboard跑不起來
狀況:
(在Server本機開啟DashBoard得到以下訊息)
=== Pre-bind state information === LOG: DisplayName = ThoughtWorks.CruiseControl.WebDashboard (Partial) LOG: Appbase = file:///C:/Program Files/CruiseControl.NET/webdashboard LOG: Initial PrivatePath = bin Calling assembly : (Unknown). === LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Post-policy reference: ThoughtWorks.CruiseControl.WebDashboard LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/ccnet/12b02713/c7918020/ThoughtWorks.CruiseControl.WebDashboard.DLL. LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/ccnet/12b02713/c7918020/ThoughtWorks.CruiseControl.WebDashboard/ThoughtWorks.CruiseControl.WebDashboard.DLL. LOG: Attempting download of new URL file:///C:/Program Files/CruiseControl.NET/webdashboard/bin/ThoughtWorks.CruiseControl.WebDashboard.DLL.
解決方法:
因為CruiseControl 1.3已經升級為.NET 2.0,所以必須在IIS上將ccnet改成以.NET 2.0運作
(在Server本機開啟DashBoard得到以下訊息)
=== Pre-bind state information === LOG: DisplayName = ThoughtWorks.CruiseControl.WebDashboard (Partial) LOG: Appbase = file:///C:/Program Files/CruiseControl.NET/webdashboard LOG: Initial PrivatePath = bin Calling assembly : (Unknown). === LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Post-policy reference: ThoughtWorks.CruiseControl.WebDashboard LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/ccnet/12b02713/c7918020/ThoughtWorks.CruiseControl.WebDashboard.DLL. LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/ccnet/12b02713/c7918020/ThoughtWorks.CruiseControl.WebDashboard/ThoughtWorks.CruiseControl.WebDashboard.DLL. LOG: Attempting download of new URL file:///C:/Program Files/CruiseControl.NET/webdashboard/bin/ThoughtWorks.CruiseControl.WebDashboard.DLL.
解決方法:
因為CruiseControl 1.3已經升級為.NET 2.0,所以必須在IIS上將ccnet改成以.NET 2.0運作
訂閱:
文章 (Atom)