Translate

2017/07/07

Delphi in Web Development: WebBroker + EasyUI (01)


I have been received many demand about web development for long time.

But, I don't wont to use ASP.NET develop the web project.

Maybe we can design web page in Delphi WebBroker. And our need a good front framework.

2017/07/05

簡單的重試機制及 DUnit 應用,使用 Delphi XE



Simple retry mechanism in Delphi』裡寫出很簡單的重試機制。

運氣還不錯,老版本也可以使用。

比較有趣的地方是,在Daniele Spinetti 所提交的 Github,有為這個單元製作一個 DUnit Test 專案。

2017/06/29

JSON Parse in Delphi XE (03)

前情提要:

這篇要說明 JSON 格式在 Delphi 裡是怎麼被理解的。

JSON 名詞解釋:
JSON(JavaScript Object Notation),這世界上有兩大資料交換語言

2017/06/27

JSON Parse in Delphi XE (02)

JSON Parse in Delphi XE (01) 裡提到因為文字轉碼失敗引發的錯誤

今天就來試著解決這個問題

首先的判斷是:

Indy 的 BUG?

那就來看看其它的軟體是否能被正確顯示:

2017/06/26

JSON Parse in Delphi XE (01)

在 Delphi.ktop 的主題中,看到了【JSON求教】這一篇

如果在 XE 裡面要實現,是不是也是這麼簡單?

想到了,就開始來實作吧!

2017/06/23

How to use URLEncode in Delphi

URL編碼,也稱【百分號編碼(Percent-encoding)】

由於 URL 不能直接接受 UTF8 文字,所以要先轉成百分號編碼後,如此網址才能順利送給 HTTP Server

從 Indy 加入 Delphi 後,就可以用 IdURI.TIdURI 單元進行編碼

以【大 匠 之 風】為例,可以得到如下的結果:

2017/06/17

Web page design tool in Delphi



Delphi 在2009 版開始把 WebSnap 廢棄後,自此就再也沒有自帶「網頁設計工具」。

有的話也只剩下自帶的 IntraWeb Evolution 版本。

以及 3rd party 的 UniGui 等類似 IntraWeb 的 Web Application 工具。

它們是 Form Mode,把 Web Application 視為一種在瀏覽器下呈現的 EXE,在執行時期動態吐出 HTML 編碼 (TForm to HTML),在服務器上線後完全無法修改網頁文字,如果要改,又得回到設計模式下重新編譯再上架。

2017/06/09

Delphi DataSnap REST server and HTML5 client

緣起:

前一陣子和網頁前端開發者合作一個網站的開發,使用 Delphi 開發 REST Service 非常的快,兩三下就完成交差。但就在這時,前端工程師卻問了我一個問題:

你的 REST API 要怎麼用 JavaScript 連?



也許有什麼好方法可以讓前端也能快速存取 REST 方法。這讓我想到從 XE 開始,DataSnap REST Application 就有內建 JavaScript 套件和 2 個 Boilerplate,也許可以從官方文件中吸取一些知識。

2017/06/07

自製簡單版加總計算 -- 使用 ClientDataSet

最近接到同事發來的一個問題,說是【在表單的某處增加一個加總欄位後,這支程式的速度就下降了】。

「 TClientDataSet 就可以做到的功能,但它的效能有這麼差嗎?」

2017/06/06

讀書心得 -- GUI 設計大家談

博客來
應用程式開發的過程,不論是桌面或是行動平台,除了背景之外,使用最多的就是圖標了。

這本書方向是在寫 Code 之前的準備,目標是先找好相關的素材。

除了方便自己回顧外,如果有美工協作,雞同鴨講的情況就少很多,主要的內容像是:

2017/06/04

賀!慶祝 Delphi 邁向 22 年,萌代言人【神野甘音】初登場!

Delphi,伴我走過近 10 年的時光 (裝嫩中),日日夜夜陪伴著我,在我心目中,一直以為我的女朋友 Delphi 長成這樣:


又或是這樣

2017/05/09

Connect SQL Server from FireDAC in Ubuntu

FireDAC + Ubuntu + SQL Server the Frame Diagram photo
Now, We could connection database from Ubuntu to SQL Server use Delphi 10.2 FireDAC.

The SQL Server in AWS and Ubuntu version comparison.  For AWS version have support all feature like for Windows version. It's best solution!

If you would understand more about it. You can go to the URL:
Ubuntu(FireDAC)を使ってMS SQL Server(RDS)に接続する。[JAPAN]

2017/04/24

Is there a "formal" design pattern to DataSnap?

English version:

Is there a "formal" design pattern to DataSnap?
We learn REST DataSnap framework from technical documents in Embarcadero site.

Usually let us feel about:

  1. Very slow!
  2. Unstable!

But, I tried 50000 clients concurrent calling EchoString process into myself DataSnap Service.

......Don't worry.

All process is normal end. It's fine!

My REST DataSnap is strong!


So...Why always have "unstable" infomation appear in many website.
.
.
.
.
.
.
.
.
.
.
.
.
.

Oh! Because "HTTP persistent connection"!

About "HTTP persistent connection", In wiki is:

HTTP persistent connection, also called HTTP keep-alive, or HTTP connection reuse, is the idea of using a single TCP connection to send and receive multiple HTTP requests/responses, as opposed to opening a new connection for every single request/response pair. The newer HTTP/2 protocol uses the same idea and takes it further to allow multiple concurrent requests/responses to be multiplexed over a single connection.

Multiple connections V.S. Persistent connection


Although "HTTP persistent connection" have advantages about "Reduced latency in subsequent requests (no handshaking)".

But, The advantages is "disadvantages": Connection count is little in REST DataSnap Service!

Because each client is hold in service, this is hard pressure!

If client lose connection from service when network unstable, and then affect memory usage continuously grows, final crash.


More than "HTTP persistent connection" same "More Energy consumption" in mobile device!

The App connection closed when into sleep mode from mobile device.

When re-open, we will get: wrong window.

A error info is like it.

About problem, 
we can used "Heartbeat packet mode" is fine solution.

Heartbeat packet mode:
Send a message from each sec to service, it like heartbeat behavior, so named it.


But it's energy consumption more!


..........

conclusion:


DataSnap framework features is flexibility!

Have a "formal design" in DataSnap framework?

Any can solve problem are all great formal design!

When you think "DataSnap is bad", please think differently, what is Correct Design?

Maybe you will discover the new continent!

中文版本:實作 REST DataSnap,你用對方法了嗎?

看似好棒棒的 DataSnap 框架,這裡頭的眉眉角角還真是不少。


官方所給的 REST DataSnap DMEO,一直被詬病的有兩點:
  1. 太慢
  2. 不穩

2017/04/05

Linux 後端開發初體驗,使用Delphi 10.2 Tokyo

掩飾不住內心的喜悅,今天一裝完 Delphi 10.2 Tokyo,馬上就來試試看 Linux 最可能的應用:Web Application 開發!

在 PAServer 安裝好後,在 Target Platforms 上增加了 【64-bit Linux】編譯選項,環境部署也只不過是數秒的時間。

體驗完 Hello World in Linux Console Mode,接著就是實作一個 Web Broker吧!

但單純只出現一個【Hello WebBroker】實在不能表達我現在的喜悅。

那麼,就搭配 JQuery Mobile 來個前端整合試試看!

成果如下圖:


在 Linux 上實現 Debug WebBroker。成功!

掩飾不住內心的喜悅,在 Linux 上終於有了解決方案,Delphier 總算是一吐局限在 Windows 平台的悶氣了!

2017/03/27

為 Delphi 10.2 練手,IntraWeb 和 EasyUI 的結合實作

我一直以為 IW 只有 Application Mode 和 (Integrated) Page Mode。

在 IW14 版,新增了 Content Handlers 特色後,當時還不是很了解這功能可以帶來什麼好處。

但在看了【IntraWeb 之 EasyUI 篇】後,才恍然大悟,原來前端可以這麼簡單開發:


我再也不用為了改一個字而整個服務停機啦!


接下來,我也依樣畫葫蘆,做了一個簡單的展示:

後端及資料庫: Delphi 10.1 + IntraWeb 14.1.4 + Firebird 2.5
前端: EasyUI (JQuery components) 1.5.1


2017/03/23

DIY 修正 JSON.ToString 的處理

你在 JSON 的轉碼上也遇到問題了嗎?


在 Delphi 初期支援 JSON 版本,JSON相關類別有個【ToString】的函式,對於異質平台間的轉換需求上,替我們省下了不少時間。

But!人生最重要的就是這個 But!

2017/03/21

IntraWeb 未來也要支援 Linux 了!

IntraWeb 隨著 Delphi 支援 Linux 後,更加令人期待它未來的發展!

IntraWeb 在 14 版之後的異變相當大,尤其是 Page Mode 設計上。

在 Delphi 10.2 準備正式發佈時,IntraWeb 官網上也馬上提出新的 Roadmap,除了宣告最低支援開發工具版本之外,還要增加對 Linux 的支援。

Delphier 可以服務的地方就更多了,不再僅是支援 Windows-base。


一起來提升我們的競爭力吧!

see also:

2017/03/18

10.2 出現後,這個訊息註定讓 Delphier 幾家歡樂幾家愁啊

早在 XE4 時期,在線上手冊就出現這麼一段話:
dbExpress, which is described in this tutorial, is being deprecated.

當時 FireDAC 並不完全成熟,還在想何時才能完全取代 dbExpress 還是未知數,更何況 BDE 現在還活得頭好壯壯啊!

2017/03/10

Delphi 10.2 正式名稱為【Tokyo】!


【Delphi 終於正式要重新支援 Linux 】了!

上一次支援 Linux 已是 2002 年的事


上一次支援 Linux 的產品叫【Kylix】(199x - 2002),CLX Framework,和 VCL framework 可以相容,採 re-compile 方式編譯同一個專案以達到跨平台,那時主打【DataSnap】和【dbExpress】三層架構和資料庫連結技術。

2017/02/25

Delphi 對 Linux Server 重啟支援:開始之前

Image courtesy of Jim McKeeth.

Delphi 10.2 開始對 Linux Server 進行支援,也就是說,FireUI 在這個版本還沒有辦法支援 Linux 圖形介面。

2017/01/17

Open dbExpress update - 2017.01.17 version

The major problem is finally solved.
In version 2017.01.17, the corrections are as follows:

  • Has been excluded from the installation of BPL, the IDE appears to lead to [Duplicates not allowed] error.
  • At the same time to solve the Run-time must be loaded dbxconnections.ini, dbxdrivers.ini problems.
  • Fixed DEMO program can not compile problem.


Details:

Download Open dbExpress 2017.01.17 supported RAD Studio 10.1 Berlin.

2017/01/14

Open dbExpress update, RAD Studio 10.1 Berlin is supported!

[2017/01/17]
Updated!
Please see " Open dbExpress update - 2017.01.17 version "
===============
I have always thought, Open dbExpress is a very cool product, using ODBC to reach a variety of connection database, and the open source code, allowing more people to maintain.

Do not worry about this product like DBX4MySQL, terminate the support of the incident.

However, Open dbExpress after 2014, also in a tragic situation of unmanned maintenance. Until 2016, support for RAD Studio is limited to XE2.

Continued in the discussion area to see whether people continue to ask whether the continuity of the Open dbExpress support.

Now, I'm happy to announce that Open dbExpress has been revived to support RAD Studio 10.1 Berlin.

Please note! XE3 ~ Seattle not yet supported.

Test MS SQL Server and MS Access can connect and get the data.

Known Issues:

1. Install dbxoodbc240.bpl, click IDE DataExplorer in the tree-node for dbExpress, will output [Duplicates not allowed.] Error message. This looks like an IDE bug.

Duplicates not allowed when click Data Explorer.
Workaround: Remove dbxoodbc240.bpl. Re-install the Open dbExpress package when needed.

2. The version is not updated. This means that the version of the problem still exists.

3. I do not have administrative privileges for this project, so I can not publish this project at Sourceforge. So I put in my personal space for download, if you have permission to upload, you are welcome to upload directly to the update to Sourceforge Open dbExpress.

Finally, download the link here:
Download Open dbExpress 2017.01.14 supported RAD Studio 10.1 Berlin.


Enjoy.

Delphi in Web Development: WebBroker + EasyUI (01)

I have been received many demand about web development for long time. But, I don't wont to use ASP.NET develop the web project. M...