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,854 other subscribers

Archive for the ‘Delphi XE2’ Category

XSD/XML Schemas: resolving `Namespace ” is not available to be referenced in this schema` (via: StackOverflow)

Posted by jpluimers on 2013/09/01

While working on my Delphi: First try on an XSD for .groupproj files, I bumped into an error `Namespace ” is not available to be referenced in this schema`.

I added a targetNamespace attribute to the GroupProj.xsd so the .grouproj files would use the right namespace.

That resulted into two funny errors:

  1. Namespace ” is not available to be referenced in this schema.
    Visual Studio (which I normally use for editing XSD) would only throw this error on these elements:
    <xsd:element ...>
    So it would not throw them on nodes using the empty namespace.
    That was really confusing!
  2. When validating .grouproj files using this GroupProj.xsd, I would get this error for all .groupproj files:
    System.Xml.Schema.XmlSchemaValidationException: Type ‘<type>’ is not declared. (in this case for ‘<type>’  ‘ProjectType’).
    That was odd too: the ‘ProjectType’ was indeed declared, and should be valid.

I could hardly find any information about the latter error, but the former gave a few useful hits.

Thanks User weston – Stack Overflow. for answering this: it made me smack to my head (like usual, a case of EBCAK). Read the rest of this entry »

Posted in Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Software Development, XML/XSD, XSD | Tagged: , , | 2 Comments »

Delphi: First try on an XSD for .groupproj files

Posted by jpluimers on 2013/08/31

Delphi introduced the .groupproj files to support MSBUILD.

I couldn’t find an XSD for it, but need to do some fiddling with those files, so I created one. It’s not very detailed, I think it gets most of the definition right.

The checkin is on my BeSharp.net mercurial repository on BitBucket:

First try on an XSD for .groupproj files.

–jeroen

via: jeroenp / BeSharp.net / commit / c122bbdef42e — Bitbucket.

Posted in Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Software Development | Leave a Comment »

Reminder to self: Delphi XE2 x64 debugging on Windows 8 is a no go, you get [Error] Disconnected session

Posted by jpluimers on 2013/08/09

Just found out this the hard way, glad I found it soon which prevented me from doing like Ondrej Kelle – Google+ – Wasted a few hours with this….:

Debugging 64 bit Delphi applications with Delphi XE2 on Windows 8 does not work

Problem: Debugging a 64 bit Delphi application using Delphi XE2 with Windows 8 results in the error Disconnected session.

Solution: Windows 8 is not a supported platform for versions of Delphi prior to Delphi XE3. To get debugger support for 64 bit applications on Windows 8, you must get Delphi XE3. If you are upgrade sensitive, Embarcadero recommends you get Support and Maintenance along with your next purchase. Support and Maintenance guarantees you all updates for 1 year and gets you 3 support incidents in addition.

The proposed solution is to upgrade to at lease Delphi XE3, but this project is not ready to upgrade just yet.

Anybody with a real workaround (apart from downgrading to Windows 7)?

–jeroen

via Error: Disconnected session.

Posted in Delphi, Delphi XE2, Development, Software Development | 4 Comments »

Conversion between absolute and relative paths in Delphi – Stack Overflow

Posted by jpluimers on 2013/07/30

A while ago, I needed routines to work with absolute and relative paths on Windows.

These links were very useful:

  1. The Delphi TPath.IsDriveRooted function (I think it was introduced in Delphi 2010) serves as a IsPathAbsolute function
  2. Conversion between absolute and relative paths in Delphi – Stack Overflow showing how to use the Windows API functions PathRelativePathTo and PathCanonicalize functions declared in the ShLwApi unit to create AbsToRel and RelToAbs functions.

Thanks Andreas Rejbrand and David Heffernan for the last two!

–jeroen

via: Conversion between absolute and relative paths in Delphi – Stack Overflow.

Posted in Delphi, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | 4 Comments »

Delphi: do not do “if (not DirectoryExists(path)) then ForceDirectories(path))”

Posted by jpluimers on 2013/07/26

During code reviews, I often see people do things like this:

if (not DirectoryExists(Path)) then
  ForceDirectories(Path))

or this:

if (not TDirectory.Exists(Path)) then
  TDirectory.CreateDirectory((Path))

Half a year ago, I wrote about .NET/C#: do not do “if (!Directory.Exists(path)) Directory.CreateDirectory(path))”. Read the rest of this entry »

Posted in Delphi, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Development, Software Development | 16 Comments »

Reminder to Self: Messagepack / BSON / ProtocolBuffers

Posted by jpluimers on 2013/07/25

Need to find/create a Delphi compatible version of Messagepack or BSON.

–jeroen

via Serializing and deserializing (packing/unpacking) to a file and/or memorystream with MessagePack in C# ».

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Delphi, Delphi XE2, Delphi XE3, Development, Software Development | 4 Comments »

Delphi virtual constructors: example of the “Factory” design pattern (via: Stack Overflow)

Posted by jpluimers on 2013/07/18

I bumped into the below answer that I gave a while (what is 4 years in a developer’s life ) on StackOverflow.

It is about Delphi Design Patterns. Sepcifically the Factory Pattern, and explains how virtual constructors implement it.

They are one of the 3 corner stones on which the component based Delphi form designer and object inspector are built:

  • Virtual constructors
  • Properties (events are just a special form of property)
  • Run-Time Type Information.

So here it goes: Read the rest of this entry »

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 XE, Delphi XE2, Delphi XE3, Delphi XE4, Development, Software Development | 6 Comments »

2D transformations as answer to “delphi – Change orientation of a shape” – Stack Overflow

Posted by jpluimers on 2013/07/09

Sometimes a generic answer to a specific answer gives people a lot more insight into what they actually want to accomplish than a specific answer.

Plus that the knowledge does not only apply to VCL in any Delphi version: it works in any development environment where you can draw.

That’s why I like this 2D transformation answer so much: Read the rest of this entry »

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 x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Development, Software Development | Leave a Comment »

Delphi XE2: Update 4 is not the final update… Be sure to check out HotFix 1

Posted by jpluimers on 2013/06/18

When at clients, I often see Delphi XE2 only updated until Delphi XE2 Update 4 (sometimes not even Update 3 is installed, which means you can run into Strange Format result in Delphi XE2 when using Currency data types).

Update 4 is the latest update offered by the ‘check for updates’. But the actual latest update is CodeCentral ID: 28881, RAD Studio XE2 Update 4 Hotfix for FireMonkey and C++.

The final ISO does include this update, so if you ever need to re-install, do it from CodeCentral ID: 28882, Delphi XE2 and C++Builder XE2 ISO (includes Update 4 Hotfix).

You can check which updates you have installed in the Help -> About box of Delphi:

  • RAD Studio XE2 Update 4:
    version 16.0.4429.46931;
    Delphi XE2 and C++ Builder XE2 Update 4
  • RAD Studio XE2 Update 4 hotfix 1:
    version 16.0.4504.48759;
    Delphi XE2 and C++ Builder XE2 Update 4 HotFix1
    Delphi XE2 and C++ Builder XE2 Update 4

So be aware: sometimes the HotFix is only recognizable as the version number, not the version text.

Though HotFix is advertised as FireMonkey and C++ update, it also includes some Delphi fixes and makes sure you don’t get the below error messages from IDE Fix Pack 5.1 for 2009-XE3.

As a matter of fact, shortly after releasing, the author Andreas Hausladen posted IDE Fix Pack 5.1 for XE2 requires XE2 Hotfix 1.

Andreas Hausladen releases new versions of the IDE Fix Pack at irregular intervals. Watch the release page. Currently it is at version 5.3: IDE Fix Pack 5.3 and for Delphi XE2 it indicates “IDE Fix Pack 5.3 for XE2+UP4+Hotfix1”.

While installing the Hotfix 1, you can get messages like these:

---------------------------
Embarcadero RAD Studio XE2
---------------------------
Error
Error applying patch to file C:\Program Files (x86)\Embarcadero\RAD Studio\9.0\lib\win64\release\IdSSLOpenSSLHeaders.dcu.  It has probably been updated by other means, and can no longer be modified by this patch.  For more information contact your patch vendor.
---------------------------
Abort   Retry   Ignore
---------------------------

The reason is that the installer thought it had enough disk space, but the dynamic swap file growth of Windows systems decreased the disk space after the initialler estimate.

Make sure you have at lease 4 gigabytes of disk space free before installing RAD Studio XE2 Update 4 Hotfix 1.

These are the error messages you can get: Read the rest of this entry »

Posted in Delphi, Delphi XE2, Development, Software Development | 1 Comment »

Crap: the outsourcing party of the client wrote C-code like this in 2005, and nobody scrutinized it

Posted by jpluimers on 2013/06/12

I was involved in a big project migrating a complex stack from Windows XP to Windows 7 x86, and got scared this !@#$ out of me.

The stack communicated to WebSphere MQ on AS/400 from Windows, and on the Windows side of things consisted of a UI developed in in Cool:Gen, a C interface to a Delphi DLL, which takes care of the communication to WebSphere MQ.

Digression:

This all was histerically grown. In the beginning (early to mid 90s last century) it was a big Borland Pascal/Turbo Pascal application – running on DOS, Windows 3.1x, Windows 95 and OS/2 2.x/3.0 – that talked over a propriatary layer over SNA to AS/400.
The vendor of that layer didn’t respond to a request for Windows NT 4.x compatibility, and meanwhile some client applications were about to be developed in Delphi.

So in 1997/1998 – together with a great AS/400 software developer – I wrote a SNA based APPC/CPI-C communication layer in Delphi 3 that could be accessed from both Turbo Pascal (using a file based interface) and Delphi (using an object interface).
The DOS interface was an executable around the Delphi interface, which was a set of classes.

Delphi part

The Delphi part of the DOS interface was centered around FindFirstChangeNotification/CreateProcess combined with MsgWaitForMultipleObjects/WaitForSingleObject to make the waiting as efficient as possible.

DOS part

DOS part

The DOS part of the Delphi interface was centered around this piece to make waiting efficient:

asm
  int $28
  mov ax, $1000
  int $15 { DESQview/TopView give up time slice }
  mov ax, $1680
  int $2F
end;

Thanks to the RBIL: Ralf Brown’s Interrupt List (there are now multiple HTML versions of it), it makes use of these tricks so DOS applications can efficiently wait : Read the rest of this entry »

Posted in C, CVS, Delphi, Delphi 2006, Delphi 3, Delphi 5, Delphi XE2, Development, Dimensions CM by Serena, MKS Integrity, Software Development, Source Code Management | 3 Comments »