Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation since 06/10/25 in all areas

  1. TOML is a "config file format for humans", that has gained a lot of traction in the python and rust communities among others. It is basically the INI file format on steroids. It compares quite well to alternative formats such as JSON, YAML and XML. Compared to JSON is way more readable and compact. Since I could not find any Delphi library for processing TOML, I have created my own: toml-delphi. Features: TOML v1.0.0 compliant. Passes all 734 (valid/invalid) official validation tests. Fast. Single stream tokenizer and lexer that doesn't use regex. Converts TOML documents to Delphi's RTL's TJSONObject, thus allowing for easy traversal, manipulation and query of the generated documents. Includes TTOMLWriter for converting TJSONObjects back to TOML. Provides for easy (de)serialization of Delphi objects and records from/to TOML. This is the interface of the main unit: TJSONObjectHelper = class helper for TJSONObject function ToTOML(MultilineStrings: Boolean = False; Indent: Integer = 4): string; procedure StreamTOML(Stream: TStream; MultilineStrings: Boolean = False; Indent: Integer = 4); procedure SaveTOMLtoFile(const FileName: string; MultilineStrings: Boolean = False; Indent: Integer = 4); class function FromTOML(const Contents: string): TJSONObject; overload; class function FromTOML(Contents: TBytes): TJSONObject; overload; class function FromTOML(Stream: TStream): TJSONObject; overload; class function FromTOMLFile(const FileName: string): TJSONObject; end; ETOMLSerializer = class(Exception); TTOMLSerializer = class class function Serialize<T>(const AValue: T): string; overload; class function Deserialize<T>(const ATOML: string): T; overload; end; Example usage: You can convert TOML source to TJSONObject using one of the FromTOML functions. For example to parse a TOML file you use: var JsonObject := TJSONObject.FromTOMLFile(FileName); //or for parsing a TOML string: var JsonObject := TJSONObject.FromTOML(TOMLstring); To convert a TJSONObject to TOML you use one of the methods ToTOML, StreamTOML or SaveTOMLToFile. For example: TOMLString := JsonObject.ToTOML; // or JsonObject.SaveTOMLToFile(FileName); Example serialization: type TTestRec = record IntValue: Integer; FloatValue: double; StringValue: string; DateValue: TDateTime; ArrayValue: TArray<string>; end; procedure TestSerializer; var Rec: TTestRec; TOMLString: string; begin Rec.IntValue := 123; Rec.FloatValue := 3.14; Rec.StringValue := 'abc'; Rec.DateValue := Now; Rec.ArrayValue := ['A', 'B', 'C']; Writeln('Serialized record:'); WriteLn('=================='); TOMLString := TTOMLSerializer.Serialize(Rec); Writeln(TOMLString); Writeln('Record deserialized and serialized again:'); Writeln('========================================='); Rec := TTOMLSerializer.Deserialize<TTestRec>(TOMLString); TOMLString := TTOMLSerializer.Serialize(Rec); Writeln(TOMLString); end; Output: Serialized record: ================== IntValue = 123 FloatValue = 3.14 StringValue = "abc" DateValue = "2025-06-18T05:37:02.110+03:00" ArrayValue = [ "A", "B", "C" ] Record deserialized and serialized again: ========================================= IntValue = 123 FloatValue = 3.14 StringValue = "abc" DateValue = "2025-06-18T05:37:02.110+03:00" ArrayValue = [ "A", "B", "C" ] I hope you find it useful.
  2. This has only been an issue if you make a mess out of your code design. In rare situations where you do need circular references using implementation section in one unit will suffice. I doubt that proposed changes would bring too much overall benefit and they would require extensive rework of the existing compiler architecture. There is existing feature which would be more beneficial for code organization: class helpers. Currently there is only a single supported helper in scope and having multiple ones would allow breaking down more complex code and organizing it into separate files. Implementing those would be a much simpler task, consistent with the existing architecture.
  3. pyscripter

    TOML delphi parser, writer and serializer

    @dummzeuch With the permission of the original author the license has now been changed to the MIT one.
  4. Smart Setup is a unified tool for installing and building Delphi packages, whether they come from TMS or elsewhere. See: https://www.tmssoftware.com/site/blog.asp?post=1360
  5. Renate Schaaf

    Bitmaps to Video for Mediafoundation

    I've just uploaded an update to my project https://github.com/rmesch/Bitmaps2Video-for-Media-Foundation What it does: Contains a VCL-class which encodes a series of bitmaps and video-clips together with an audio-file to video. The result is an .mp4-file with H264 or H265 compression together with AAC-audio. It uses windows mediafoundation, which is usually contained in windows. Hardware-encoding is supported, if your graphics-card can do it. Requires: Headers for mediafoundation from FactoryXCode: https://github.com/FactoryXCode/MfPack Windows 10 or higher Encoder (MF-Transform) for H264/H265, usually come with the graphics-driver Delphi XE7 or higher, if I haven't messed it up again, I've only got the CE and Delphi2006 (Win32 and Win64 should be working, but Win64 recently crashes for me with "The session was disconnected".) The demo-project shows some uses: Record a series of canvas-drawings to video Make a slideshow from image-files (.bmp,.jpg,.png,.gif) with music (.wav, .mp3, .wmv, ...) and 2 kinds of transitions Insert a videoclip into a slideshow (anything that windows can decode should work) Transcode a video-file including the first audio-stream. Improvements: I think I now better understand how to feed frames to the encoder. With the right settings it makes stutter-free videos with good audio-video-synchronization. It's now usable for me in my "big" project, and I no longer need to rely on ffmpeg - dlls. More info in changes.txt. Just try it, if you're interested, I'd be glad. Renate
  6. Anders Melander

    What .PAS file does a form use?

    I'm working on a project like that; New units are named consistently after strict rules so we can easily locate the relevant unit. Old units are named after whatever the developer had time to type (and apparently he was always in a rush). So I introduced a "magic" key that when pressed at run-time displays the name of the active form/frame. It's basically just a TApplicationEvents.OnShortCut on the main form: procedure TFormAnynymizedToProtectTheGuilty.ApplicationEventsShortCut(var Message: TWMKey; var Handled: Boolean); begin {$ifdef DEBUG} if (Menus.ShortCutFromMessage(Message) = ShortCut(VK_F1, [ssAlt])) then begin if (Screen.ActiveCustomForm <> nil) then begin var Msg := ''; // Find frames in the form var Control := Screen.ActiveControl; while (Control <> nil) and (Control <> Screen.ActiveCustomForm) do begin if (Control is TFrame) then Msg := Msg + Format('Embedded frame: %s in %s.pas', [Control.ClassName, Control.UnitName]) + #13 else if (Control is TForm) then Msg := Msg + Format('Embedded form: %s in %s.pas', [Control.ClassName, Control.UnitName]) + #13; Control := Control.Parent; end; Msg := Msg + Format('Active form: %s in %s.pas', [Screen.ActiveCustomForm.ClassName, Screen.ActiveCustomForm.UnitName]); TaskMessageDlg('YOU ARE IN A MAZE OF TWISTY LITTLE PASSAGES, ALL ALIKE.', Msg, mtInformation, [mbOK], 0); end; Handled := True; end; {$endif DEBUG} end;
  7. With Signtool Yes, however with Signotaur you do not.
  8. Chris Pim

    Updating files in assets\internal\ (12, FMX, Android)

    Fair enough! I was searching for “application run parameters” and other more general things - I should’ve just searched for cleaninstall! Curiously, if you type cleaninstall into the search box in the docwiki, it initially says “Nothing matches the search” until you actually press return, which also caught me out. That’s my excuse anyway 😂
  9. 🔧 [JOB] Part-Time Delphi Developer (VCL / Win32) – Support & Mentorship Role Location: Remote (U.S. preferred, but open) Commitment: Part-time (5–10 hrs/week) Project Type: Ongoing support + mentoring role We’re looking for an experienced Delphi developer (VCL / Win32 only) to help support and sustain a well-established, industry-specific engineering software package used for retaining wall and geotechnical design. The application has been actively developed and maintained by the original developer (who’s still involved), but we’re now looking to add a second experienced Delphi developer to: Assist with ongoing support and small enhancements Help document and organize the codebase into a shared source control repository (Git) Collaborate with the original developer on architecture and long-term sustainability Mentor a junior team member (with technical aptitude) as they begin learning Delphi and the codebase We’re not looking to rewrite the software — just to maintain it, support it, and prepare for long-term continuity. The original developer has been incredibly generous with his knowledge and is ready to help onboard someone gradually. 🧰 Tech Stack & Context: Delphi VCL (Win32 only — no FireMonkey) Long-running proprietary engineering app (wall design, CAD integration, etc.) Some external modules involve MathCAD and AutoCAD scripting We’re setting up a Git-based source control repository internally for collaboration ✅ Ideal Candidate: 5+ years of Delphi (VCL) experience Comfortable reading and documenting legacy code Good communicator; able to mentor or explain logic to others U.S.-based preferred for communication ease, but flexible for the right person Bonus: experience with AutoCAD integrations, MathCAD, or engineering tools ⏱ Availability: Part-time: ~5–10 hours per week, with flexibility Occasional check-ins with our team (main developer + junior mentee) 💼 To Apply: Email tim@earthretention.com with: A brief intro or CV Your hourly rate or fee structure A note on your experience with Delphi VCL and any mentoring/legacy experience This is a great opportunity for a seasoned Delphi developer looking to support a stable, well-built product with a thoughtful team — no chaos, no rewrites, just clean continuity. Looking forward to hearing from you. — Tim Winders COO, Earth Retention / CTi Software
  10. Patrick PREMARTIN

    Extreme slow-down in Windows FMX app UI since upgrading to 12.1

    I open the issue https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-3711 You can follow it by enabling the notifications after login on this URL (quality.embarcadero.com). The difference between TThread.Queue() and TThread.ForceQueue() happens in the main thread : in the first case the code is executed, in the second it's delayed to next message processing iteration. Unfortunately, the behavior is not the same on Mac and Windows and in this project the form is only refreshed on macOS, for Windows it's done at the end.
  11. dummzeuch

    Define conditional symbol in .dpr

    You cannot define a symbol in the .dpr file to be available in the units (it will be available in the .dpr file itself though). You must put it into the .dproj file (Project -> Options). Alternatively you can define it in an include file and include that file in all units that require the symbol. That latter approach is used by most libraries because a library cannot add anything to the project options.
  12. himitsu

    Bugs on WINMD, who can clarify ?

    Source: https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-1577 https://quality.embarcadero.com/browse/RSP-44096 https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-1754 https://www.delphipraxis.net/214473-warnung-vor-winmd.html ......................
  13. Vincent Parrett

    Intercepting UuidCreate function

    Intercepting functions for unit testing is a terrible idea. A better option would be to create abstractions and a concrete implementation (ie actually calls UuidCreate), that abstraction can be easily mocked using Delphi Mocks or Spring4D for uinit tests. The same applies to code that relies on things like Now or NowUTC - e.g - https://github.com/VSoftTechnologies/VSoft.System.TimeProvider
  14. dummzeuch

    TOML delphi parser, writer and serializer

    My only problem with that is the license: GPL simply makes it useless for me. But since it's based on another GPL library you probably didn't have a choice.
  15. salvadordf

    SynEdit for FMX ?

    I know it's not the same but one of the FMX demos in the WebView4Delphi project shows how to embed a Monaco editor : https://github.com/microsoft/monaco-editor https://github.com/salvadordf/WebView4Delphi/tree/main/demos/Delphi_FMX/MonacoEditor
  16. TECNativeMap is a 100% Delphi mapping component that uses neither browser nor javascript, and is available on all Delphi-supported platforms. Compatible since Delphi 7 for VCL and XE3 for Firemonkey. Download the trial version for Delphi 12
  17. Delphi bindings to libxml2 and libxslt libraries. One of the most important goals of the project is the cross-platform replacement of MSXML 6.0. Therefore, where possible, the library should follow the W3C DOM model, but compatibility with MSXML is a priority. Library For details, see readme on GITHUB https://github.com/apokroy/LX2 P.S. The library is still at an early stage of development, therefore, changes to the API are possible.
  18. david berneda

    Physically reduce jpeg image size??

    You might try also the CompressionQuality property, 60% instead of 90% should reduce the size in bytes (losing quality of course) https://engineertips.wordpress.com/2021/11/27/delphi-resize-jpeg/ The Webp format is an alternative, it gets smaller size vs jpeg with the same quality, and there are Delphi libraries to do so in vcl (and fmx) https://github.com/Wykerd/delphi-webp
  19. Dalija Prasnikar

    Introducing My Delphi TFuture PPL For Thread Safe UI

    The whole point of Delphi Future implementation is to be a blocking call. Now, we can discuss whether this kind of design is useful or not and in which circumstances. However, your improved Future is mostly useless. Instead of creating a future and then resolving it in additional task (you are involving two threads here) you should just run the code in the task and that is it. Simply use TTask.Run( procedure begin var LValue := (...); TThread.Queue(nil, procedure begin LogReply('Result: ' + LValue.ToString); // update UI on main thread that service the TTask end); end); No need to overcomplicate things.
  20. Fudley

    Updating files in assets\internal\ (12, FMX, Android)

    I tried "-doallmywork"but no effect.
  21. Well, in this case you can. I did a lot of refactoring such code myself during the last decades. The constraint you suggested to remove is a good indicator of progress in such an endeavor.
  22. David Heffernan

    How do I assert a single ?

    The principle of a function that compares real values for equality, up to a specified tolerance, is a valid thing to do in many cases. But there are lots of caveats. In practise, most developers (and far from just in the Delphi space) that I see recommending it are completely unaware of these caveats. Some of these caveats and issues: How do you choose a tolerance? Does your tolerance account for the scale of the values, and indeed should it? Some use cases demand absolute tolerances, some demand relative tolerances. If you are accounting for scale, how do you choose the scale? Is it based on the pair of values being compared, or should it be based from the total pool of values. For instance, you might have two series that you wish to compare. Shouldn't the scale be based on the series rather than individual samples? Or maybe it is individual samples. It's easy to mistake this as an equality, but the resulting relationship implied by equality to tolerance is not transitive, so is not a mathematical equality. That is a R b and b R c does not imply a R c. Looking more specifically at Delphi's SameValue, the tolerance used when the Epsilon parameter is zero (or omitted) is very odd. I definitely think puppies are dying left, right and centre when that code path is chosen. One of the common misconceptions with floating point is that it is not exact. I think of it as exact, subject to the rules of the domain, but the key point is that not all values are representable. So if you have floating point values a and b, then they represent some precise real value. But when you do a * b, say, then the true value may not be representable. And so the result is the closest representable value. This is well defined, and reproducible. A lot of people think that there's just some random errors and fuzz in it all. That FuzzFactor constant in the RTL source seems to be a classic example of that sort of thinking. This famous question on SO is a useful resource: https://stackoverflow.com/questions/588004/is-floating-point-math-broken One of my pet bug bears in Delphi is its inability to convert correctly between floating point and textual representations. In every other mainstream language (and most non-mainstream languages) this is possible. But in Delphi the code used to perform these conversions is home grown and broken. There are good algorithms for doing this, and it's a subject of active research, but Embarcadero don't seem to care about this. In my codebase I use correct algorithms. Which means that for all values I can convert from float to text and back and always get the same value. The inability to do this often leads to users calling SameValue. My own codebase does call comparison function that compare for equality to tolerance. But there is a lot of care taken in how the tolerance is chosen and applied. I guess that's the crux of what I am saying. So many people just say, this is hard, slap a tolerance onto the comparison that is good enough for the two values I have to hand, and surely that's fine for all other values! I'm a bit of a pedant in this area, I admit. But it's kind of my job to be. Sorry!
  23. Uwe Raabe

    High-dpi scaling problems with TFrame

    There are several bugs fixed in 12.2 and 12.3 affecting frames. https://quality.embarcadero.com/browse/RSP-37402 https://quality.embarcadero.com/browse/RSP-39847 https://quality.embarcadero.com/browse/RSP-40110 https://quality.embarcadero.com/browse/RSP-43560 https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-1020 Perhaps these will fix your problem, too. I will test your project later when I've found some time to configure my system for monitors with different dpi.
  24. When you buy the latest version of Delphi, you also get access to earlier versions of Delphi at no extra charge.: https://www.embarcadero.com/products/delphi/previous-versions Delphi 2010 is covered by this. A lot of third party component vendors do something similar for the same reason with older versions available in the registered users download areas. You may need to make a request or they might be there already.
  25. Uwe Raabe

    Has the toolbar problem been fixed?

    A stable Delphi is also important to me. That's why I do my best to help Embarcadero achieve this.
×