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 June 8th, 2021

Chaz Firestone su Twitter: “All the balls are the same color ā€” and that color is *brown*!ā€¦ “

Posted by jpluimers on 2021/06/08

With User Experience, perception plays a big role. It helps to understand how colors work: a difficult topic with amazing results like: ā€œAll the balls are the same color ā€” and that color is brown!ā€

All pictures below are from the [WayBack] Chaz Firestone on Twitter: “All the balls are the same color ā€” and that color is brown!ā€¦ “ thread.

Original by [WayBack] David Novick (@NovickProf) | Twitter: Professor of Engineering Education and Leadership, the University of Texas at El Paso. Tweets cover innovation & entrepreneurship, improv, and color illusions. El Paso, TX.

[Archive.is] David Novick on Twitter: “A three-color confetti illusion with spheres, which appear to be yellowish, reddish, and purpleish but in fact have exactly the same light-brown base color (RGB 255,188,144). Shrinking the image increases the effect. Original png file is at .ā€¦ “

A PNG of the original is at engineering.utep.edu/novick/colors and his dropbox, and is even more stunning than the Twitter dithered versions below.

Colors from the color picker tool by [WayBack] #therightwaye (@therightwaye) | Twitter:

Grey backgrounds byĀ [WayBack] Joffan (@Joffan7) | Twitter:

The cool thing is that this is being used in product packaging to make the fruits and vegetables look more orange.

Carrots byĀ [WayBack] Hanon Ondricek on Twitter: “Oh right! And baby carrot bags have orange stripes… #itrustnothingnowā€¦ “:

Oranges and grapefruits byĀ [WayBack] Alexei Kojenov (@kojenov) | Twitter:

–jeroen

Read the rest of this entry »

Posted in Color (software development), Development, Software Development, User Experience (ux) | Leave a Comment »

Toegankelijkheid is een recht, geen optie. Voor zowel overheid, als private bedrijven en instellingen dus een plicht in redelijkheid daarvoor te zorgen.

Posted by jpluimers on 2021/06/08

Uit een thread die een stuk onbenul aan de kaak stelde, kwam iets moois:

[WayBack] Max Verslakken šŸŒˆ on Twitter: “ā€˜Ik, een lopende persoon, bepaal wel effe voor mensen met een handicap wat er toegankelijk moet worden.ā€™ Nieuwsflits: toegankelijkheid is een recht..ā€¦”:

Om precies te zijn: met de ratificatie van hetĀ #VNverdragĀ Handicap heeft Nederland als staat/overheid de plicht om toegankelijkheid te vergroten (zie vooral artikelen 4 en 9 van dit verdrag,Ā wetten.overheid.nl/BWBV0004045/20ā€¦). Daarbij speelt ‘redelijk’ wel een rol, zie o.a. artikel 2.Ā 1/2
2/2 Zo’n plicht was er nog niet voor private organisaties (zoals pretparken), maar die is er nu wel met Besluit Toegankelijkheid (zoek.officielebekendmakingen.nl/stb-2017-256.hā€¦). Het is de plicht om ‘iets’ te doen voor algemene toegankelijkheid, waarbij ‘redelijk’ en ‘geleidelijk’ wel een rol spelen.
Tot slot: in het Besluit Toegankelijkheid staan enkele voorbeelden, zie de toelichting bij artikel 6. Wat ‘redelijk’ is, hangt af van o.a. de omvang van de organisatie, zie artikel 7. Zo mag je van bijv. een grote supermarkt veel meer verwachten/eisen dan van een kleine bakkerij.
Nog 1 P.S. šŸ˜‰. Geert schrijft “alle attracties in een pretpark voor iedereen toegankelijk lukt niet”. Op korte termijn lukt dat idd niet, maar op langere tijd is veel mogelijk. Dat houdt die ‘geleidelijkheid’ in: niet alles hoeft meteen, maar er moet wel steeds vooruitgang zijn.

–jeroen Read the rest of this entry »

Posted in accessibility (a11y), Development, Software Development | Leave a Comment »

Delphi: some notes on HModule while tracking down an access violation in TRegGroups.UnregisterModuleClasses

Posted by jpluimers on 2021/06/08

Too bad the whole mechanism involving TRegGroups.UnregisterModuleClasses is not documented anywhere

It is the underlying storage to support TClassFinder, which was introduced in Delphi 6, documented on-line in Delphi 2007, documented slightly in Delphi 2009, and since Delphi 2010 only one line of documentation was added (including the unchanged “instatiated”):

  • Delphi 2007: [WayBack] TClassFinder Class

    This is class Classes.TClassFinder.

  • Delphi 2009:[WayBack] TClassFinder Class

    The TClassFinder allows the list of registered persistent classes to be retrieved. Objects instatiated from persistent classes are those that can be stored (serialised) beyond the operation of the current application.

  • Delphi 2010:[WayBack] Classes.TClassFinder – RAD Studio VCL Reference

    TClassFinderĀ allows registered persistent classes to be retrieved.

    TheĀ TClassFinderĀ allows the list of registered persistent classes to be retrieved. Objects instatiated from persistent classes are those that can be stored (serialised) beyond the operation of the current application.

Back to TRegGroups.UnregisterModuleClasses: it takes a HMODULE parameter and ultimately gets called through the (since Delphi 2007) on-line documented [WayBack] Classes.UnRegisterModuleClasses Function

procedure UnRegisterModuleClasses(Module: HMODULE);

Call UnRegisterModuleClasses to unregister all object classes that were registered by the module with the handle specified by the Module parameter. When a class is unregistered, it can’t be loaded or saved by the component streaming system.

After unregistering a class, its name can be reused to register another object class.

To get more context about the access violation, I used both the stack trace and a debugging watch for GetModuleName(Module) (using the [WayBack] SysUtils.GetModuleName Function).

In order to see which classes were registered by what module, I set a breakpoint at in TRegGroup.AddClass (which can be called through various code paths):

procedure TRegGroup.AddClass(AClass: TPersistentClass);
begin
  FGroupClasses.Add(AClass);
end;

HModule

That gave me the class, but I also needed theĀ HModule for a class, so I did a windows get module of currently executing code – Google Search, giving meĀ these links, all C/C++ related:

Here you already see some confusion: there is HINSTANCE and HMODULE. That’s a historic thing, as described by Raymond Chen in [WayBack] What is the difference between HINSTANCE and HMODULE? | The Old New Thing:

They mean the same thing today, but at one time they were quite different.
It all comes from 16-bit Windows.
In those days, a ā€œmoduleā€ represented a file on disk that had been loaded into memory, and the module ā€œhandleā€ was a handle to a data structure that described the parts of the file, where they come from, and where they had been loaded into memory (if at all). On the other hand an ā€œinstanceā€ represented a ā€œset of variablesā€.
One analogy that might (or might not) make sense is that a ā€œmoduleā€ is like the code for a C++ class ā€“ it describes how to construct an object, it implements the methods, it describes how the objects of the class behave. On the other hand, an ā€œinstanceā€ is like a C++ object that belongs to that class ā€“ it describes the state of a particular instance of that object.
In C# terms, a ā€œmoduleā€ is like a ā€œtypeā€ and an instance is like an ā€œobjectā€. (Except that modules donā€™t have things like ā€œstatic membersā€, but it was a weak analogy anyway.)

GetModuleName

Searching for delphi “__ImageBase” – Google Search then got me [WayBack] c++ – Get DLL path at runtime – Stack Overflow with a nice Delphi related answer by [WayBack] Ian Boyd:

For Delphi users:

SysUtils.GetModuleName(hInstance);              //Works; hInstance is a special global variable
SysUtils.GetModuleName(0);                      //Fails; returns the name of the host exe process
SysUtils.GetModuleName(GetModuleFilename(nil)); //Fails; returns the name of the host exe process

In case your Delphi doesn’t have SysUtils.GetModuleName, it is declared as:

...

This reassured my use of [WayBack] SysUtils.GetModuleName code was OK:

function GetModuleName(Module: HMODULE): string; 
var
  ModName: array[0..MAX_PATH] of Char; 
begin
  SetString(Result, ModName, GetModuleFileName(Module, ModName, Length(ModName))); 
end;

HInstance in Delphi

The example from Ian Boyd also brought back memories from long ago about the [WayBack] HInstance Variable – Delphi in a Nutshell [Book]:

Read the rest of this entry »

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