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

Delphi: When porting really old code from versions that did not have .dproj files, watch your .dfg and .dof files

Posted by jpluimers on 2021/06/10

I have been bitten by this a few times too much, so time to write it down:

When porting old Delphi code from the Delphi 7 and older era, the options were stored .dof (options) and .cfg (configuration) files.

More modern Delphi versions try to translate these files when generating the .dproj file, in a similar way as they try to upgrade older .dproj files to newer formats.

Many things can go wrong, including these ones I have bumped into multiple times:

  • DCC_DebugInformation having a 0 or false value, but not handling these values correctly (I remember problems around the Delphi XE5 era with this: When the Delphi XE5 commandline compiler fails with error F1026: File not found: ‘False.dpr’)
  • DCC_OutputDependencies not being adhered to (no .d file is being emitted by the compiler), though for the .drc files, DCC_OutputDRCFile works fine)
  • DCC_DebugInformation having a 1 value (Limited Debug information) instead of being absent (Debug information)
  • DCC_SymbolReferenceInfo having a 1 value (Definitions Only) instead of being absent (Reference info)

–jeroen

Posted in Delphi, Development, Software Development | 1 Comment »

(nullable) rowversion (Transact-SQL) – SQL Server | Microsoft Docs

Posted by jpluimers on 2021/06/09

I was not aware there could be a nullable [WayBack] rowversion (Transact-SQL) – SQL Server | Microsoft Docs, but it is possible:

Duplicate rowversion values can be generated by using the SELECT INTO statement in which a rowversioncolumn is in the SELECT list. We do not recommend using rowversion in this manner.

A nonnullable rowversion column is semantically equivalent to a binary(8) column. A nullable rowversion column is semantically equivalent to a varbinary(8) column.

You can use the rowversion column of a row to easily determine whether the row has had an update statement ran against it since the last time it was read. If an update statement is ran against the row, the rowversion value is updated. If no update statements are ran against the row, the rowversion value is the same as when it was previously read. To return the current rowversion value for a database, use @@DBTS.

You can add a rowversion column to a table to help maintain the integrity of the database when multiple users are updating rows at the same time. You may also want to know how many rows and which rows were updated without re-querying the table.

For example, assume that you create a table named MyTest. You populate some data in the table by running the following Transact-SQL statements.

–jeroen

Posted in Database Development, Development, Software Development, SQL, SQL Server | Leave a Comment »

The state of text reading robots a few years back; I doubt it has improved much since: AI often still is Algorithmic Irresponsibility

Posted by jpluimers on 2021/06/09

The state of text reading robots and AI a few years back; I doubt it has improved much since: [WayBack] Thread by @JFBonnefon: “It’s a big day today: I had a scientific manuscript rejected by a robot. Thread. The bot detected ❝a high level of textual overlap with previous literature […]”.

Basically, it detected all duplicates to be in non-relevant pieces.

Via: [WayBack] Michael Bolton on Twitter: “Thread. Machines read strings. They don’t understand context or intentions. This is how AI comes to stand for Anti-Intellectualism and Algorithmic Irresponsibility (the latter coined by @jamesmarcusbach).… “

Although I could not find that reference through [Archive.is] “Algorithmic Irresponsibility” – Google Search. I could only find two:

–jeroen

Read the rest of this entry »

Posted in AI and ML; Artificial Intelligence & Machine Learning, Development, Software Development | Leave a Comment »

Delphi: .dproj TargetedPlatforms bit flags in main PropertyGroup, and Platform values in other elements/attributes

Posted by jpluimers on 2021/06/09

For cleanup of .dproj files, I want to know the bit flags that TargetPlatforms can have.

TL;DR: .dproj content management in Delphi is a mess

For future reference empiric values for the flags that build the TargetedPlatforms (not to be confused with PlatformTargets) element content in the main PropertyGroup of a .dproj file in a table.

This might help creating an XSD for a .dproj file (Source: Reminder to self: make a start for an XSD that validates Delphi dproj files).

Absent cells means I have no idea if the values are relevant or what they could be.

Input for those is more than welcome.

Bit# TargetedPlatforms bit flag value Platform and $(Platform)value Meaning (dropdown value of “Select Platform” dialog)
0 1 Win32 32-bit Windows
1 2 Win64 64-bit Windows
2 4
3 8
4 16
5 32
6 64
7 128
8 256
9 512
10 1024 iOSDevice64 iOS Device 64-bit
11 2048
12 4096

($Platform) values still to cover:

  • Android
  • Linux64
  • OSX32
  • iOSDevice32
  • iOSSimulator

There is only one place for TargetedPlatforms in the .dproj file: at the XPath /Project/PropertyGroup/TargetedPlatforms.

For getting the XPath, I used Notepad++ as described in my earlier blog post Getting the path of an XML node in your code editor.

It has the combined flags, so:

  • 3 means Win32 and Win64 are enabled
  • 1025 means Win32 and iOSDevice64 are enabled

The Platform value (and thus $(Platform) value) is the one used in for example these elements or attributes:

  • /Project/PropertyGroup/Platform as currently selected platform
  • /Project/PropertyGroup/@Condition as selectivity expression, for instance
    •  <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win64)'!=''">
    • <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
  • /Project/ProjectExtensions/BorlandProject/Platforms/Platform (all having for the value property with the Platform value) having a content of either True or False.
    • This allows a .dproj file to contain information for platforms that are not visible yet.

The actual values of Platform also play a role in these places:

  • /Project/PropertyGroup/Base_Win64 containing the base settings for the Win64 platform so they can be derived for the Debug or Release builds.
  • /Project/PropertyGroup/@Condition for instance <PropertyGroup Condition="'$(Base_Win64)'!=''">
  • /Project/ProjectExtensions/BorlandProject/Deployment/DeployFile/Platform/@Name for instance <Platform Name="iOSSimulator">

Even worse: there are unneeded  nodes present for bits in TargetPlatforms and /Project/ProjectExtensions/BorlandProject/Platforms/Platform being absent or having a content False for /Project/ProjectExtensions/BorlandProject/Platforms/Platform/@value other than the enabled bits in TargetPlatforms, for instance:

  • nodes matched by /Project/ProjectExtensions/BorlandProject/Deployment/DeployFile/Platform
  • nodes matched by /Project/ProjectExtensions/BorlandProject/Deployment/ProjectRoot/@Platform
  • nodes matched by /Project/ProjectExtensions/BorlandProject/Deployment/DeployClass/Platform/@Name (and the parent DeployClass subtrees)
  • nodes matched by /Project/ProjectExtensions/BorlandProject/Platforms/Platform@value

Some examples of superfluous nodes when TargetPlarforms has a value of 1 (corresponding to Platform having a value of Win32:

<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>

Also, non relevant platforms are included in this node:

<Platforms>
    <Platform value="Win32">True</Platform>
    <Platform value="Win64">False</Platform>
</Platforms>

The Deployment section is even worse; see for instance [WayBack] delphi – How manage or clean deploy section in dproj files? – Stack Overflow.

–jeroen

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

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 »

CloudKey ESXi Appliance – Google Search

Posted by jpluimers on 2021/06/07

Via [Archive.is] CloudKey ESXi Appliance – Google Search:

–jeroen

Posted in *nix, Cloud Key, ESXi6, ESXi6.5, ESXi6.7, Internet, Network-and-equipment, Power User, Unifi-Ubiquiti, Virtualization, VMware, VMware ESXi | Leave a Comment »

Random, Quick Brown Fox and Lorem Ipsum – How to Add Filler Text in Microsoft Word Documents

Posted by jpluimers on 2021/06/07

Choices:

  • =lorem(...): Ramdom Lorem Ipsum text paragraphs.
    • The sentences are roughly between 0.25 and 1.0 document widths in length.
  • =rand(...): Random English help text like paragraphs.
    • The sentences are roughly between 0.5 and 1.5 document width in length.
  • =rand.old(...): “The quick brown fox jumps over the lazy dog.” paragraphs (up until Word 2003, this was what rand(...) returned).
    • The sentences are always the same length.

(...) parameters:

  • (x,y): x paragraphs of y sentences of text
  • (y): y paragraphs of 3 sentences of text (lorem more towards 1, rand more towards 3)
  • (): depends on the function:
    • =lorem(): 5 paragraphs of 3 sentences of text
    • =rand(): 5 paragraphs of 3 sentences of text
    • =rand.old(): 3 paragraphs of 3 sentences of text

Note:

  • There is no way to specify x paragraphs of random number lines of text.
  • They need to have “Replace text as you type” enabled (see menu option “File” -> “Options” -> “Proofing” -> “Autocorrect Options”)
  • Word 2003 and lower only have =rand(...)

Based on:

Related: [WayBack] 10 awesome Lorem Ipsum alternatives – Justinmind via [WayBack] rand () in word – Microsoft Tech Community – 325554

For a random document demo, I usually do this:

  1. =lorem(100,1) to get 100 paragraphs of 1 line of text
  2. About every 10 paragraphs, I mark a paragraph with a relevant Heading style
  3. Inside the remaining text, I combine some paragraphs to get longer ones

–jeroen

Posted in Office, Office 2003, Office 2007, Office 2010, Office 2013, Office 2016, Power User, Word | Leave a Comment »

Contact for when WayBack internet archival fails to grab content

Posted by jpluimers on 2021/06/07

For my link archive, some tweets. [WayBack] Mark Graham is the person to contact in case archiving a link in the WayBack machine fails.

These are the steps for my link archival:

  1. check if it saves and renders with the WayBack machine, if so, copy the saved URL and the original URL
  2. check if it saves and renders with archive.is, if so, copy the saved URL and the original URL
  3. if neither saved, then use the original URL and link text, but note it was unsavable; otherwise prepend the original URL and link text with [WayBack] or [Archive.is] containing the saved URL

Reporting history gist: https://gist.github.com/jpluimers/6115b3cd6dab568ebd1c10ebddfaf140

–jeroen

Read the rest of this entry »

Posted in Internet, InternetArchive, Power User, WayBack machine | Leave a Comment »