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 4,184 other subscribers

Archive for November, 2022

Reminder to self: write a more extensive blog post on Delphi style guides and code style in general

Posted by jpluimers on 2022/11/30

A while ago, Uwe Raabe reminded me about the Delphi Style Guide which is on-line at the Embarcadero document wiki:

He reminded me to write a bit more about Delphi Style Guides, as there are a few and I used them on past conference sessions.

I thought either the blog post or the conference sessions were already online.

Nope, no 2010 conference sessions at [Wayback/Archive] jpluimers/Conferences: Materials for the conferences that Jeroen Wiert Pluimers spoke on., and no blog post yet.

Hopefully over time I will update that repository, but for now: here is a summary of Delphi Style Guides and a short hint on why to get naming conventions right.

I might extend both in a later blog post, health and time permitting.

Delphi Style Guides

Style guides I found in the past as files named in those session materials:

The above also made me find this interesting post: [Wayback/Archive] Delphi-PRAXiS – Einzelnen Beitrag anzeigen – Delphi Einrücken ::: ::: Wie rückt ihr ein? which mentions these style guides (I modified all links to point to the most recent WayBack machine version that is complete)):

  • Borland empfiehlt folgende Formatierungsregeln:
    http://community.borland.com/article/0,1410,10280,00.html
    Der Punkt 3 “naming conventions” schweigt sich aber über Deine Frage aus 
  • Deutsche Übersetzung der Borland Style Guides
    http://www.dsdt.info/grundlagen/styleguide/
    Unsere Freunde von dsdt.info haben sich die Mühe gemacht und dem Text ins deutsche Übersetzt.
    Damit gibt es nun keine Ausreden mehr sich nicht an die Richtlinien zu halten 
  • Delphi 4 Developer’s Guide Coding Standards Document
    von Econos – Stefan Hoffmeister (1998)
    basiert auf dem Coding standard von Xavier Pacheco and Steve Teixeira
    http://www.econos.de/delphi/cs.html
    Hier gibt es auch eine Liste mit Präfixen zu den einzelnen Komponenten
  • Delphi Object Pascal Coding and Project Organization Standard
    von Michael P. Hollis and Mark S. Lauter
    http://onelauter.com/codestandards/
    Hier wird zwar auch nicht auf die Präfixe eingegangen, aber es wird unter anderem auch eine Verzeichnisstruktur vorgeschlagen.
    Solch ein Dokument mit den einzuhaltenden Regeln sollte in jedem Projekt / Team existieren.
  • Delphi coding Standards
    Maintained by Mustafa GÖKMEN
    http://gokmen.selcuk.edu.tr/document…/delphi/cs.php
    Hier ist auch eine Liste mit Präfixen enthalten
  • Delphi Identifier Naming Conventions
    von Zarko Gajic
    it made it into the WayBack machine
    Dieser Artikel befasst sich nur mit der Benamung von Variablen

The dstgroup version is based on WayBack: onelauter.com/codestandards/CodeStandards.doc.

Mixed emotions conventions

Anyway, this is the piece of code by Uwe Raabe that made me frown as it mixes two Delphi styles at once and uses improper meanings in names:

procedure TSearchForm.StartSearch;
begin
  StatusBar.SimpleText := '';
  dspFiles.Clear;
  Files.Clear;
  BeginSearch;
  SearchFolder(edtRootFolder.Text, edtSearchPattern.Text);
  EndSearch;
end;
 
procedure TSearchForm.SearchFolder(const APath, ASearchPattern: string);
var
  arr: TArray;
  dir: string;
begin
  arr := TDirectory.GetFiles(APath, ASearchPattern);
  AddFiles(arr);
  { release memory as early as possible }
  arr := nil;
  for dir in TDirectory.GetDirectories(APath) do begin
    if not TDirectory.Exists(dir) then Continue;
    SearchFolder(dir, ASearchPattern);
  end;
end;
 
procedure TSearchForm.AddFiles(const AFiles: TArray);
begin
  Files.AddStrings(AFiles);
  dspFiles.Items.Count := Files.Count;
  StatusBar.SimpleText := Format('%d files found', [Files.Count]);
end;

This is the start of technical debt, and resulted in the below cool Twitter thread.

Note that I intentionally used “Digital Signal Processor” as dsp abbreviations are very context sensitive, causing truckloads of problems especially when switching between functionality at front and technical stuff at front in naming conventions.

Functionally, it could have made very much sense to add files into a list to be passed onto a Digital Signal Processor for pre- or post-processing of signals.

Uwe uses this Style Guide (which regrettably does not pay tribute to the original author):

So yes, Uwe posted a cool example on how to apply technology properly, and I retweeted it as this: [Archive] Jeroen Wiert Pluimers on Twitter: “Async Tasks in VCL Projects. Cool example on how to properly to Async in VCL. Important thought: please do not mix naming conventions like Uwe does, as it is substantially adds to your technical debt.… “

It is also a reminder for me to phrase this into the positive form: stick to one naming convention as it makes less technical debt creep in. Like Uwe, I learn new things every day and be reminded it is hart to not follow old habbits.

–jeroen

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

google chrome devtools – Use JavaScript to set value of textbox when .value and events don’t seem to work – Stack Overflow

Posted by jpluimers on 2022/11/29

For my link archive: [Wayback/Archive] google chrome devtools – Use JavaScript to set value of textbox when .value and events don’t seem to work – Stack Overflow

TL;DR

Sometimes fields are blocked from pasting values.

Normally a trick like this works in the chrome development panel console:

document.getElementById('nonPasteElementID').value = 'myValueFromTheClipboard'

With some web development environments this does not work.

For react, after finding the react render name for the input (in the case of the answer, it was “reactNameForInputElement“) this is a solution:

To make it work you will need this:

const input = document.getElementById('nonPasteElementID');
const event = new Event('reactNameForInputElement', { bubbles: true });
input.value = '1';
input.dispatchEvent(event);

–jeroen

Posted in Chrome, Chrome, Development, Google, JavaScript/ECMAScript, Power User, Scripting, Software Development, Web Browsers, Web Development | Leave a Comment »

Kamer van Koophandel: de Non-Mailing-Indicator

Posted by jpluimers on 2022/11/28

I wish they had mailed me about this: [Wayback/Archive] De Non-Mailing-Indicator

Als je na je inschrijving in het Handelsregister niet benaderd wilt worden met fysieke post of huis-aan-huis bezoek op je ingeschreven adres, dan kun je de NMI activeren. Hiermee geef je aan dat je geen ongevraagde reclame per post of verkoop aan je deur wilt.

Na het activeren van de NMI staat dit zowel op het uittreksel als in de gratis toegankelijke informatie op de website.

De bescherming die de NMI biedt, is beperkt tot fysieke post en huis-aan-huis bezoek. De NMI beschermt niet tegen reclame en aanbiedingen via e-mail, telefoon, sms of WhatsApp. Je moet er rekening mee houden dat je ondanks de activering snel na je inschrijving benaderd gaat worden met allerlei aanbiedingen. Bedrijven en organisaties maken daarvoor gebruik van de openbare gegevens van het Handelsregister.

Het aanzetten van de NMI betekent dat je minder goed gevonden wordt. Zo heeft Google als beleid dat ze bedrijven met een NMI niet opneemt in Google Maps.

Je kunt eenvoudig via een formulier de [Wayback/Archive] Non-Mailing-Indicator activeren of deactiveren.

Met dit formulier kun je de non-mailing-indicator (NMI) activeren of deactiveren. Kies je voor ‘activeren’ dan mogen jouw gegevens uit het Handelsregister niet worden gebruikt voor postreclame of verkoop aan de deur. Je kunt zelf checken of je de NMI wel of niet hebt geactiveerd. Doe hiervoor de volgende stappen:

  • Ga naar [Wayback/Archive] de bedrijvenzoeker en vul je bedrijfsnaam of KVK-nummer in.
  • Klik op jouw bedrijfsnaam. Je gaat nu naar een pagina waar alle gegevens van jouw bedrijf staan.
  • Zie jij de zin “De onderneming/organisatie wil niet dat haar adresgegevens worden gebruikt voor ongevraagde postreclame en verkoop aan de deur” staan? Dan heb jij je NMI geactiveerd. Zie je deze zin niet, dan heb jij de NMI niet geactiveerd.

Als je je inschrijft in het Handelsregister kun je direct de NMI activeren. Als je de NMI op een later tijdstip activeert, bijvoorbeeld enkele maanden na je inschrijving, dan zijn je gegevens al bij veel bedrijven en organisaties bekend en opgenomen in hun databestanden. Dit wordt niet automatisch aangepast tenzij deze bedrijven regelmatig via KVK een update aanvragen. Omdat het achteraf activeren van de NMI in de praktijk weinig effect blijkt te hebben, kun je er het beste voor kiezen om dat meteen bij de inschrijving te doen.

jeroen

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

Isotopp’s home sensor network

Posted by jpluimers on 2022/11/25

For my link archive an interesting blog post by isotopp (Kristian Köhntopp)

[Wayback] My home sensor network

I have been asked to document my home sensor network. Being married to a person with a background in web security sets boundary conditions:

  1. No cloud. We are running all services locally.
  2. No control, only metrics.

I am collecting data from a number of plugs with power meters over Wifi, using the MQTT protocol. I am also collecting data from a number of temperature sensors over Zigbee, and convert to MQTT. The MQTT data is ingested into Influx, and then read and plotted in Grafana. All of this is dockered and runs locally on an Ubuntu server.

Via [Archive] Kristian Köhntopp on Twitter: “For @sluongng …”

–jeroen

Posted in Hardware, IoT Internet of Things, Power User | Leave a Comment »

Great tags: #BugMagnet #IAmATester

Posted by jpluimers on 2022/11/24

I should use the great tags #BugMagnet #IAmATester more often.

Via: [Archive.is] Stephan Kämper on Twitter: “Moin @VIVANI_official, wenn man vom Twitter-Profil auf den Link zur Webseite klick, dann landet man auf einer Login-Seite von @WordPress, nicht beim Impressum, wie es der Link-Text vermuten lässt. #BugMagnet #IchBinEinTester”

–jeroen

Posted in Development, SocialMedia, Software Development, Testing | Leave a Comment »

 
%d bloggers like this: