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

Formatted sourcecode in WordPress now supports even more languages

Posted by jpluimers on 2010/02/15

I just found out that the sourcecode tag in WordPress now supports even more languages.

This is the list of languages is below, it contains links to Wikipedia for each language.
Starred ones (bold and hyperlinks in this theme are the same ) are new since my post last year.

This is a follow up on the original article Including formatted sourcecode in WordPress « The Wiert Corner – Jeroen Pluimers’ irregular stream of Wiert stuff.

–jeroen

Posted in .NET, C#, CSS, Database Development, Delphi, Development, Encoding, Java, Software Development, SQL Server, Web Development, WordPress, XML, XML/XSD | Tagged: | 2 Comments »

Web means Unicode

Posted by jpluimers on 2010/02/12

Google published an interesting graph generated from their internal data based on their indexed web pages.Encodings on the web

A quick summary of popular encodings based on the graph:

  1. Unicode – almost 50% and rapidly rising
  2. ASCII20% and falling
  3. Western European* – 20% and falling
  4. Rest – 10% and falling

Conclusion: if you do something with the web, make sure you support Unicode.

When you are using Delphi, and need help with transitioning to Unicode: contact me.

–jeroen

* Western European encodings: Windows-1252, ISO-8859-1 and ISO-8859-15.

Reference: Official Google Blog: Unicode nearing 50% of the web.

Edit: 20100212T1500

Some people mentioned (either in the comments or otherwise) that a some sites pretend they emit Unicode, but in fact they don’t.
This doesn’t relieve you from making sure you support Unicode: Don’t pretend you support Unicode, but do it properly!

Examples of bad support for Unicode are not limited to the visible web, but also applications talking to the web, and to webservices (one of my own experiences is explained in StUF – receiving data from a provider where UTF-8 is in fact ISO-8859: it shows an example where a vendor does Unicode support really wrong).

So: when you support Unicode, support it properly.

–jeroen

Posted in .NET, ASP.NET, C#, Database Development, Delphi, Development, Encoding, Firebird, IIS, InterBase, ISO-8859, ISO8859, Prism, SOAP/WebServices, Software Development, SQL Server, Unicode, UTF-8, UTF8, Visual Studio and tools, Web Development | 7 Comments »

Delphi – 2010/2009 code-completion changes making life harder..

Posted by jpluimers on 2010/02/01

I’m trying to create a list of code completion changes in Delphi 2009 and 2010 that make life a harder (as compared to Delphi 2007).
The reason is that I want to post a summary in a QC report, so they get fixed.

Please comment below to add your own.
I’ll summarize in a week or 2.

These are the ones I found:

  1. When the code completion list is visible, pressing the Enter key would select the topmost item and complete it
  2. When you press ctrl-space to activate the code completion list, and you had already typed part of an identifier, the topmost item would match this identifier

I have the idea that this is caused by the fact that when the code completion list becomes visible, the topmost item in the list is not automatically being selected in Delphi 2009/2010, where in Delphi 2007 (and before) it was.

It seems you now need to press the down-arrow once to select it.
That means one action extra, while the code completion list has always meant to be a productivity boost.

Please comment….

–jeroen

Posted in Delphi, Development, Software Development | 21 Comments »

Validate XML with XSD in .NET and native MSXML – big difference in string maxLength validation with newlines (samples in C# and Delphi)

Posted by jpluimers on 2010/01/19

Recently, I had an issue while validating XML with XSD: validation in .NET using the built in classes in the System.XML namespace, and validation in native Windows using the COM objects exposed by  MSXML version 6 (which incidentally ships with the .NET 3.0 framework).

Some documents validating OK in .NET did not validate well with MSXML.

I’ll show my findings below, and try to explain the difference I found, together with my conclusions.
The main conclusion is that MSXML version 6 has a bug, but I wonder why I can’t find much more information on it.

Since there is not so much ready to use for validating XML by XSD in .NET and native, I’ll include complete source code of command-line validations applications for both platforms.
.NET source code is in C#.
Native source code is in Delphi.
Read the rest of this entry »

Posted in .NET, C#, C# 2.0, C# 3.0, Delphi, Development, Software Development, Visual Studio and tools, XML, XML/XSD, XSD | 4 Comments »

Delphi – HIGHCHARUNICODE directive (Delphi) – RAD Studio

Posted by jpluimers on 2010/01/18

I forgot about it, but this thread (which got wiped by Embarcadero) reminded be about the differences between these two character values.

Quoting from the first post:

c1 := #128;
c2 := chr(128);
Assert(c1 = c2);

the assertion fails, meaning that c1 <> c2.

In fact c1 = #$20AC and c2 = #$80.

Read the rest of this entry »

Posted in Delphi, Development, Encoding, Software Development, Unicode | 2 Comments »

Delphi – TCustomGrid.InvalidateCol and InvalidateRow bug that has been there since at least Delphi 4^H^H^H^H^H^H^H^H 2 and 1

Posted by jpluimers on 2010/01/12

I just re-reported this in in QC as 81060, but wanted to let you know that there is a bug in TCustomGrid.InvalidateCol and TCustomGrid.InvalidateRow which has been there since at least Delphi 4 Delphi 1 (InvalidateRow) and Delphi 2 (InvalidateCol) and still present in Delphi 2010.

Both methods will not invalidate the entire Row/Col but only the Left/Top most cells of that Row/Col.
So the invalidate the absolute rectangle in stead of the visible rectangle.

You will see this behaviour when you have a virtual grid that is larger than the actual grid on the screen, you scroll through that grid, and perform your own drawing.

Boths bugs are easy to fix, have been reported in QC as number 8472 before (and reported even before QC existed), but denied as ‘test case error’  in stead of being investigated further.
The earliest reference I could find on them is as number 531 in the Delphi Buglist, by Rune Moberg, long time and well respected Delphi developer and bikedude.

Some of the 3rd party grid vendors are also to blame: they seemed to have worked around it without pressing the Delphi team to solve the issue.
For instance, the infamous rxgrid, just invalidates all Rows within InvalidateCol. Now that is pure overkill, as my solution will show. Read the rest of this entry »

Posted in Delphi, Development, QC, Software Development | 2 Comments »

C# / Delphi – getting the right parameter and function result order for SOAP

Posted by jpluimers on 2010/01/05

Getting different architectures to talk can be a pain, even when using standards like SOAP.

In this case, the .NET WSDL imports Delphi generated WSDL in a different manner than you’d expect at first sight: when having both an ‘out’ parameter and a function ‘result’, the ‘result’ is not imported well.

But alas: SOAP didn’t accommodate for this situation in the past, and now SOAP now has some additions to solve this.

Bruneau Babet explains this here: [WayBackSOAP inconsistency? Delphi 2010 (Win32) Server and .NET Client swapping ‘out-parameter’ and ‘result’. – Stack Overflow.

There he explains how to use the parameterOrder attribute, which the Delphi WSDL importer and exporter still do not support.

–jeroen

Posted in .NET, ASP.NET, Conference Topics, Conferences, Delphi, Development, Event, SOAP/WebServices, Software Development | Leave a Comment »

Delphi – Announce: ModelMaker Code Explorer 8.02 beta

Posted by jpluimers on 2010/01/05

Gerrit Beuze just announced the new beta of ModelMaker Code Explorer 8.

For me, ModelMaker Code Explorer (especially at a price of only EUR 99!)  is an indispensable tool for both creating new sources, and maintaining old sources (the refactorings it can do are awesome, but there are many other useful features in it as well).

Over the years, I’ve been using interfaces in Delphi more and more.
Actually, in some of my projects almost all classes implement interfaces.

Therefore, I’m particularly glad with the new feature  ‘auto complete style drop down list’ in the ‘Edit Class dialog’ that this beta brings.

More info: ModelMaker Code Explorer 8.02 beta.

Note: if you use Visual Studio, there is a Visual Studio edition of ModelMaker Code Explorer too.

–jeroen

Posted in C# 2.0, C# 3.0, Delphi, Development, Software Development, Visual Studio and tools | Leave a Comment »

Anyone got the Delphi 2010 code formatter to work with anonymous methods?

Posted by jpluimers on 2009/12/24

With the default settings, the Delphi 2010 code formatter folds anonymous methods on one line.

Is there anyone who has found settings to circumvent this?
(You can also react on my Stackoverflow question here, I will update the blog with the relevant answers).

Original code:

procedure TUnit.AppendFinalization(const StringBuilder: TStringBuilder);
begin
  AppendMemberResults(StringBuilder,
    function(Member: TGeneratableInUnit): IStringListWrapper
    begin
      Result := Member.FinalizationText;
    end
  );
end;

procedure TUnit.AppendMemberResults(const StringBuilder: TStringBuilder; const GetMemberText: TFunc<TGeneratableInUnit, IStringListWrapper>);

Formatted code:

procedure TUnit.AppendFinalization(const StringBuilder: TStringBuilder);
begin
  AppendMemberResults(StringBuilder, function(Member: TGeneratableInUnit): IStringListWrapper begin Result := Member.FinalizationText; end);
end;

procedure TUnit.AppendMemberResults(const StringBuilder: TStringBuilder; const GetMemberText: TFunc<TGeneratableInUnit, IStringListWrapper>);

As you can see, the anonymous method is being formatted to one line.

I feel I’m missing some kind of setting here…

–jeroen

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

For Pre D2007 versions: CodeCentral 24535 Delphi SOAP Runtime and Importer Update

Posted by jpluimers on 2009/12/23

Had to use this on an old project, so I put this up as a reference (quite a few people have it, it was released late 2007 and I just put it up here as a reference for myself):
[WayBack] 24535 Delphi SOAP Runtime and Importer Update.

It contains the SOAP runtime and WSDL importer from Delphi 2007, but then compiled for Delphi  7, Delphi  2005 and Delphi  2006.
So if you have a project stuck in one of those old Delphi versions, you can use the SOAP/WSDL support from Delphi 2007.

–jeroen

Posted in Delphi, Development, SOAP/WebServices, Software Development | 1 Comment »