2013/02/21

三層應用 webconnection與httpsrvr.dll與IIS的有關的問題

似乎可以改善WebConnection的連線狀況,有時間來試試


資料節錄如下:
改寫部分RemoteDataModule中的代碼:
線程模型(Threading Model)用Neutral
 /// Delphi
class procedure TEverydayInfoServer.UpdateRegistry(Register: Boolean; 
    const ClassID, ProgID: string);
begin
  if Register then
  begin
    inherited UpdateRegistry(Register, ClassID, ProgID);
    EnableWebTransport(ClassID);
    RegisterPooled(ClassID, 50, 1); //關鍵是這一句,用緩衝池的.
  end else
  begin
    DisableWebTransport(ClassID);
    UnregisterPooled(ClassID);
    inherited UpdateRegistry(Register, ClassID, ProgID);
  end;
end;

2015/ 02/19 更新
 // C++ Builder
  // Listing 21.1 UpdateRegistry to enable Connection Pooling
  // Function invoked to (un)register object
  //
  static HRESULT WINAPI UpdateRegistry(BOOL bRegister)
  {
  TRemoteDataModuleRegistrar regObj(GetObjectCLSID(),  GetProgID(), GetDescription());
  // Disable these flags to disable use by socket or Web connections.
  // Also set other flags to configure the behavior of your application server.
  // For more information, see atlmod.h and atlvcl.cpp.
  regObj.Singleton = false;
  regObj.MaxObjects = 10;
  regObj.Timeout = 42;
  regObj.RegisterPooled = true;
  regObj.EnableWeb = true;
  regObj.EnableSocket = true;
  return regObj.UpdateRegistry(bRegister);
  }

從 Document 來看,設定後會保留一個 RDM Instance,一併設定 Client 的最大連線數。

Client 連線數設定上限也可以達到節省 Database 的版權費用,的確可以參考使用。

資料來源:

2013/02/20

[轉]一堂價值39萬元的課,把它看完,你一定會有收獲.


一堂價值39萬元的課,把它看完,你一定會有收獲.

第一課
一個男人在他妻子洗完澡後准備進浴室洗澡。這時,門鈴響了。
妻子迅速用浴巾裹住自己衝到門口。
當她打開門時,鄰居鮑勃站在那兒。
在她開口前,鮑勃說,“你如果把浴巾拿掉,我給你800美元。”
想了一會兒,這個女人拿掉浴巾赤裸地站在鮑勃面前。幾秒鐘後,鮑勃遞給她800美元然後離開了。
女人重新裹好浴巾回到屋裡。
當她踏進浴室時,丈夫問她,“是誰呀?”
“是鄰居鮑勃。”她回答。
“哦,”丈夫說,“他有沒有提到還欠我800美元?”
故事寓意:
及時與同舟共濟的股東分享重要信息,將會避免不必要的曝光。

2013/02/01

File Name Utilities

資料來源:File Name Utilities

ChangeFileExt function
Changes the extension part of a string containing full path and file name.
ExcludeTrailingBackslash function
Removes '\' from the end of a string if it is there.
ExpandFileName function
Retrieves the full path and filename of a specified (relative) file.
ExpandUNCFileName function
Retrieves the full path and filename of a specified (relative) file using Universal Naming Convention for network files.
ExtractFileDir function
Returns only only directory or drive information parts of a string containing full path and file name.
ExtractFileDrive function
Returns only drive part of a string containing full path and file name.
ExtractFileName function
Returns only file name and extension parts of a string containing full path and file name.
ExtractFileExt function
Returns the extension part of a string containing full path and file name.
ExtractFilePath function
Returns the drive and directory parts of a string containing full path and file name.
ExtractShortPathName function
Returns 8.3 format for a given full path and file name.
MinimizeName function
Returns a shortened version of a filename (using dots for folders) that fits into some pixel length.
IncludeTrailingBackslash function
Adds '\' to the end of a string if it is not already there.
New, Is "IncludeTrailingPathDelimiter"
IsPathDelimiter function
Returns true if a specified character in a string is the backslash (\) character.
MatchesMask function
Returns True is a string value matches a format specifed by a mask.
ProcessPath procedure
Parses a full file name into its drive, path, and file name.
more to come...

How to use URLEncode in Delphi

URL編碼,也稱【百分號編碼(Percent-encoding)】 由於 URL 不能直接接受 UTF8 文字,所以要先轉成百分號編碼後,如此網址才能順利送給 HTTP Server 從 Indy 加入 Delphi 後,就可以用 IdURI.TIdURI 單元進行編碼 ...