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

When DelphiSpeedup cannot register itself in Delphi on Windows Vista/7/8

Posted by jpluimers on 2014/03/06

Every now and then I need to go back to an old Delphi version, which nowadays means try and get it and all the tools installed on something newer than Windows XP.

When installing on Windows Vista and up (I usually run Windows 7 or 8.1), the DelphiSpeedUp installer barfs with something like this:

---------------------------
Installdelphispeedup105
---------------------------
Cannot register DelphiSpeedUpLoader.bpl.
---------------------------
OK
---------------------------

Andreas Hausladen (@AndyHTech) came to the rescue: Read the rest of this entry »

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

Not only only important in Windows PowerShell: “Whitespace, Please” (via: TechNet Magazine)

Posted by jpluimers on 2014/03/06

In this series of PowerShell postings, the below quote by Don Jones from Concentrated Technology is a must:

Proper formatting, including a little whitespace here and there, can make your Windows PowerShell commands a heck of a lot easier to understand.

But please don’t limit this to PowerShell code.

I see too many code at clients, even at conferences and magazine articles that are badly formatted.

Even more important: when you ask or provide for help on a forum or community site: please properly format your code examples. That makes it much easier for your audience (often yourself) to grasp the meaning.

For PowerShell: note that most syntactic elements provide for a very natural line continuation (so you can write really readable code), except for CmdLets, so often you will see { at the end of a line to make the most readable code.

–jeroen

via: Windows PowerShell: Whitespace, Please | TechNet Magazine.

Posted in .NET, Delphi, Development, PowerShell, Scripting, Software Development | Leave a Comment »

Delphi Predefined Conditionals on iOS: IOS, MACOS, MACOS32, POSIX and POSIX32 (via: Conditional compilation (Delphi) – RAD Studio)

Posted by jpluimers on 2014/03/03

Just a reminder to Self after reading Predefined Conditions in Conditional compilation (Delphi) – RAD Studio.

On iOS, these conditional symbols are defined:

  • IOS
  • MACOS
  • MACOS32
  • POSIX
  • POSIX32

For the (x86 based) iOS simulator, CPU386 and CPUX86 are defined.

For iOS physical devices, CPUARM is defined.

For OS X and the iOS Simulator, ALIGN_STACK is defined as some parameters (including Extended) require to be aligned on 16-byte boundaries. For explanation, see the Mac OS X Stack Alignment article by Eli Boling, as well as PC_MAPPED_EXCEPTIONS and UNDERSCOREIMPORTNAME (sometimes een PIC).

–jeroen

via: Predefined Conditions in Conditional compilation (Delphi) – RAD Studio.

Posted in Delphi, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development | Leave a Comment »

Delphi types that cannot be used for TypeInfo

Posted by jpluimers on 2014/03/03

When writing the Spring4D unit tests for GetTypeSize to include as many TTypeKind values, I came across a few types that either did not compile, or were not supported by TypeInfo. I listed them below as I could not find them in the documentation.

I included a test named Test_EnsureAllTTypeKindsCoveredByCallsTo_Test_GetTypeSize_ that verifies that all TTypeKind values except tkUnknown are covered. So future extensions of TTypeKind will make the tests fail.

As a side issue, I really wanted to know if tkUnknown could be emitted by the compiler. It can sort of, for instance by defining discontiguous enumerations, but are incompatible with TypeInfo as well.

Types that do not compile at all: Read the rest of this entry »

Posted in Agile, Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, DUnit, Software Development, Unit Testing | 2 Comments »

The OS X 10.9.2 (Mavericks) fix for the SSL issue is out; Apple’s #gotofail weekend – Ashkan Soltani.

Posted by jpluimers on 2014/02/25

As a follow up of When using Apple Hardware, be prepared for security updates. iOS already there, OS X and others will follow. #gotofail:

This is a must read: Apple’s #gotofail weekend – Ashkan Soltani, and cortesi – Exploiting CVE-2014-1266 with mitmproxy.

especially since the OS X Mavericks fix is out:

–jeroen

via Norbert Rittel and Kristian Köhntopp.

Posted in Apple, Delphi, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Mac, Mac OS X / OS X / MacOS, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, OS X 10.9 Mavericks, Power User, Software Development, xCode/Mac/iPad/iPhone/iOS/cocoa | 3 Comments »

Link clearance: history of Pascal / Object Pascal / Delphi Language / FreePacal / …

Posted by jpluimers on 2014/02/25

This post lists a lot of links related to the history of Pascal / Object Pascal / Delphi Language / FreePascal / etc.

No mentioning of Pascal should start without Niklaus Wirth. At the time of writing he is still alive, hopefully he still is a the time of publication.

Link clearance.

Read the rest of this entry »

Posted in Apple Pascal, BitSavers.org, Borland Pascal, DEC Pascal, Delphi, Development, FreePascal, History, Object Pascal, Pascal, Software Development, Think Pascal, Turbo Pascal, UCSD Pascal | 7 Comments »

Coding in Delphi available in printed form: USD $40 + shipping

Posted by jpluimers on 2014/02/24

On my way back from France, I noted the printed edition of Coding in Delphi has become available through CreateSpace (which is Amazon’s self publishing mechanism):

Coding in Delphi is a new programming book by Nick Hodges that covers a variety of powerful Delphi programming features and techniques including Generics, Interfaces, Exception, Handling, Anonymous Methods, Collections, RTTI, Enumerators, Attributes, Dependency Injection and Unit Testing

  • Publication Date: Feb 22 2014
  • ISBN/EAN13: 1941266037 / 9781941266038
  • Page Count: 242
  • Binding Type: US Trade Paper
  • Trim Size: 8.5″ x 11″
  • Language: English
  • Color: Black and White
  • Related Categories: Computers / Programming / Software Development

In related news: his paper and recored Rad in Action session about Unit Testing is also available.

via:

Posted in Delphi, Development, Software Development | 5 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: | 8 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 »

XanaNews word-wrap / NNTP text settings

Posted by jpluimers on 2014/02/19

These XanaNews settings are here:

Tools — Options — Posting Settings — Maximum Line Length=72

also

Text Format=NNTP

–jeroen

via Re: xananews – dumb question….

Posted in Delphi, Development, Software Development | Leave a Comment »