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 September, 2019

GExperts: Copy Component Names

Posted by jpluimers on 2019/09/17

Sometimes your toolbox can already things you forgot it could: [Archive.is] GExperts Help.

Via:

–jeroen

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

Delphi: when calling TThread.Synchronize, ensure the synchronised method handles exceptions

Posted by jpluimers on 2019/09/17

Since about a decade, TThread has a few overloaded [WayBack] Synchronize methods which all allow some specified synchronised method to run in the context of the main thread:

Any exceptions raised in that methods are caught using [WayBackSystem.AcquireExceptionObject and re-raised in the calling thread.

If that happens, you loose a piece of the stack information. I knew that, but found out the hard way that it does because I had to hunt for bugs through inherited code written by people that did not know.

This was part of the stack trace that code would show during an exception:

Exception EAccessViolation at $004D732F: Access violation at address $00409174 in module ''.....exe''.
Read of address 80808080
StackTrace:
(000D632F){.....exe} [004D732F] System.Classes.TThread.Synchronize$qqrp41System.Classes.TThread.TSynchronizeRecordo (Line 14975, "System.Classes.pas" + 40) + $0
(000D6430){.....exe} [004D7430] System.Classes.TThread.Synchronize$qqrxp22System.Classes.TThreadynpqqrv$v (Line 15007, "System.Classes.pas" + 9) + $A
(005D6E61){.....exe} [009D7E61] IdSync.DoThreadSync$qqrp18Idthread.TIdThreadynpqqrv$v (Line 281, "IdSync.pas" + 21) + $6
(005D6E87){.....exe} [009D7E87] IdSync.TIdSync.SynchronizeMethod$qqrynpqqrv$v (Line 326, "IdSync.pas" + 2) + $8

Exception EAccessViolation at $00409174: Access violation at address $00409174 in module ''.....exe''. Read of address $80808080 with StackTrace
(00008174){.....exe} [00409174] System.@IsClass$qqrxp14System.TObjectp17System.TMetaClass + $C

The first exception has a different address than the one in the exception message.

Which means that you miss the whole stack path to the _IsClass call (the underlying method implementing the as keyword) that the actual exception was initiated at.

And yes: the $80808080 is the FastMM4 marker for freed memory, so this was a use-after-free scenario.

A simple wrapper like this using a central logging facility gave much more insight in the actual cause:

procedure RunLoggedMethod(AMethod: TMethod);
begin
  try
    AMethod();
  except
    on E: Exception do
    begin
      Logger.LogExceptionDuringMethod(E, AMethod);
      raise; // mandatory to stay compatible with the old un-logged code
    end;
  end;
end;

Then call it like this inside a thread descendant:

Synchronize(RunLoggedMethod(MethodToRunInMainThread));

The old code was like this:

Synchronize(MethodToRunInMainThread);

This was quite easy to change, as I already had boiler code around exported DLL functions that had a similar construct (without the raise; as exceptions cannot pass DLL boundaries unless very specific circumstances hold).

Similar methods are needed to encapsulate procedure TIdSync.Synchronize(), procedure TIdSync.SynchronizeMethodprocedure TIdThread.Synchronize(Method: TThreadMethod) and [WayBack] Queue overloads:

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | 1 Comment »

Route traffic from one port via VPN – MikroTik

Posted by jpluimers on 2019/09/16

For my link archive: [WayBack] Route traffic from one port via VPN – MikroTik

Via [WayBack] networking – Mikrotik route internet traffic from one interface via vpn – Super User

–jeroen

Posted in Internet, MikroTik, Power User, routers | Leave a Comment »

Eigenes DynDNS mit Bind und Apache – CupRacer.de

Posted by jpluimers on 2019/09/16

Dieser Artikel beschreibt, wie man einen eigenen Mechanismus für DNS-Updates als DynDNS-Alternative aufbaut.

Translated:

This article describes how you can create your own mechanism for DNS-updates as alternative for DynDNS.

Interesting read: [WayBackEigenes DynDNS mit Bind und Apache – CupRacer.de

Edit

The above post disappeared, but this one (which adds calling the DynDNS server from a Fritz!Box) is still up: [WayBack] Eigener DynDNS mit Bind, Apache und PHP | onderka.com with an update at [WayBack] Eigener DynDNS mit dnsmasq, Apache und PHP | onderka.com.

Source code for both:

Related and background reading:

–jeroen

Posted in *nix, bind-named, Linux, openSuSE, Power User, SuSE Linux, Tumbleweed | Leave a Comment »

Blast from the TomsHardware past – Stress Test: Power Supplies Under Full Load

Posted by jpluimers on 2019/09/16

Blast form the past, as I just found out I had archived the (moved) pages where the original link wasn’t:

We put PC power supplies from 300 to 850 watts under continuous load to see if they can satisfy the power appetite of potent Athlon and P4 systems. Are they efficient and stable? Click into the THG Laboratory to find out!

Sources: the “Stress Test: Power Supplies Under Full Load” series:

The original page was not archived (likely because they dislike WayBack), but linked from [WayBack] Using PC power supplies in things other than PCs which I linked to in Convert/adapt an old ATX Power Supply into a Bench Power Supply with (or without) 3D Printed Parts

Note that [Archive.is] Data Collection And Live Upload refers to the – now gone – Inadequate and Deceptive Product Labeling : Comparison of 21 Power Supplies , which I found back as well:

In spite of the high end-user retail prices, our lab technicians were surprised by the test results. No fewer than 6 power supplies struggled under full load: 3 of the candidates simply went up in smoke, while the other 3 shut down prematurely. The “black sheep” among all the test participants was Maxtron, with the TOP-520P4. According to the manufacturer’s specifications, this power supply is represented to be capable of withstanding 520 watts – divided up over the corresponding voltage ranges. However, in our test, it ceased working at 446 watts. Completely dead!

–jeroen

Posted in Hardware, PC PSU, Power User, PSU | Leave a Comment »

Crowdsourcing App-Translation with in-app message – Christoph Wiesner – Medium

Posted by jpluimers on 2019/09/13

Interesting approach on how a free app got itself free translations: Case Study on engaging users to become app translators

Source: [WayBackCrowdsourcing App-Translation with in-app message – Christoph Wiesner – Medium

The app: Visual Timer – Countdown

Platforms used:

  • Firebase is Google’s mobile platform that helps you quickly develop high-quality apps and grow your business.Source: Firebase
  • POEditor is an online localization management tool, perfect for collaborative or crowdsourced translation projects. Translate websites, apps, games and more!Source: Software Localization Management Platform

Via:

–jeroen

 

Posted in Android Devices, Development, internatiolanization (i18n) and localization (l10), Power User, Software Development | Leave a Comment »

How to start up your Mac in Internet Recovery Mode

Posted by jpluimers on 2019/09/13

When all else fails: [WayBackHow to start up your Mac in Internet Recovery Mode.

Command-Option-R is one of the plethora of keyboard tricks you can use during boot:

Some Mac features are available by holding down certain keys during startup.

[WayBackStartup key combinations for Mac – Apple Support

 

Hold during startup Description
Shift ⇧ Start up in Safe Mode.
Option ⌥ Start up to Startup Manager.
C Start up from a bootable CD, DVD, or USB thumb drive (such as OS X install media).
D Start up to either Apple Hardware Test or Apple Diagnostics, depending on which Mac you’re using.
Option-D Start up to either Apple Hardware Test or Apple Diagnostics over the Internet.
N Start up from a compatible NetBoot server.
Option-N Start up from a NetBoot server using the default boot image.
Command (⌘)-R Start up from OS X Recovery.
Command-Option-R Start up from OS X Recovery over the Internet.
Command-Option-P-R Reset NVRAM. Release the keys after you hear the startup sound again.
Command-S Start up in single-user mode.
T Start up in target disk mode.
X Start up from an OS X startup volume when the Mac would otherwise start up from a non-OS X startup volume.
Command-V Start up in verbose mode.
Eject (⏏), F12, mouse button, or trackpad button Eject removable media, such as an optical disc.

Read the rest of this entry »

Posted in Apple, Mac, Mac OS X / OS X / MacOS, MacBook, MacBook Retina, MacBook-Pro, OS X 10.11 El Capitan, OS X 10.9 Mavericks, Power User | Leave a Comment »

Happy Day of the Programmer!

Posted by jpluimers on 2019/09/13

Enjoy your day and [WayBack] Good Questions — Geek&Poke; [WayBack] The art of programming — Geek&Poke

 

 

 

–jeroen

Related: Happy Day of the Programmer! 2018

Posted in Development, Software Development | Leave a Comment »

What went wrong with the IT industry? Some interesting thoughts on other industries coping with complexity…

Posted by jpluimers on 2019/09/12

[WayBack] What went wrong with the IT industry? Well, maybe the same as what happened in other industries that deal with complexity. We maybe beat ourselves up to… – James Coplien – Google+ is on my list of videos to watch.

–jeroen

Read the rest of this entry »

Posted in Development, Software Development, Systems Architecture | Leave a Comment »

Delphi / Stefan Glienke: I looked into IntroSort … and the Microsoft implementation … Here is my current implementation

Posted by jpluimers on 2019/09/12

For my link archive: [WayBack] Delphi / Stefan Glienke: I looked into IntroSort … and the Microsoft implementation … Here is my current implementation

[WayBackDelphi IntroSort by Stefan Glienke

–jeroen

https://bitbucket.org/snippets/sglienke/64LG6b/introsort

 

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