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

Archive for 2019

LED Voltage Drops

Posted by jpluimers on 2019/09/19

[WayBackDangerous Prototypes: Basic Light Emitting Diode guide – Voltage drop or forward voltage has a nice table of common LED types:

You can also measure them yourself using most multi-meters have setting for that as described in [WayBack] Easy way to figure out a LED’s Vf in order to pick an appropriate resistor – Electrical Engineering Stack Exchange

You can also measure yourself, but my Proster VC99 multi-meter (cheap, but functions well, see for instance the review in [WayBack] MagPi issue 43) can measure voltage drop, so I’ve measured some LEDs from old PC cases:

  • Red: 1.8 V
  • Yellow: 1.8 V
  • Green: 1.8 V
  • Blue: does not measure

Given that they all have the same voltage drop, I made the below table with some resistor values to get the same current through them on various voltages (3.3V, 5V and 12V) based on Standard resistor values.

Note anything less than 20mA of current usually is OK (though 20mA often is on the bright side).

LED Colour Voltage drop (Vf) Total Voltage Remaining Voltage Resistance Ω Current mA Power mW
Any 1.8 5 3.2 220 14.55 46.55
Any 1.8 12 10.2 680 15.00 153.00
Any 1.8 3.3 1.5 100 15.00 22.50
Any 1.8 5 3.2 330 9.70 31.03
Any 1.8 12 10.2 1000 10.20 104.04
Any 1.8 3.3 1.5 150 10.00 15.00
Any 1.8 5 3.2 470 6.81 21.79
Any 1.8 12 10.2 1500 6.80 69.36
Any 1.8 3.3 1.5 220 6.82 10.23

Background for doing these calculations:

–jeroen

Read the rest of this entry »

Posted in Development, Hardware Development | Leave a Comment »

Product Discovery Anti-Patterns Leading to Failure

Posted by jpluimers on 2019/09/19

Learn more about the product discovery anti-patterns that can manifest themselves when you try to fill Scrum’s product discovery void. #agileantipatterns #productdiscovery #productroadmap

Source: [WayBackProduct Discovery Anti-Patterns Leading to Failure

Via: [WayBack] Product Discovery Anti-Patterns Leading to Failure – Marjan Venema – Google+

–jeroen

 

Posted in Agile, Development, Scrum, Software Development | Leave a Comment »

GitHub – ultraware/DelphiGrpc: DelphiGrpc is a Delphi implementation of the realtime and streaming gRPC protocol (http://grpc.io).

Posted by jpluimers on 2019/09/18

For my link list: [WayBack] GitHub – ultraware/DelphiGrpc: DelphiGrpc is a Delphi implementation of the realtime and streaming gRPC protocol (http://grpc.io).

The following libraries are used:

Via [WayBack] Interesting finding today – DelphiGrpc – a grpc.io implementation in Delphi – Edwin Yip – Google+

–jeroen

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

Why prod is down…

Posted by jpluimers on 2019/09/18

From [WayBack] imgur: Why Prod is Down

Downloads:

Via:

–jeroen

Read the rest of this entry »

Posted in Agile, Cloud, Cloud Development, Development, Infrastructure, Software Development | Leave a Comment »

PyGotham keynote: The Other Async (Threads + Async = ❤️)

Posted by jpluimers on 2019/09/18

Interesting talk:

Published on Oct 8, 2017

Screencast of my keynote presentation at PyGotham 2017, New York City. October 7, 2017. In this live-coded talk, I build a queue object that spans the world of threads and asyncio with a single unified API.

Via [WayBack] The Other Async (Threads + Async = ❤️) – screencast of David Beazley’s keynote at PyGotham 2017 – ThisIsWhyICode – Google+

–jeroen

Read the rest of this entry »

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

Using Image Encoders and Decoders in Managed GDI+ | Microsoft Docs

Posted by jpluimers on 2019/09/17

I forgot who pointed me to this, but it will be useful the next time I need to do image export/import in .NET or GDI+ [WayBackUsing Image Encoders and Decoders in Managed GDI+ | Microsoft Docs.

GDI+ has built-in encoders and decoders that support the following file types:

  • BMP
  • GIF
  • JPEG
  • PNG
  • TIFF

GDI+ also has built-in decoders that support the following file types:

  • WMF
  • EMF
  • ICON

–jeroen

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

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 »