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

Archive for the ‘Delphi’ Category

Registry Search-Replace tools – correcting the havoc after a data migration

Posted by jpluimers on 2011/10/07

A while ago, I found myself in the situation where at a corporate client the user profiles had moved on the LAN. Very understandable: it was one of the migrations towards DFS. They notified this in advance, so I made backups of everything (home drive and user profile) just to make sure.

The move indeed caused all sorts of havoc, because the data was moved, but the registry was only slightly modified.

Some of the errors I got were like these:

[Internet Explorer - Search Provider Default]
A program on your computer has corrupted your default search provider setting for Internet Explorer.

Internet Explorer has reset this setting to your original search provider, Live Search (search.live.com).

Internet Explorer will now open Search Settings, where you can change this setting or install more search providers.
[OK]

and

[Desktop]
\\old-server\old-share\user-id\Desktop refers to a location that is unavailable. It could be on a hard drive on this computer, or on a network. Check to make sure that the disk is properly inserted, or that you are connected to the Internet or your network, and then try again. If it still cannot be located, the information might have been moved to a different location.
[OK]

Below some of the ramblings on what I did to get everything working again, including registry searches when you are not allowed to run RegEdit, searching through text, and the places in the registry that had to change. Read the rest of this entry »

Posted in .NET, C#, Delphi, Development, Encoding, Power User, Software Development, Unicode | Leave a Comment »

When you are bitten by normally having the luxury of a current development environment

Posted by jpluimers on 2011/10/06

Sometimes you are at clients that don’t fully appreciate the luxury of keeping their development environment current.

This case a client still using Delphi 2006, where I promptly ran into a compiler error that was solved 5 years ago: a “F2084 Internal Error: C11919” at the end of the method.

begin
  if RMQResult.Create(CompCode, Reason).IsOK then
//...
end; // [Pascal Fatal Error] MQObjects.pas(668): F2084 Internal Error: C11919

The cause is that the compiler barfs at calling a method on a freshly created record.
The function result is an intermediate, which is not handled correctly (fixed in Delphi 2007).

This is not only for record intermediates: reusing an intermediate like the result of Pred() will crash the compiler in Delphi 2006.

The workaround is introducing a real variable.
This works:

var
  MQResult: RMQResult;
begin
  MQResult := RMQResult.Create(CompCode, Reason);
  if MQResult.IsOK then
//...
end; // compiles fine

–jeroen

Posted in Delphi, Development, F2084, Software Development | 4 Comments »

CRC32 Calculators in Delphi and .NET

Posted by jpluimers on 2011/10/05

For a couple of projects, I needed to calculate CRC32 hashes (they same CRC that for instance is used in ZIP files).

A few of the projects used C#, others used Delphi, so here are a few references:

FileFormat.info has a good on-line hasher (that does CRC32, md5 and a bunch of others) accepting both strings, hex bytes and files.

–jeroen

via: CRC32 Calculator.

Posted in .NET, C#, Delphi, Development, Software Development | 1 Comment »

I won’t make it to CodeRage this year, the Diving instructor and a diving buddy of my retarded brother just died in a diving accident: counselling to do

Posted by jpluimers on 2011/10/03

I’m really sorry to announce it, but I’m still shocked, while in the mean time providing counselling to my brother, providing the newspaper interviewer with background information on how diving with handicapped/retarded people works, and helping hands where I can.

It means I won’t make it to CodeRage this year. With pain in my heart, but even more pain for Fred Snijder (diving instructor) and Nico Laan (diving buddy), their families, friends, pupils, and co-divers. Those guys will be dearly missed, and leave an inexplicably large hole behind (no pun intended).

Just read, and shiver imagining that two of the most well trained and precautionary diving people I know just, well, died on October, 1st.

I’m in an utterly confused state of mind: sad, confused, supportive, etc.

Germany

2 Dutch divers died in German lake

The bodies of 2 divers were recovered on Sunday at a depth of 50 metres in the Kreidesee in Hemmoor, 30 miles southeast of Cuxhaven, following a diving accident.

The Delta Duikteam of Alkmaar had a group of 6 people diving at the 60-metre deep lake, 2 surfaced without problems, 2 others required to make an emergency ascent but they are not listed in life-threatening condition. Of the 2 missing divers whose bodies were found yesterday, 1 was an experienced instructor. 3rd October 2011

–jeroen, confused.

via: www.safetynews.co.uk

Fundiving    Kreidesee    Zevensprong    Delta Duikteam Alkmaar    AD newspaper    CodeRage

 

 

Posted in About, Delphi, Development, Personal, Software Development | 7 Comments »

EditorLineEnds.ttr – what is it?

Posted by jpluimers on 2011/09/29

Sometimes when you start Delphi 2005..2010 multiple times, you get an error message similar to this:

[Error]
Cannot create file "C:\DOCUME~1\username\LOCALS~1\Temp\EditorLineEnds.ttr". The process cannot access the file because it is being used by another process.
[OK]

Edit: It looks like some people have issues with Delphi 2006 and higher in combination with Windows 7  and higher and KB2982791 or KB2993651 installed. I only do for Delphi 2006 (for 2007 and higher I use the IdeFixPack from Andreas Hausladen). Thomas Mueller wrote a workaround which works in Delphi 2006 and up: Delphi 2007 error: “Cannot create file C:\Users\Admin\AppData\Local\Temp\EditorLineEnds.ttr” – Stack Overflow.

Since there are [WayBack] are [WayBack] a [WayBack] few [WayBack] QC [WayBack] entries on the EditorLineEnds.ttr file: what is it?

In fact, there are two files in that %TEMP% directory: EditorLineEnds.ttr and EditorLineEnds.for

EditorLineEnds.ttr is a TrueType font (you can copy it to EditorLineEnds.ttf and view it using the font viewer that Windows has built-in). Read the rest of this entry »

Posted in Delphi, Development, Power User, QC, Software Development | 2 Comments »

Delphi XE2 Update 1 is out; be sure to get it.

Posted by jpluimers on 2011/09/28

I’m at the BASTA.NET conference, so I need to keep this short:

Be sure to get Delphi XE2 Update 1 and read the release notes. You will need it in order to apply future updates, which will come soon and often: a big change when compared to previous product releases.

You will need do a full uninstall/install cycle, which will take a while.

On the Mac, you will also need to uninstall/install the Delphi XE 2 FireMonkey iOS support package as well.

It is worth it: tons of bug fixes, and an importent fix to comply with licensing (the first XE2 version had a license issue with the GLScene: if you have 3D apps, then Installing Update 1 and rebuilding your source will ensure that your applications have a valid redistributable license).

Bug fixes (over 120!) are in these areas:

  • FireMonkey design-time and run-time fixes
  • New VCL Styles
  • VCL Styles design-time and run-time fixes
  • IDE fixes to improve stability
  • C++ and Delphi compiler fixes

–jeroen

Posted in Delphi, Development, FireMonkey, Software Development | 4 Comments »

BLTN: GExperts build 1.35 for Delphi and RAD Studio XE2

Posted by jpluimers on 2011/09/28

I forgot to blog on this while prepping for Delphi Tage and DelphiLive, so here it goes (BLTN, no, not that movie):

Thursday, 01 September 2011 00:00
We now have a pre-release of GExperts 1.35 available for download that supports RAD Studio XE2.  We especially appreciate your help testing FireMonkey and 64-bit compatibility, support for unit scope prefixes, etc.

–jeroen

Via: Delphi and RAD Studio XE2 Support | General.

Posted in Delphi, Development, Software Development | 1 Comment »

Delphi Spring, Mocks and how to use them: some links

Posted by jpluimers on 2011/09/27

Now that there is Spring and Mocks for Delphi, it is time to post a few links:

Hope you enjoy them as much as I do!

–jeroen

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

A few more classics on BitSavers in the /pdf/borland tree

Posted by jpluimers on 2011/09/27

Hope you like these classics from the early Borland era:

Oh, and if you – like me – started in the Apple ][ and Lisa era, there are lots of nice documents of Apple products from that period to, for instance:

–jeroen

Via: Index of /pdf/borland.

Posted in BitSavers.org, Delphi, Development, History, Software Development | 5 Comments »

C# Using Blocks can Swallow Exceptions | DigitallyCreated

Posted by jpluimers on 2011/09/22

I got to the SafeUsingBlock extension method because of a nice StackOverflow thread on exceptions swallowed in a using block.

Actually, you can broaden the case into a wider scope: in any language when you protect resources in a try finally block (essentially, a using will turn into an implicit try finally block), and both the core logic and the finally throw an exception, the exception from the core block is swallowed.

Simple C# example:

using System;
public class Example
{
    public void Main()
    {
        try
        {
                try
                {
                    throw new ApplicationException("logic block");
                }
                finally
                {
                    throw new ApplicationException("finally block");
                }
        }
        catch (Exception error)
        {
            Console.WriteLine(error.ToString());
        }
    }
}

Simple Delphi example:

program Example;
begin
  try
    try
      raise Exception.Create('logic block');
    finally
      raise Exception.Create('finally block');
    end;
  except
    on error: Exception do
    begin
      Write(error.ClassName, ' ', error.Message);
    end;
  end;
end.

Both examples will only write out the finally block exception message, not the logic block exception message.

This is a corner case (like the example from the MSDN documentation), from which the SafeUsingBlock protects you from by providing an AggregateException class.

In C#, it is a guideline to avoid throwing exceptions in the Dispose when implementing the disposable pattern.

This is good practice in any programming environment: when disposing objects, only throw exceptions in very critical situations when the containing process has been corrupted.

Practically this is very easy as the disposers are very thin and should not contain any business logic, so it is pretty easy to spot places where the program state really is corrupt.

An other alternative is for instance have a Close method that throws an exception, and a disposer not throwing.

–jeroen

via C# Using Blocks can Swallow Exceptions | DigitallyCreated.

Posted in .NET, C#, Delphi, Development, Software Development | 7 Comments »