Posts Tagged ‘Delphi’

Beyond Compare 3 Beta

Tuesday, July 8th, 2008

One of my favorite tools for software development beyond Delphi is Beyond Compare. It is the best tool for comparing and merging files, directories, etc. It is also written in Delphi.

They happen to have a Beta for version 3 available now. Beyond a whole slew of new features for comparing and merging source files, they are also now running natively on Linux. I sent them an email about the Linux support and they are using Kylix along with some GUI wrappers of their own to make development smoother.

click for screenshotThey have a full list of the cool features in version 3, along with upgrade information. One of the really cool features I am looking forward to is the 3-way text merge. I also really like the image comparison plug-in they offer.

I have found it is an indispensable tool when I am moving files between one computer to another. If the process fails part way through do to network issues or whatever, Beyond Compare effectively lets me resume where I left off. Additionally, I can quickly see if some of the files are out of date or corrupted. A great way to trouble shoot system differences in testing software.

Good-bye Old Friends

Tuesday, July 1st, 2008

It appears I am saying my good-bye to two of my old friends. I knew this was coming on both accounts, but the reality is finally here. First of all, I good-bye to Borland, hello to Embarcadero. The people and products will still be there, but it is a new company. I expect this to be a change for the best. Now I need to figure out a way to re-brand all this Borland merchandise I own. . . .

My second old friend I bid farewell to is bsdg.org. I registered the doman name when I took over as president of the Boise Software Developers Group back in 2000. In that time it also became my first blog site, which I found quite enjoyable. At my high point I broke the news about PDC 2005 thanks to an email from the organizer, and that resulted in links from Robert Scoble as well as many others.

As of October 2007 I moved away from Boise, and Chris Brandsma took over as president of BSDG. At one point I debated changing to to the Borland Software Developers Group and keeping the domain name, but Delphi was already dropping the Borland roots at that point. All my old blog posts are still there someplace, but they are hidden behind a wall of cryptic 404 errors provided by the ASP.NET CMS that was recently installed. Rather sad. Maybe I will migrate some of the content here. . . . .

??? ?po??un ?o? ?sn ?s?q ???

Friday, June 20th, 2008

With all the talk about the next version of Delphi fully supporting Unicode, I was pretty excited to find:

??? ?po??un ?o? ?sn ?s?q ???

Well, maybe the best use for those of us who typically only need to use standard ASCII characters. . . .

Updated Delphi Road Map

Wednesday, April 23rd, 2008

Nick just posted an updated Delphi Road Map. Check it out. This looks to be one of the most significant Delphi releases in a long time. This road map is just covers native code, not .NET – that will be in a future road map I guess. Anonymous Methods, Generics and Unicode stand to be huge langauge and framework improvements.

Scripting Engine Unit Template

Thursday, April 10th, 2008

I must say, Delphi Live Templates and the Scripting Engines are REALLY amazing. I wanted to make a new scripting engine, but then I got to thinking that my scripting engines had a lot of similar code, so I figured I would make a Live Template to create Scripting Engines. I based it on Nick’s BaseScriptingEngine from his article on Creating a Live Templates Scripting Engine.

I then created a Template Project for the Scripting Engine Package. So I can pop out a scripting engine now faster then you can say “Delphi Rocks”.

I thought I would share my Scripting Engine Unit Template. You will probably want to make your own Scripting Engine Package Template Project, but if there is enough interest I will share mine out. You will most likely want to modify this template to suite your own framework.

[Scripting Engine Unit Template]

Note: This references my general scripting engine to create a new GUID. You will need to do that manually until I dress up my general scripting engine for public consumption.

Marcus Oblak and D-Robots

Monday, February 25th, 2008

Back in November I hosted the Delphi Robot Rage competition as part of CodeRage. At the time I was unable to contact the author of D-Robots (the program we used). I am not sure if that was a result of outdated contact information or just poor luck (i.e. spam blockers). Well, I received an email from Marcus Oblak AKA “mrqzzz mrqzzz” and the author of D-Robots. Turns out I misspelled his name, for which I apologize. Hopefully we can work something out to get a slight update to D-Robots and use it for another Delphi Robot Rage. I’ll keep you posted.

List of 3rd Party Components for Delphi 2007

Friday, December 7th, 2007

My thanks to Andreano Lanusse, the Product Line Manager for Latin America at CodeGear, who just posted a list of 3rd Party Components for Delphi 2007. This is a great resource. Andreano is open to suggestions and feedback on his list too and has provided his email address for everyone.

This has long been one of the strengths of Delphi – the strong collection of 3rd party components. 3rd party component development was of course fostered by the fact that Delphi came with full source for the VCL and RTL. A move the Microsoft if finally duplicating in releasing the source for the .NET framework. Although unlike Delphi, Microsoft will not allow you to modify and recompile the framework in your applications. With Delphi you can tweak the VCL and recompile it (not a trivial task, but allowable and possible) for your applications. Granted doing so makes moving to new versions of Delphi a little more tricky, and you cannot redistribute the modified source.

BTW, notice the link to my TurboPower page on line 27.

Multi-Class Class Helpers

Monday, December 3rd, 2007

This is cool. I figured out a way to assign the same class helper to multiple classes in Delphi 2007. Marco Cantu asked me if I knew how to do this during CodeRage II, and then David I. mentioned that Class Helpers should be used to implement Aspect Orientated Programming (AOP), but since they don’t support assigning the same class helpers to multiple classes that wouldn’t work.

I’ll write this up later. It isn’t a best case scenario, and requires a few extra lines of code, but it accomplishes what I set out to do, and that is pretty dang cool! Hopefully later CodeGear will extend class helpers and make this and other cool stuff easier. . .

Exceptions in Constructors and Destructors

Monday, December 3rd, 2007

Check out Alister Christie’s latest movie on CodeGearGuru.com. He covers the elusive Exceptions in Constructors and Destructors. Thanks Alister. That was one of the questions from my Exceptional Exceptions session that I needed to follow up on.

Crashing Like VB

Wednesday, November 28th, 2007

I always thought Delphi’s global exception handler was a great feature. It allows your program to continue after an otherwise unhandled exception would have caused it to terminate. Typically in a serious application you would assign your own global exception handler, or used one of the great 3rd part exception handlers like madExcept or Exceptional Magic (I love that name!) They both provide a nice dialog, stack trace, logging and reporting.

Well it turns out that if you want to be Microsoft Windows Vista Logo certified, then you need to crash your application on certain exceptions.

Applications must handle only exceptions that are known and expected, and Windows Error Reporting must not be disabled. If a fault (such as an Access Violation) is injected into an application, the application must allow Windows Error Reporting to report this crash. (from requirement 3.2 Resilient Software: Eliminate Application Failures)

Microsoft’s rational for this requirement is the ISV will receive the error report Microsoft collects for them. I guess most software developers don’t have access to tools like we do in Delphi to catch exceptions and log them for us.

So short of tossing out the Forms unit and writing everything from scratch, how can you get around the usefulness of the global exception handler.

My first thought was to create a custome application exception handler by placing a TApplicationEvents on your main form and assigning the OnException event. In the event include the line

  raise e;

This will pass an exception up to the operating system and terminate your application, at least when I tested it in Delphi 2007. When I tried it in Delphi 7, it didn’t work right.

A more elegant and involved solution:

First you need a couple global variables:

var
  GlobalExcept: Exception;
  GlobalExceptAddr: Pointer;

And a global exception handler:

procedure TForm1.ApplicationException(Sender: TObject; E: Exception);
begin
  if E is EAccessViolation then
  begin
    // Keep the exception object from being destroyed!
    AcquireExceptionObject;
    GlobalExcept := e;
    GlobalExceptAddr := ExceptAddr;
    Application.Terminate;
  end;
end;

The rest of the magic happens in the project file (DPR)

begin
  GlobalExcept := nil;
  GlobalExceptAddr := nil;
  try
    Application.Initialize;
    Application.CreateForm(TForm1, Form1);
  Application.Run;
  finally
    if Assigned( GlobalExcept ) then
    begin
      raise GlobalExcept at GlobalExceptAddr;
    end;
  end;
end.

And you can [download the code].

Thanks to Jeremi Reda for asking this question in borland.public.delphi.non-technical.

I didn’t cover this in my CodeRage II session on Exceptional Exceptions, but there is a lot of other cool stuff, like AcquireExceptionObject!