hcOPF building blocks - Application Settings

November 2nd, 2020

I just checked in some additional code to provide database driven hierarchical Program Settings using the hcOPF framework for data access.  The Settings code can be found under the Source/UI/Common/Settings folder for domain objects and other non-visual code, including database scripts for Firebird.  The actual program Settings dialog is located in Source/UI/VCL and only a VCL version is available at this time.

It should be simple to incorporate this into a VCL application, especially one already using Firebird.  If you run the Application Settings.sql script it should create all the necessary database structures.  Then you need to populate the SettingsCategory and Settings tables.  To integrate the ProgramSettings dialog, use the unit and call it’s Execute method with the Settings list and current security level. Keep in mind that the settings key value must be unique across all settings. While a path like key may work, if you re-organize the setting hierarchy the key will no longer make sense.

At some point I would like to provide a “Designer” mode into the Dialog that would allow you to interactively create or modify the setting hierarchy.  For now, scripts to build it will have to suffice.  Keep in mind that this is the first release of code I wrote a long time ago.  It has worked well for the last 10 years, but it needs to be tightened up (more database constraints, a review of code for better performance/less overhead).  When time permits I intend on improving it for use on future projects.

C# features I wish Delphi Had

October 2nd, 2020

In C# 4 Named and Optional Arguments were introduced to allow developers to supply only the arguments they wish to in a method call.  Similar to Objective C, this makes the method call more descriptive and shorter.  I have often wished I could use this kind of syntax when calling a method with a Boolean parameter.  Reading the method call with a True or False argument doesn’t tell you  what the meaning of the argument is.  Something like  UpdateBusinessObject(TriggerEvents: False) is much more meaningful. The only alternative in Delphi is to define a 2 element enumerated type and pass that rather than a boolean.

The New modifier to explicitly deal with hiding of members from ancestor classes.  That includes properties which if declared public in Delphi cannot be hidden by using any trick such as re-declaring a property with only a getter.

String interpolation is also a nice feature of C# 6.  It certainly beats updating all the index values for Format() when adding an additional format specifier.

What C# features do you like that Delphi could use?

Pain Ergo Ergonomics

September 30th, 2020

As a programmer I spend far to much time in front of a screen, and as a result I’ve suffered from my share of back, neck and wrist pain.

For the last several weeks I’ve been suffering from a repetitive strain injury on my dominant wrist thanks to all the mousing I do.  Icing the wrist, and resting it as much as possible helped, but it was just a roller coaster ride in terms of the pain returning.  After all, it’s not as if you can just stop working.

I was in one of my favourite stores; MemoryExpress a local computer chain, when I noticed the sales rep was using a bizarre looking mouse.  I asked him about it, showing my wrist brace, and he said it was great and really helped prevent my kind of inquiry.  I checked it out on their website, and after the pain increased again a couple days later, I broke down and bought it.

The Logitech MX Vertical mouse is not cheap at $120 CAD, but already my wrist is feeling better and it’s only been a day using the new mouse.  You can easily spend several hundred dollars on physio, or taking time off so why not spend it on a more ergonomic mouse that helps keep you healthy.  Highly recommended!

Installing Firebird 3.06 on Ubuntu 18.04.5 LTS

September 21st, 2020

Thanks to my inexperience with the Ubuntu package manager, and my talent for breaking software, I managed to trash my Ubuntu installation recently to the point where it wouldn’t even boot.  It gave me the opportunity to test my backups, and I’m happy to say that re-installing Ubuntu with a restore of data, with some re-installation of apps got me pretty much back to where I was.  I did however, encounter an issue where Ubuntu would not login to the GUI.  Thankfully I eventually found this post, which solved the problem.

The original issue started around the installation of Firebird 3.0.5 for Linux. It appeared the installer needed a file libtommath.so.0 which was not present on my distro.  I thought I had gotten it installed properly, then I ran into the infamous “COLLATION UNICODE_CI_AI for CHARACTER SET UTF8 is not installed” error.  I managed to get past that, but when I opened the database in an FMX app using FireDAC in local mode I got an exception “N8Firebird16status_exceptionE”.   FlameRobin would open it without issue.  If I chose Break in the exception dialog it looked for the source to libstdc++.so.6. The exception was in a call to isc_attach_database or isc_dsql_fetch.  I assumed it was an incompatibility between FireDAC and the standard C++ library.

It turns out I had gotten myself into a mess trying to get the libtommath file.  I broke some package references and when I tried to fix them, a slew of packages were removed.  I was warned not to continue unless I knew what I was doing, but when has that stopped me?  Also there didn’t seem to be any alternative to fix the package manager’s complaint that things were broken even if everything still seemed functional.  Ah live and learn…

This time I tried installing Firebird 3.06 thinking it was newer and might address some of the problems I had encountered….nope.  This time I used a symlink ( sudo ln -sf /usr/lib/x86_64-linux-gnu/libtommath.so.1 /usr/lib/x86_64-linux-gnu/libtommath.so.0 ) to resolve the missing libtommath.

Then I got a completely new error in the FMX deployment code.  It attempted to create a hidden folder “/home/<username>/.fmxlinux” which contains “libfmux-1.48.so”.  I did not invoke paserver with sudo so I didn’t have adequate permissions and got an EFCreateError exception with an empty message triggered by line 9345 of System.Classes.  I only mention that because the message should contain the filename being created and the OS error message but it did not.

After resolving the permission issue, I re-confirmed that even on my fresh Linux/Firebird install, I still get an exception when attempting to access my database, which of course pertains to the missing collation.  Since I didn’t make note of how I resolved the collation error when I installed 3.05 I can’t be sure what I did, or whether the “resolution”  did not truly work.

Reading the “Release notes for Firebird 3.06″ I saw they had upgraded the ICU libraries to v52.1 so I downloaded the package and installed it.  Re-starting Firebird the collation error was resolved and neither FireDAC or FlameRobin reported the “N8Firebird16status_exceptionE” error any longer.  Obviously whatever I did to fix the collation error when I installed Firebird 3.05 was not correct despite the fact I was no longer getting the collation exception.

I hope this helps someone else install FireBird 3.06 on Ubuntu/Debian and saves them all the time I spent searching for solutions to the myriad of issues I encountered including my own folly.

I Just Don’t GetIt

September 17th, 2020

In case you were wondering, GetIt appears to be down at the moment.  I went to take 5 minutes to update a bug report, and I needed to install FmxLinux to do so, only to see:

GetIt Not Accessible

GetIt Not Accessible

I guess it will have to wait.  This is the problem of automating everything.  You become reliant on services that need to be up 24×7 or the odds are they will impede your work at some point.

UPDATE:  GetIt is back up now.

Ubuntu is better with WINE

September 15th, 2020

It’s been a couple of years since I made the jump to Ubuntu 18.04 LTS as my primary operating system, thanks in no small part to Windows 10 updates and BODs.

It all started when I loaded my Toshiba Satellite L70D laptop with an SSD and Ubuntu to try to extend its usable lifetime. To give you an idea how old it is, the laptop shipped with Windows 8.1 on it, and I bought it because it was one of the few 17″ laptops still available at the time.  I would have bought a 17″ Macbook Pro after my 15″ died, but it seemed Apple

and other manufacturer’s were no longer making 17″ laptops.  Now you can find numerous 17″ PC laptops aimed at the gaming market.  Anyway, the laptop ran well and I discovered I could run VMs using VirtualBox reliably.  I had been using VMWare Fusion before, and had tried earlier versions of VirtualBox with no success.

I had been looking for a lean OS on which to run numerous VMs.  I was considering OS/X, but there is definitely a cost premium for the hardware, and the choices available are more limited than the clone market.  I even thought about a Hackintosh but didn’t really want to explore EULA violations and support issues for updates.

After discovering all the major software I was using had Ubuntu supported versions, I decided to take the jump and load it on my new (at the time) desktop.  While I ran into a few VirtualBox issues along the way I have never lost any data so far, and would have to say that my experience rivals the commercial VM software I have used.  I’ve also had no hardware support issues like I had experienced previously when trying out Linux distros.

Linux seems to have matured enough that even a noob with a little Googling can find the solution to any issue or question I have had thus far.  Of course I chose Ubuntu because it is one of the largest distros, so it’s a relatively safe choice, but other distros I played with seemed just as viable.

Recently I wanted to see if a personal VCL project would run natively under Ubuntu.  I was contemplating making an FMX version just to have it natively on Linux without using a VM.  The app uses a dynamic plug-in architecture with run-time packages.  It is based on code I originally received from Mark Miller; the author of Coderush for Delphi and DevExpress’ Coderush for .NET.  The project also uses Firebird 3.0 embedded, and the VirtualTreeView in grid mode, since it’s open source and lightning fast.

I tried CrossVCL’s VTreeView demo only to find out that it is indeed a work in progress.  It’s VTreeView support has some painting issues and run-time exceptions were thrown so I knew I needed to find another way to get my VCL app onto Ubuntu without using VirtualBox.  The other night I thought I would see if I could get it to work under WINE.  I installed Q4Wine from the Ubuntu software app, and added my application EXE with the default settings.  Much to my surprise, it fired right up.  I even managed to make an Ubuntu shortcut and add it to my favorites.

CompositeApp running on Ubuntu 18.04LTS with WINE

Embedding Firebird 3.0X

September 1st, 2020

With Firebird 3.0X releases there is no longer a separate install for embedded deployments.  In fact the guidance essentially is to use the ZIP package and customize it as desired.  If you want a minimal deployment, it’s difficult to know what files are absolutely necessary, unless you are very familiar with the project.

I recently had a need to distribute an application for testing, and didn’t want the users to have to install the Firebird server.  The target audience is also well suited to an embedded install, so I thought I would try it out.  With the help of ProcessMonitor and the aforementioned guidance documentation I discovered that the following files seem to be the bare requirements:


I am using Local DB access via FireDAC with Delphi 10.4 and tested this configuration by simply unzipping the files including my app, and the database into a Win7 VM and running it.  Firebird weighs in at about 16Mb where my app and it’s supporting DLLs are 40Mb with Debug info.

Getting Cross with CrossVCL

August 17th, 2020

Thought I would give CrossVCL VirtualTreeView support a look see, but when I installed it I couldn’t even run any sample applications.  Kept getting “ld-linux.exe: error: cannot find -lGL”.  Being a Linux newbie I searched the KSDEV CrossVCL issue forum and FAQ thought I was onto something, but after expanding the compiler messages I discovered it was GTK3 related.

A little googling and I found this post which explains that if you want to compile apps for GTK3 you need to change the version of the GTK3 libs that come with Ubuntu 18.04 LTS.

To use gtk2 or gtk3 apps you don’t need to install anything. But, if you want to develop (or even just compile) apps this is what you’re looking for:

sudo apt-get install libgtk-3-dev

After issuing the command above and updating the SDK I was able to compile and run CrossVCL apps.  No need to get cross, just the correct libs.

Another GExperts GEM

August 11th, 2020

I’ve used GExperts for some time, and I keep finding gold nuggets or gems as the saying goes, that make it easier to accomplish day to day tasks.

GIT may be  a great version control system, but it probably contributes to a lot of task switching, which can impact productivity.  For instance, I often need to switch branches to address smaller issues, or make a fix for something QA has found during testing of a fix (hey..sh..it happens…).  Each time I do so, all the files I had open in the IDE for that particular issue, are lost in terms of knowing which ones they were.  AFAIK (as far as I know) there is no way to have the IDE save this information such that when you switch branches it will be preserved.  The IDE will save the current open file list in a project DSK file so it can restore them, but if you have the DSK file in version control, switching branches will replace it.  DSKs are normally not versioned because sharing them between developers is not desirable.  If it’s not in version control, saving it on a different branch will overwrite the list of files.  What is the solution?

One potential solution is to use GExperts Favorites feature.  You can create folders for each set of files (by project or issue # for instance),  Then just add the files you want and next time you switch you can easily re-open the files of interest from your favorites.  It even has the ability to add your Favorites to the File menu.

One of the great things about Delphi’s IDE is the OpenTools API which allows for such extensive add-ins, and Thomas Mueller has put a lot of effort in maintaining and evolving the project.  Thanks!

hcOPF supports Delphi 10.4 Sydney

July 25th, 2020

Things have been a little crazy in case you hadn’t noticed.  Between COVID-19, the economic fallout and all the turmoil in our nearest neighbour, I plum forgot to blog about updating hcOPF to support Delphi Sydney 10.4.

It might also be because adding support for a newer compiler version doesn’t take a great deal of effort. I normally just copy the ones from the previous version, and modify them as needed for the new one.  It would of course be a whole lot easier if {$LIBSUFFIX AUTO} was implemented and I could use that as well (or something like it) to set the output folder. Then I wouldn’t even need to make a copy and update the projects!