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

Archive for March 3rd, 2021

Common UX ant-pattern: “you have Tea and No Tea”

Posted by jpluimers on 2021/03/03

I see this pattern in a lot of user interfaces, especially on web-sites: “you have Tea and No Tea”.

For instance the example from the web site on the right: it indicates in Dutch you are getting a postal package. In the body text it says “because we send it as a letter, you do not get a tracking code” followed by a headed section containing a link to an invalid tracking code.

There was only one historic case where the condition “you have Tea and No Tea” opened doors.

Nowadays you should just put a user story on your front-end team back-log that prevents displaying a tracking code when there is none.

Maybe file an issue for the back-end team as well, to distinguish the cases where you can or cannot track shipments.

If you fix it, then an important to remember that often multiple front-ends share the same code.

In the case of the screen shot on the right, the email system showed the same issue; a strong indication either part of the code, or the design steps have been shared.

For such cases, it helps tracking back where the root of the shared design or code came started, then ensure everything stemming from that root is re-checked to ensure altered copies are inspected for the need of modification.

Background

[WayBack] Thread by @jpluimers: “Er gaat iets mis met @KPNwebcare PostNL tracking codes voor prepaid SIM kaarten vanaf mijnbestelling.kpn.com : de “PostNL Track & Trace […]”

Er gaat iets mis met @KPNwebcare PostNL tracking codes voor prepaid SIM kaarten vanaf mijnbestelling.kpn.com : de “PostNL Track & Trace code” link mist de 3S en ziet er nu uit als jouw.postnl.nl/#!/track-en-tr… waarbij op * 20 cijfers staan zonder 3S erin.

Hoe krijg ik de goede code?

Ah, een typisch geval van “you have Tea and No Tea” waarbij “Tea” de aandacht trekt, maar “No Tea” niet.

Mooie user story voor een backlog item van jullie front-end scrum teams (;

Applaus als jullie trouwens laten zien deze klassieker te kennen (;

and [WayBack] Thread by @jpluimers: “@KPNwebcare Doe ik. Zowel site als email hebben hetzelfde probleem. @KPNwebcare Daar zitten deze twee zinnen in: “Handig om te weten: omdat […]”

Doe ik. Zowel site als email hebben hetzelfde probleem.
mentions Daar zitten deze twee zinnen in:

“Handig om te weten: omdat uw bestelling via post wordt verstuurd, is het niet mogelijk om deze via een Track & Trace code te volgen”

en

“Track & Trace code
Dit is uw persoonlijke PostNL Track & Trace code”

Met daarin dezelfde foutieve link.

–jeroen

Read the rest of this entry »

Posted in Development, Software Development, Usability, User Experience (ux) | Leave a Comment »

Delphi: quickly failing in use-after free scenarios

Posted by jpluimers on 2021/03/03

Two tricks that can help in use-after-free scenarios.

Call ScanMemoryPoolForCorruptions often

One of the scenarios of use after free, is that memory blocks get corrupted.

FastMM4 normall checks this at process end using the CheckBlocksOnShutdown method (in FastMM4.pas when writing this private at line 11156), but you can also do this process manually using the ScanMemoryPoolForCorruptions method (also in FastMM4.pas, but public at line L1356).

You can automate this process by setting the FullDebugModeScanMemoryPoolBeforeEveryOperation flag to True while in FullDebugMode as you see in the quoted code blocks below.

Note that calling ScanMemoryPoolForCorruptions between allocations might reveal wild pointer dereferences between allocations.

  - Added a global variable "FullDebugModeScanMemoryPoolBeforeEveryOperation".
    When this variable is set to true and FullDebugMode is enabled, then the
    entire memory pool is checked for consistency before every GetMem, FreeMem
    and ReallocMem operation. An "Out of Memory" error is raised if a
    corruption is found (and this variable is set to false to prevent recursive
    errors). This obviously incurs a massive performance hit, so enable it only
    when hunting for elusive memory corruption bugs. (Thanks to Marcus Mönnig.)

  {If this variable is set to true and FullDebugMode is enabled, then the
   entire memory pool is checked for consistency before every memory
   operation. Note that this incurs a massive performance hit on top of
   the already significant FullDebugMode overhead, so enable this option
   only when absolutely necessary.}
  FullDebugModeScanMemoryPoolBeforeEveryOperation: Boolean = False;

Call any virtual method on an instance reference

A quick way to test use-after free scenarios is to call a virtual method on an instance.

Virtual methods mean that the Virtual Method Table needs to be used as a starting point, so any nil pointer will get dereferenced.

Two simple methods that you can call, which have no side effects, except for referencing memory, and are virtual on [WayBack] TObject are [WayBack] GetHashCode and [WayBack] ToString. Both methods got added in Delphi 2009, and now support 64-bit and 32-bit compilers are below.

If you use use these in addition to FastMM4 clearing memory, and FastMM4 redirecting virtual methods of freed objects, you have a good chance of catching use-after free.

Without FastMM, they are also of good help, especially when the freed memory has since then been overwritten by new usage. FastMM4 is a lot more strict about this, so definitely recommended.

Calling these two methods help you to quickly fail with an EAccessViolation [WayBack] in use-after-free scenarios.

More on the virtual method table is for instance in [WayBack] Hallvard’s Blog: Method calls compiler implementation.

Read the rest of this entry »

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

JSON or binary stream? Delphi 2010: How to save a whole record to a file? – Stack Overflow

Posted by jpluimers on 2021/03/03

A while back I proposed using JSON in order to [WayBack] Delphi 2010: How to save a whole record to a file? – Stack Overflow.

There is also a native solution using streaming (which by now has moved to [WayBack] GitHub – KrystianBigaj/kblib: Automatically exported from code.google.com/p/kblib with main source file [WayBack] kblib/uKBDynamic.pas), but be aware that unlike JSON:

  • Streams are not fully compatible between Delphi Unicode and Delphi non-Unicode (they are if you limit yourself to AnsiString)
  • Streams are not compatible between x64 and x86 unless you use kdoCPUArchCompatibility and provide additional compatibility (read comments on kdoCPUArchCompatibility)

The main file from my proposed solution has since then move

Which reminds me I still need to fix quite a few links, as per Anyone who knows about http://sourceforge.net/p/radstudiodemos/code/HEAD/tree/branches/RADStudio_Rio ?

–jeroen

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