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,860 other subscribers

Archive for December, 2019

Amazon contact URLs: USA, UK, DE, ES

Posted by jpluimers on 2019/12/27

For my link archive.

Most offer live chat, but not all of them offer that around the clock.

–jeroen

Posted in LifeHacker, Power User | Leave a Comment »

Delphi: Why is there no class procedure TArray.Sort(Keys: array of T; var Values: array of T; const Comparer: IComparer);

Posted by jpluimers on 2019/12/26

The underlying question at [WayBack] … Does anyone know of any array sort method similar to this for Delphi (with the two array parameters, key and value with a comparer method) … – Ugochukwu Mmaduekwe – Google+ was basically this:

Why is there no
class procedure TArray<T>.Sort(Keys: array of T; var Values: array of T; const Comparer: IComparer<T>); overload;

From my answer:

No it is not there as the method that does the actual sort does not accommodate for it:

class procedure TArray.QuickSort<T>(var Values: array of T; const Comparer: IComparer<T>; L, R: Integer);

You could write a helper for it so that similarly to C#, they all end in public static void Sort(Array keys, Array items, int index, int length, IComparer comparer)

In case you need to look at the external TrySZSort: https://github.com/dotnet/coreclr/blob/master/src/classlibnative/bcltype/arrayhelpers.cpp#L268

In other cases, C# uses an IntrospectionSort implemented at

Or you could try to use this overload of TArray.Sort Method (array of T):

class procedure Sort<T>(var Values: array of T; const Comparer: IComparer<T>); overload;

It was introduced in Delphi 2009.

Your Comparer then needs to extract the key of each element and implement IComparer<T>.

However, this will never sort the Keys array.

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

Sasha Laundy on Twitter: “The best debugger ever made is a good night’s sleep.”

Posted by jpluimers on 2019/12/26

Very similar to “you get the best ideas while sleeping“:

[WayBack/Archive.isSasha Laundy on Twitter: “The best debugger ever made is a good night’s sleep.”

Via: [WayBack] So true it hurts – CodeProject – Google+

For me, taking a shower and contemplating during a commute are good debuggers too. But sleeping is still the best.

Hope you enjoyed Christmas, good luck on your debugging ventures!

–jeroen

Posted in Debugging, Development, Fun, Quotes, Software Development | Leave a Comment »

Delphi 10.1.2 Berlin: after ….

Posted by jpluimers on 2019/12/25

For my archive: [WayBack] Bummer, a big showstopper with Berlin 10.1.2: an object with an indexed property getter crashes the debugger! Please +Marco Cantù we need a fix for this… – André Mussche – Google+

When debugging and adding a watch on a property:

  1. ‘Function to be called, xxxx, was eliminated by linker’
  2. ‘Assertion failure: “!e32->evalArgs.evalFCallPending”
    in ..\win32src\proc32.cpp at line 1830’

It was fixed in 10.2 Tokyo: [RSP-16522] property getters with index can’t be viewed in the debugger and crashes! – Embarcadero Technologies

–jeroen

Posted in Delphi, Delphi 10.1 Berlin (BigBen), Development, Software Development | Leave a Comment »

Flexible and Economical UTF-8 Decoder

Posted by jpluimers on 2019/12/25

For my link archive: [Archive.is] Flexible and Economical UTF-8 Decoder.

Be sure to read the whole article there as the explanation of the initial algorithm is important and final algorithm is towards the end.

The foundation is a state machine combined with a lookup table to find the initial state and proceed to subsequent states.

Related (and reminder to check what David did):

–jeroen

Read the rest of this entry »

Posted in C, C++, Delphi, Development, Software Development | 1 Comment »

Pythonic

Posted by jpluimers on 2019/12/24

When learning Python, one of the terms to get used to is Pythonic, basically shorthand for a loosely defined idiomatic Python way of writing code.

Some links to help you get a feel for this:

Sometime, I am going to dig into learning how to write Pythonic code for merging and joining dictionaries (preferably those of namedtuple entities). Hopefully these links will help me with that:

–jeroen

Posted in Development, Python, Software Development | Leave a Comment »

Idea: managing a garage door with a modified Marantec switch, some sensors and Raspberry Pi

Posted by jpluimers on 2019/12/24

Some links to get this idea going, incomplete, as I have not yet included Domoticz or OpenHAB links:

I will likely need:

  • some optocouplers to decouple GPIO pins from the Marantec switch and sensors
  • sensors for detecting current state: open/closed/opening/closing/obstructed

Warning on selecting GPIO pins:

When the Raspberry Pi reboots GPIO pins are reset to their default state. This can cause your garage door to open without you issuing a command. Please make sure you pick the correct pins so that you don’t accidentally have your garage door opening after a power loss.

The following pins are pulled HIGH (they output a 3.3 volt signal) on reboot:

  • GPIO0/2
  • GPIO1/3
  • GPIO4
  • GPIO7
  • GPIO8

GPIO14 is configured as a Serial Transmit line, so avoid choosing that pin.

All other pins are pulled LOW (they have a 0 volt signal, same as GND).

If your relay triggers when the GPIO pin goes LOW, then pick a pin that starts out HIGH on reboot. If your relay triggers with the GPIO PIN goes HIGH then pick a GPIO pin that starts out LOW on reboot.

–jeroen

Posted in Development, Hardware Development, Hardware Interfacing, Raspberry Pi | Leave a Comment »

Delphi and generics: some examples of “E2015: Operator not applicable to this operand type”

Posted by jpluimers on 2019/12/24

I don’t have enough time right now to elaborate on the code, so below is a an example of where I bumped into the very non-descriptive [WayBack/Archive.is] E2015: Operator not applicable to this operand type when using generics in Delphi.

Most have to do with comparing types (one of which is similar to comparing interfaces where you need to have a GUID in order to get an as comparison working, see Source: Delphi – Using FastMM4 part 2: TDataModule descendants exposing interfaces, or the introduction of a TInterfacedDataModule).

Like most post-Delphi 2007 language features in Delphi, generics still have rough edges. I doubt this will change anytime soon and I am not alone in this.

The documentation never got update to cover situations involving generics ([Archive.is] E2015 Operator not applicable to this operand type (Delphi) – RAD Studio), so basically this to show some examples you might bump into as well.

Note the code below usually is an indication of code-smell, as was the more elaborate situation I had to use it in. A long term solution for that code was to introduce more polymorphism.

A shorter term solution involves either the use of local variables or type-casting (for the latter, see [WayBack] delphi – Cannot compile constrained generic method – Stack Overflow)

–jeroen

Read the rest of this entry »

Posted in Delphi, Development, Software Development | Leave a Comment »

Michel Portasse auf Twitter: “Daarom:… “

Posted by jpluimers on 2019/12/23

Via [WayBack] Rianne Meijer on Twitter: “U hebt nog week om over te stappen van zorgverzekeraar, bij voorkeur naar eentje zonder omzetplafond Power to the patienten en de zorgverleners… “

[WayBack] Michel Portasse onTwitter: “Daarom:… “

Read the rest of this entry »

Posted in LifeHacker, Power User | Leave a Comment »

Top 2000 café 2019 – Alle informatie op een rij – NPO Radio 2 – Presentatoren, producers/sidekicks, nieuwslezers en tijden

Posted by jpluimers on 2019/12/23

Een overzicht van alles wat ik via de Top2000 site en Twitter bij elkaar geschraapt heb.

Edit 20190228

  • (Dank René Gerritsen): Stefan Stasse ziek, Annemieke Schollaardt zijn zijn slot, en Emmely de Wilt in het slot van Annemieke, Timur in het slot van Stefan op 26 december.
  • (Dank Matijn Nijhuis): Matijn’s Quiz op 27 en 29 december in de Top 2000 Tent
  • (Dank Moon/Caroline: Caroline Brouwer is toch terug van vakantie)

Edit 20190229; wachttijden: [WayBack] Top 2000 Cafe | Beeld en Geluid 

Tijdschema

Start Eind DJ Sidekick/Producer Sidekick Twitter Twitter Twitter Nieuwslezer Twitter
8:00 9:00 Jan-Willem Roodbeen Jeroen Kijk in de Vegte @JWRoodbeen @jeroenkidv Carmen Verheul @carmenverheul
9:00 10:00
10:00 11:00 Bart Arens @BartRadio2
11:00 12:00
12:00 13:00 Gijs Staverman @GijsStaverman
13:00 14:00 Matijn Nijhuis @matijn
14:00 15:00 Rob Stenders Caroline Brouwer @robstenders @radiocarol
(toch niet op vakantie)
15:00 16:00
16:00 17:00 Ruud de Wild Cielke Sijben

Georgina Gulsen

Thijs Maalderink

Gijs Hakkert

@ruuddewild @CielkeSijben
is vervangen door 

@GeorginaGulsen
@OnwijsThijs
@GijsHakkert
17:00 18:00
18:00 19:00 Wouter van der Goes @woutervdgoes
19:00 20:00
20:00 21:00 Annemieke Schollaardt
(vervangt Stefan Stasse)
Nathan Tamis @Annemiekeishere @NathanTamis Wouter Walgemoed @wouwal
21:00 22:00
22:00 23:00 Paul Rabbering @paul_rabbering
23:00 24:00
0:00 1:00 Leo Blokhuis @LeoBlokhuis Nachtlezer
1:00 2:00
2:00 3:00 Rick van Velthuysen @rickvanv
3:00 4:00
4:00 5:00 Frank van ’t Hof @frankvanthof
5:00 6:00
6:00 7:00 Emmely de Wilt @EmmelydeWilt
7:00 8:00 Carmen Verheul @carmenverheul

 

Matijn’s quiz in de top 2000 tent:

  • 27 december 09.15 – 10.00 uur (Vrijdag)
  • 29 december 09.15 – 10.00 uur (Zondag)

Bronnen:

–jeroen

Read the rest of this entry »

Posted in History, LifeHacker, Personal, Power User | Leave a Comment »