The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    20140508-Delphi-2007--Project-Options--Cannot-Edit-Application-Title-HelpFile-Icon-Theming

    20140430-Fiddler-Filter-Actions-Button-Run-Filterset-now

    20140424-Windows-7-free-disk-space

    More Photos
  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,721 other followers

Posts Tagged ‘Delphi’

Delphi XE7 is out with version 21.0.17017.3725; Spring4D is almost ready.

Posted by jpluimers on 2014/09/04

Remarkably few people note the actual version number of the Delphi releases, though that is the version mentioned in any QC reports.

Now that Delphi Insider: Download links for Delphi XE7, C++Builder XE7 and RAD Studio XE7 are there, the ftpd and altd have been seeded a few days ago with the version time stamped at the end of last month, here is the version number:

QC version number for Delphi XE7: 21.0.17017.3725 (Update 1 has version 21.0.17707.5020).

I got that number from the first XE7 report in QC posted almost 2 months ago (and verified it against other reports), so it seems XE7 has undergone some serious testing.

Before installing, note that in addition to the below documentation links:

Be sure to have at least 60 gigabytes of free disk space before you attempt to install.

This in addition to the 5 gigabyte ISO file (:

XE7 doc links

Spring4D

On the Spring4D side (yes, it has a new logo!), Stefan has added XE7 support, so a new release of that is near.

–jeroen

Posted in Delphi, Delphi XE7, Development, Software Development | Tagged: , | 1 Comment »

Delphi and C++ Builder VCL Library Buffer Overflow

Posted by jpluimers on 2014/08/19

Since this did not make it to DelphiFeeds yet: I’ve seen the function PaletteFromDIBColorTable in Graphics.pas go back as far at least until Delphi 2006, and references on the web as far back as Delphi 4.

So: this bug is old, but as it is a security one, make sure you patch soon.

For Delphi XE6, download 29913 BMP Buffer Overflow hotfix – Delphi, C++Builder, RAD Studio XE6.

For older Delphi versions, read this piece that was adapted from the EDN article Delphi and C++ Builder VCL Library Buffer Overflow:

For users of prior versions of Delphi and C++Builder: these steps should be followed to modify the VCL source code and add it to your application.

For each application:

  1. Add the modified Edit Vcl.Graphics.pas or Graphics.pas or Borland.Vcl.Graphics.pas to your project
  2. For C++Builder: Under Project | Options | Packages | Runtime Packages, set “Link with runtime packages” to false
  3. Rebuild your application

Once for the native VCL and .NET VCL:

  • Note: Variable names and scoping might be slightly different depending on your product version.
  1. Edit Vcl.Graphics.pas or Graphics.pas or Borland.Vcl.Graphics.pas
  2. Locate the function PaletteFromDIBColorTable.
  3. Add the following code just before the line assigning a value to Pal.palNumEntries when the DIBHandle = 0
    if ColorCount > 256 then 
      InvalidGraphic{$IFNDEF CLR}@{$ENDIF}SInvalidBitmap;;

–jeroen

via Delphi and C++ Builder VCL Library Buffer Overflow.

Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Development, Software Development | Tagged: , , , | 5 Comments »

Optimizing Delphi build speeds (via; Vin Colgin – Google+; IDE FixPack; DelphiSpeedUp, Microsoft KBs with speed fixes)

Posted by jpluimers on 2014/03/23

An interesting thread by Vin Colgin – Google+ – IDE FixPack 5.4.1 shows 36.5% increase in BUILD speed under….

The post and discussion covers these topics:

–jeroen

Posted in Delphi, Delphi 2007, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Software Development | Tagged: , | 9 Comments »

Hidden Features in Delphi related topics (from StackOverflow, until the diamond moderators kill these too)

Posted by jpluimers on 2014/02/20

There are (soon probably “were”) a few very interesting Q&A threads on Stack Overflow in the “Hidden Secrets of” series on Delphi related topics.

I sort of can get (but don’t agree: there is a very good voting system to de-emphasize material that is not useful, but who am I to argue with the minority of “the world is black and white, we just follow the rules” diamondss) that these get closed, but cannot get that very useful material gets deleted for anyone with less than 10-thousand reputation.

–jeroen

@Jeroen & David, I’ve deleted my off-topic comments from here. Could you do the same, please ? I’ve also asked moderators to delete my meta question as it seems the users there are not even humans. Never mind. Stack Overflow is not what it was few years ago as I observe. It’s getting worse. Another piece to this mosaic was running the portuguese version of Stack Overflow ideal for cross posting between the sites.

Posted in Delphi, Development, Software Development | Tagged: | 6 Comments »

Delphi: the Factory Pattern with virtual Create Constructors (via: What Design Patterns do you implement in common Delphi programming? – Stack Overflow)

Posted by jpluimers on 2014/02/20

Delphi Component Design

Delphi Component Design

From long ago, but still very valid, as I recently had another question like “what design patterns does Delphi use?”.

The Delphi usage of patterns to make the VCL and your applications work is one of the reasons I like the Delphi Component Design: Danny Thorpe so much.
Do not let you scare by the book title: a lot of information in this book is much broader than designing components.
It is about why and how things are done in the RTL and VCL, and which patterns you can use yourself.

Try and git it while you can still get it. It is excellent, but rare to get as it has been out of print for a while.

Only a minority of the Delphi developers knows that every Delphi developer uses a Factory pattern (delphi.about.com has an example in “regular” Delphi), but then implemented using virtual Create constructors.

So: time to shed some light on that :-)

Virtual constructors are to classes like virtual methods are like object instances.

The whole idea of the factory pattern is that you decouple the logic that determines what kind (in this case “class”) of thing (in this case “object instance”) to create from the actual creation.

It works like this using virtual Create constructors:

TComponent has a virtual Create constructor so, which can be overridden by any descending class:

type
  TComponent = class(TPersistent, ...)
    constructor Create(AOwner: TComponent); virtual;
    ...
  end;

For instance the TDirectoryListBox.Create constructor overrides it:

type
  TDirectoryListBox = class(...)
    constructor Create(AOwner: TComponent); override;
    ...
  end;

You can store a class reference (the class analogy to an object instance reference) in a variable of type ‘class type’. For component classes, there is a predefined type TComponentClass in the Classes unit:

type
  TComponentClass = class of TComponent;

When you have a variable (or parameter) of type TComponentClass, you can do polymorphic construction, which is very very similar to the factory pattern:

var
  ClassToCreate: TComponentClass;

...

procedure SomeMethodInSomeUnit;
begin
  ClassToCreate := TButton;
end;

...

procedure AnotherMethodInAnotherUnit;
var
  CreatedComponent: TComponent;
begin
  CreatedComponent := ClassToCreate.Create(Application);
  ...
end;

The Delphi RTL uses this for instance here:

Result := TComponentClass(FindClass(ReadStr)).Create(nil);

and here:

// create another instance of this kind of grid
SubGrid := TCustomDBGrid(TComponentClass(Self.ClassType).Create(Self));

The first use in the Delphi RTL is how the whole creation process works of forms, datamodules, frames and components that are being read from a DFM file.

The form (datamodule/frame/…) classes actually have a (published) list of components that are on the form (datamodule/frame/…). That list includes for each component the instance name and the class reference.
When reading the DFM files, the Delphi RTL then:

  1. finds about the components instance name,
  2. uses that name to find the underlying class reference,
  3. then uses the class reference to dynamically create the correct object

A regular Delphi developer usually never sees that happen, but without it, the whole Delphi RAD experience would not exist.

Allen Bauer (the Chief Scientist at Embarcadero), wrote a short blog article about this topic as well.
There is also a SO question about where virtual constructors are being used.

Let me know if that was enough light on the virtual Create constructor topic :-)

–jeroen via: What Design Patterns do you implement in common Delphi programming? – Stack Overflow.

Posted in Delphi, Delphi 1, Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Software Development | Tagged: , | 4 Comments »

 
%d bloggers like this: