Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 02/24/21 in all areas

  1. https://www.finalbuilder.com/resources/blogs/advice-for-delphi-library-authors
  2. Lars Fosdal

    Max string literal length = 255

    @emailx45 It is great that you are enthusiastic and helpful - but - the wrong kind of help is not really helpful, is it? I guess you missed the "/rant" in my original post, as well as the comment about "logical, but annoying", and the explicit reference to string literals. I also clearly stated WHY I wanted a longer string literal; and @Angus Robertson provided another example of when this limit is a challenge. Yet you post a completely irrelevant suggestion that AnsiString is the answer to the problem. My advice: - Study posts until you are sure you understand the context - Avoid applying your own opinion as one of the Embarcadero engineers - Avoid what-about-ism - Avoid characterizing the desires of others as insane - Avoid posting bullshit comments not relevant to the discussion Fun fact: The line length limit in the Delphi IDE is 4096 chars.
  3. balabuev

    TTreeNode leak when VCL styles are active

    I removed as much as possible from your demo. It's now independent from SVG image list, and refers only to standard components. I removed almost all code also. Source.zip What is interesting: removing the bottom list view will stop the bug from occurring.
  4. Meanwhile a bit dusty, but most of it is still valid and overlaps your suggestions nicely: Delphi Library Guidelines
  5. Fr0sT.Brutal

    Micro optimization: Split strings

    function Split(const Str: string; const Delim: string; AllowEmpty: Boolean; LastIdx: Integer): TStrArray; var CurrDelim, NextDelim, CurrIdx: Integer; begin if Str = '' then begin SetLength(Result, 0); Exit; end; CurrDelim := 1; CurrIdx := 0; SetLength(Result, 16); repeat if CurrIdx = Length(Result) then SetLength(Result, CurrIdx + 16); // check if array if full and extend if needed if (LastIdx <> -1) and (CurrIdx = LastIdx) then // last index reached - write all up to end begin NextDelim := Length(Str)+1; end else begin NextDelim := Pos(Delim, Str, CurrDelim); // next delim if NextDelim = 0 then // string is finished - write all up to end NextDelim := Length(Str)+1; end; Result[CurrIdx] := Copy(Str, CurrDelim, NextDelim - CurrDelim); CurrDelim := NextDelim + Length(Delim); // if fragment is not empty or empty are OK - inc index if (Result[CurrIdx] <> '') or AllowEmpty then Inc(CurrIdx) else Continue; until CurrDelim > Length(Str); SetLength(Result, CurrIdx); // cut the array down end; - any string as delimiter - customize if empty elements will be extracted ("foo;;;bar" & AllowEmpty=False => ["foo", "bar"]) - optional stop splitting after N elements found (mainly for name-value pairs like "login: user:pass" & LastIdx=1 => ["login", "user:pass"])
  6. David Heffernan

    spinlock primitives

    FWIW this is my spin lock TSpinLock = class private FLock: Integer; public procedure Acquire; procedure Release; end; procedure TSpinLock.Acquire; begin Assert(AlignedOn32bitBoundary(@FLock)); while AtomicCmpExchange(FLock, 1, 0)<>0 do begin //signal to CPU that we are spinning; see, for example, http://msdn.microsoft.com/en-us/magazine/cc163726.aspx YieldProcessor; end; end; procedure TSpinLock.Release; begin AtomicExchange(FLock, 0); end; It's only useful on x86/x64 because Emba haven't provided an implementation of YieldProcessor for other processors! I suspect that professional spin locks use different yield methods depending on how long they have been spinning.
  7. mikerabat

    FIDO2 and CBOR

    Hi there! There is the C library libFido2 around in form of a dll. I took the liberty to put arround a Delphi library that supports FIDO2 keys around that library including a little project that shows how one could do WebAuthn logins. check out: https://github.com/mikerabat/DelphiFido2 https://github.com/mikerabat/DelphiCBOR for further reading. kind regards Mike
  8. A.M. Hoornweg

    spinlock primitives

    The purpose of a spinlock is to obtain the lock as quickly as possible. On a single core system, doLock should yield on contention because the thread that owns the lock is waiting to be resumed. On multi-core systems it can keep spinning. In the initialization of the unit, call GetProcessAffinityMask() and count the bits in the integer to obtain the number of cores available to the program.
  9. Coniah

    Delphi 10.4.2 first impressions

    Glad things are working well. I'll keep trying. I'm looking forward to using the latest version. It was a good move to update your TMS components. After reinstalling, it's the TMS components that are generating errors when I try to recompile.
  10. Vincent Parrett

    Blogged : Advice for Delphi library authors

    Agreed, that's what gave me the idea to write the post 😉
  11. Yeah, all my win64 component paths were wiped out. Luckily, I had backup the registry before upgrade, so re-import the registry solves.
  12. Announcing the Availability of RAD Studio 10.4.2 Sydney Release 2 https://blogs.embarcadero.com/announcing-the-availability-of-rad-studio-10-4-2-sydney-release-2/
  13. Mike Torrettinni

    Micro optimization: Split strings

    Very good! Why did you choose that LastIdx should be -1 and not 0, to parse all text? If you pass 0 it will not delimit string. So I guess MaxInt is best, if you want all delimited strings? If I call Split(str, delim, false, 0) it doesn't delimit, it only delimits full string with Split(str, delim, false, MaxInt), because of condition : if (LastIdx <> -1) and (CurrIdx = LastIdx) then // last index reached - write all up to end begin NextDelim := Length(Str)+1; end and CurrIdx = 0 at the beginning. I would expect: LastIdx = 0 => parse All, LastIdx >0 parse to that LastIdx and end. No?
  14. Fr0sT.Brutal

    Hiding a public property in a descendant class

    Good though there's still a chance you miss some cases procedure TForm1.EditOnChange(Sender: TObject); begin with TEdit(Sender) do Text := Text + 'lol'; end;
  15. Actually I did less than a year ago: Compiling TeeChart 2020 for Delphi 2007 It won't help, of course.
  16. Attila Kovacs

    TTreeNode leak when VCL styles are active

    an MCVE would be nice as we could figure out which version are affected and also debug it instead of guessing
  17. balabuev

    TTreeNode leak when VCL styles are active

    I was not able to reproduce the issue. Tried with Form>PageControl>TabSheet>Frame>PageControl>TabSheet>TreeView. Can you upload simplified demo project?
  18. Dalija Prasnikar

    TTreeNode leak when VCL styles are active

    Well, if nobody reports issues, chances they will be fixed is zero to none. Yes, there is always chance that EMBT developers themselves will eventually bump into the issue and make internal report, but those chances are rather slim. I am not judging anyone here, reporting bugs takes time, but the more people report reproducible bugs they encounter, the less bugs there will be out in the wild. Yes, I also know that report alone does not mean that bug will be promptly fixed.
  19. dummzeuch

    spinlock primitives

    ... or simply assume a multi core system. When was the last time you saw a single core (Windows-) system in the wild? OK, a program could be restricted to a single core by the user or the OS, so there is that. And there are VMs which can also be configured to run on a single core even on a multi core system.
  20. Vincent Parrett

    GExperts 1.3.18 experimental twm 2021-02-21 released

    Never mind, I deleted my local copy an checked out again, and it builds fine. No idea why as svn wasn't showing any changes to the source (apart from GXIcons.res which happens during the build).
  21. This is what I've initially talked about.
  22. Ian Branch

    GExperts 1.3.18 experimental twm 2021-02-21 released

    Built fine here for D2007 & D10.4.1.
  23. Anders Melander

    spinlock primitives

    You are writing your own spinlock to get better performance - and then you use Sleep() which is guaranteed to cause a context switch...? Unless you really know what you're doing then you better of using the synchronization primitives provided by the OS. https://devblogs.microsoft.com/oldnewthing/20051004-09/?p=33923 http://joeduffyblog.com/2006/08/22/priorityinduced-starvation-why-sleep1-is-better-than-sleep0-and-the-windows-balance-set-manager/ Apparently this can't be repeated often enough.
  24. David Heffernan

    spinlock primitives

    Aren't you meant to use the YIELD instruction (if I've remembered it's name right)
  25. Rollo62

    XLS 2 XLSX

    No payed, no OLE, ... Puh its getting hard. I would have suggested to look into (payed) HtmlOffice components as well, but not sure if they can do that you want. Anyway, then maybe UNO + LibreOffice is the last free resort ?
×