Interesting, need to try this one day to see how well this works so the base constructor TObject.Create cannot be called.[WayBack] delphi – How to hide the inherited TObject constructor while the class has overloaded ones? – Stack Overflow
–jeroen
Posted by jpluimers on 2019/07/18
Interesting, need to try this one day to see how well this works so the base constructor TObject.Create cannot be called.[WayBack] delphi – How to hide the inherited TObject constructor while the class has overloaded ones? – Stack Overflow
–jeroen
Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »
Posted by jpluimers on 2019/07/08
+Stefan Glienke at EKON21:
I don’t count sheep, I count references.
Response from +Roald van Doorn:
When you reach -1 you wake up from a nightmare.
Source: [WayBack] Jeroen Wiert Pluimers – G+
Posted in Conferences, EKON, Event, Fun, Quotes, T-Shirt quotes | Leave a Comment »
Posted by jpluimers on 2019/06/13
Out of the box, Delphi does not support record properties because of two lacking features:
Paul Toth worked around both at [WayBack] DelphiTips/RecordProperty at master · tothpaul/DelphiTips · GitHub
He uses an intermediate helper where he redirects the get/set methods to from a property registration call.
Note that in the past, Pieter Zijlstra did a similar thing, but bumped into a Delphi 2010 problem where the status indicates it is till open: [WayBack] QualityCentral: 77635 – Open – The new RTTI of D2010 causes components with published record properties to fail to stream in.
Source: Yes ! I’ve published a Record property it could be nice to have this feature…
Via: [WayBack] Yes ! I’ve published a Record property it could be nice to have this feature in Delphi, but we need RTTI for record properties to simplify the code (an… – Paul TOTH – Google+
–jeroen
Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »
Posted by jpluimers on 2019/06/12
For my archive: [WayBack/Archive] Cyclomatic Complexity of switch case statement – Stack Overflow.
Ultimate reference: [WayBack/Archive] NIST Special Publication 500-235: Structured Testing: A Testing Methodology Using the Cyclomatic Complexity Metric
Via: [WayBack/Archive] I have a question regarding Cyclometric Complexity… IF versus CASE… – David Hoyle – Google+
–jeroen
Posted in .NET, C#, Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »
Posted by jpluimers on 2019/05/23
Most code I come across is in the red zone, exactly depicting why you want immutable constructs. Immutable constructs will never end-up in the red zone.
Image: [WayBack] Wayback Machine.
The red zone is just one quadrant on the mutability/shareability diagram and getting outside that red zone quadrant is key.
With processor cores now becoming ubiquitous: you cannot get outside of the “Shard” half, so you have to get outside of the “Mutable” half.
Explaining the why and how, is part of a few presentations that Kevlin Henney gave:
Related YouTube videos are below.
–jeroen
Posted in Conference Topics, Conferences, Development, Event, Multi-Threading / Concurrency, Software Development | Leave a Comment »
Posted by jpluimers on 2019/05/23
Interesting thread that reminded me of the relatively new FastMM feature to track down lock contention and cope with it using release stacks:
[WayBack] I try use FastMM4 to tracking bottleneck in allocating memory. I was inspired by this Primož movie: https://www.youtube.com/watch?v=p-5mJyXvmrc When I… – Jacek Laskowski – Google+
The changes by Primož have added these two new conditional defines to the FastMM4 codebase:
LogLockContentionUseReleaseStack (note this option was not documented in FastMM4Options.inc)These options are mutually exclusive.
This was the original post it got introduced in [WayBack] The Delphi Geek: Finding Memory Allocation Bottlenecks with FastMM4 and merged into the main repository.
FastMM introduction: [WayBack] The New Memory Manager In BDS 2006 – by Pierre le Riche.
It also taught me about [WayBack] RAMDisk – Software that Accelerates, Protects, Optimizes – Server Memory Products & Services – Dataram.
Primož stores his DCU files there: much faster than SSD, and far less wear on your SSD; see https://youtu.be/p-5mJyXvmrc?t=2675
–jeroen
Posted in Conference Topics, Conferences, Delphi, Development, Event, FastMM, Software Development | Leave a Comment »
Posted by jpluimers on 2019/05/22
Thanks Ondrej Kelle for answering this:
uses
System.SysUtils,
Web.HTTPApp,
Soap.WebBrokerSOAP;
function TTest.CallMe: string;
var
WebDispatcher: IWebDispatcherAccess;
begin
Result := '';
if Supports(GetSOAPWebModule, IWebDispatcherAccess, WebDispatcher) then
Result := Format('You are calling me from: %s', [WebDispatcher.Request.RemoteIP]);
end;
Source: [WayBack] web services – Accessing the original TWebRequest object in a Delphi SOAP Server – Stack Overflow
–jeroen
Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »
Posted by jpluimers on 2019/05/15
One more thing to take away from Procedural Programming: It’s Back? It Never Went Away – Kevlin Henney [ACCU 2018] – YouTube was explained in [WayBack] How to Design Early Returns in C++ (Based on Procedural Programming) – Fluent C++.
Though in C++, it applies to all programming languages that stem from a procedural background (Pascal, C#, Java, golang, to name just a few).
The article is about keeping an if/else-if/else tree, even when they can be removed becomes some of their bodies perform an early return, as
In C++, as well as in other languages, the
returnkeyword has two responsibilities:
- interrupting control flow,
- yielding a value.
It basically comes down to this argument:
Essentially, the argument for Code #1 is that you need to know less to understand the structure of the code.
Indeed, if we fold away the contents of the if statements, Code #1 becomes this:
1234567 bool isLeapYear(int year){if (year % 400) { ... }else if (year % 100) { ... }else if (year % 4) { ... }else { ... }}The structure of the code is very clear. There are 4 different paths based on the
year, they’re independent from each other, and each path will determine the boolean result of the function (if it doesn’t throw an exception).Now let’s see how Code #2 looks like when we fold away the if statements:
12345678 bool isLeapYear(int year){if (year % 400) { ... }if (year % 100) { ... }if (year % 4) { ... }return false;}And now we know much less. Do the if statements contain a
return? Maybe.Do they depend on each other? Potentially.
Do some of them rely on the last
return falseof the function? Can’t tell.With Code #2, you need to look inside of the if statement to understand the structure of the function. For that reason, Code #1 requires a reader to know less to understand the structure. It gives away information more easily than Code #2.
–jeroen
via [WayBack] Kevlin Henney – Google+: How to Design Early Returns in C++ (Based on Procedural Programming) – Fluent C++
Posted in .NET, C, C#, C++, Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »
Posted by jpluimers on 2019/05/07
I hope that by now they are available for more Delphi versions:
Some other posts around the Debug Visualiser topic:
–jeroen
Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »
Posted by jpluimers on 2019/05/02
A while ago I found out the [WayBack] not maintained status · hgourvest/superobject@f1c42db · GitHub.
This means you should not use the [WayBack] superobject JSON library in Delphi any more: there won’t be any fixes.
Many people use it, especially because it used to be much more stable than the built-in JSON support of Delphi.
One breaking issue in superobject is the lack of large address space support: due to the pointer calculations in various places, it does not support pointers above the 2 gibibyte boundary as filed in the 2016 [WayBack] Issues with {$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} · Issue #22 · hgourvest/superobject · GitHub
This gives problems in at least this case:
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} (in older Delphi 7 through 2006 also versions this was {$SetPEFlags $20})HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Memory Management value AllocationPreference to hex value 00100000{$define AlwaysAllocateTopDown} settingExample registry file and batch file to enable top-down memory (reboot afterwards):
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management] "AllocationPreference"=dword:00100000
Command to view:
reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" | findstr "AllocationPreference"
Command to enable:
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v AllocationPreference /t REG_DWORD /d 00100000 /f
Command to disable:
reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v AllocationPreference /f
Be very very very careful with this, and by enabling Large Address Aware to your executables, as many times they can load 3rd party libraries that often are beyond your control.
Even if there is a slight chance that your code is being used with Large Address Aware enabled, then follow guidelines line in [WayBack] windows – Unit Testing for x86 LargeAddressAware compatibility – Stack Overflow
Summary of [WayBack] memory – Drawbacks of using /LARGEADDRESSAWARE for 32 bit Windows executables? – Stack Overflow:
blindly applying the
LargeAddressAwareflag to your 32bit executable deploys a ticking time bomb!by setting this flag you are testifying to the OS:
yes, my application (and all DLLs being loaded during runtime) can cope with memory addresses up to 4 GB.
so don’t restrict the VAS for the process to 2 GB but unlock the full range (of 4 GB)”.but can you really guarantee?
do you take responsibility for all the system DLLs, microsoft redistributables and 3rd-party modules your process may use?
Edit 20240628
Earlier this year, the SuperObject Delphi library got archived on GitHub. Definitely unmaintained: [Wayback/Archive] GitHub – hgourvest/superobject: This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
The XSuperObject library mentioned below in a comment has not been maintained for 4 years either ( [Wayback/Archive] GitHub – onryldz/x-superobject: Delphi Cross Platform Rapid JSON: “vkrapotkin Now ParseFromFile can read UTF8-BOM files (#136) 2d3ec01 · 2020-12-09”), so I wonder what alternatives are still available.
--jeroen
Posted in Conference Topics, Conferences, Delphi, Development, EKON, Event, Software Development | 4 Comments »