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

Archive for May 12th, 2021

Golang written: nefertiti-tradebot.com

Posted by jpluimers on 2021/05/12

[WayBack] dutchdelphidude on Twitter: “ik doe nu dit ermee nefertiti-tradebot.com … “

nefertiti-tradebot.com

–jeroen

Read the rest of this entry »

Posted in Development, Go (golang), Software Development | Leave a Comment »

Reminder to self: check if @NS_online finally accepts email addresses having a plus sign in them

Posted by jpluimers on 2021/05/12

Quite a while back, @NS_Online (Dutch railroads) did not accept plus signs in email addresses. I verified a few times over the years and not much progress.

This is a reminder to myself to re-check.

Below the fold the Twitter thread that started with [WayBack] Jeroen Pluimers on Twitter: “Toch jammer dat @NS_online valide email adressen met een plus-teken erin weigert.… “

Hopefully by now they retraced themselves from the bad company of many other parties failing to adhere to clear and long existing internet standards: [WayBack] User:Me at work/plushaters | Mozilla Community | FANDOM powered by Wikia.

Their web care team and their developers made a assumptions there:

  • questioning the use of a + in email addresses
  • questioning the email address used
  • diminishing the popularity of using a + inside email addresses
  • when you never heard of something, it does not exist
  • you can validate an email address without actually trying to deliver it

Some links on email addresses and their validity:

A bit takeaway:

  • when doing server side validation using XHR (XMLHttpRequest – Wikipedia), then be aware that you need to encode strings properly so you do not loose information

–jeroen

Read the rest of this entry »

Posted in Development, Power User, Software Development, Web Development | Leave a Comment »

FastMM4: turn warnings W1047 and W1048 off

Posted by jpluimers on 2021/05/12

(Tagged FastMM4 as that’s the first code I saw these warnings to be turned off)

Delphi 7 introduced introduced warnings for unsafe constructs like W1047 and W1048 so you could prepare your code for the first Delphi .NET compilers .

The oldest online documentation on this is in Delphi 2007:

After Delphi 2007, the .NET compiler got shelved, but the errors and warning stayed as they serve a good purpose for native code as well.

Delphi 2007 did not document any of the other directives.

Unlike the D2007 documentation, however, the UNSAFECODE should be written UNSAFE_CODE as with using {$WARN UNSAFECODE ON}, you will get this error:

E1030 Invalid compiler directive: 'UNSAFECODE'

Looking at the library code and example code that ships with Delphi, these are the valid $WARN compiler directives having to do with UNSAFE:

  • UNSAFE_CAST (since Delphi 7, but only used in Vcl.WinXPanels.pas introduced in Delphi 10.2 Tokyo and up)
  • UNSAFE_CODE (since Delphi 7, but still documented as UNSAFECODE)
  • UNSAFE_TYPE (since Delphi 7)
  • UNSAFE_VOID_POINTER (since Delphi XE3, as precursor to the NEXTGEN compilers)

The ultimate source for these is the file DCCStrs.pas that has shipped since Delphi 2009: [WayBack] warnings – Identifiers for Delphi’s $WARN compiler directive – Stack Overflow.

A problem is that current documentation still lists the wrong name in many places:

This one finally got it right: [WayBack] Warning messages (Delphi) – RAD Studio

UNSAFE_TYPE W1046
UNSAFE_CODE W1047
UNSAFE_CAST W1048

Note it also documented UNSAFE_VOID_POINTER:

UNSAFE_VOID_POINTER W1070

[WayBack] W1070 Use of untype pointer can disrupt instance reference counts (Delphi) – RAD Studio

And these warning messages still do not contain the directives, but do explain the underlying code construct better:

You have to use these directives:

// Get rid of "W1047 Unsafe code 'ASM'", "W1047 Unsafe code '^ operator'", "W1047 Unsafe code '@ operator'" and similar

{$WARN UNSAFE_CODE OFF}

// Get rid of "W1048 Unsafe typecast of 'TFreedObject' to 'PByte'" and similar

{$WARN UNSAFE_CAST OFF}

Back in the days, some people were not amused and disabled the warnings, for instance in [Archive.is] Re: How can I eliminate these warnings in Delphi 7 which did not appear in Delphi 5. – Google Groups:

Dennis Passmore:
I have one include file that I usually include in all projects as follows—– WarningsOff.inc —————-
{$IFDEF CONDITIONALEXPRESSIONS}
  {$IF CompilerVersion >= 14}
{$WARN SYMBOL_PLATFORM OFF}
{$WARN SYMBOL_DEPRECATED OFF}
{$WARN SYMBOL_LIBRARY OFF}
{$WARN UNIT_DEPRECATED OFF}
{$WARN UNIT_LIBRARY OFF}
{$WARN UNIT_PLATFORM OFF}

{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_CAST OFF}

  {$IFEND}
{$ENDIF}
———————and it gets ride of all unwanted warnings in the IDE or even DCC32.exe when compiling the project
from the command line.

I just add the following line to the project .dpr file and do not worry about the rest.

{$I WarningsOff.inc}

Dennis Passmore

“If you cannot conceive the idea you
will never achieve the desired results”

I disagree with such an approach, as those warnings have their purpose.

Knowing how to selectively disable/enable them however, is important.

–jeroen

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

 
%d bloggers like this: