-
Content Count
3504 -
Joined
-
Last visited
-
Days Won
115
Everything posted by Lars Fosdal
-
How-to: Post a message to Teams using WebHooks
Lars Fosdal replied to Lars Fosdal's topic in Tips / Blogs / Tutorials / Videos
@Anders Melander - We use Continua CI and FinalBuilder, and Continua has Teams support built in. My PS scripts also posts to Teams, but I use the PSTeams module. I still need to master how do PS Secure Vault secret keys across multiple users to avoid having the URLs in the PS script, though. Love your example of how simple it is to do Json in PowerShell! @Uwe Raabe Ignorance, I guess I've never used TRESTClient and I already was using Indy for JsonRPC. Thanks for sharing the modified version! I added it to the article. How TLS capable is the TRESTClient? -
How-to: Post a message to Teams using WebHooks
Lars Fosdal replied to Lars Fosdal's topic in Tips / Blogs / Tutorials / Videos
Thanks, Mahdi! Fixed the URL. -
Organizing enums
Lars Fosdal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
In most cases, yes π -
If your data takes a little time to load, you could delegate the loading to a background task which then again triggers another repaint on completion. That would eliminate any UI stutter due to load times.
-
Organizing enums
Lars Fosdal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
We mostly store the ordinal value of the enumerated type variable to an int in the database. Yes, it is fragile with regards to people changing the enumeration - but we have guidelines and unit tests to avoid that. type TPSDExpeditionType = (etRetailer,etWholesaler,etRetailerDairy,etWholesalerDairy); // Do not reorder or remove - add at end TLocation = class ExpeditionType: TPSDExpeditionType; We use RTTI to export the enums to a view in the database so that we can do logic in the SQL code using the same identifiers as we use in Delphi. T-SQL doesn't do constants per se, but selecting from a flat static view is optimized by the query engine and is extremely low cost. CREATE TABLE [dbo].[t_locations]( [Id] [int] IDENTITY(1,1) NOT NULL, [ExpeditionType] [int] NOT NULL -- CREATE VIEW [dbo].[v_psd_constants] AS SELECT 0 AS etRetailer, 1 AS etWholesaler, 2 AS etRetailerDairy, 3 AS etWholesalerDairy -- SELECT * FROM v_Locations loc WHERE loc.ExpeditionType = (SELECT TOP(1) etRetailerDairy FROM v_psd_constants) This means we can handle renames and additions - but not removals or reordering. From an SQL performance perspective, this runs circles around using strings. -
Embarcadero working with MVPs on (some) Delphi source code
Lars Fosdal replied to Javier TarΓ's topic in Tips / Blogs / Tutorials / Videos
Nice! π -
Organizing enums
Lars Fosdal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
"Do you even SQL?" -
Organizing enums
Lars Fosdal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
You store Enums as strings in the database? -
Organizing enums
Lars Fosdal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Well, it is all about littering the code with comments like "do not remove or reorder elements" π -
Organizing enums
Lars Fosdal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Which causes problems for RTTI. -
Organizing enums
Lars Fosdal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
A pitfall with Enums is that they are so easy to change. Add another member in the middle of the list, and you have changed the ordinal value of the rest. This is fine if you only use the enumerated reference inside your application, but if you use the ordinal - f.x. when saving to/retrieving from a database, or when transmitting to another system - you get into trouble. -
Organizing enums
Lars Fosdal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Changing NA to Nada gives same result. But - adding the "unit scope" works. CommandType := ScopedEnumsWithoutT.CommandType.NA; -
Organizing enums
Lars Fosdal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Dropping the T for types in Delphi doesn't quite work for scoped types. program ScopedEnumsWithoutT; {$APPTYPE CONSOLE} {$R *.res} {$ScopedEnums ON} uses System.SysUtils; type CommandType = (NA, Whatever); type TClass = class private FCommandType: CommandType; public constructor Create; property CommandType: CommandType read FCommandType write FCommandType; end; procedure Test; begin var Instance := TClass.Create; try Instance.CommandType := CommandType.Whatever; // This is fine finally Instance.Free; end; end; { TClass } constructor TClass.Create; begin CommandType := ScopedEnumsWithoutT.CommandType.NA; // When using "unit name space" - this is fine CommandType := CommandType.NA; // [dcc32 Error] : E2018 Record, object or class type required end; begin try Test; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. -
All my method arguments start with a - regardless of if they are const, var or out.
-
A minor bug in Error Insight / Compiler messages Passing an unknown class as type parameter to a method gives multiple and slightly confusing error messages that doesn't identify the actual problem. https://quality.embarcadero.com/browse/RSP-31327
- 5 replies
-
- delphi 10.4.1
- getit
-
(and 3 more)
Tagged with:
-
https://blogs.embarcadero.com/new-getit-web-portal The portal https://getitnow.embarcadero.com/
-
We could, but we have our reasons for not doing so.
-
There are a number of libs, such as TMS, that still do not use fully qualified unit names. We removed as many aliases as possible, but could not remove them all. As for the problem being discussed - is it the same as this one: https://quality.embarcadero.com/browse/RSP-18130?filter=-2 ? Edit: We use 10.4.1 now, and although the compilation still is sluggish - we wait a lot longer for the EurekaLog linker to complete its task than we do for the actual compiling.
-
Organizing enums
Lars Fosdal replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Well, we have thousands of meaningful and reasonably obvious names (within their context) - but yeah - remembering them gets harder every year. Age takes its toll. π But - Code Insight should work whether you are assigning or passing as a parameter. Unfortunately, it has often put the enumerated values a long way down the list of candidates. We've only started using 10.4.1, so the jury is still out on this issue, but the LSP has been less than rock solid so far. -
Are we talking about MS SQL Server T-SQL - or is there a TSQL class somewhere? Regardless of which - I'd say go for FireDAC.
-
Large address space awareness. How to test properly?
Lars Fosdal replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
IMO, the > 2Gb 32-bit trick is an errorprone kludge. We are also dependent on 32-bit DLLs - but are considering going the extra length to isolate them behind an API of some sort. -
Double-dabble to convert binary to decimal
Lars Fosdal replied to Darian Miller's topic in Tips / Blogs / Tutorials / Videos
@limelect Press to insert code without having the editor destroying it. -
@Anders Melander - Would you need to clone that SVG imagelist if you need to use different sizes of icons at the same time?
-
Related: A good source of SVG icons: https://www.flaticon.com/
-
Automatically killing a service when stuck
Lars Fosdal replied to Thijs van Dien's topic in Windows API
Absolutely. But nevertheless a goal. You need to KNOW the challenges with each component, and know how to work around them. Restarting is an option, but it should be a choice, not a result of a crash. As for "A network socket that couldn't connect" - Do you have to restart your services for that reconnect to happen?