FireDAC DataSnap Connection Pool

First use these units as follows. Of course, also need some other units uses SysUtils, Classes, DB,Variants, Windows, Math, System.IniFiles, SynCommons, IPPeerClient, FireDAC.Comp.Client, FireDAC.Phys.DS, FireDAC.Comp.UI, FireDAC.Phys.Intf, FireDAC.Stan.Util, FireDAC.Stan.Def, FireDAC.Stan.Pool , FireDAC.Stan.Error, FireDAC.Stan.Intf, Datasnap.DSHTTPLayer; then we need a record to read configs, you can implement it as you like TDSPoolConfig = record CleanupTimeout: string; ExpireTimeout: string; MaximumItems: string; Server: string; Port: string; DSUserName, DSPassword: string; IsHttpClient:Boolean; procedure ReadConfig; end; ok, now come the pool

How to Use mORMot to Build Rest Services and Consume Them

如何使用mORMot构建Rest服务并使用 服务端 var FModel: TSQLModel; FDB: TSQLRestServer; FServer: TSQLHttpServer; //Create Server FModel := TSQLModel.Create([], 'api'); FDB := TSQLRestServerFullMemory.Create(FModel, 'test.json', false, false); //reg services FDB.ServiceRegister(TTestService, [TypeInfo(ITestService)], sicShared); //setting and start it FServer := TSQLHttpServer.Create(httpPort, [FDB], '+', useHttpApiRegisteringURI); FServer.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries 接口和D

Use webhook to deploy Hugo

First, make sure your hugo blog files are hosted on Github or any other git hosting server where you can access to through network. Github is suggested. in your server apt-get install hugo wget https://github.com/adnanh/webhook/releases/download/2.6.8/webhook-linux-amd64.tar.gz tar -zxvf webhook-linux-amd64.tar.gz mv webhook-linux-amd64 webhook && cd webhook chmod +x webhook vim hooks.json [ { "id": "redeploy-webhook", "execute-command": "/pathto/hookscripts.sh", "command-working-directory": "/directory/to/webhook" } ] cd ~/webhook ./webhook -hooks hooks.json -verbose -port 1234 -hotreload & or add

Build Restapi With Gin and Mgo

首先安装govendor go get -u github.com/kardianos/govendor 并添加 $GOPATH/bin/ 到环境变量中 这样可以执行 govendor 命令来确认已经完成安装 新建目录 例如 $GOPATH/src/gin-mgo-api 并创建一个 main.go, 然后 govendor init 初始化之 使用 govendor 来管

Replace Battery of Nexus6p

Nexus 6P跟了我有快两年的时间了, 最近开始变得越来越不给力了, 经常20%左右就直接关机, 一个早上还没过完就只剩下60%的电了, 于是基本上最近一段

TWinHTTP

uses SynCrtSock; {$R *.dfm} procedure TForm1.btn1Click(Sender: TObject); begin mmo1.Lines.Add( TWinHTTP.Get('https://www.baidu.com')); end; 静态调用

SynLog日志组件捕获成吨可调试异常

工程设置(Release or Debug) Delphi Compiler -> Linking -> Map file -> Detailed Delphi Compiler -> Compiling -> Debug information -> Debug information {*******************************************************} { } { 工程: 短信专业版 } { 单元功能: 日志类 } { 作者: Linx } { 时间: 2017-12-10 17:29:47 } {

以JSON作为配置文件

代码如下 其实我一直有个疑问, 为什么github上很多的配置库基本上都是只读的,并没有提供写配置的方法,因为如果可以实时地修改某个配置项的话就

mORMot数组操作

procedure TForm1.FormCreate(Sender: TObject); type TGroup = record name: string; value: string; end; TGroupArr = array of TGroup; var DA:TDynArray; strArr:TStringDynArray; v:string; newResult,findResult:TGroup; groupArr:TGroupArr; begin SetLength(strArr,2); strArr[0]:='123'; strArr[1]:='345'; DA.Init(TypeInfo(TStringDynArray),strArr); v := 'str 1'; //DA.Add('str 1') is illegal DA.Add(v); v := 'str 2'; DA.Add(v); ShowMessage(DA.SaveToJSON()); DA.ClearSafe; //find record from array DA.Init(TypeInfo(TGroupArr),groupArr); //必须设置这个属性 才可以查找 DA.Compare := SortDynArrayString; newResult.name := 'A';

mORMot操作JSON

type TCusObject = class private FB: string; FA: string; procedure SetA(const Value: string); procedure SetB(const Value: string); published property A: string read FA write SetA; property B: string read FB write SetB; end; procedure TCusObject.SetA(const Value: string); begin FA := Value; end; procedure TCusObject.SetB(const Value: string); begin FB := Value; end; uses SynCommons; procedure TForm1.btn1Click(Sender: TObject); var json,json1:Variant; begin json := _JsonFast(mmo1.Lines.Text); // more faster O(∩_∩