2018/07/25

Devart UniDAC Express 初體驗

Devart UniDAC Express 安裝
下載點:
https://www.devart.com/unidac/download.html


下載 10.2 Tokyo 的版本

安裝就一直按 Next,相當簡單

因為 UniDAC Express 不含任何的 Provider,所以這時的 TUniConnection 是連不上任何資料庫的。

2018/07/19

RAD Studio Community Edition 快速安裝介紹

可先到 Delphi Community Edition Landing Page 下載 ESD 安裝檔。C++ Builder Community Edition 在此。

下載 ESD 的同時會發序號 email 給你

要注意的是,Community ESD 線上安裝除了介紹所需的 .Net 套件外,還需要自行下載 DirectX 9.0c 轉發套件,若未安裝時,進行到安裝 DirectX 9.0c 時會安裝失敗,屆時只能移除重裝。

2018/07/08

JavaScript iframe Variable Scope Test


目的:
測試 JavaScript Variable 在重複載入時是否共用同一個 Variable。

測試方式:
建立多個 iframe,但指向同一個 html 檔案。

JavaScript code is below:

  var MyVar = 0;
  function onButtonClick() {
    $("#A1").html(MyVar);
    MyVar += 1;
  }


預期:載入 base.html 時,MyVal 會預設歸零,藉以測試其它重複載入的 iframe 裡的同名變數是否會被影響。

測試步驟:
1. 建立 iframe 並累加 5 次變數
2. 以再建立 iframe 的方式重複載入該 html 檔案
3. 回到原 iframe,再累加變數,檢查變數是否歸零
4.切換到 2. 所建的 iframe 並累加變數,檢查變數是否被 3. 累加

結論:
各別的 iframe 就算是載入相同 JavaScript 檔,裡面同名 Variable Scope 也僅限在該 iframe 裡。

結果符合預期,收工。



See also :



2018/07/05

JSONObject Sort by Delphi


在 KTOP 看到有人在問 JSON 物件能否排序。

第一時間想著官方沒有類似 TJSONObject.Sort 的方法,除非再自行加工改寫。

後來看到其他會員回答的排序法,而樓主似乎也不排斥『要自己寫程式』的方式。

內容使用到『泛型物件』和『DBXJSON』,一時手癢,就自己試著玩玩看:

2018/06/28

Async callback in JS DataSnap Framework

This is a question about a obsessive-compulsive disorder patient. photo from



In the default Datasnap REST application, if there is a specified build of the Sample Methods :

The "echostring" and "ReverseString" two method and corresponding pages are added to the template. By opening the Reversestring template, you can learn that JavaScript is written like this:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
function onReverseStringClick()
{
  if (loginRequired && (AdminInst == null))
  {
    showLogin(true);
    return;
  }
  var valueField = document.getElementById('valueField');
  var s = serverMethods().ReverseString(valueField.value);
  valueField.value = s.result;
}

2018/06/06

Boost Regex and Unicode in C++ Builder

Boost - Bast C++ Library
Because "String" default is unicode in C++ Builer 2009 later.

And same std::wstring.

so, We should to use prefix "w" class, like:
wregex, wsmatch etc.

The Sample code below:

2018/06/01

Delphi Base Class - TProc (CHT)

圖片來源

TProc 在 Delphi 的宣告是:
1
2
3
4
5
TProc = reference to procedure;
TProc<T> = reference to procedure (Arg1: T);
TProc<T1,T2> = reference to procedure (Arg1: T1; Arg2: T2);
TProc<T1,T2,T3> = reference to procedure (Arg1: T1; Arg2: T2; Arg3: T3);
TProc<T1,T2,T3,T4> = reference to procedure (Arg1: T1; Arg2: T2; Arg3: T3; Arg4: T4);


最近在寫測速程式時突然應用到它,我是這麼寫的: