Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 07/20/21 in all areas

  1. pyscripter

    New Community Edition

    In case you have not seen it: Delphi & C++Builder Community Editions Now Available in Version 10.4.2! (embarcadero.com)
  2. Well, any typed const could be modified by pointer seems you recall ancient times when this was true indeed
  3. @mvanrijnen @Edwin Yip Thanks for the references. The aim with the Sempare Template Engine was to have a template engine that was native to Delphi and could be used for web, but also for other kinds of purposes such as code or config generation. At the time I wrote it, dmustache was mainly what was available, but I wanted a template language that was more readable and pascal-like, and from a library perspective providing more flexibility in terms of extension points (custom functions) and the ability to support various sub-template inclusion patterns (content with header/footer, main template referencing content template, etc) and dynamic loading. Due to the fact that looping is a feature, it also has to be safe and offers a timeout if template processing takes too long due to data processing or bad logic. It does rely on RTTI, which does mean there is a performance penalty, but I chose functionality/flexibility over performance to start. I have not had problems reported yet, so I suspect performance has been acceptable for users, as it has been for my use cases. Documentation wise, it should be fairly well covered on github, but I have been working on a CHM help edition which can be used from the IDE with context sensitive help which may be a bit more friendly for those that don't want to necessarily have to browse to the the github docs. Please email me conrad@sempare.ltd/conrad.vermeulen@gmail.com if you are interested and can notify you when it is available. If you have feature requests/comments feel free to raise them on the issue tracker (https://github.com/sempare/sempare-delphi-template-engine/issues). I do check here periodically, but may miss things or reply late. In the next release, I'm allowing for discovery of variables and functions that are referenced. So if you provide a template editor and are using a dictionary/json to pass variables, the UI can know upfront what the required variables are and perform additional validation if required, prompting the user if anything is missing. Alternatively, it could be a way to identify variables that are required, allowing for optimal querying of data from database before populating the template. This is just a complementary feature to an existing feature where errors can be raised if a referenced variable is not present. Further, I hope to create some more examples with more popular web frameworks soon, as I think many people find it easier to see how things work from demos. I realise licensing as GPL may be contentious, but I've gone with the 'free as in speech vs free as in beer' approach. So for a nominal one time fee, you can use it under the commercial license without any restriction. I'll keep you posted on new developments as they unfold.
  4. So we need true constants for records 🙂 Always found it strange the variable constant construction in Delphi. Try to explain it to someone: * var x : integer; Variables: something from which the value can change throughout the execution of the application. * const x = 5; Constant: something from which the value can not change throughout the execution of the application. * const X : integer = 5; A constant from which the value can change throughout the execution of the application, so whats constant on this? If i want to explain this to my mother, she be asking if everything is alright with me 🙂 (and she uses an iphone, ipad and a notebook)
  5. I've butted my head against this, and sadly there currently is no way to pass a typed const to an attribute. There are reports for problems with typed consts - so please vote. https://quality.embarcadero.com/browse/RSP-13921 likewise, for dynamic arrays https://quality.embarcadero.com/browse/RSP-32488
  6. You can try https://github.com/arimateia/liquid-delphi which is a Delphi implementation of Liquid template engine.
  7. Lars Fosdal

    TListView filled by Thread = Freeze

    I usually do this as a two pass operation. I first start a thread that fills a memory structure. Once the thread is done, I trigger an update in the main thread that fills the UI from the memory structure. I have nothing but negative experiences with doing UI updates directly from threads.
  8. Jim McKeeth

    Is this C++ builders new FORUM ???

    I spent quite a bit of time with Ann Lynnworth from https://www.codenewsfast.com and restored a full archive there. You can go find all the old messages there.
  9. Lars Fosdal

    Enums and generics

    It probably is no consolation that I also have hundreds of these helpers... TAllowState = (asAllow,asWarn,asDeny); TAllowStateHelper = record helper for TAllowState const Translate: array[TAllowState] of xlt = ( { asAllow } (no:'Tillatt'; se:'Tillåten'; en:'Allow'), { asWarn } (no:'Vis advarsel'; se:'Visa varning'; en:'Show warning'), { asDeny } (no:'Sperret'; se:'Sperrad'; en:'Denied') ); public function ToString(const Language: TLanguage = langDefault): String; inline; class function FromString(str: string; const Language: TLanguage = langDefault): TAllowState; static; end; { TAllowStateHelper } class function TAllowStateHelper.FromString(str: string; const Language: TLanguage): TAllowState; begin Result:=asWarn; //Default var Lang := Language.GetLanguage; for var state :=Low(TAllowState) to High(TAllowState) do if CompareText(str, state.ToString(Lang)) = 0 then Exit(state); end; function TAllowStateHelper.ToString(const Language: TLanguage): String; begin Result := Translate[Self].Text(Language); end;
×