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

Archive for the ‘Delphi’ Category

string – Check if MyString[1] is an alphabetical character? – Stack Overflow (and how Embarcadero broke one of the product version neutral redirects)

Posted by jpluimers on 2024/09/24

Quite a while ago [Wayback/Archive] string – Check if MyString[1] is an alphabetical character? – Stack Overflow asked by [Wayback/Archive] User Jeff was answered by [Wayback/Archive] Andreas Rejbrand:

The simplest approach is

function GetAlphaSubstr(const Str: string): string;
const
  ALPHA_CHARS = ['a'..'z', 'A'..'Z'];
var
  ActualLength: integer;
  i: Integer;
begin
  SetLength(result, length(Str));
  ActualLength := 0;
  for i := 1 to length(Str) do
    if Str[i] in ALPHA_CHARS then
    begin
      inc(ActualLength);
      result[ActualLength] := Str[i];
    end;
  SetLength(Result, ActualLength);
end;

but this will only consider English letters as “alphabetical characters”. It will not even consider the extremely important Swedish letters Å, Ä, and Ö as “alphabetical characters”!

Slightly more sophisticated is

function GetAlphaSubstr2(const Str: string): string;
var
  ActualLength: integer;
  i: Integer;
begin
  SetLength(result, length(Str));
  ActualLength := 0;
  for i := 1 to length(Str) do
    if Character.IsLetter(Str[i]) then
    begin
      inc(ActualLength);
      result[ActualLength] := Str[i];
    end;
  SetLength(Result, ActualLength);
end;

Back in 2011 I added a comment that for more than a decade would redirect to the most current documentation on the IsLetter method:

+1 for using IsLetter which checks the Unicode definition for being a letter or not [Wayback] docwiki.embarcadero.com/VCL/en/Character.TCharacter.IsLetter

Back then, Delphi X2 was current, so it would redirect

  1. from [Wayback] http://docwiki.embarcadero.com/VCL/en/Character.TCharacter.IsLetter
  2. to [Wayback] http://docwiki.embarcadero.com/VCL/XE2/en/Character.TCharacter.IsLetter
  3. then to [Wayback] http://docwiki.embarcadero.com/VCL/XE2/en/Character.TCharacter.IsLetter
  4. ending at [Wayback] http://docwiki.embarcadero.com/Libraries/XE2/en/System.Character.TCharacter.IsLetter

After a long outage in 2022 (see The Delphi documentation site docwiki.embarcadero.com has been down/up oscillating for 4 days is now down for almost a day.) only the Alexandria help was restored.

This killed the above redirect.

Luckily [Wayback/Archive] George Birbilis noticed that and commented this:

@JeroenWiertPluimers the correct link now is: docwiki.embarcadero.com/Libraries/Alexandria/en/…

In order to refer to the most recent Delphi version, now you have to use [Wayback] http://docwiki.embarcadero.com/Libraries/en/System.Character.TCharacter.IsLetter.

This redirects:

  1. via [Wayback] http://docwiki.embarcadero.com/Libraries/Alexandria/en/System.Character.TCharacter.IsLetter to
  2. to [Wayback] https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.Character.TCharacter.IsLetter

The above breaks the help integration from older Delphi products which is bad. It is also bad because it makes it harder to port legacy Delphi code to more modern Delphi versions.

Hopefully the above gives you a bit insight how the docwiki help system was designed and what is left of that design.

–jeroen

Posted in Communications Development, Conference Topics, Conferences, Delphi, Development, Encryption, Event, HTML, HTTP, https, HTTPS/TLS security, Internet protocol suite, Power User, Security, Software Development, TCP, TLS, Web Development | Leave a Comment »

Interesting thread on the usefulness of running a syslog server and being able to write to it

Posted by jpluimers on 2024/07/04

For my link archive:

  1. [Wayback/Archive] jilles.com 🔜 MCH2022 🏳️‍🌈 on Twitter: “My Ubiquity setup stopped working (again). This happens way to often in my opinion. I have setup a monitoring environment to debug the issues and consider it not reliable enough for the amount of money I spend on it.”

  2. [Wayback/Archive] Rick on Twitter: “@jilles_com Waar heb je problemen mee? En ik tijdelijk een syslog server draaien. Dan je kun je gemakkelijker de logs doorspitten (kiwi heeft een simpele gratis versie)”
  3. [Wayback/Archive] jilles.com on Twitter: “@RickvanSoest Ik draai een grafana setup met syslog, snmp ingest en een losse traceroute om uit te sluiten of het aan de provider of de hardware ligt.”
  4. [Wayback/Archive] jilles.com on Twitter: “@RickvanSoest Software upgrades die falen. In dit geval een PoE switch die op z’n gat lag. In dit geval iets dat met een reboot gefixt is. Maar in geval van de upgrade was het een compleet nieuwe configuratie.”

In todays cross-platform world, it pays if your tooling can send logging to syslog.

Though originating from the CP/M and SunOS background, I have done most of my professional development work in Windows back-ends and front-ends, so here are some links relevant to that:

--jeroen

Posted in .NET, C#, Delphi, Development, DVCS - Distributed Version Control, git, Software Development, Source Code Management, Subversion/SVN | 2 Comments »

GitHub – KirillOsenkov/LargeAddressAware: A build tools package that adds support for making 32-bit exes LARGEADDRESSAWARE (and some words on a 64-bit Delphi product)

Posted by jpluimers on 2024/06/26

[Wayback/Archive] GitHub – KirillOsenkov/LargeAddressAware: A build tools package that adds support for making 32-bit exes LARGEADDRESSAWARE

Hopefully this can be applied to Delphi projects as well. If not then in Delphi you can manually call this in an post-build task.

Addition late 20240626

[Wayback/Archive] Kirill Osenkov: “@wiert I also found that you can…” – Mastodon

@wiert I also found that you can target AnyCPU 32-bit preferred and it will give you the same address space. So that tool is only for x86.

Via [Wayback/Archive] Meik Tranel on X: “Please for the love of all that is holy. Do not build #dotnet tools to serve a non interactive task that is supposed to be run during a build – use an #MSBuild task package. Also #JS/#NPM devs should not be allowed to write tooling. Thanks for coming to my ted talk…”.

The Delphi bit inspired a few months ago by: [Wayback/Archive] Andreas on X: “Will there ever be a 64bit Delphi IDE or at least a LargeAddressAware version. Our Projekt crashes the IDE between 14-18 compilations because it runs out of memory. Maybe I have to patch the IDE myself by moving all .NET and Compiler memory allocations above the 2 GB address.”

Read the rest of this entry »

Posted in .NET, Conference Topics, Conferences, Continuous Integration, Delphi, Development, Event, msbuild, Software Development | Leave a Comment »

Delphi has had a more type safe FreeAndNil or a while now, but in order to do so it lies to you

Posted by jpluimers on 2024/06/26

During my year+ of cancer treatments, Embarcadero did a tiny thing that makes [Wayback/Archive]FreeAndNil safer to use. In order to do so, the method now lies to you by taking a const [ref] parameter which technically it is not allowed to change, but the internal hackery allows it to. Dalija Prasnikar explained it in 2020: [Wayback/Archive] Magic behind FreeAndNil.

The new signature is this:

procedure FreeAndNil(const [ref] Obj: TObject); inline;

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Delphi 10.4 Sydney (Denali), Delphi 11.0 Alexandria (Olympus), Development, EKON, Event, Software Development | 2 Comments »

Reminder to self: check to see if Delphi improved support for MMX/SSE/AVX instructions

Posted by jpluimers on 2024/06/13

This is from a long time ago [Wayback/Archive] Does Delphi support all MMX/SSE instructions? – Stack Overflow:

Delphi 2007 supports the MMX and SSE instruction sets. Certainly, Delphi 2010 and XE support up to the SSE4.2 instruction sets (but so far no support for AVX).

The [Wayback] Delphi 2005 Language Guide explained a bit, but no more recent PDF is available and the [Wayback/Archive] Embarcadero/IDERA Documentation Wiki is very much outdated on this information as per [Wayback/Archive] Talk:Assembler Syntax – RAD Studio:

Re: “Instruction Opcodes” The information on available instruction sets is outdated. D2010 and Fulcrum support the SIMD instruction sets all the way up to SSE4.2 (i.e., SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2).

–jeroen

Posted in Assembly Language, Delphi, Development, Software Development, x64, x86 | Leave a Comment »

delphi – What is the meaning of the bScan parameter value 0x45 in keybd_event? – Stack Overflow

Posted by jpluimers on 2024/06/06

From a long time go and a project that got cancelled, but maybe in the future I will need a similar thing again: back in the days not all raw key codes were readily documented or converted correctly from winuser.h to other environments (0x45 is the keyboard raw scan code value for VK_NUMLOCK of the Num Lock key).

[Wayback/Archive] delphi – What is the meaning of the bScan parameter value 0x45 in keybd_event? – Stack Overflow (thanks [Wayback/Archive] David Heffernan and [Wayback/Archive] kludg):

Read the rest of this entry »

Posted in .NET, Conference Topics, Conferences, Delphi, Development, Event, Software Development, Windows Development | Tagged: | Leave a Comment »

Field Tested Systems

Posted by jpluimers on 2024/05/14

Besides a cool portable spectrometer and software (written in Delphi), [WayBack] Field Tested Systems also has a really nice poster showing the spectrogram fingerprints of all the elements:

Via Delphi: 2 things to check when FMX/VCL units are inserted when you use VCL/FMX components (G+ post by Tom Field)

–jeroen

Posted in Delphi, Development, FireMonkey, LifeHacker, Power User, science, Software Development | Leave a Comment »

webcamoid/webcamoid: Webcamoid is a full featured and multiplatform webcam suite.

Posted by jpluimers on 2024/04/11

This is cool and works well (including the portable version) :[Wayback/Archive] webcamoid/webcamoid: Webcamoid is a full featured and multiplatform webcam suite.

Most code is C++ with bits using the QML language of the Qt cross platform UI library.

It reminded me of the Kylix days: the first Linux version of Delphi where the CLX GUI framework was a rework of VCL but based on Qt instead of Win32 GDI.

The downloads are at [Wayback/Archive] Webcamoid, The ultimate webcam suite! with installable and portable versions of 32-bit and 64-bit for Linux, Mac and Windows (I have tried the latter, see below why).

Read the rest of this entry »

Posted in C++, Delphi, Development, Kylix, kylix_rd, Qt, Software Development | Leave a Comment »

The Global Delphi Summit: June 13+14 in “Amsterdam” (actually the H20 venue in Purmerend)

Posted by jpluimers on 2024/03/15

Cool event – for me even relatively close (about 60 minutes driving) – [Wayback/Archive] The Global Delphi Summit taking place this year on June 13 and 14.

The speaker line-up is great as are their sessions. The main web-site pages are:

Via [Wayback/Archive] Delphi Summit 2024 – GDK Software

If you come from abroad, consider spending a few extra days. Purmerend has a nice old Dutch city center with roots going back as far as the 1100s. The map File:Waterland 1288.jpg – Wikimedia Commons shows it situated in between various lakes which in the 1600s all became land by pumping out the water and transforming them into polders. There are scenic routes over many of the dikes surrounding these polders.

Read the rest of this entry »

Posted in Conferences, Delphi, Delphi Summit, Development, Event, Software Development | Comments Off on The Global Delphi Summit: June 13+14 in “Amsterdam” (actually the H20 venue in Purmerend)

Oh boy, VB.NET and JavaScript both have a `with` keyword too!

Posted by jpluimers on 2024/03/05

Last year, within a week, I saw two tweets of languages that, like Pascal, have a with statement as well:

  1. [Archive.is] Shawn Wildermuth 💻☕🎸🎥🎮 on Twitter: “JavaScript’s Forgotten Keyword (with)”
  2. [Archive.is] John Kaster #BlackLivesMatter on Twitter: “@suited_aces @marcocantu @delphijunkie @JimMcKeeth @jpluimers I present “with”… “

The first points to an article that shows the JavaScript implementation of with is very similar to the Pascal one: [Wayback] JavaScript’s Forgotten Keyword (with) – DEV Community.

Just in case some of my readers do not know my opinion of the Pascal with statement  (it even has it’s own blog category), I really think you should not use it Delphi: you should avoid the with statement as it makes your code less future proof.

The reason not to use it is called [Wayback] Accidental Shadowing in computer language speak (it also can rear its head when you define variables at different block levels like for instance this golang example: [Wayback] Warning for accidental variable shadowing with block scope – Technical Discussion – Go Forum).

Even the JavaScript specification advises against using the with keyword in [Wayback] with – JavaScript | MDN

**Warning:**Use of the with statement is not recommended, as it may be the source of confusing bugs and compatibility issues. See the “Ambiguity Contra” paragraph in the “Description” section below for details.

There have been various proposals to extend the Delphi implementation of the with statement to make it more resilient to Accidental Shadowing by forcing the usage to be prepended by a . (dot) or alias, as for instance seen in [Wayback] Re: “with” Coders are Monsters – delphi / [Wayback] delphi • View topic • “with” Coders are Monsters:

This is in fact what the second twitter messages pointed to: a VB.NET example doing just that: prepend with a dot: [Wayback] Maarten Balliauw on Twitter: “Looks like using With makes it pretty clean!… “

I was not even aware that VB.NET had it, but it has: [Wayback] With…End With Statement – Visual Basic | Microsoft Docs

And it has similar debugging issues as with Delphi as per [Wayback] The VB.NET ‘With’ Statement – embrace or avoid? – Stack Overflow:

Find the beginning of a With statement and set a breakpoint. Step to the next line (so you’re hiding the first line right under the if block). Highlight it, then ‘Add Watch’. You should see this: ‘With’ contexts and statements are not valid in debug windows.

–jeroen

Posted in .NET, Delphi, Development, Go (golang), JavaScript/ECMAScript, Pascal, Scripting, Software Development, VB.NET, With statement | Leave a Comment »