GExperts Bugfixes

 GExperts  Comments Off on GExperts Bugfixes
Dec 302017
 

The Unicode issues in GExperts just don’t end. Today I fixed three of them:

procedure bla;
begin
  SomeVar := 3245;
  // german description with some äöüß to SomeVar
  SomeVar := 123;

  SomeQuery.FieldByName('GermanWordWithäöüß').AsString := 'some value';
end;

(Yes, I know, this doesn’t compile.)

  • Move the cursor to the first occurrence of SomeVar and press Ctrl+Alt+Down. The cursor jumps to the middle of the next Occurrence of SomeVar instead of the start of the identifier.
  • Move the cursor to the opening parenthesis after FieldByName and press Ctrl+Alt+Right. The cursor moves to somewhere in AsString rather than the closing parenthesis.
  • Move the cursor to the closing parenthesis and press Ctrl+Alt+Left. You get the error that AsString is not a valid delimiter

They were caused by the two byte UTF-8 characters in the respective lines which threw off the column index.

And if that wasn’t enough I also fixed some bugs in the Grep history list which could cause an Access Violation, infinite loop or wrong check marks in the Open dialog.

All these were reported by Konstantin Tkachenko who also included some patches which fixed them. Unfortunately he could only test them in Delphi 2010 so they worked for Delphi 2007+ but not for Delphi 6 and 7. They were valuable nonetheless. Thanks Konstantin!

Also, Achim Kalwa, who already contributed quite a few patches to GExperts, sent me some more this week:

  • Remove the ugly “(S+C+x)” suffixes in the Project Options dialog and replace them with a hint.
  • Sort the component names by tab order in the Copy Component Names expert.
  • Shortcuts for Add/Remove/Default buttons in the Editor Popup menu configuration dialog as well as sorting the list of experts alphabetically.

Access Violation in Delphi 6 or 7 when setting IOTASourceEditor.BlockVisible to True

 Delphi  Comments Off on Access Violation in Delphi 6 or 7 when setting IOTASourceEditor.BlockVisible to True
Dec 302017
 

Note to self:

If you get an access violation when setting IOTASourceEditor.BlockVisible to true in Delphi 6 or 7 e.g.:

procedure GxOtaSelectBlock(const Editor: IOTASourceEditor; const Start, After: TOTACharPos);
begin
  Assert(Assigned(Editor));
  Editor.BlockVisible := False;
  try
    Editor.BlockType := btNonInclusive;
    Editor.BlockStart := Start;
    Editor.BlockAfter := After;
  finally
    Editor.BlockVisible := True; // <---- BOOM
  end;
end;

Check that your source editor does not contain UTF-8 characters or a BOM. Delphi 6 and 7 allow you to paste those into the editor window (from an editor that supports them, like Notepad++ or Delphi >7) but cannot handle it correctly.

Delphi XE2 crash when opening the About dialog

 Delphi  Comments Off on Delphi XE2 crash when opening the About dialog
Dec 292017
 

Today I had a rather annoying problem with Delphi XE2. I only wanted to change the caption of a TListView column using the Columns Editor (right click -> Columns Editor). The IDE crashed on me with an Access Violation. So, I thought I had broken it again (things like this happen when you are developing IDE plugins) and uninstalled GExperts. After a restart I tried it again and got the same Access Violation, proving at least that GExperts was not the culprit.

So, which other IDE plugins were installed? To find out, I opened the Help -> About dialog, which immediately crashed on me with an Access Violation. It happened while it was drawing the list of Installed Products.

Next I tried to debug Delphi with itself, loading the GExperts sources. The problem at least was reproducible and the call stack told me the crash was in TCustomListView.CNNotify. That unfortunately wasn’t very helpful apart from telling me that it had something to do with custom drawing (which was deeper in the call stack) of a TListView, which was what both crashes shared: The About Dialog as well as the Columns Editor both use TListView and apparently do custom drawing.

So, I removed all experts that I had installed …

… and tried it again. At first, it seemed to work, I could open the About Dialog and nothing bad happened. Then I opened the project I was trying to change, called the Columns Editor and – boom – got the Access Violation.

I restarted the IDE again and looked into the About Dialog. There were only the Embarcadero Quality Insight and the JEDI Visual Component Library left. No crash occurred. I reloaded the project, opened the About Dialog again and got the now familiar Access Violation. WTF? Could it be the JVCL?

I renamed the JvCore160.bpl package that all jvcl packages load. And tried again. I got lots of error messages when I started the IDE and again when I opened my project, but I could successfully open the About Dialog.

So, if it really is the JVCL, why did the Access Violation only occur when my project was loaded?

I made the JvCore160.bpl package available again, restarted the IDE, but this time created a new VCL project and added a JVCL component to it. I opened the About Dialog and got the AV. I guess that proved the point.

That was when I remembered reading about Delphi 2005 (and later) loading packages on demand instead of on startup. This explains why the AV happens only after a JVCL component was used in a project: Because otherwise the packages simply were not loaded at all.

Unfortunately that didn’t help much, because my project needs the JVCL (in particular the TJvFilenameEdit component), so I could not simply uninstall it. Since I had not heard about this problem, I guess it isn’t wide spread. One possibility is that I have produced it myself by sticking with an older JCL/JVCL source code and simply patching it to make it compile with Delphi XE2 instead of keeping up with the latest version (The reason for that is that I don’t like the hassle with Git, so I stopped following the JEDI projects when the sources were moved from SourceForge to GitHub.)

I went to GitHub, downloaded the latest ZIP files from all three projects, put everything together and installed JCL and JVCL to Delphi XE2 (the JCL installer dialog looks intimidating if you have got 18 versions of Delphi installed). I then had to remove the directories from the library paths again and compile several of my packages that need the JCL or JVCL+JCL, which required me to make some small changes to my code. But it took only about half an hour, which is nothing compared to the several hours I had already wasted trying to find out what made Delphi XE2 crash.

I loaded the dreaded project again, and everything worked fine. I could finally change the List View captions which was all I wanted to do to start with.

Isn’t it great when everything just works?

new Seagate Barracuda drives are very slow

 Linux  Comments Off on new Seagate Barracuda drives are very slow
Dec 292017
 

Seagate has changed their Barracuda desktop 3,5″ 2 and 4 TB drives from using 3 platters to using only 2 while doubling the cache RAM from 128 to 256 MBs.

We have been buying this type of drives for various usages, one of them is the 4 TB drive for the backup of our main file server (using Dirvish). Before the change, an ext3 format under Ubuntu Linux took a few minutes. After the change, it now takes literally(!) hours. The inode tables counter grows very quickly until it has reached about 1000, after which it starts crawling upwards veeeeeerrrrryyyy sloooooowwwwwlyyyyyy. I guess about 1000 is when the cache has been filled and any further writing goes directly to the actual drive.

Once the formatting is done, the initial backup takes several days rather than the usual 8 to 12 hours it took before the change.

Once the initial backup is done, the incremental backups only take the usual 30 minutes unless there have been very many changes, then again you can see that the drive is very slow when writing large amounts of data.

It does not matter whether the drive is connected via USB 3 (which is the way we use it for the backup) or SATA, the slowdown is reproducible every time.

Another use for these drives was the 2 TB variant to store videos in our measurement vehicles. There are 2 of these drives in one PC which are used to write MJPEG streams of 2 HD cameras each. These cameras take a picture every metre, which comes out at about 22 pictures per second when driving at 80 km/h. Before the change that was no problem at all. We could even drive at 100 km/h (27 pictures per second). After the change, the videos suddenly had lots of lost frames because the drive is just too slow to write them.

For now the 1 TB variant seems to be as fast as ever.

So now we are looking for alternative drives to use. Until a few years ago we only bought Hitachi but switched to Seagate when Western Digital acquired HGST and raised the prices. I guess we’ll have to look into WD / HGST again as well as checking out other Seagate product lines.

Weihnachtslieder Spickzettel

 German Only  Comments Off on Weihnachtslieder Spickzettel
Dec 232017
 

Es ist jedes Jahr dasselbe, es soll vor der Bescherung gesungen werden und nur wenige kennen den Text. Irgendwie schon peinlich. Deshalb habe ich jetzt endlich eine Maßnahme ergriffen und mir den Text der gebräuchlichsten Lieder zusammengestellt. Sie passen in noch lesbarer Schrift auf eine DIN A4 Seite, wenn man zwei Seiten auf eine druckt (typischerweise erlauben heutige Drucker das).

Enthalten sind:

  • O Tannenbaum
  • O du fröliche
  • Ihr Kinderlein kommet
  • Alle Jahre wieder
  • Stille Nacht, heilige Nacht

Download als PDF.

Alternativ zum Ausdruck kann man sich das PDF auch auf dem Smartphone anzeigen lassen. Das hat den Vorteil, dass man es auch bei schlechter Beleuchtung lesen kann. Ob das der Stimmung zuträglich ist, muss jeder selbst entscheiden.