The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,839 other subscribers

Delphi books you should have or have read

Posted by jpluimers on 2015/10/08

Here is a list of books that I think any serious Delphi developer should have or have read:

  • Julian Bucknall: The Tomes Of Delphi Algorithms And Data Structures (paperback, kindle)
    • Still a classic, focussing on the why and how of algorithms. Lots of it apply even outside the Delphi field.
  • Nick Hodges: Coding in Delphi (paperback, kindle/PDF)
    • Want to learn about the newest Delphi language features? Then this book is for you. If not and still using a Delphi XE* version, then you should consider a new job.
  • Danny Thorpe: Delphi Component Design (paperback; no eBook)
    • Despite its age, it is still current: it shows you how and why many designs in the RTL are they way they are. More importantly it shows how to use these designs in your code. Even the most advanced Delphi programmers can learn a thing or two here. Many of the new RTL/VCL/FMX developers can learn far more from it.
  • Daniele Teti: Delphi Cookbook (paperback, eBook)
    • Even though it is relatively young, it is a classic example of a good how-to book with many inspiring examples on how to get a variety of things done in both regular and mobile applications.
  • Cary Jensen: Delphi in Depth: ClientDataSets 2nd Edition (paperback, PDF)
    • Although ClientDataSet is rapidly becoming obsolete in newer Delphi versions, old Delphi code benefits from ClientDataSets a lot: definitely recommended if you have to maintain an existing codebase.
  • Marco Cantù: Essential Pascal (paperback, PDF not available any more since Marco started working for Embarcadero)
  • Chris Rolliston: Delphi XE2 Foundations (paperback, kindle parts 1/2/3)
    • It covers language and non-visual things well so it is pretty version agnostic.
  • Ray Lischner: Delphi in a Nutshell (paperback, kindle)
    • It still covers the best Object Pascal language description on paper (sans modern language features like generics and anonymous methods.

There are many other Delphi books out, but most are either version specific, bound to a narrow area of topics, outdated or not well written.

–jeroen 

Posted in Uncategorized | 1 Comment »

On Epsilon, MachineEpsilon, and relative differences – via: I was wondering, that what is the closest value to the Zero floating point can have – G+

Posted by jpluimers on 2015/10/07

A long time ago, there was an interesting discussion here: I was wondering, that what is the closest value to the Zero floating point can have.

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.

–jeroen

Posted in .NET, Algorithms, C, C#, C++, Delphi, Development, Floating point handling, Software Development | 1 Comment »

Get the path to the most recent msbuild.exe from the registry.

Posted by jpluimers on 2015/10/06

Get the path to the most recent msbuild.exe from the registry:


@echo off
:: http://stackoverflow.com/questions/328017/path-to-msbuild
:: http://www.csharp411.com/where-to-find-msbuild-exe/
:: http://timrayburn.net/blog/visual-studio-2013-and-msbuild/
:: http://blogs.msdn.com/b/visualstudio/archive/2013/07/24/msbuild-is-now-part-of-visual-studio.aspx
setlocal
:vswhereModernTry
:: https://github.com/Microsoft/vswhere/wiki/Find-MSBuild
:: Normal output example of `vswhere -legacy -latest -property installationPath` has no trailing back-slash:
:: `C:\Program Files (x86)\Microsoft Visual Studio 14.0\`
for /f "usebackq tokens=*" %%i in (`vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
set InstallDir=%%i
)
:: without ENABLEEXTENSIONS, %InstallDir% is only available outside the above loop.
for %%v in (15.0, 14.0) do (
if exist "%InstallDir%\MSBuild\%%v\Bin\MSBuild.exe" (
set msBuildExe="%InstallDir%\MSBuild\%%v\Bin\MSBuild.exe"
goto :finish
)
)
:manualTry
:: order of the versions is important: get the most recent one
for %%v in (14.0, 12.0, 4.0, 3.5, 2.0) do (
for /f "usebackq tokens=2* delims= " %%c in (`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\%%v" /v MSBuildToolsPath`) do (
set msBuildExe="%%dMSBuild.exe"
goto :finish
)
)
:vswhereLegacyTry
:: -legacy is not compatible with -products or -requires
:: note there is no Visual Studio 13.0 (just like there is no Office 13.0) likely because USA superstition.
:: https://en.wikipedia.org/wiki/Microsoft_Visual_Studio#History
:: msbuild was introduced in Visual Studio 8.0: https://en.wikipedia.org/wiki/MSBuild#History
:: Legacy output example of `vswhere -legacy -latest -property installationPath` has trailing back-slash:
:: `C:\Program Files (x86)\Microsoft Visual Studio 14.0\`
for /f "usebackq tokens=*" %%i in (`vswhere -legacy -latest -property installationPath`) do (
set InstallDir=%%i
)
:: without ENABLEEXTENSIONS, %InstallDir% is only available outside the above loop.
for %%v in (14.0, 12.0, 11.0, 10.0, 9.0, 8.0) do (
if exist "%InstallDir%MSBuild\%%v\Bin\MSBuild.exe" (
set msBuildExe="%InstallDir%MSBuild\%%v\Bin\MSBuild.exe"
goto :finish
)
)
:: nothing found
:finish
endlocal & if not [%msBuildExe%]==[] if exist %msBuildExe% ( echo %msBuildExe% )


for /f "usebackq tokens=*" %%c in (`"%~dp0get-msbuildExe-path.bat"`) do (
call %%c %*
)

view raw

run-msbuild.bat

hosted with ❤ by GitHub

With help from:

Note

This needs adoption for Visual Studio 2017 (15.0) and up; see the comments at the above gist:

lextm commented on Mar 9, 2017  

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,

https://github.com/Microsoft/vswhere

n9 commented on May 17, 2017

Be sure to call vswhere -products * to get standalone installation of BuildTools. (See Microsoft/vswhere#61.)

–jeroen

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Delphi, Delphi 10 Seattle, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »

Fiber to Fiber speed beats Cable to Fiber speed by a factor 2 (all three internet connections are in the same house)

Posted by jpluimers on 2015/10/05

I’ve two fiber connections, one cable connection and one ADSL connection at home.

This is a traceroute from one fiber connection to the other over the outside network:

traceroute to snip.xs4all.nl (80.100.143.119), 64 hops max, 52 byte packets
 1  tomatortn66u (172.23.71.1)  0.951 ms  0.708 ms  0.638 ms
 2  fiber24315337241.heldenvannu.net (37.153.243.241)  1.135 ms  0.988 ms  0.974 ms
 3  rt121bb121-212-183.routit.net (212.121.121.183)  1.973 ms  1.976 ms  1.919 ms
 4  0-7-0-4-core2-a-tc1.routit.net (84.246.25.133)  2.711 ms  2.498 ms  2.517 ms
 5  0-7-0-4-core2-a-tc1.routit.net (84.246.25.133)  2.725 ms  2.674 ms  2.535 ms
 6  0-7-0-7-core4-a-tc2.routit.net (37.0.80.7)  3.048 ms  2.883 ms  2.712 ms
 7  1-2-inet1-tc2.routit.net (84.246.25.46)  2.767 ms  2.633 ms  2.514 ms
 8  ams-ix.tc2.xs4all.net (80.249.208.166)  2.676 ms  4.177 ms  2.775 ms
 9  0.ae5.xr3.3d12.xs4all.net (194.109.5.13)  2.987 ms  3.114 ms  11.387 ms
10  xe-8-1-0.dr11.xs4all.net (194.109.7.14)  6.188 ms
    xe-7-0-1.dr11.d12.xs4all.net (194.109.7.58)  3.320 ms
    xe-8-0-1.dr11.d12.xs4all.net (194.109.7.38)  3.206 ms
11  snip.xs4all.nl (80.100.143.119)  4.079 ms !X  3.960 ms !X  3.946 ms !X

This is the same but from my third connection (that will go away sooner than later): Cable.

traceroute to snip.xs4all.nl (80.100.143.119), 64 hops max, 52 byte packets
 1  www.asusnetwork.net (192.168.171.1)  1.016 ms  0.983 ms  0.938 ms
 2  * * *
 3  212.142.62.69 (212.142.62.69)  11.427 ms  8.361 ms  8.459 ms
 4  84.116.244.97 (84.116.244.97)  8.080 ms  10.405 ms  7.340 ms
 5  nl-ams09b-ri1-xe-10-2-0.aorta.net (84.116.130.22)  7.625 ms
    nl-ams09b-ri1-xe-8-0-0.aorta.net (84.116.130.2)  10.392 ms
    84.116.136.81 (84.116.136.81)  9.534 ms
 6  0.xe-1-2-0.xr1.tc2.xs4all.net (194.109.7.209)  8.315 ms  9.505 ms  9.684 ms
 7  0.ae5.xr3.3d12.xs4all.net (194.109.5.13)  9.508 ms
    0.ae4.xr4.1d12.xs4all.net (194.109.5.9)  9.565 ms
    0.ae5.xr3.3d12.xs4all.net (194.109.5.13)  9.459 ms
 8  xe-7-0-1.dr11.d12.xs4all.net (194.109.7.58)  8.547 ms  13.159 ms  9.893 ms
 9  snip.xs4all.nl (80.100.143.119)  9.710 ms !X  10.079 ms !X  8.121 ms !X

Finally there is ADSL (which will go even sooner):

snap:~ # traceroute snip.xs4all.nl
traceroute to snip.xs4all.nl (80.100.143.119), 30 hops max, 40 byte packets using UDP
 1  192.168.71.1 (192.168.71.1)  1.052 ms   0.554 ms   0.520 ms
 2  lo0.dr13.d12.xs4all.net (194.109.5.212)  17.767 ms   17.368 ms   17.123 ms
 3  1423.ae3.xr4.1d12.xs4all.net (194.109.7.137)  16.901 ms 1418.ae3.xr4.1d12.xs4all.net (194.109.7.17)  16.628 ms 1323.ae3.xr3.3d12.xs4all.net (194.109.7.141)  16.354 ms
 4  xe-8-1-0.dr11.xs4all.net (194.109.7.14)  15.961 ms xe7-0-0.dr11.d12.xs4all.net (194.109.7.170)  15.762 ms xe-8-1-0.dr11.xs4all.net (194.109.7.14)  15.283 ms
 5  snip.xs4all.nl (80.100.143.119)(N!)  15.914 ms (N!)  16.171 ms (N!)  15.710 ms

Cable is about twice as slow than Fiber.

ADSL is about three times as slow than Fiber.

–jeroen

Posted in fiber, Fritz!, Fritz!Box, Internet, Power User, routers, TomatoUSB | Leave a Comment »

Solution for My 6th generation nano plays same song over and over and will not suffle songs – via Apple Support Communities

Posted by jpluimers on 2015/10/05

Solution for:

My 6th generation nano plays same song over and over and will not shuffle songs or play them like it is supposed to skipping to next song. What do i need to do to get it back to normal?

peter’d in response to Karrojava:

If you have that second Nano, the one that is 1 3/4 inches, perfectly square, and your song is playing over and over, you need to put your finger on the double arrows that move to next song and swipe left. You’ll get the screen with the repeat loop, the genius icon and the shuffle icon and you’ll see that the repeat loop has a 1 showing. Just touch it and the one will disappear. It took me an hour to figure this out and I even got it twice and couldn’t figure out what I did. It isn’t in the current Nano instructions as the newer ones have easier access to these icons.

This is the sequence of screens from iPod nano in delhi | iPad in delhi | HP Laptop in delhi | Samsung Notebook | Chirag Desktop | Gaming Headphone | Apple, MAC Computers | VHS INFOTECH PVT. LTD.:

Playing song Playing song: swipe, then Repeat count; Genius; Shuffle mode Repeat count; Genius; Shuffle mode.

Note: this iPod doesn’t auto-roate so you use two fingers to rotate it 90 degrees on any screen

Rote the screen: use two fingers. Rote the screen:  Use two fingers to rorate the screen. Use two fingers to rorate the screen.

–jeroen

via

Posted in Apple, iPod, iPod Nano, Power User | Leave a Comment »

OnePlus One battery drain: 5.0 lollipop – Android 5.0 display keeps turning on with black and white notifications – Android Enthusiasts Stack Exchange

Posted by jpluimers on 2015/10/02

This was a huge battery drain for mmy Oneplus One running CM12: 5.0 lollipop – Android 5.0 display keeps turning on with black and white notifications – Android Enthusiasts Stack Exchange.

Posted in Android Devices, OnePlus One, Power User | Leave a Comment »

Merging Google Contacts URL

Posted by jpluimers on 2015/10/02

For my link archive: https://contacts.google.com/u/0/preview/merge

Posted in Google, GoogleContacts, Power User | Leave a Comment »

Pruning your Windows 7+/Server 2008 R2+ installations and huge files in %windir%\Logs\CBS

Posted by jpluimers on 2015/10/02

This applies to at least these versions when you run them under at least VMware Fusion or Workstation:

  • Windows 7
  • Windows 8
  • Windows 8.1
  • Windows Server 2008 R2

Often this folder get huge: %windir%\Logs\CBS (normally C:\Windows\Logs\CBS)

I’ve successfully compressed the content, but even though it is text, they don’t compress that well.

Some reports indicate you can safely delete them when there is nothing wrong with your system nor with Windows Update:

So that’s what I’m going to try next.

Later: done the below on an UAC (Administrator) command prompt.

Cleanup CBS via [WayBack] Gin answering at [WayBackwindows 8 – Why is CBS.log file size 20 GB – Super User::

net stop TrustedInstaller
del %windir%\Logs\CBS\CBSPersist*.*
net start TrustedInstaller

Then I did this to cleanup the C:\Windows\SoftwareDistribution\DataStore\DataStore.edb file via [WayBack] Gin at [WayBackwindows 8 – Why is CBS.log file size 20 GB – Super User:

net stop wuauserv
net stop bits
esentutl.exe /d %windir%\SoftwareDistribution\DataStore\DataStore.edb
CleanMgr
reboot

The reboot will restart the stopped services.

–jeroen

Posted in Power User, Windows, Windows 7, Windows 8, Windows 8.1, Windows Server 2008 R2 | Leave a Comment »

NUnit XSD for verification and XML to HTML conversion

Posted by jpluimers on 2015/10/01

Of course NUnit will emit NUnit compatible XML, but other tools do too.

To verify if such XML is indeed compliant to the NUnit standard, there is an XML Schema for it which – at the time of writing – the latest version was here:

http://www.nunit.org/docs/2.6.4/files/Results.xsd

Many CI tools map the resulting XML into some form of output. To get HTML output, XSLT is a logical choice, but there are other means too. Here are a few links to get started converting the output:

–jeroen

Posted in Agile, Development, Software Development, Unit Testing | Leave a Comment »

Visual Studio: Zoom Out when ReSharper has captured Ctrl+Shift+,

Posted by jpluimers on 2015/09/30

ReSharper has a whole set of nice keyboard shortcuts, which includes Ctrl + Shift + , for View Recent Edits.

This overwrites the Zoom Out half of the default Visual Studio zoom keyboard shortcuts (thanks Carlos Muñoz):

Ctrl + Shift + . to zoom in and Ctrl + Shift + , to zoom out.

They don’t keep an alternative for Zoom Out, and unlike most tools I know that allow for zooming, there is no keyboard accessible menu entry for Zoom Out in Visual Studio.

So you have to use your mouse to go in the lower left of your editor window in order to Zoom Out (thanks ashteele for putting that in an SO question):

Zoom percentage in the lower left of your Visual Studio editor Window

Or you can reconfigure the old shortcut (thanks Aaron Ransley):

through Tools -> Options -> Environment -> Keyboard and map “View.ZoomIn” and “View.ZoomOut

–jeroen

Posted in .NET, Development, Software Development, Visual Studio 11, Visual Studio 2010, Visual Studio 2013, Visual Studio 2014, Visual Studio and tools | Leave a Comment »