Recently I needed to do some calculations on series where getting close to zero could become a problem.
Math seems to have an Epsilon of 1E-12.
Sytem.Types has Epsilon of 1E-30 and Epsilon2 of 1E-40.
XE4+ FMX has IsEssentiallyZero and IsNotEssentiallyZero for Single values.
In practice it depends a lot on what you are doing. Sometimes absolute Epsilons are best, but at other times relative difference is much more applicable.
Then there is also a Machine Epsilon: a way to derive an Epsilon from a data type that works in all languages and platforms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Note that 15.0 (in VS2017) no longer registers itself at this registry key location, so this trick won’t simply work. vswhere is now recommended to locate MSBuild 15,
I’ve seen this question coming up a few times, and bumped into this at a client recently: the UAC dialog coming up when debugging a 32-bit executable.
This is caused (more details below) by Installer Detection Technology introduced in Windows Vista (with UAC) and tightened in more modern Windows versions.
The solution is to either:
not include Installer, Patch, Update, Upgrade, Setup, … in your EXE name
provide a correct manifest to your EXE (getting this right can be hard)
I missed this last May, but revisiting some old G+ posts I saw Allen Bauer commenting:
Current working theory of Nullable<T>.
Nullable<T> = record
...
property Value: T read FValue; default;
...
end;
Using the default directive to “hoist” the operators of “T”. Currently the default directive only works for array properties by “hoisting” the ‘[]’ operator. Marking a non-array property with default will make the containing type behave as that type.
This, coupled with some intrinsic compiler knowledge of the Nullable<T> type will make Nullable<T> work without any addition of keywords or other standard functions or procedures.
Using the “default” directive on a non-array property will work for any type, except for having the null-propagation semantics.
When considering language features, I try and not only make it work for the intended purpose, but also broaden reach of any supporting feature. In the above scenario, even user-defined operators on “T” will be properly hoisted and used.
So hopefully, one day there will me more than Nullable<T> in Spring.pas which has been around for quite a while now..
If you were in the IDE: restart the IDE and reload the project
Compile the project again
Note:
Sometimes it pays off back-porting to Delphi 2010: the generated executables are a lot smaller than more recent Delphi versions which can make a huge differenec when uploading many versions of bootstrap binaries to a version control system.
If, like Delphi XE and higher, your organise your projects to use output directories like ...Bin\Delphi####\$(Platform)\$(Config), and back-port to Delphi 2010, then
The Delphi 2010 compiler puts the files in almost the right directory ...\Bin\Delphi2010\Debug\Spring.Tests.exe
The Delphi 2010 debugger barfs with this message:
---------------------------
Error
---------------------------
Could not find program, '...\Bin\Delphi2010\%Platform%\%Config%\Spring.Tests.exe'.
---------------------------
OK
---------------------------
So you might think that it is enough to hard code this in your base configuration:
Platform=Win32
Well no, the debugger still shows the above error message. Despite the compiler putting it in the correct directory: ...\Bin\Delphi2010\Win32\Debug\Spring.Tests.exe
So there are 3 configurations for the output directory:
Base (for documentation purposes only)
Bin\Delphi2010\$(platform)\$(config)
Debug
Bin\Delphi2010\Win32\Debug
Release
Bin\Delphi2010\Win32\Release
You might think: why is Spring4D still supporting Delphi 2010?
Two simple reasons:
many people still use it
it produces relatively small executables, which still is important in some situations like producing our own Build tool and keeping binary versions of that in our version control system
I’ve a VM with many Delphi versions and want to clean up space from %ProgramData% to install more. I think somewhere in the comments it was mentioned what to delete from %ProgramData% to lessen the disk space used by Delphi installations. […]
The VM is on an SSD, and the GUID directories there total to about 50 gigabytes.So any reminder what I can delete there would be much appreciated (:
Besides saving disk space, another advantage is that you get far less duplicates when indexing your filesystem with Everything: the directories contain copies of all files also present in the final installation (like %ProgramFiles%, etc).
Thanks to Ilya S, below are my notes for cleaning up a machine that has Delphi 2007 and Delphi 2010-XE6 installed.
In these folders, backup delete all subdirectories but the directory OFFLINE. Don’t delete files. Keep the backups in case you need them.
lextm commented on Mar 9, 2017 •
vswhereis now recommended to locate MSBuild 15,https://github.com/Microsoft/vswhere
n9 commented on May 17, 2017
vswhere -products *to get standalone installation of BuildTools. (See Microsoft/vswhere#61.)