Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 03/05/24 in all areas

  1. This is nothing new - it's called Eytzinger Layout.
  2. David Heffernan

    Delphi 12 : Encoding Unicode strange behaviour

    This sounds completely broken. What if the file starts with the sentinel value that indicates that you have a utf8 payload. Why aren't you passing a separate header, and then the payload? And why are you passing utf16 at all. Isn't that just expensive. And if you must pass around utf16 please tell me that you are handling byte order correctly.
  3. Dave Nottage

    How to rearrange projects in projects group file?

    Select a project in Project Manager, use Ctrl-Up or Ctrl-Down to move it up/down the list
  4. DelphiUdIT

    TLS v1.3

    Update on the use of the TLS1_3 protocol in Indy (NOT OFFICIAL FROM Indy Team). This is an indication coming from the undersigned, who has carried out exactly what is described and verified that there are no problems either with the IDE or with the existing projects by recompiling and executing them. Conditions: - Rad Studio Athens 12.0 patch 1 (or Delphi); - Dowloaded Last GitHub repository Indy source: https://github.com/IndySockets/Indy/archive/refs/tags/Indy-10.6.3.zip - Donwloaded PR299 (aka NewOpenSSL_PR x OpenSSL 1.1.1): https://github.com/mezen/Indy/archive/refs/heads/NewOpenSSL_PR.zip Now you need to uninstall Indy from Rad Studio IDE, components and binaries included. YOU DO NOT NEED TO DELETE THE ORIGINAL INDY SOURCES. This is the official link explaining how update Indy: https://github.com/IndySockets/Indy/wiki/Updating-Indy ATTENTION: Do not use THE AUTOMATIC PROCEDURE in the instructions indicated in the previous link. It deletes files that do not belong to the Indy environment. You have to do what is indicated by hand, but when you get to the REMOVE THE FILES procedure, stop!!!! Instead, perform these steps: 1) Using Windows Explorer, go to the RAD STUDIO installation BIN directory (normally "C:\Program Files (x86)\Embarcadero\Studio\23.0\bin") and delete the following files: Then go to the BIN64 directory and delete the following files: Now you need to go to the LIB directory and list all the ID* files of the subdirectories (use the pane at the top right of the explorer to search). I recommend listing the files by NAME. The list includes a series of files (more than 10000) that will need to be deleted, BUT FROM THIS LIST YOU MUST UNSELECT (i.e. THE FILES SHOULD NOT BE DELETED) the following files: - all files starting with "FMX", should be 16; - all files starting with "Vcl", should be 8; - all files starting with "play", should be 4; - the "idoc.dcu" files should be 4; - the "idispids.dcu" files should be 4; The procedure indicated in the link (Update Indy) would have deleted these last 8 files. Now that you have deleted the files you will need to open the IDE. Errors will be generated: - package "dclemsedge290.bpl" could not be loaded, ignore and select not to reload again. - the "livepreview290.bpl" package, ignore and select not to reload again. Other packages may give errors, this depends on the fact that you have components registered in the IDE and that use Indy. You can ignore them and allow them to be reloaded the next time you restart the IDE. If you want to do a clean job, you should go to TOOL/OPTIONS/LANGUAGE/DELPHI/LIBRARY and from the "Browsing Path" item you will have to eliminate the Indy references (Core, System and Protocol) IN ALL PRESENT PLATFORMS. Now Indy is no longer present in Delphi. If you followed my initial instructions you should have downloaded the two zip files indicated. Unzip the first one (Indy-10.6.3.zip) into a directory. This directory will be the one containing Indy and will be used for all your applications. Now from the second ZIP file (NewOpenSSL_PR.zip) EXTRACT ONLY the OPENSSL directory found in "Indy/Lib/Protocols" and add it to the directory you created in the previous step, always under Lib/Protocols (so at the end there will be a directory plus, Lib/Protocols/OpenSSL). You will now have Indy with TLS1_3 enabled and with usable OpenSSL 1.1.1 (and also partially OpenSSL 3.1.x). Continue with the "Build and Install" paragraph of the link indicated initially. After finishing, you need to add two paths to Delphi's LIBRARY PATH to follow the ones you entered as in the instructions: "Lib\Protocols\OpenSSL" "Lib\Protocols\OpenSSL\Dynamic" You will now need to recompile (and reinstall) all of your IDE components that use Indy and your projects. For now the TLS1_3 can only be configured in code (therefore in RUNTIME), not in DesignTime as the IDE components have not been updated. All your projects however will remain perfectly functional and will use the old TLS1_2 standard and the old OPENSSL 1.0.2 DLLs until you modify the source to include the new standard. It's late and I'm going to eat now... UPDATE A note for those who use Indy to develop 64 bit or mixed 32 bit and 64 bit (even if you already know this): after having compiled and installed the Indy components (therefore 32 bit), delete the dcu files from the directories (where you unzipped Indy). You can safely delete ALL *.dcu files. If you leave them, when you go to compile your 64 bit project it will give you an error because the "dcu" are 32 bit. By deleting the dcu, you will force the recompilation (in your project) of the Indy libraries. Also remember that in the options of your project a valid path is indicated in the "Unit output directory", this will allow the compiler to generate all the dcu of the project within that directory.
  5. Der schöne Günther

    Delphi 12 : Encoding Unicode strange behaviour

    Your life will be much easier if you rely on Strings and Chars for text manipulation, not bytes. Convert to bytes when your text manipulation is done, not before that.
  6. Dalija Prasnikar

    Delphi and "Use only memory safe languages"

    Delphi is not memory safe language. But, at the end it all depends on the kind of code you write.
  7. David Heffernan

    Set dynamic array of records to nil: frees all content?

    Wrong. Setting a dynamic array to nil is identical to setting length to 0 and identical to passing it to Finalize.
  8. DelphiUdIT

    C++ Builder can work with Unreal Engine 5 ?

    May be March 13th we will know 😉
  9. Angus Robertson

    How to convert JWK to PEM format in Delphi?

    ICS has various Jose and PEM functions that will read and create Json Web Keys. IcsJoseJWKGetPKey reads the Json text and saves the key as type TX509Base. TX509Base has methods to save certificates, private and public keys in numerous formats. What do you want to do with the public key? This may be better discussed in the ICS support forum . Angus
  10. Wow. That's a nice resource!
  11. David Heffernan

    Delphi and "Use only memory safe languages"

    That doesn't help if you have multiple variables that refer to the same instance which I guess is a more likely scenario for double free.
  12. Lars Fosdal

    Delphi and "Use only memory safe languages"

    That feels almost like you're advocating the use of FreeAndNil 😄
  13. Attila Kovacs

    What new features would you like to see in Delphi 13?

    it will also be enough if QP is operational by the time D13 arrives
  14. PeterPanettone

    What new features would you like to see in Delphi 13?

    As a developer who deals a lot with design, I find Delphi's lack of layout options a thorn in my mind. The layout features in Delphi are one-dimensional (e.g., property Align). Delphi lacks a layout component like TdxLayoutControl from DevExpress for a professional design: In practice, the lack of professional layout capabilities results in many bumbling-looking applications, with controls that sometimes overlap when run on a device with display settings different from those of the original application developer. This shortcoming has given Delphi the unjustified reputation of being an unprofessional amateur developer tool. That's why my greatest wish for the Delphi community would be a native layout control from Embarcadero. Or even better, Embarcadero should buy the TdxLayoutControl component from DevExpress and integrate it into the Professional version. This would give Delphi the professionalism it deserves due to its other capabilities.
  15. DelphiUdIT

    What's the general opinion on v12?

    Apart from the fact that we are in the section: nothing else.
  16. David Heffernan

    Delphi and "Use only memory safe languages"

    What's pretty astonishing is that the NSA thinks that Delphi is memory safe! See White House urges developers to avoid C and C++, use 'memory-safe' programming languages | Tom's Hardware (tomshardware.com) I guess the NSA don't know anything about Delphi. obj := TObject.Create; obj.Free; obj.Free; Take that, NSA!
  17. Lajos Juhász

    What new features would you like to see in Delphi 13?

    I am with the idea that was presented in the Delphi's birthday webinar, I do not want the code from any of the projects I am working on to land in some AI database and pop up as a suggestion on a query. The code I am working on belongs to the company I am working for or a client. Nobody wants that code to go public. I am ok with the idea and did it a couple of times to ask Bing to write some simple code that I can review faster than to type in, have some fun.
  18. dummzeuch

    What new features would you like to see in Delphi 13?

    No, not with the kind of AI that we currently have.
  19. Brandon Staggs

    Encryption (AES)

    The comments on that readme explicitly state it's not complete. However, it also says Argon2 is not fully documented and isn't as good as bcrypt, both of which are really odd things to say.
  20. Real professionals have to earn money with their works, they don't have the time to reinvent the wheel, debug and validate it. If you want to shoot yourself in the foot be my guest, but don't expect me to supply the bullets...
  21. vfbb

    iPub Refit - REST API in simple way

    @Attila Kovacs I added support to register custom json converters. About the nullables, is very easy to implement the nullable and the converters. See one simple solution: uses System.Rtti, System.TypInfo, System.JSON.Serializers, System.JSON.Readers, System.JSON.Writers, System.JSON.Types, iPub.Rtl.Refit; type TNullable<T> = record IsNull: Boolean; Value: T; end; TNullableConverter<T> = class(TJsonConverter) public procedure WriteJson(const AWriter: TJsonWriter; const AValue: TValue; const ASerializer: TJsonSerializer); override; function ReadJson(const AReader: TJsonReader; ATypeInf: PTypeInfo; const AExistingValue: TValue; const ASerializer: TJsonSerializer): TValue; override; function CanConvert(ATypeInf: PTypeInfo): Boolean; override; end; { TNullableConverter<T> } function TNullableConverter<T>.CanConvert(ATypeInf: PTypeInfo): Boolean; begin Result := ATypeInf = TypeInfo(TNullable<T>); end; function TNullableConverter<T>.ReadJson(const AReader: TJsonReader; ATypeInf: PTypeInfo; const AExistingValue: TValue; const ASerializer: TJsonSerializer): TValue; var LNullable: TNullable<T>; begin if AReader.TokenType = TJsonToken.Null then begin LNullable.IsNull := True; LNullable.Value := Default(T); end else begin LNullable.IsNull := False; LNullable.Value := AReader.Value.AsType<T>; end; TValue.Make<TNullable<T>>(LNullable, Result); end; procedure TNullableConverter<T>.WriteJson(const AWriter: TJsonWriter; const AValue: TValue; const ASerializer: TJsonSerializer); var LNullable: TNullable<T>; LValue: TValue; begin LNullable := AValue.AsType<TNullable<T>>; if LNullable.IsNull then AWriter.WriteNull else begin TValue.Make<T>(LNullable.Value, LValue); AWriter.WriteValue(LValue); end; end; initialization GRestService.RegisterConverters([TNullableConverter<string>, TNullableConverter<Byte>, TNullableConverter<Word>, TNullableConverter<Integer>, TNullableConverter<Cardinal>, TNullableConverter<Single>, TNullableConverter<Double>, TNullableConverter<Int64>, TNullableConverter<UInt64>, TNullableConverter<TDateTime>, TNullableConverter<Boolean>, TNullableConverter<Char>]); end. To use just replace the simple types to the nullable types: TUser = record Name: TNullable<string>; Location: string; Id: Integer; Email: TNullable<string>; end; [BaseUrl('https://api.github.com')] IGithubApi = interface(IipRestApi) ['{4C3B546F-216D-46D9-8E7D-0009C0771064}'] [Get('/users/{user}')] function GetUser(const AUser: string): TUser; end; procedure TForm1.FormCreate(Sender: TObject); var LGithubApi: IGithubApi; LUser: TUser; begin LGithubApi := GRestService.&For<IGithubApi>; LUser := LGithubApi.GetUser('viniciusfbb'); end; You can test the code above and see the user name is not null but the user email is null. The nullable type and the nullable converter code in this example need to be implemented by the developer, I can't put it on the library because each developer has it own implementation os nullable.
  22. PeterPanettone

    What new features would you like to see in Delphi 13?

    An IDE with AI capabilities could easily accomplish such things.
×