Jump to content

Frédéric

Members
  • Content Count

    11
  • Joined

  • Last visited

Everything posted by Frédéric

  1. Frédéric

    TGUID to Json

    Hello, I'm currently using RAD Studio 11.2 and just wondering why the standard Delphi Json library (Rest.Json or Data.DBXJsonReflect) is not able to serialize a TGUID value ? Is this possible or I am missing something ? It fails with an 'insufficient RTTI available to support this operation' error. Sure I can add a converter, but it should at least be converted as a record (or to a string), or no ? How should this be handled ? Thanks ! Frederic
  2. Frédéric

    TGUID to Json

    Thanks UWE !
  3. Frédéric

    TGUID to Json

    Yes, of course! Here the code snippet: interface uses REST.JsonReflect; type TGUIDInterceptor = class(TJSONInterceptor) public constructor Create; function StringConverter(Data: TObject; Field: string): string; override; procedure StringReverter(Data: TObject; Field: string; Arg: string); override; end; MyClass = class(TObject) private [JSONReflect(ctString, rtString, TGUIDInterceptor, nil, true)] FJobUID: TGUID; published property JobUID: TGUID read FJobUID write FJobUID; End; implementation uses System.Rtti; { TGUIDInterceptor } constructor TGUIDInterceptor.Create; begin inherited Create; ConverterType := ctString; ReverterType := rtString; end; function TGUIDInterceptor.StringConverter(Data: TObject; Field: string): string; var ctx: TRTTIContext; begin Result := GUIDToString(ctx.GetType(Data.ClassType).GetField(Field).GetValue(Data).AsType<TGUID>); end; procedure TGUIDInterceptor.StringReverter(Data: TObject; Field, Arg: string); var ctx: TRTTIContext; LValue: TValue; begin var vGUID := StringToGUID(Arg); TValue.Make<TGUID>(vGUID, LValue); ctx.GetType(Data.ClassType).GetField(Field).SetValue(Data, LValue); end;
  4. Frédéric

    TGUID to Json

    Hi Stefan, Thanks for pointing to the QC Issue. I've just put an JSONReflect attribute on the concerned fields of my objects so now it works like I need. OK the undesired format in one thing but yes it should produce something out of the box. The output format can already be adjusted case by case, or possibly an option to choose the output format. Regards
  5. Hello, On my RAD Studio 10.3.2 with IDE Fixpack 6.4.4 installed I get a Compiler Fatal error when I pass the -x-cgo compiler option: [dcc32 Fatal Error] frmMain.pas(36): F2084 Internal Error: AV1335D091(0D0F0000)-R00000001-0 This happens when the compiler encounters a simple integer division: function TForm1.DoDivision(AValue: Integer): integer; begin result := AValue div FIntegerField; end; By removing the -x-cgo option the compiler is happy again ! I have all the latest hotfixes install (at least the ones I know :-) ) I didn't get this error with Delphi 10.2.3 version and IDE FixPack 6.4.2. Is this a known problem or is something wrong with my installation ? I verified twice and couldn't find anything wrong... Perhaps important info, I have both 10.3.2 and 10.2.3 installed on same VM. But I left some paths to be sure the compiler doesn't catch some wrong files. It seems OK from this side. Frederic
  6. Hi, Fine it works. I didn't check the result, but at least it doesn't make the compiler fail !!! Thanks a lot for your work !!!
  7. Hi, yes of course, but I was just wondering if it is a known bug of the fixpack or if I'm doing something wrong. Thanks I didn't catch there are some entries for IDEFixpack
  8. Frédéric

    TDSRestConnection, bug in DoSetCredential

    Hi, Just want to share this and to eventually have confirmation (or not !!) I suspect a bug in the DoSetCredential method used by TDSRestConnection (System.Net.HttpClient.Win, TWinHTTPClient.DoSetCredential) I'm just upgrading an (working !) application from Delphi XE7 to Delphi 10.3.1. It's an application using Datasnap REST to communicate with a standalone Datasnap server (or IIS ISAPI in production) By doing my first tests I immediatly encountered the following problem: By calling the TDSRestConnection.TestConnection I get this error: Error adding header (87): Incorrect parameter ==> ('Paramètre incorrect' translated from french) Basic authentication is used. After debugging the code I saw that TNetEncoding.Base64.Encode adds a linebreak after 76 chars (The base64 encoded credentials goes slightly over 80chars...). This seems the default behavior the TBase64Encoding class but the WinHttpAddRequestHeaders API don't like it. I have changed the code in System.Net.HttpClient.Win to change the CharsPerLine to 255 and then it is OK. Bug or misuse ? Thanks ! Frederic
  9. Hi, I have my main monitor set to 200% (resolution of 3840 * 2160) . My additionnal monitor is set to 100% (1920 * 1080). Windows 10. The Delphi IDE runs on the second monitor (font 100%). If all the parts of the IDE remain on this same monitor then all is correct. But as soon as I put one or more IDE panels (Structure or Project panes for ex.) on the primary monitor, appart on the panes on the primary monitor, no menu pops up (neither main menu or 'real' popups). (Do they show elsewhere ?) If I do it in the other way (Delphi on the main monitor, 200%) and panes on the additional monitor, then the menu content shows but completely shifted to the left and with a 100% font instead of 200%. This is probably related to HiRes stuffs which the IDE does not correctly support. But perhaps worth mentionning. For me it sounds more like a bug, not taking the current monitor settings, but the last one used !! Perhaps does someone have a magic solution ??? Already a QC entry ? Thanks ! Frédéric
  10. Frédéric

    No menu content or popups anymore

    Ah yes, sorry I forgot to mention it. Currently I'm using Rio (10.3.1). But the same happens also with Tokyo. I suppose previous version will not work better regarding this. @Uwe: Hmmm, I"m working on a laptop, and this is so handy to have the programs starting (by default) on the main screen and having the debug information on the secondary screen without having to switch manually (Not to speak about multiple redraw triggers in debug when switching is done). And switching to 100% on a 3840 * 2160 monitor needs to buy a good magnifying glass to be able to read something 🙂 🙂 !!! Sad to say but this is one more point where the IDE is not up to date !!!!
  11. Hi, kbmMW supports AMQP 0.9.1 http://www.components4developers.com/
×