2015/07/31

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






2015/07/27

Delphi字串計數函式

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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;

資料來源:

2015/07/23

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;
...

但裡頭是組合語言,我已經沒辦法了,只能回避囉!

延伸閱讀:

2015/07/21

TByte 和 TByteDynArray 的轉換

TByteDynArray 同等 TByte

意外發現 TBytesStream 這個類別

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

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

see also: