Via Cà Matta 2 - Peschiera Borromeo (MI)
+39 02 00704272
info@synaptica.info

Categoria: Programmazione

Digital Innovation Partner

TCriticalSection Threrad Example Delphi

TThreadedMsgEvent = class( TThread ) private FLock : TCriticalSection; FStr : TQueue<String>; FMemo : TMemo; function GetEvent : String; protected procedure Execute; override; public procedure AddEvent( aMsg : String ); constructor Create( AMemo: TMemo ); destructor Destroy; override; end; implementation { TThreadedMsgEvent } procedure TThreadedMsgEvent.AddEvent(aMsg: String); begin FLock.Acquire; FStr.Enqueue( FormatDateTime(‘DD/MM/YY HH:NN:SS.ZZZ’,Now)+ ‘ : ‘+ aMsg…
Leggi tutto

Delphi Linux Daemon

Delphi Linux … create a background process… daemon service stay tuned   https://chapmanworld.com/2017/04/05/creating-a-linux-daemon-service-in-delphi/ http://blog.paolorossi.net/2017/07/11/building-a-real-linux-daemon-with-delphi-part-1-2/ http://blog.paolorossi.net/2017/09/04/building-a-real-linux-daemon-with-delphi-part-2/

Delphi & WebSocket

WebSocket è una tecnologia che permette un interazione bidirezionale tra server e client, mi direte, nulla di nuovo con una connessione socket degli anni 90 facevamo la stessa cosa. Vero!!!  La cosa che però rende questa tecnologia molto vantaggiosa è che per prima cosa, implementa degli standard nei protocolli di trasmissione e fruizione dei dati…
Leggi tutto

PHP cURL

// initialize cURL $ch = curl_init(); // set the URL of the remote resource to download curl_setopt($ch, CURLOPT_URL, ‘http://www.site.com/index.html’); //set url as curl_init() parameter –> $ch = curl_init(‘http://www.site.com/index.html’); // required that no headers be downloaded curl_setopt($ch, CURLOPT_HEADER, 0); // prevent remote content from being passed to print curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // set the timeout to…
Leggi tutto

PHP json_decode() Function

Decode JSON object with an array value: $jsonobj = ‘{“dataset”:[{“field1″:”hello”,”field2″:0,”field3″:1},{“field1″:”hola”,”field2″:2,”field3″:3}]}’; $obj = json_decode($jsonobj); // it returns object $array_dataset = $obj->dataset; for ($i = 0; $i < count($array_dataset); $i++) { $singoloArray = $array_dataset[$i]; foreach($singoloArray as $field => $value) { echo $field . ” => ” . $value . “<br>”; } } Decode array of JSON object:…
Leggi tutto

VCL – Load HTML code in TWebBrowser

Easy HTML editor with instant preview into TWebBrowser Component to use: – TSynedit – TSynHTMLSyn – TWebBrowser – TTimer (set Interval 1000) – TSplitter (set Align alLeft) Here the code: procedure TForm1.SynEdit1KeyPress(Sender: TObject; var Key: Char); begin Timer1.Enabled := True; end; procedure TForm1.Timer1Timer(Sender: TObject); var Doc: Variant; begin Timer1.Enabled := False; if not Assigned(WebBrowser1.Document) then…
Leggi tutto