-
Content Count
3416 -
Joined
-
Last visited
-
Days Won
113
Everything posted by Lars Fosdal
-
RTTI and EXE file size: how to shrink your executable 2 times
Lars Fosdal replied to Kryvich's topic in RTL and Delphi Object Pascal
I use RTTI extensively, so turning it off would have undesirable effects, I wish there was a simpler way to enable/disable it for specific inheritance trees, though.- 16 replies
-
Delphi Bugs reported to QualityPortal
Lars Fosdal replied to Lars Fosdal's topic in Community Management
I wasn't really thinking of the complete list, just a place for DP members to post reports they have made or discovered. -
General DB access question -- paging query results
Lars Fosdal replied to David Schwartz's topic in Databases
We use the ApexSQL tools (https://www.apexsql.com/). Diff and DataDiff are very flexible and powerful, although ApexSQL from time to time redo their UIs with varying success - probably when upgrading their MSVS 😛 -
General DB access question -- paging query results
Lars Fosdal replied to David Schwartz's topic in Databases
Thank you, @Dmitry Arefiev! It seems I have to withdraw that critical statement and explore the FireDAC options again. How did you prime the FDQuery for that specific result? We have a mix of 2008, 2012, 2016 and 2017 servers, so we are still held back by the 2008. I will have to push for an upgrade of the handful of 2008 servers still remaining. -
General DB access question -- paging query results
Lars Fosdal replied to David Schwartz's topic in Databases
How does the generated SQL look for retrieving the top 100 results at row 19.900 for SQL Server? -
Delphi Bugs reported to QualityPortal
Lars Fosdal replied to Lars Fosdal's topic in Community Management
Depends on the severity, but we could see it as a source for future unit tests 😛 -
Delphi Bugs reported to QualityPortal
Lars Fosdal replied to Lars Fosdal's topic in Community Management
Well, yeah... but who logs in there daily? It would be nice to get a heads up on new reports. -
property Items: TArray<TMyType> - enumerate props of TMyType?
Lars Fosdal posted a topic in RTL and Delphi Object Pascal
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; -
property Items: TArray<TMyType> - enumerate props of TMyType?
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
Or ... lack of sleep. I was looking at the wrong context. I should have mentioned that I need to walk a complex structure, and I would like to do it recursively, and not specifically for this particular element type. I need to use rt.GetProperties to get the inherited props as well. -
property Items: TArray<TMyType> - enumerate props of TMyType?
Lars Fosdal replied to Lars Fosdal's topic in RTL and Delphi Object Pascal
Thanks, @Attila Kovacs - I wonder how I could overlook GetDeclaredProperties? I guess I will have to blame lack of coffee. -
MariaDB - the fully opensource branch of MySQL (which is Oracle owned), is ACID. https://mariadb.com/resources/blog/acid-compliance-what-it-means-and-why-you-should-care/ Edit: Sorry, that was ClustrixDB, a variant for the cloud
-
General DB access question -- paging query results
Lars Fosdal replied to David Schwartz's topic in Databases
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 -
For..to..step in Delphi
Lars Fosdal replied to Primož Gabrijelčič's topic in Tips / Blogs / Tutorials / Videos
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 -
For..to..step in Delphi
Lars Fosdal replied to Primož Gabrijelčič's topic in Tips / Blogs / Tutorials / Videos
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; -
You can also consider handling the application wide WM_ACTIVATEAPP where WParam = 0 when you lose focus and 1 when you get focus- and then explicitly hide/restore your floating forms.
-
Microsoft is now accepting ARM64 Win32 apps in its Windows 10 Store
Lars Fosdal posted a topic in Windows API
IMO, as I've requested before - EMBT really need to consider ARM64 and VCL for RAD Studio. https://www.neowin.net/news/microsoft-is-now-accepting-arm64-apps-in-its-windows-10-store -
New official Embarcadero forums online http://community.idera.com/developer-tools/ The sign-up/login is a bit prickly at first, so keep your login name / login email and password at hand, and request a password reset if your get into problems.
-
Custom Managed Records Coming in Delphi 10.3
Lars Fosdal replied to Marco Cantu's topic in RTL and Delphi Object Pascal
True. My point was that relying on the const keyword as "security against tampering" is - as David also points out - a bit of a gamble. -
Custom Managed Records Coming in Delphi 10.3
Lars Fosdal replied to Marco Cantu's topic in RTL and Delphi Object Pascal
Another variation type PTestRec = ^TTestRec; procedure Test7( const rec: PTestRec ); begin rec.Change( 7 ); end; ... Test7( @rec ); Writeln( rec.Value ); shows 7 -
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.
-
SDTimes Industry Watch: The developer transformation
Lars Fosdal replied to Lars Fosdal's topic in Project Planning and -Management
Precisely 🙂 More often, it is about devs doing operational care and maintenance, first line support, etc - or devs doing tasks such as second line failure / error analysis and verifying that a problem can be reproduced before escalating. -
New in 10.3: IDE UI Improvements in the Main Window
Lars Fosdal replied to Mohammed Nasman's topic in Delphi IDE and APIs
Code Insight/Completion, Error Insight, Background Compilation - all depends on various parts of the compilers. -
How to obtain the value of a field of type TWndMethod via RTTI?
Lars Fosdal replied to Kryvich's topic in RTL and Delphi Object Pascal
what if you first extract it as a pointer, and then cast the pointer to TWndMethod? -
Both look more or less the same in the compact view.
-
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. Forums: Easier to read code snippets Forums: Clickable URL is nice. Forums: Showing something that resembles the original formatting is nice.