GExperts 1.3.14 experimental twm 2019-09-08 released

 Delphi, GExperts  Comments Off on GExperts 1.3.14 experimental twm 2019-09-08 released
Sep 082019
 

I just released GExperts 1.3.14 for all supported Delphi versions.

Apart from the bug fixes to the source code formatter there are the following changes:

  • Export and Import entries for the Tools menu (blog post)
  • Copy and paste for Delphi Tool menu entries (blog post)
  • The Uses Clause Manager builds its list of identifiers in the background so it should now take less than a second to display the identifier list.
  • Since Delphi XE3 and later no longer allow creating components with subcomponents (the OTAPI function for that crashes – bug report here), GExperts no longer supports these components in the Replace Components expert.
  • The Delphi Tool Properties dialog now gets resized so the list of macros can be displayed without scrolling.
  • Added incremental search to Code Proofreader dictionary
  • Keep StringGrid selection visible when focusing other controls in the Rename Components configuration dialog. (Patch by Achim Kalwa)
  • Fix for bug #129 The “Other Properties” list in the Rename Components Configuration is not saved if the list is empty. (Patch by Achim Kalwa)
  • New “Focus Code Editor” expert, provides a keyboard shortcut Shift+F6 to focus the code editor window.
  • Improved output in the Keyvoard Shortcuts window: Modifier keys are shown in a separate column. The list can be sorted by clicking on the title column.
  • Workaround for bug #127: Open File now always sets the focus to the code editor when a file was opened.
  • Separate configuration dialog for printing in class browser moved to a new tab in the standard configuration dialog
  • Moved the “Parse map file” option to the main search dialog of Grep
  • Fix for bug #124: Error while installing multiple design packages
  • Partial bugfix for Grep search in form files (bug #120): If multiline search is *not* active, no matches are found. Not sure this fixes the problem that is originally reported in #120 since I was never able to reproduce the problem.
  • Also add a size grip to the GExperts configuration dialog (Patch by Achim Kalwa)
  • Unfold source at found position for Previous / Next identifier editor expert
  • Unfold source when jumping to code editor from procedure list
  • More flexible Convert Strings expert
  • Lots of small improvements to the code base that are not visible to the user.

Please note that the naming scheme has changed. The files are now called GX<DelphiVersion>_<GExpertsVersion>_experimental_twm_<date>.exe. where the GExperts version is now fully spelled out as 1.3.14 rather than 1.3E.

There is also one change that some of you might not like:
I was getting lots of emails containing feature requests and bug reports that were sent via the bug report / feature request dialog in GExperts. Since I usually don’t have the time to immediately attend to them they tend to accumulate in my inbox and clutter it until I find the time to wade through them and usually create a feature request or bug report on SourceForge. This process is not only time consuming but also error prone.

I prefer to work on the actual program rather than being my own secretary. So, from now on the the dialog mentioned above links to the appropriate page on SourceForge instead.

Yes, that means I expect my users who want some bug to be fixed or a feature added to invest the effort to:

  • Create an account on SourceForge if they don’t have one.
  • Write a detailed bug report / feature request, including screen shots if that’s helpful.
  • Answer any questions that might arise from these reports via SourceForge.

If you don’t like this, think about your attitude. You are getting this tool for free after all and nobody forces you to use it. (Yes, I have received some rather disturbing emails when I asked people to file a bug report on SourceForge instead of sending them to me or posting them in some forums. Please remember: I don’t get paid for my work on GExperts, you are not my customers, therefore I don’t need to be “service minded” as somebody called it.)

The new version is available for download on the GExperts download page.

 Posted by on 2019-09-08 at 14:23

Various bugs in the GExperts code formatter fixed

 Delphi, GExperts  Comments Off on Various bugs in the GExperts code formatter fixed
Sep 082019
 

There were some long standing bugs in the GExperts code formatter, most of them concerning language features that didn’t exist back in Delphi 2007 (and therefore were not my primary concern for a long time). I have fixed several of them now:

  • Anonymous methods were not indented correctly
  • Various problems with Generics as reported here and some more I found myself while testing the ones reported

In addition there are the bugs I already fixed last weekend:

  • Variant records with methods were not indented correctly
  • The formatter did not know the ‘final’ keyword

I’m pretty sure that the quality of the GExperts code formatter now exceeds the one of the built in formatter in the Delphi IDE (which in my eyes only recently became actually usable, the first versions were just bug ridden proofs of concept). That of course doesn’t mean that it is perfect now. If you find any more bugs, please report them! I cannot fix bugs that I am not aware of and there are still a lot of language features that I don’t or rarely use myself. Please include examples of wrongly and correctly formatted code with these reports (as actual text, not as a bitmap).

 Posted by on 2019-09-08 at 11:44

Please remove unused versions of Java

 Windows  Comments Off on Please remove unused versions of Java
Aug 082019
 

Today I got one of these dreaded update reminders for software that I don’t really want to have on my computer (no, not Flash this time). So after procrastinating the inevitable for a few days I just now started the update. I got an interesting surprise:

What???!!!! Oracle doesn’t want me to keep Java on my computer, just because I haven’t used it for half a year? Is this the same company that boasts how many gazillion devices run Java?

Ok, guys, I’ll go for it and remove Java, but I am sure I will shortly find out which of the programs on my PC requires it and will no longer run because I uninstalled it.

 Posted by on 2019-08-08 at 10:09

Man wird alt wie ‘ne Kuh und lernt immernoch dazu …

 Windows  Comments Off on Man wird alt wie ‘ne Kuh und lernt immernoch dazu …
Aug 042019
 

(German proverb, roughly translates to: You get as old as a cow and still learn something new.)

I didn’t know about the Windows assoc command which lets you deal with file associations on the command line.

Found it via this post on StackOverflow.

 Posted by on 2019-08-04 at 10:58

dzBdsLauncher 1.0 released

 Delphi, dzBdsLauncher  Comments Off on dzBdsLauncher 1.0 released
Aug 032019
 

As I work with multiple Delphi versions on the same computer it happens frequently that I simply double click on a project and the wrong IDE starts. It then either tells me that the .dproj file format is invalid (if it was created with a later version) or it updates an older file format to the format which that IDE uses.

While I solved this problem for projects which only get compiled with a particular Delphi version by using a batch file, this fails when a project is in the process of being migrated to a new version. In that case there will be one .dpr file and two or more .dproj files for that project. e.g.

  • myproject.dpr
  • myproject.2007.dproj
  • myproject.xe2.dproj
  • myproject.10-3.dproj

Where the suffix tells me which Delphi version to use. It is actually a nice feature of the IDE that there can be multiple .dproj files for a given .dpr file.

Unfortunately there is no easy way to just double click on one of the .dproj files to open it in the correct IDE.

Enter dzBdsLauncher:

It’s a simple tool that I register as the default program for .dproj files. It checks the file name passed to it for a suffix, and automatically starts the correct IDE for it.

It reads the executable name of the installed bds.exe from the registry, so it does not need any configuration.

It does not work if there is no suffix. In that case, you simply double click the .dpr file instead of the .dproj file. If I find the time I will enhance it to check the .dproj file for the Delphi version that created it and start the correct IDE based on that. Unfortunately this is more complex than you’d think.

The source is here on OSDN.

 Posted by on 2019-08-03 at 20:09

I just uninstalled Google Chrome

 Google  Comments Off on I just uninstalled Google Chrome
Aug 032019
 

Apparently there was a long discussion on this before, but somehow I missed it:

The latest release of Google Chrome no longer shows the full url any more. It removes the protocol (http:// or https://) and also the “www.”-prefix if it existed.

So “https://www.bing.com” becomes just “bing.com”.

In my opinion this is plain dangerous.

It’s as dangerous as the “feature” Microsoft added to Windows Explorer back in Windows XP of not showing the file extensions. I still don’t understand why they never realized that it was a mistake and reversed this decision.

For now, Firefox has become my standard browser (again), even though it has its own problems.

I hope that the other browsers won’t follow this stupid idea. (But somehow I doubt they will see the light.).

Google Just Stopped Displaying ‘www’ and ‘https’ In Chrome’s Address Bar on slashdot.

 Posted by on 2019-08-03 at 19:28

GPS time vs. UTC

 Delphi  Comments Off on GPS time vs. UTC
Jul 312019
 

If you have ever worked with GPSes you probably know about the NMEA protocol. Many of the sentences there have got a time stamp that is in UTC (universal time coordinated – thank the French for the odd word order). Like me, you might have assumed that GPS works with UTC, but that is not the case.

Internally GPS works with GPS time which is kept as weeks and seconds since the start of the GPS system at 00:00:00 on 1980-01-06. This time is kept by atomic clocks. The other GNSSes (Global Satellite Navigation Systems) also have their own internal clock.

UTC (formerly known as GMT) is the local time at longitude 0 (where the London district Greenwich is located, hence Greenwich Mean Time), without any fiddling with daylight savings time. Since UTC is meant to conform closely to the rotation of the earth and the latter is not stable, it needs the occasional leap second. At the time of this writing, there have been 18 of these since 1980. So UTC is 18 seconds behind GPS time by now.

Why do I write about this? I have recently started integrating an OXTS INS into one of our measurement vehicles. These devices can be configured to send NMEA data over a serial port, just like a conventional GPS. They can also send NCOM data, which is their internal binary format. While the NMEA data adheres to the NMEA specification of providing the times in UTC, the NCOM data does provide the “native” GPS time. So they do not match, which took me by surprise when I encountered it.

Of course I first assumed a bug in my own code, but it wasn’t. The first hint was that the times were always 18 seconds off. I still didn’t get it and had to actually call support. (Afterwards I googled it and found lots of references, so I guess I should have been able to figure it out myself.)

Since that offset is not constant – there might be yet another leap second soon – the NCOM format also contains the current UTC time offset. Look in Table 26 on the NCOM format documentation.

It’s sent in the Status Information as channel 15 and is stored in byte 7 of the BatchS structure. Just to make it difficult to read it is encoded as a 8 bit signed integer with a twist: Bits 1–7: UTC time offset, valid when Bit 0 = 1.

Here is some Delphi code to decode that particular value:

function TSTable26Rec.TryGetUtcTimeOffsetSecs(out _Offset: Integer): Boolean;
begin
  // only valid if Bit0 = 1
  Result := ((UtcTimeOffset and $01) <> 0);
  if Result then begin
    // the type cast to Smallint is necessary to get the sign correctly
    _Offset := Smallint(UtcTimeOffset shr 1);
  end;
end;
 Posted by on 2019-07-31 at 10:11

Common unit aliases for backwards compatibility to older Delphi versions

 Delphi  Comments Off on Common unit aliases for backwards compatibility to older Delphi versions
Jul 282019
 

Backwards compatibility to older Delphi versions is an issue mostly encountered by component and IDE plugin developers. Borland, Codegear and Embarcadero actually did quite a good job in that area. Many ancient projects (at least back to Delphi 6) can simply be loaded into a later IDE and they just compile. The IDE usually makes the necessary changes. That of course does not mean that there aren’t any hiccups 😉

One commonly encountered problem is that some declarations have moved to different or newly introduced units over the time. Two examples of that are

(I hope I got these right.)

This has two effects:

  1. Later IDEs automatically add the new unit names to the uses lists of forms that use these components. Unfortunately it ignores any {$IFDEF}s you might already have in place there, so the generated source code does not compile due to a duplicate in the uses list: “E2004 Identifier redeclared: ‘Actions'”.
  2. Older IDEs will no longer compile the code because these units are not available there: “F1026: File not found ‘Actions.dcu'”

Unit aliases can solve this problem. You add an entry “NewUnit=OldUnit” to the unit aliases list in the project options, in this case that would be:

Actions=ActnList;ImageList=Controls

You then simply add the new unit names to the uses list. This solves both issues: The IDE will find the unit it expects and will no longer try to add it. And older compilers will know that the new unit just maps to another one they can find.

If it’s just about backwards compatibility, an entry “NewUnit=System” would also do the trick.

btw: You can safely remove the pre defined aliases for the units Windows and BDE. They date back to ancient times (Delphi 3 in 1997?) when multiple units for each of these were merged into a single one.

btw: Apparently it is not possible to define a unit alias that starts with an underscore:

_Actions=ActnList

will result in the compiler error: “F1030: Invalid compiler directive: ‘-A_Actions=ActnList'” (at least in Delphi 2007). It’s allowed to end in an underscore though.

Edit: I already blogged about unit aliases and what they are good for in 2016 in Backwards compatibility of uses lists. So this is just some additional explanation and also gives me the list should I need it again.

 Posted by on 2019-07-28 at 14:19

Bugfix for Delphi IDE explorer in Delphi 10.3

 Delphi  Comments Off on Bugfix for Delphi IDE explorer in Delphi 10.3
Jul 272019
 

In December 2018 I found out that some of the functionality in my Delhi IDE explorer was broken in Delphi 10.3, namely the function to select the current active control or automatically follow the focus. The reason was that the IDE now used the Screen.ActiveControlChanged event itself, disabling it for to my plugin.

Today I finally found a way to fix it, so the current source code will work with Delphi 10.3 (all three releases).

 Posted by on 2019-07-27 at 14:49