Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 08/20/19 in all areas

  1. Lars Fosdal

    Resolve a uses clause unit path?

    I sometimes miss the output from the old compilers which showed the path and name of the units being compiled in the sequence they were built, in a complete log.
  2. Dmitriy M

    JSON - Why self ins't updated with new values ?

    program Project1; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, REST.JSON, Unit1 in 'Unit1.pas'; var Person1, Person2: TPerson; jsonstr: string; begin Person1 := TPerson.Create; try Person1.Name := 'Hello'; jsonstr := Person1.SaveSettings; writeln(jsonstr); //write {"name":"Hello"} Person1.Name := 'hi'; Person1.LoadSettings(jsonstr); writeln(Person1.Name); //write Hello readln; finally Person1.Free; end; jsonstr := '{"name":"Stephane"}'; Person2 := TPerson.FromString(jsonstr); try writeln(Person2.Name); //write Stephane readln; finally Person2.Free; end; end. unit Unit1; interface type TPerson = class(TObject) private [JSONNameAttribute('NAME')] FName: string; public class function FromString(const aJsonString: String): TPerson; procedure LoadSettings(const aJsonString: String); function SaveSettings: string; property Name: string read FName write FName; end; implementation uses REST.JSON; class function TPerson.FromString(const aJsonString: String): TPerson; begin Result := TJSON.JsonToObject<TPerson>(aJsonString); end; procedure TPerson.LoadSettings(const aJsonString: String); var oJSON: TJSONObject; begin oJSON := TJSONObject.ParseJSONValue(aJsonString) as TJSONObject; try TJSON.JsonToObject(self, oJSON); finally oJSON.Free; end; end; function TPerson.SaveSettings: String; begin Result := TJSON.ObjectToJsonString(self); end; end. Reference
  3. chkaufmann

    Error 204 with FastMM4

    Using google with the right key words I found this: https://github.com/pleriche/FastMM4/issues/63 https://quality.embarcadero.com/browse/RSP-22897 Just a workaround but it solved my problem. Christian
  4. For the same reason I abandoned using VM for Delphi, productivity is the key to me. But benefits described by Dave Novo Dave Novo still stand. And the factors that might affect the performance listed by John Kouraklis definitely worth checking, especially anti-virus software. The real-time protection of any AV software is the major, most significant culprit of performance loss, I think you should use an AV without or allow you to disable real-time protection like me :) IMHO a program don't really need real-time AV protection, you should have the necessary habits to keep you safe from dark side of the Internet.
  5. Angus Robertson

    HMAC_SHA256

    There is an example in the same unit, IcsJoseGetSig. There is also a sample project OverbyteIcsJoseTst.dpr that is used to test the various Jose functions, including hex, base64 and base64url encoding and decoding. But this unit needs the OpenSSL DLLs to be distributed with your application, as does any use of SSL or encryption in ICS. And you need to initialise OpenSSL before calling those functions, see the sample application. As others mentioned, there are Delphi only implementations of SHA256, but IcsHMACDigest more modern digests as well. and most REST applications need HTTPS.
×