Jump to content

Lars Fosdal

Administrators
  • Content Count

    3303
  • Joined

  • Last visited

  • Days Won

    110

Posts posted by Lars Fosdal


  1. Setting RowSetSize to f.x. 100 doesn't really help you if you need to get rows 19.900 -> 19.999 - because that implies that you also need to read all the rows before 19.900 to get there.

     

    Pagination and getting the top (n) rows from an arbitrary offset, f.x starting at row 20.000 - is not something that FireDAC handles well by itself, and server side pagination is very much per SQL Server type.

     

    Some examples:

    Oracle: https://blogs.oracle.com/oraclemagazine/on-top-n-and-pagination-queries

    SQL Server: https://stackoverflow.com/questions/109232/what-is-the-best-way-to-paginate-results-in-sql-server

     

     


  2. I want to recursively walk the properties of MyVar: TMyOuterType - but the Items list may be empty.

    How can I walk the base element type of Items, i.e. TMyType - when I have no instance data?

    type
      TMyType = class
      public
        property One: string;
        property Two: string;
      end;
      
      TMyType2 = class(TMyType)
      public
        property Two: string;
      end;
    
      TMyType3 = class(TMyType2)
      public 
        property Three: string;
      end;
      
      TMyTypeArray = TArray<TMyType>; // i.e. polymorphic
      
      TMyOuterType = class
      public
        property Items: TMyTypeArray;
      end;
      
      var
        MyVar: TMyOuterType;

     


  3. 1 hour ago, Arnaud Bouchez said:

    Perhaps fun for you, but certainly complicated and slower than a simple "while" loop, especially when the process within the loop is small and the range is huge.
    The duplicated SetLength() is just so "funny".

    The duplicate SetLength was a lazy way of avoiding the corner case math check.  It may occasionally reduce the length of an array, which afaik is not that costly?

    Some points for doing it this way:

    - it is a reusable pattern without embedded logic in the loop, which gives readable code

    - we could do it the same way for a TArray<double> with fractional fractional increments
    - a similar pattern can be used to fetch pre-calculated arrays

    There are so many ways to use Delphi


  4. Not efficient, not tested, but fun 😄
    User exercise - make a Range.AsDouble(0, 5, 0.25)

    type
      Range = record
        class function AsInt(const aFrom, aTo: Integer; const aStep: Integer = 1): TArray<Integer>; static;
        procedure Test;
      end;
    
    class function Range.AsInt(const aFrom, aTo, aStep: Integer): TArray<Integer>;
    var
     ix, n: Integer;
     v: Integer;
    begin
      n := ((aTo - aFrom) + 1) div aStep;
      SetLength(Result, n + 1);
      v := aFrom;
      ix := 0;
      while v <= aTo
      do begin
        Result[ix] := v;
        v := v + aStep;
      end;
      SetLength(Result, ix + 1);
    end;
    
    procedure Range.Test;
    var
      ix: Integer;
    begin
      for ix in Range.AsInt(0, 11, 2)
      do begin
        Writeln(ix);
      end;
    end;

     

    • Like 1

  5. IMO, as I've requested before - EMBT really need to consider ARM64 and VCL for RAD Studio. 

    Quote

    Today, Microsoft announced that with the release of Visual Studio 15.9, ARM64 development is officially available. The news comes after the firm released a preview SDK back at its Build 2018 developer conference in May. ARM64 support isn't just for UWP apps, or even Store apps. Any Win32 app can be recompiled with ARM support; of course, if developers want their apps to work in S mode, they'll need to port them to the Microsoft Store. Naturally, compiling a UWP app for ARM64 is easier, as it's just an extra checkbox. Win32 app developers need to add an ARM64 configuration.

    https://www.neowin.net/news/microsoft-is-now-accepting-arm64-apps-in-its-windows-10-store

    • Like 1

  6. Whichever DB you decide to use - don't expose the DB as remote storage for to your game clients, but use a REST interface or similar instead.

    This isolates the game client from the storage technicalities, and you can change the databases without having to change the game client.

    It also reduces the risk of someone meddling with the DB - at least as long as you handle the REST data properly and ward off SQL injection attempts.

    • Like 1

  7. Using The Old Reader (https://theoldreader.com/), it seems like the rssalltopics.xml (Forums) gives the best readability, while the 1-new-topics.xml (New Topics) sort of mangle the contents.

    Both should probably be modified to contain "Delphi PRAXiS" instead of the "New Topics" / "Forum topics" - as the name doesn't really show up in the RSS readers.

     

    Forums: Embedded graphics is nice.


    image.thumb.png.ebf786a8ba25984d7eff584c8d3097d0.png

     

    Forums: Easier to read code snippets

     

    image.thumb.png.0e5009b9ee0e9e79fcfaa458db090573.png

     

    Forums: Clickable URL is nice.

     

    image.thumb.png.d22796d232dff9d3f80a6d2485aa9d4d.png

     

    Forums: Showing something that resembles the original formatting is nice.

     

    image.thumb.png.3e87336a3cf814dcb5bf198c16ff4e8b.png

     


  8. Like @David Heffernan suggests, we override the version numbers from our Continua CI build server, using the same version/build number across all apps within the separate branches, and updating them through FinalBuilder parameters.

     

    Current versions:

    Devel is 2019.3.12.11451 and Pilot just went from 2018.11.6.5035 to Live 2018.11.6.36

    As you can see, the version is y.m.d.BuildNo where the day is the planned release date.

    Devel build numbers start at y.m.d.10001 and are periodically reset.

    Pilots at y.m.d.5001 -> 5xxx

    Live at y.m.d.xxx + 1

     

    We are trying to limit ourselves to three major releases per year, and avoid introducing breaking SQL Schema changes between the major releases.

    We still have too many hotfixes.  The previous Live version had build number 353. Note that doesn't mean we had that many actual roll-outs, just that many commits 😛

     

    image.png.c949c8ad2c4a27351db77b69c0cbd460.png

    • Like 1
×