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 2,280 other followers

Archive for December 24th, 2020

Electronics-Salon DIN Rail Mount +/-20Amp AC/DC Current Sensor Module, based on ACS712: Amazon.com: Industrial & Scientific

Posted by jpluimers on 2020/12/24

For my link archive (this DIN rail device allow sensing current used by a circuit; models for 5A/20A/30A).

Thanks Matthijs ter Woord for pointing me to this.

Schematics show it uses an LM317 linear voltage regulator (to get 5V out of a 8V-35V range) next to the ACS712 current sensor (based on the [WayBack] Hall effect) available in 5A, 20A and 30A varieties.

Documentation:

Schematics:

 

Read the rest of this entry »

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

Essential versus Accidental Complexity: 2 minute Kevlin Henney video and some links

Posted by jpluimers on 2020/12/24

The topic is as old as the 1986 “No Silver Bullet” book, still relevant, but few people are consciously aware of the difference of these fundamental ideas:

Essential versus Accidental Complexity

TL;DR:

  • Essential complexity is the problem you try to solve
  • Accidental complexity is the problems you have created while solving

The first is what it is all about (it is in your problem domain, and not reducible); the second is what you want to minimise, like technical debt, size effects of quick fixes, bad tool/framework/language choices, long feedback loops.

2 minute video:

Related:

Via:

–jeroen

Read the rest of this entry »

Posted in Conference Topics, Conferences, Development, Event, Software Development | Leave a Comment »

Is this code safe? function Some(const Str : AnsiString); var arr : TBytes …

Posted by jpluimers on 2020/12/24

[WayBack] Is this code safe? function Some(const Str : AnsiString); var arr : TBytes absolute Str; begin fSomeMethodWithTBytesParam(arr); <- arr is properly c… – Jacek Laskowski – Google+

Such a seemingly simple question:

Is this code safe?

procedure Some(const Str : AnsiString); 
var arr : TBytes absolute Str; 
begin
  fSomeMethodWithTBytesParam(arr); // <- arr is properly casted to string bytes? 
end;

Such a wealth of information in the comments:

  • No it is not, except for the nil-pointer case
  • The compiler has for instance an implicit length prefix
  • In 32-bit mode, the Length prefix of strings and dynamic arrays are both 32-bits
  • In 64-bit mode, the Length prefix of strings is 32-bits, but the one for dynamic arrays is 64-bits
  • use BytesOf to transform from characters to bytes
  • do not store binary data into strings of single-byte character sets

–jeroen

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

 
%d bloggers like this: