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

Archive for the ‘Delphi’ Category

Hi there. Is it possible to get RTTI information for IDE “built-in” classes …

Posted by jpluimers on 2018/12/04

For my link archive: [WayBack] Hi there.Is it possible to get RTTI information for IDE “built-in” classes with an OTA Wizard?Let’s say I create a TRttiContext object in my wizard…. – Fl Ko – Google+

Here is an IDE explorer that helps: [WayBack] GitHub – DGH2112/Delphi-IDE-Explorer: A RAD Studio IDE wizard / expert / plugin that allows you to browser the internal fields, methods, properties and events of the IDE.

–jeroen

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

UTF-8 support for single byte character sets is beta in Windows and likely breaks a lot of applications not expecting this (via Unicode in Microsoft Windows: UTF-8 – Wikipedia)

Posted by jpluimers on 2018/12/04

Uh-oh: [WayBack] Unicode in Microsoft Windows: UTF-8 – Wikipedia:

Microsoft Windows has a code page designated for UTF-8code page 65001. Prior to Windows 10 insider build 17035 (November 2017),[7] it was impossible to set the locale code page to 65001, leaving this code page only available for:

  • Explicit conversion functions such as MultiByteToWideChar
  • The Win32 console command chcp 65001 to translate stdin/out between UTF-8 and UTF-16.

This means that “narrow” functions, in particular fopen, cannot be called with UTF-8 strings, and in fact there is no way to open all possible files using fopen no matter what the locale is set to and/or what bytes are put in the string, as none of the available locales can produce all possible UTF-16 characters.

On all modern non-Windows platforms, the string passed to fopen is effectively UTF-8. This produces an incompatibility between other platforms and Windows. The normal work-around is to add Windows-specific code to convert UTF-8 to UTF-16 using MultiByteToWideChar and call the “wide” function.[8] Conversion is also needed even for Windows-specific api such as SetWindowText since many applications inherently have to use UTF-8 due to its use in file formats, internet protocols, and its ability to interoperate with raw arrays of bytes.

There were proposals to add new API to portable libraries such as Boost to do the necessary conversion, by adding new functions for opening and renaming files. These functions would pass filenames through unchanged on Unix, but translate them to UTF-16 on Windows.[9] This would allow code to be “portable”, but required just as many code changes as calling the wide functions.

With insider build 17035 and the April 2018 update (nominal build 17134) for Windows 10, a “Beta: Use Unicode UTF-8 for worldwide language support” checkbox appeared for setting the locale code page to UTF-8.[a] This allows for calling “narrow” functions, including fopen and SetWindowTextA, with UTF-8 strings. Microsoft claims this option might break some functions (a possible example is _mbsrev[10]) as they were written to assume multibyte encodings used no more than 2 bytes per character, thus until now code pages with more bytes such as GB 18030 (cp54936) and UTF-8 could not be set as the locale.[11]


  1. Jump up^ [WayBack“UTF-8 in Windows”Stack Overflow. Retrieved July 1, 2011.
  2. Jump up^ [WayBack“Boost.Nowide”.
  3. Jump up^ [WayBackhttps://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strrev-wcsrev-mbsrev-mbsrev-l
  4. Jump up^ [WayBack“Code Page Identifiers (Windows)”msdn.microsoft.com.

Via [WayBack] Microsoft Windows Beta UTF-8 support for Ansi API could break things. Wiki Article of the Change… – Tommi Prami – Google+

Related, as handling encoding is hard, especially if it is changed or not your default:

–jeroen

Posted in .NET, C, C++, Delphi, Development, Encoding, GB 18030, Power User, Software Development, UTF-16, UTF-32, UTF-8, UTF16, UTF32, UTF8, Windows, Windows 10 | 2 Comments »

Delphi XE8..Tokyo 10.2 Release 3: Access Violation at address xxxxxxxx in module ‘delphicoreide###.bpl’ whenever I try to create a new unit or form. How to fix it?

Posted by jpluimers on 2018/11/30

[WayBack] Ouch: “It’s due to some Castalia code, that’s merged in Delphi since XE8. It’s only possible to reduce this issue, so it will happen less often… – Thomas Mueller (dummzeuch) – Google+

“It’s due to some Castalia code, that’s merged in Delphi since XE8. It’s only possible to reduce this issue, so it will happen less often. Use: Tools – Options – Editor Options – Color – Structural Highlighting and switch everything off. Looking at how the code is integrated into the IDE, this results in less editor parsing and repainting. Irrespective of that, the handler that causes the Access violation is still attached to the editor. So basically, we will have to wait for this to be fixed in 10.3.”

The errors in 10.2 are related to “EditorStructuralHighlight.TStructuralHighlighter.EvQuery” – Google Search, but older versions can have a different path.

Lets hope that by a new Delphi version has been released that fixes this, but do not expect older versions to get fixes for it.

For XE8, it is enough to disable Castalia, which is on the list of packages to disable in …/Native/Delphi/Scripts/List-Delphi-Installed-Packages.ps1.

More recent versions have the old Castalia code base much more rightly integrated, so the only way is to disable Structural Syntax Highlighting in the Editor options.

More at:

I have seen this happen too, but so intermittently that I could not point it back to this code (especially since I usually have Model Maker Code Explorer and GExerts loaded which makes it harder to trace back issues to actual Delphi things).

–jeroen

Posted in Delphi, Development, Software Development | 2 Comments »

New official Embarcadero forums online http://community.idera.com/devel- initially only had non-TLS http URLs

Posted by jpluimers on 2018/11/23

If you are not a company good at infrastructure, then do not start hosting new things yourself. This is why I like the DelphiPraxis forums (both English and German), as they really know what they are doing.

Of course, forums never have all the features in a way that each user wants, but DelphiPraxis is secure, has well maintained and public moderators, and a history if quality posts.

But the G+ group did move there for a reason (: [WayBack] We have moved to https://en.delphipraxis.net ! Starting January 1st, 2019 – the G+ Delphi Developers Community will be closed for new posts and new mem… – Lars Fosdal – Google+

After a long series of goofing around with infrastructure (old forums, new forums, now newer forums, years of TLS trouble, selling software or which the infrastructure has been down for a long time), last week, finally they had the [WayBack] New official Embarcadero forums online http://community.idera.com/developer-tools/ The sign-up/login is a bit prickly at first, so keep your login name… – Lars Fosdal – Google+.

The announcement already has a the catch in the title: initially they were http only, so totally insecure for your logon data. They could have easily circumvented that by deploying some LetsEncrypt renewal, for instance the commercial one in Delphi ([WayBack] Execute’s Online Store), of which this is a demo: [WayBackGitHub – tothpaul/LetsEncryptDelphi: Let’s Encrypt component for Delphi Tokyo 10.2.3

I have not added them to embarcaderomonitoring.wiert.me, as they are now on the Idera.com domain, so I will likely start a special monitoring page for those subdomains.

–jeroen

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

Delphi 10.3 Rio got released; I’ll wait a while hoping to see more positive comments

Posted by jpluimers on 2018/11/22

The first messages on G+ saw about Delphi 10.3 Rio are these:

Related:

I think I will wait a while before installing until more positive messages are being published.

If you do want to try, the hashes of delphicbuilder10_3_0_94364.iso are these:

crc32  157b6e36
md5    0882d58cb53a7d0a828cc45d06c6ecd0
sha1   21579b530f781895885923809d9e670b439ebf9d
sha256 9213de93c2abdd6a2ee23aa84fc7e63a87d62d0344f0d0f0ee162d0e7dce7c7d

and for the radstudio10_3_0_esd_94364.exe they are:

crc32  033aeb53
md5    b25fab9d5f0724fb1d59ea77deff6702
sha1   289bbf33c90ae43b151af116e1e7c7a5348591e6
sha256 fb9a825ddaf235441ff72c10fbb03d2cf94adb3f037508e69f0978a37dc95773

jeroen  

PS: [WayBack] How to verify file hashes on macOS | ModMy

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

Delphi sorcery: Loop wars – measuring performance

Posted by jpluimers on 2018/11/21

Interesting read: [WayBack] Delphi sorcery: Loop wars – measuring performance.

It is on optimisation of for…in constructs. More comments at [WayBack] Since there was this offtopic argument going on about performance of for-in versus for-to. – Stefan Glienke – Google+, including penalties for TStrings, string handling and inline methods.

–jeroen

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

Reminder to Self: check if NameOf has been implemented yet

Posted by jpluimers on 2018/11/20

It’s been a wish for a very very long time: to get the name of an identifier as a string in Delphi:

For now the best one can do is either using an Assert and catching the exception (it gets you the unit name, source file name and source line number) in the links below, or using debug symbol information (like a MAP or TDS file) mentioned in the StackOverflow questions above.

C# has had a  [WayBack] nameof for many years now that is evaluated at compile time: [WayBackc# – Is nameof() evaluated at compile-time? – Stack Overflow.

There is a request RAD Studio – RSP-13290: NameOf(T) compiler (magic) function in Quality Portal by Horácio Filho about 3 years ago quotes below.

Since it took the C# team about 3 years after the original [WayBackAdd nameof operator in C# – Visual Studio request, I wonder how fast the Delphi team is.

NameOf .NET-like compiler magic (intrinsic) function would eliminate a lot of hand-written exception messages from several units.

C# 6 introduced nameof operator to obtain the simple (unqualified) string name of a variable, type, or member.

With the current Delphi implementation, after changing variables name we have ot change the related exception message as well. Putting variables name in the code is not a good practise, and is here that NameOf taking place saving tons of lines of code. As the result of NameOf(T) function (if so) is evaluated at compile time (according to the C# implementation – http://stackoverflow.com/a/26573179) we need a help from compiler or it could be achieved using RTTI.

There is a discussion on Google+ community [WayBackhttps://plus.google.com/+StefanGlienke/posts/AsGHSLF4rTX.
The function could be designed as
NameOf(x: Identifier)
following the same (or similar) warranties C# provides.

Using Assert:

–jeroen

Read the rest of this entry »

Posted in Delphi, Development, Software Development | 2 Comments »

Solution for Delphi – post-build event with multiple if/copy combinations only execute if first file does not exist – Stack Overflow

Posted by jpluimers on 2018/11/15

My solution in [WayBack] delphi – post-build event with multiple if/copy combinations only execute if first file does not exist – Stack Overflow is an addendum to my 2014 post Delphi prebuild/prelink/postbuild events.

Here we go:

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development, The Old New Thing, Windows Development | Leave a Comment »

Andreas on Twitter:

Posted by jpluimers on 2018/11/13

Cool: I never knew the Delphi debugger’s expression understood more than just expressions: compiler directives too!

[WayBack@AndyHTech on Twitter:

The debugger’s expression evaluator can’t access an PInteger like an array because PInteger wasn’t declared with $POINTERMATH ON. But if you write “{$POINTERMATH ON} MyIntPtr[0]” into the evaluator the array access works. POINTERMATH ON should always be on in the expr evaluator.
… and if you did this, the option stays active until the compiler has to compile a project, the it is reset.

–jeroen

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

Delphi 10.1 Berlin Update 1 exit error · GitHub

Posted by jpluimers on 2018/11/13

Reminder to self: check this when it re-occurs [WayBack] Delphi 10.1 Berlin Update 1 exit error · GitHub.

there is an Invalid pointer operation. inside System.TObject.FreeInstance with a stack trace involving multiple rounds of

[50BE9CC9]{vcl240.bpl  } Vcl.Forms.TCustomForm.CloseQuery (Line 7061, "Vcl.Forms.pas" + 8) + $14
[5393DDD4]{DDevExtensionsD101.dll} DSUFeatures.CloseForm + $28
[5393DEA2]{DDevExtensionsD101.dll} DSUFeatures.HookedTCustomFormClose + $42
[50BE8A80]{vcl240.bpl  } Vcl.Forms.TCustomForm.WMClose (Line 6398, "Vcl.Forms.pas" + 0) + $0
[50AA3B32]{vcl240.bpl  } Vcl.Controls.TControl.WndProc (Line 7313, "Vcl.Controls.pas" + 91) + $6
[1ACC4D50]{tmsdXE10.bpl} Advgrid. + $0

–jeroen

Read the rest of this entry »

Posted in Delphi, Delphi 10.1 Berlin (BigBen), Development, Software Development | Leave a Comment »