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,512 other followers

Archive for January 3rd, 2019

The IOTAComponent.SetPropByName, when used for an integer property, always sets that property to 0 instead of the desired value.

Posted by jpluimers on 2019/01/03

Reminder to self: [WayBack…The IOTAComponent method SetPropByName, when used for an integer property, always sets that property to 0 instead of the desired value…. – Thomas Mueller (dummzeuch) – Google+

Fix in GExperts for the Rename Component functionality in [WayBack] GExperts / Code / Commit [r2318]: Workaround for an apparent OTA-bug: IOTAComponent.SetPropByName for integers always sets the property to 0 instead of the given value. Now we compare the values and if they don’t match use RTTY on the NativeObject to set it. This seems to work. (The bug exists on Delphi 2007 and 10.2, I haven’t tested other versions. The bugfix also works on these versions.):

         VInteger := StrToInt(Value);
         Result := AComponent.SetPropByName(PropertyName, VInteger);
+        if AComponent.GetPropValueByName(PropertyName, TempInt) then begin
+          // Setting an integer property often (always?) fails, so we check the value here and if
+          // it is different, we use the native object to set the value. This works.
+          // (Example: Try to set the Interval property of a TTimer. It always gets set to 0.)
+          // This happens in Delphi 2007 and 10.2, I haven't tested other versions.)
+          // -- 2018-07-16 twm
+          if TempInt <> VInteger then
+            SetPropValue(NativeObject, PropertyName, VInteger);
+        end;

Only the IOTAComponent interface is mentioned (only once!) in the documentation at [Archive.is] Using Editor Interfaces – RAD Studio, so I have ambivalent feelings on how important this is for Embarcadero to fix IOTAComponent.SetPropByName.

It has been broken since at least Delphi 2007 as per GExperts fix and XE3 as per [RSP-20895] IOTAComponent.SetPropByName always sets an integer to zero – Embarcadero Technologies.

–jeroen

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

Testing SMTP from the console on Linux, BSD and Mac OS: swaks and smtp-cli Perl script clients

Posted by jpluimers on 2019/01/03

Testing SMTP using telnet is tedious as you have to remember the commands and responses in the SMTP protocol. It gets even harder when doing SMTP AUTH, as then you have to base encode a bunch of strings [WayBackHow to Test SMTP AUTH using Telnet [Wiki] | NDCHost

Luckily there is a Perl script swaks: [WayBackSwaks – Swiss Army Knife for SMTP which does ESMTP and LMTP as well as TLS.

The funny thing is that the repository at jetmore/swaks: Swaks – Swiss Army Knife for SMTP only has the readme, but the not the script which you can get from [WayBack] swaks.pl.

Despite that, most Linux distributions have an installation package.

[WayBackswaks for OpenSuse is in the [WayBacknetwork repository, so for Tumbleweed (actually: Factory) on Raspberry Pi you need to perform this:

zypper addrepo http://download.opensuse.org/repositories/network/openSUSE_Factory_ARM/network.repo
zypper refresh
zypper install swaks

On Mac OS X it is even easier: if you have the homebrew package manager installed, you just install the [WayBackswaks formula using the [WayBack] swaks.rb script:

brew install swaks

Note there is also the smtp-cli Perl script which I mentioned before at Fake/Mock SMTP servers and services for use during development, which also does TLS, but few environments have ready built packages for them. If you still want to try it out:

For SMTP AUTH:

swaks -tls --to jeroen.wiert.me@pluimers.com --from jeroen.wiert.me@pluimers.com --server smtp.xs4all.nl --auth-user username

Which prompts for the password, then outputs like this:

=== Trying smtp.xs4all.nl:25...
=== Connected to smtp.xs4all.nl.
<- 220 smtp-cloud3.xs4all.net ESMTP ESMTP server ready -> EHLO rmbpro1tbjwp
<-  250-smtp-cloud3.xs4all.net hello [188.206.68.219], pleased to meet you
<-  250-HELP
<-  250-AUTH LOGIN PLAIN
<-  250-SIZE 157286400
<-  250-8BITMIME
<-  250-STARTTLS
<- 250 OK -> STARTTLS
<- 220 Ready to start TLS === TLS started with cipher TLSv1:DHE-RSA-AES256-SHA:256 === TLS no local certificate set === TLS peer DN="/OU=Domain Control Validated/OU=PositiveSSL Wildcard/CN=*.xs4all.nl" ~> EHLO rmbpro1tbjwp
<~  250-smtp-cloud3.xs4all.net hello [188.206.68.219], pleased to meet you
<~  250-HELP
<~  250-AUTH LOGIN PLAIN
<~  250-SIZE 157286400
<~  250-8BITMIME
<~ 250 OK ~> AUTH LOGIN
<~ 334 ############ ~> anA=
<~ 334 ############ ~> ############################
<~ 235 ... authentication succeeded ~> MAIL FROM:<jeroen.wiert.me@pluimers.com>
<~  250 <jeroen.wiert.me@pluimers.com> sender ok
 ~> RCPT TO:<jeroen.wiert.me@pluimers.com>
<~  250 <jeroen.wiert.me@pluimers.com> recipient ok
 ~> DATA
<~ 354 enter mail, end with "." on a line by itself ~> Date: Wed, 19 Jul 2017 09:09:57 +0200
 ~> To: jeroen.wiert.me@pluimers.com
 ~> From: jeroen.wiert.me@pluimers.com
 ~> Subject: test Wed, 19 Jul 2017 09:09:57 +0200
 ~> Message-Id: <20170719090957.052207@rmbpro1tbjwp>
 ~> X-Mailer: swaks v20170101.0 jetmore.org/john/code/swaks/
 ~> 
 ~> This is a test mailing
 ~> 
 ~> .
<~ 250 smtp-cloud3.xs4all.net accepted mail mXA71v00C4jr6ac01XA9Bo for delivery ~> QUIT
<~  221 smtp-cloud3.xs4all.net ESMTP closing connection
=== Connection closed with remote host.

–jeroen

Posted in *nix, *nix-tools, Communications Development, Development, Hardware Development, Internet protocol suite, Linux, openSuSE, Power User, Raspberry Pi, SMTP, SuSE Linux, Tumbleweed | Leave a Comment »

Various online CSV to Markdown converters: best is Markdown Tables generator – TablesGenerator.com

Posted by jpluimers on 2019/01/03

TL;DR: use Markdown Tables generator – TablesGenerator.com as it has the most features.

A few tools that help converting CSV (with separators like comma, semicolon and tab) to Markdown online:

  1. [Archive.csMarkdown Table Maker
    • Supports:
      • Use first line as headers
      • Auto detection of separator
      • Tab separated
      • Comma separated
      • Semicolon separated
    • Does not support:
      • Quote characters
  2. [WayBack] CSV to Markdown Table Generator — Donat Studios
    • Supports:
      • Use first line as headers
      • Tab separated
      • Comma separated
      • Semicolon separated
    • Does not support:
      • Quote characters
  3. [WayBackMarkdown Tables generator – TablesGenerator.com
    • Supports auto detection of:
      • Use first line as headers
      • Tab separated
      • Comma separated
      • Semicolon separated
      • Quote characters

–jeroen

Posted in CSV, Development, Lightweight markup language, MarkDown, Power User, Software Development | Leave a Comment »

 
%d bloggers like this: