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 4,183 other subscribers

Archive for April, 2009

Jeroen turns 40 today :-)

Posted by jpluimers on 2009/04/29

Being born on April 29, 1969, Jeroen turns 40 today.

Posted in About | Leave a Comment »

WordPress – bug in sourcecode shortcode: backslash followed by zero is removed

Posted by jpluimers on 2009/04/28

See this support post:

It seems even that post is affected by the same bug.


Posted in Development, WordPress | Tagged: | 2 Comments »

.NET/C# – an easier foreach for enums using generic methods

Posted by jpluimers on 2009/04/28

I like enums. Maybe because of my Turbo Pascal and Delphi background. They are descriptive. Makes code easier to read.

        public enum TrafficLightColors

But using them in C# foreach loops is a bit of a pain, not so much in the loop itself, but more in getting the list of values to loop over.
Read the rest of this entry »

Posted in .NET, C# 2.0, Delphi, Development, Software Development | Leave a Comment »

Answered @ stackoverflow – on virtual constructors called through class references in Delphi

Posted by jpluimers on 2009/04/27

I just tried to elaborate on an answer to a question from Michael Justin on stackoverflow.
(yes, that’s the author of some message broker clients like the Habari ActiveMQ client that allows Delphi applications to talk to the Apache ActiveMQ message queueing broker).

His question is on virtual constructors and class reference: How can I detect if a Delphi class has a virtual constructor?
The combination of class references and virtual constructors is one of the fundaments of how Delphi became Delphi; in simple terms:

  • class references allow you to register components on the component palette in Delphi
  • virtual constructors allows the designer to construct  the instances of those components at design time

That’s why I think it is important to describe the distinction between virtual constructors and regular non-virtual constructors in the answer below (which is a copy of the answer I posted to stackoverflow)

Read the rest of this entry »

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

Delphi – bizarre use of class helpers to circumvent ‘with’

Posted by jpluimers on 2009/04/27

Quite a while ago, a co-worker asked how to get tot the Instance variable when using a with statement like this:

function TMyForm.ExecuteForm(FormClass: TFormClass): Integer;
  with FormClass.Create(self) do
      Result := ShowModal;

So I wrote the blog entry below when I started my blog last week, and set the published date to somewhere early May, a week that will be really busy.
Then I found out about the Stackoverflow question Reference object instance created using “with” in Delphi followed by the answer by user ‘Alexander‘ (a really smart Russian guy).
Enough coincidence to publish the blog article earlier than scheduled :-) 

Before I explain why I really hate ‘with’, lets show what my co-worker wanted, and my solution: Read the rest of this entry »

Posted in Delphi, Development, Pingback, Software Development, Stackoverflow | 2 Comments »

%d bloggers like this: