發表文章

目前顯示的是 七月, 2015的文章

Httpsrvr.dll在Apache for Windows的設定

按  HTTPSRVR with Apache 的說明:
1. Install Apache (I will assume default directory structure for 2.0.52).
2. Copy 'httpsrvr.dll' to your /apache2/cgi-bin directory.
3. In httpd.conf, change the 'Options None' (again assuming defaults for 2.0.52) in to 'Options ExecCGI'.
4. AddHandler isapi-isa .dll to your httpd.conf.
5. Restart Apache. 

補充實作的設定段:
# # "/xampp/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # Options None AllowOverride None Options ExecCGI Order allow,deny Allow from all AddHandler isapi-isa .dll




Delphi字串計數函式

已經忘記是什麼時候遇到需要計算重複字的次數問題
前陣子想到才上Google來找,因為關鍵字仍然不方便搜尋,所以轉錄在這裡。

uses StrUtils; function Occurrences(const Substring, Text: string): Integer; var offset: Integer; begin result := 0; offset := PosEx(Substring, Text, 1); while offset <> 0 do begin inc(result); offset := PosEx(Substring, Text, offset + length(Substring)); end; end;
資料來源:
Delphi: count number of times a string occurs in another string

TDataSetProvider 的一個 Bugs

追 VCL Code 才找到問題主因……
procedure TDataPacketWriter.AddIndexDefs(DataSet: TDataSet; const Info: TInfoArray); ... { Get the DEFAULT_ORDER } if not (poRetainServerOrder in Options) then DefIdx := (DataSet as IProviderSupport).PSGetDefaultOrder // EListError: List index out of bounds (-1) else DefIdx := nil; ...
但裡頭是組合語言,我已經沒辦法了,只能回避囉!

延伸閱讀:
DBCommon.pas 雖然有 BUG ,但裡頭值得研究TClientDataSet.RefreshRecord doesn't work anymore for JOINED queriesTCustomADODataSet.PSGetDefaultOrder ignores 'Order By' CommandText clause

TByte 和 TByteDynArray 的轉換

TByteDynArray 同等 TByte

意外發現 TBytesStream 這個類別

但發現不能做 TBytesStream.Create(TByteDynArray)
不過卻可以寫成這樣:
TBytesStream.Create(TByte(TByteDynArray))

據說後來有改正這個缺點。

see also:
TBytes has no type infoCan TBytes, TByteDynArray, Array of Bytes be safely typecasted to each other?