Archive for April, 2009
WordPress – bug in sourcecode shortcode: backslash followed by zero is removed
Posted by jpluimers on 2009/04/28
See this support post:
http://en.forums.wordpress.com/topic/bug-within-sourcecode-backslash-followed-by-zero-is-removed
It seems even that post is affected by the same bug.
–jeroen
Posted in Development, WordPress | Tagged: sourcecode language | 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
{
Red,
Yellow,
Green
}
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)
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;
begin
with FormClass.Create(self) do
try
Result := ShowModal;
finally
Free;
end;
end;
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 | 1 Comment »
.NET/C# – Issue with FileStream on network with transfers larger than 64 megabyte
Posted by jpluimers on 2009/04/27
Quite a while ago (2006!), I bumped into an issue when copying large chuncks of data to a network.
I posted it to Google, mentioned that breaking up the data in smaller blocks worked, but never had the time to post the solution.
So here it is
First the problem:
The old code consistently fails when:
- the FileStream is on a network
- and the MemoryStream is 64 megabytes or larger
The old code succeeds when:
- the MemoryStream is smaller than 64 megabytes
- or the FileStream is not on a network
An example of the exception message you get upon failure:
System.IO.IOException: Insufficient system resources exist to complete the requested service. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count) at System.IO.BufferedStream.Write(Byte[] array, Int32 offset, Int32 count) ...
Then the old code:
public static void WriteMemoryStreamToFile(string filename, MemoryStream memory)
{
using (Stream
file = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.ReadWrite),
fileBuffer = new BufferedStream(file)
)
{
byte[] memoryBuffer = memory.GetBuffer();
int memoryLength = (int)memory.Length;
fileBuffer.Write(memoryBuffer, 0, memoryLength); //##jpl: drawback: works only up to 2 gigabyte!
fileBuffer.Close();
file.Close();
}
}
Note that the old code already has a limitation of 2 gigabyte, back then this was not an issue (in 2006 there were not that many people having more than 2 gigabytes of memory, now that is a different story).
Posted in .NET, C#, Development | 6 Comments »
Performed @ Bloemencorso Bollenstreek 2009 (Flowercorso 2009)
Posted by jpluimers on 2009/04/26
Yesterday, the Senior Band of Adest Musica (the marching band where next year I hope to celebrate my 30th membership anniversary) participated in the 62nd edition of the Flower Parade in “de Bollenstreek“.
(Actually this is should formally be called “de Duin- and Bollenstreek”, as the complete “Bollenstreek” also includes two more regions in North Holland, and a few smaller areas on the South Holland islands).
The Senior Band has brass and percussion (no woodwinds, though the Stage Band orchestra part of Adest Musica has them).
It will compete during the World Music Contest 2009 in Kerkrade, so this was a great opportunity to show the public our new marches that we are going to play at the WMC: “Moving Force” and “to Fight and Win” (sorry Dutch link only) as well as the introductory march to the show “Up is Down” that bridges our previous show “Legends of the Seas” to the new show “the Musketeer”.
At the flower corso, also our new truck themed “the Musketeer” as well, click on the picture on the right to see an enlarged version.
A few videos of the Flower Parade with us performing are already on-line:
- Adest Musica Sassenheim - Bloemencorso 2009 - WMC / The - 10 minute compilation
- Adest Musica Sassenheim – Bloemencorso 2009 - 2.5 minute compilation showing “Up is Down”
- Adest Musica Sassenheim – Bloemencorso 25 april 2009 - very short fragment, but the only one showing my wife (light blue shirt) and brother (khaki jacket) having back-packs with fresh water!
So now you know what I do to balance all the keyboard work I do
–jeroen
Posted in About, Personal | Leave a Comment »
Conferences, seminars and other public appearances « The Wiert Corner
Posted by jpluimers on 2009/04/26
On request, I have started to maintain a page about the events I have spoken at or will be speaking at.
The page serves as a central landing spot for people wanting to download materials of past appearances, or wanting to meet me in person on future appearances.
Currently, it contains
- a link to my downloads for The CodeRage III virtual conference, held during December 1-5, 2008 on Delphi, database and XML related topics
- a link to my downloads for The Delphi 2009 interactive briefing on April 1st, 2009 on migrating from Delphi 2007 to Delphi 2009, and from Delphi 5 to Delphi 2006/2007
- the schedule for my events in 2009 (the events that have been set).
I will extend it with more downloads and more events over time (and blog about it when it gets extended).
Drop me a message at the contact form when you need more of the past downloads (I have been speaking at conferencs since 1995, so there is quite a lot of material <g>)
Posted in About, Conferences, Delphi, Development, Event, PowerDay | Leave a Comment »
Spoken @ Delphi 2009 interactive briefing on April 1st, 2009 (no joke!) on migrating from Delphi 2007 to Delphi 2009, and from Delphi 5 to Delphi 2006/2007
Posted by jpluimers on 2009/04/26

Oosterkamp training | consultancy (the company that I used to co-own before partnering in better office benelux), together with Barnsten (the CodeGear / Embarcadero representative in the benelux) organized a Delphi 2009 interactive briefing on the evening of April 1st, 2009.
That wasn’t a joke, and we had good attendance with interesting questions.
I did a session on migrating to the most current Delphi version.

Read the rest of this entry »
Posted in Briefing, Delphi, Development, Event, Software Development | 1 Comment »
.NET/C# – obtaining information through WMI
Posted by jpluimers on 2009/04/25
WMI (Windows Management Instrumentation) is a way of obtaining information from your PC that otherwise might be hard to find.
WMI is based on Common Information Model (CIM), so you’ll see an example of that too.
There is one drawback: for a lot of the WMI, you need to have enough privileges (like: being an admin, which none of you should be, right?).
So beware!
You can use WMI from C#, but you have to generate the C# classes for the WMI classes first.
I’ll show some examples for WMI Win32 classes, as I needed some of those classes recently myself.
Before I forget:
in order to browse through the WMI Win32 object instances, you can download this nifty WMI Administrative Tools toolset from the Microsoft MSDN site. Note that these are from 2002, and they only reliably work from within Internet Explorer.
Read the rest of this entry »
Posted in .NET, C#, Development, Software Development, Visual Studio and tools | Leave a Comment »
Who is coming to DelphiLive? « Daniel Magin’s Weblog
Posted by jpluimers on 2009/04/24
My German colleague Daniel Magin is keeping track of people going to attend or speak at DelphiLive ’09.
Please leave a comment on his blog posting to help him assembling the list.
I’ll be arriving on the evening of tuesday, May 12th, and leave in the morning of sunday May 17th (in order to keep the flight costs down, it is wise to include a Saturday/Sunday night stay).
–jeroen
Posted in Conferences, Event, Pingback | Leave a Comment »
Delphi – finding out the design-time package name of a unit
Posted by jpluimers on 2009/04/24
Somehow I keep forgetting this ‘be aware though’ part below, hence this blog post ![]()
![]()
When you are developing packages, sometimes you need units that are part of the VCL/RTL source tree.
Normally when compiling such a package, Delphi suggests the depending VCL/RTL package to add to your required package list.
However, that does not always work, especially with design-time packages (those start with ‘dcl’ in stead of ‘vcl’).
The last time I bumped into this was when I developed a package that needed the MessageDigest_5 unit.
Read the rest of this entry »
Posted in Development, Package Development, Software Development | Leave a Comment »
Spoken @ CodeRage III, December 1-5, 2008 on Delphi, database and XML related topics
Posted by jpluimers on 2009/04/24
At the CodeRage III on-line virtual conference, I have done 4 sessions. 
For me, it was the first time speaking at conference done this way.
A few things were different:
- Sessions were 45 minutes presenting in stead of the normal 60 minutes
- The main body of the session was pre-recorded, the 15 minute Q&A was live
- I had to learn Camtasia
- The broadcasts were done through LiveMeeting
Posted in Conferences, Event, XML/XSD | 3 Comments »
.NET/C# – converting UTF8 to ASCII (yes, you *can* loose information with this) using System.Text.Encoding
Posted by jpluimers on 2009/04/23
Quite a while ago, we needed to exchange some text files with .NET and a DOS application (yes, they still exist!).
Since the .NET app already exchanged text files with other applications using UTF8, we had to reencode those into plain ASCII.
(yes, I am aware there are dozens of codepages we could encode to, we decided to stick with 7-bit ASCII, and warned the client about possible information loss).
A couple of months later, we neede to exchange information with an app doing Windows-1252, and then even later on to a web-app needing ISO 8859-1 (both are Western European encodings).
So I decided to refactor the UTF8 to ASCII conversion app into something more maintainable.
But first let me show you how you can dump all of the .NET supported encodings:
Read the rest of this entry »
Posted in .NET, C#, Development, Software Development | 3 Comments »
Including formatted sourcecode in WordPress
Posted by jpluimers on 2009/04/22
Since I’m quite new to WordPress it is a learn as-I-go process (sounds familiar huh?) and a major goal of this blog is to keep track of things so that I don’t forget them:
Including formatted code in your blog is easy, WordPress has a FAQ about it!
Basically it comes down to adding the sourcecode shortcode and then make sure the language attribute has the right value.
But there are some gotcha’s that are not in the FAQ:
- paste the
sourcecodeshortcode as “plain text” (or in the HTML editor) otherwise it will get span tags around it and not render as code - C# has
languagecodecsharp(if you use a non-existing language code, it will not render as code either)
The language codes I will probably use most are csharp and delphi, followed by xml and sql and maybe some css and html.
In your editor, you will then see something like this:
Read the rest of this entry »
Posted in Development, WordPress | Tagged: sourcecode language | 5 Comments »
Delphi – adding for … in support to TPageControl
Posted by jpluimers on 2009/04/22
A long time ago, the for ... in statement was added to the structured statements part of the Delphi language. It is a really powerful statement, that allows for code like this:
var
Line: string;
begin
for Line in MyMemo.Lines do
// some business logic
end;
in stead of using the traditional for statement which needs an extra LineIndex variable and an assignment statement:
var
LineIndex: Integer;
Line: string;
begin
for LineIndex := 0 to MyMemo.Lines.Count do
begin
Line := MyMemo.Lines[LineIndex];
// some business logic
end;
end;
So, “for … in” is a cool feature, but now I wanted to do the same for a TPageControl:
Read the rest of this entry »
Posted in Delphi, Development, Software Development | 1 Comment »
Colleauges speak @ InterBase PowerDay’s in The Netherlands and Germany
Posted by jpluimers on 2009/04/22
Tomorrow, the 23rd of April, my Dutch and German InterBase colleauges from better office will be delivering the InterBase PowerDay inAmersfoort.
Speaking are Daniel Magin and Gwan Tan, attending are both regular InterBase developers and InterBase VARs.
The PowerDay costs EUR 124 excluding VAT to attend, and has 4 sessions that roughly covering these areas:
- What’s new in InterBase 2009
- InterBase as a vault
- Advanced InterBase
- Tools to maintain InterBase
The event is organized together with Barnsten, which are the representatives of CodeGear in The Netherlands.
A similar event is organized in Germany on the 6th of May in Frankfurt/Offenbach. That event is organized by better office Germany and CodeGear Germany.
better office Germany is InterBase master reseller, and better office benelux (where I work) has some very knowledgeable InterBase people too.
Posted in Database Development, Development, Event, InterBase, PowerDay | Leave a Comment »
Speaking @ Microsoft DevDays ’09, May 28-29, The Hague
Posted by jpluimers on 2009/04/21
I’ll be speaking during the Microsoft DevDays ‘09 that are held from May 28-29 (27 if you count the preconference) in The Hague (at the World Forum, previously known as Nederlands Congres Centrum).
My session is in the “Geek Night” track that is held on the evening of May 28.
It is gonna be a cool session, showing collaboration on many levels:
- as in integration between .NET and hardware (WebCams and Servos through USB)
- as cooperation between you and Open Source projects
- as building your own shooter device from plexiglass and other easy to obtain hardware
- as interaction between users and the automated shooter device
The session works towards the creation of an automated shooter device.
It consists of a USB webcam of which you monitor the video stream, a USB Servo Controller that steers Servos and relais, and a laserpointer.
The laserpointer can track moving objects (like you, the audience!) as seen through the webcam.
During the session you see the pro’s and con’s of using Open Source, what can go wrong when using multiple-web-cams, and much much more.
Prepare for a fun night!
Posted in .NET, C#, Conferences, DevDays09, Development, Event, Software Development | Tagged: DevDays09 | Leave a Comment »
Speaking @ DelphiLive ’09, May 13-16, San Jose
Posted by jpluimers on 2009/04/21
I’ll be speaking during DelphiLive ’09 that is held from May 13-16 in San Jose (CA, USA, not any of the other San Jose cities).
This is going to be a top event with really knowledgeable Delphi speakers from all over the world.
Besides the 2 sessions that I’m doing, I’ll be hanging around as are the other speakers.
So feel free to approach us, and learn from the things we learned. Or teach us something new: all of us are eager to learn as well as teach!
The downloads are now available.
Posted in Conferences, Database Development, Delphi, Development, Event, InterBase, Software Development | Tagged: Conferences, Delphi, Travel | Leave a Comment »
Wiert
Posted by jpluimers on 2009/04/21
… is my middle name, which originates from the Frisian word Wiard (according to this really old Dutch book describing names) which seems to mean “strong warrior”
… sounds similar to weird, which fits quite well to tha extraordinary things I encounter in both my professional and personal life.
So here is the start of an irregular bunch of postings on subjects that I’m going to share on this blog.
Like most blogs, it is to write down things that I stumble upon and somehow want to remember, or might be of interest to other people.
So: enjoy
–jeroen
PS: For people that do not know me yet, please see my LinkedIn profile and some of my personal interests: Adest Musica, La Perlina, Flickr stream, DreamFoundation
Posted in About | Leave a Comment »













