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

Archive for the ‘Delphi XE3’ Category

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 »

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 »

Run batch file from Delphi IDE (via: Stack Overflow)

Posted by jpluimers on 2013/05/29

In pre-Galileo versions of Delphi it was easy to run a .BAT or .CMD file as a main project file: just press F9.

Thanks to iManBiglary for posting how to do this in modern Delphi versions. Paraphrased:

Add the file path to cmd.exe (easieist is to add $(ComSpec) which expands the %ComSpec% environment variable) in the tools menu, with /c$EDNAME as the parameter.
In addition, you can tell the IDE to save your file before running the external tool with the $SAVE macro

One of the things you can do with this is add a project containing a batch file that starts to assemble your build results to create a deployment set.

–jeroen

via: Run batch file from Delphi IDE – Stack Overflow.

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

On my research list: Distinguishing USB devices

Posted by jpluimers on 2013/05/23

So I won’t forget:

delphi – How to distinguish flash drives? – Stack Overflow.

In that answer, Dan C talks about VID / PID (Vendor ID and Product ID) and how to get some of the serials without WMI.

–jeroen

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

DataSnap in the Cloud – DelphiFeeds.com

Posted by jpluimers on 2013/05/22

On my research list (Thanks Uwe!): DataSnap in the Cloud – DelphiFeeds.com.

It shows you how to do DataSnap from the Azure clound, including getting some of the default Delphi database demos to work on SQL Server (erm, SQL Azure).

–jeroen

Posted in Delphi, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | Leave a Comment »

Don’t pass interfaces between application architectures over a DLL boundary

Posted by jpluimers on 2013/05/15

It is unwise to pass objects allocated in one framework over a DLL boundary to a different framework.

In the case of Using C dll in delphi return nothing, someone tries to pass an Interface to some memory in the C side over to Delphi.

Unless that interface is COM based, don’t do that!

In a more general way: don’t pass memory allocated on the DLL side over to the client side, no matter what kind of client you have.

From the DLL, either pass simple types, or fill buffers allocated at the client side.

Edit:

There was a nice Delphi DLL return string from C# … .NET 4.5 Heap Corruption but .NET 4.0 works? Explain please? – Stack Overflow question explaining in detail what to do for strings in a specific case: use the COM heap on the Delphi side using CoTaskMemAlloc (actually it uses the OLE task memory allocator as the Old New Thing explains).

–jeroen

via: Using C dll in delphi return nothing – Stack Overflow.

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, Delphi, Delphi 1, 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, Development, Software Development | 5 Comments »