XE3 and Subversion/Google Code

Just a small heads up, but it has come to my attention that the XE3 IDE’s Subversion (SVN) integration does not support the older, pre-v1.7 Subversion format, at least out of the box. While there are interop issues with recent versions of TortoiseSVN (the Subversion client I actually use) too, the XE3 IDE goes a step further by just hanging when the ‘Open From Version Control’ command is used against a repository in the older format.

While this in practice won’t bother many people, Google Code (a free-as-in-beer way to publish open source code) still uses Subversion v1.6… which means anything Delphi-related there whose author chose Subversion precisely because the Delphi IDE provides SVN support in the box may now look slightly foolish… Anyhow, this is all just a slightly roundabout way of saying I’ve added a ZIP of the sample code for my XE2 book here!

[Edit – my initial post was overly negative about TortoiseSVN (thanks to Robert Love and M J Marshall for correcting me in the comments). The issue is that TortoiseSVN v1.7x forces you to upgrade working copies from v1.6x to v1.7x, which means you can’t use both it and the XE or XE2 IDE interchangeably, assuming you haven’t modified the IDE’s behaviour to use the newer SVN DLLs. However, if you only use TortoiseSVN as your client, it can happily work with v1.6x servers. This though gives even less reason for the XE3 IDE to just hang!]

FindFirst on OS X – two small tips

If using FindFirst/FindNext/FindClose when targeting OS X , there’s two things to keep in mind:

  1. To search for items with any name, use a mask of ‘*’ not ‘*.*’.
  2. If enumerating sub-directories and sub-directories of sub-directories, remember to check faSymLink or you may find yourself in an endless loop.

The following code demonstrates getting both things right, assuming you just want to ignore directory links like you would a folder shortcut on Windows (thanks to Primož Gabrijelčič in the comments for making the caveat clear):

procedure DoSearch(const Path, FileSpec: string);
const
  SAnyMask = {$IFDEF MSWINDOWS}'*.*'{$ELSE}'*'{$ENDIF};
var
  Info: TSearchRec;
begin
  //find files in the immediate directory...
  if FindFirst(Path + FileSpec, faAnyFile and not faDirectory,
    Info) = 0 then
  try
    repeat
      //work with found file info...
    until FindNext(Info) <> 0;
  finally
    FindClose(Info);
  end;
  //find sub-directories and recurse
  if FindFirst(Path + SAnyMask, faDirectory, Info) = 0 then
  try
    repeat
      if (Info.Attr and faDirectory <> 0) and
         (Info.Name <> '.') and  (Info.Name <> '..') and
         (Info.Attr and faSymLink = 0) then
        DoSearch(Path + Info.Name + PathDelim, FileSpec);
    until FindNext(Info) <> 0;
  finally
    FindClose(Info);
  end;
end;

As an aside, both these things I previously forgot in the public version of one of my book demos (ahem), but the source is now updated in the SVN.

Minor update to the eBook version of Delphi XE2 Foundations

Just a quick ‘heads up’ to say a (very) minor revision of the Kindle edition of my book, Delphi XE2 Foundations, is now available. This corrects some typos in the original version, but as nothing substantive has changed, it isn’t necessary to update. Further, if you have bought one of the eBook parts this month (July), it is probable you already have the corrected version. This is because it has actually been out for a few weeks – I’ve just been waiting for Amazon to make it available to people who bought a part previously.

If at the start of the eBook the copyright page says ‘Updated 30 June 2012’, then you have the most recent version (the printed version won’t, since it had the corrections in question at the outset). Otherwise, you can upgrade by going to the ‘Manage Your Kindle’ page on Amazon’s website; an ‘update available’ link should then be visible:

Having chosen the option to update, the book should re-download when you next open your app or device. For myself, I found the book ‘disappeared’ in the Mac app after it had finished being re-downloaded, however simply closing and reopening the app fixed that. Also, please be aware that a side effect of upgrading will may be the loss of any annotations or notes made in the original version.

As an aside, various Kindle apps and devices have themselves had software or firmware updates from Amazon in the past couple of months. I would recommend upgrading to anyone affected. Of the Kindle apps for Windows and OS X, v1.9.x was better than v1.8.x, and v.10.x (current at my time of writing) finally supports the entire CSS subset supported by the Kindle Fire (under the hood, an eBook is composed of HTML and CSS, like a webpage). For example, here’s a page from my book in v1.8.1 of the desktop app (OS X, but Windows was similar):

And here’s the exact same page in v1.10.0:

The desktop apps supposedly auto-update, but I haven’t found that to be the case – I’ve needed to manually download and reinstall.

The printed version of Delphi XE2 Foundations is now available

Having published it previously as three separate eBooks, the printed version of my book, Delphi XE2 Foundations, is now available. You can buy it on Amazon.com here, Amazon.co.uk here, Amazon.de here, Amazon.fr here, Amazon.es here, and Amazon.it here. If you don’t mind registering for an account, you can also get it direct from CreateSpace here (I get a better royalty rate if you do that). The price is $49.99 on Amazon.com and CreateSpace, £34.99 on Amazon.co.uk and €39.99 (or thereabouts) on the other European sites.

As I’ve previously discussed, the book takes you through the language and wider RTL as at the XE2 release, covering older and newer features alongside each other. Consequently, one chapter tackles string handling, another streams and so on. If you are an experienced Delphi user, the earlier chapters may not be so interesting while the later ones (which include coverage of OS X support at the RTL level and the newer multithreading primitives) hopefully will be; conversely, less experienced users may find the earlier chapters more relevant. To forstall misunderstandings, the book is more a reference-type one than a tutorial-type one, so I don’t want anyone to get the wrong idea and be disappointed as a result.

Compared to the Kindle version, the printed one isn’t split into three parts, but does contain an index. Otherwise, the text is identical but for the correction of a few typos that I will push down to the Kindle version shortly. I’m not sure when exactly, since I’m looking to fix a few Unicode character issues at the same time (different Kindle devices and apps have varying levels of Unicode support, which is a pain). In any case, corrections will be made available to existing eBook purchasers too.

Delphi XE2 Foundations, Kindle edition is out!

I have (finally!) published my book, Delphi XE2 Foundations, on Amazon’s Kindle eBook store:

Part 1 (chapters 1-4) – Amazon.co.uk; Amazon.com; Amazon.de; Amazon.fr; Amazon.es; Amazon.it
Part 2 (chapters 5-9) – Amazon.co.uk; Amazon.com; Amazon.de; Amazon.fr; Amazon.es; Amazon.it
Part 3 (chapters 10-15) – Amazon.co.uk; Amazon.com; Amazon.de; Amazon.fr; Amazon.es; Amazon.it

Some general info on the book is available at http://delphifoundations.com/; sample code is also available in a Subversion repository hosted on Google code (http://code.google.com/p/delphi-foundations/). Significantly, the book is more a reference-type one than a tutorial-type one, so I don’t want anyone to get the wrong idea and be disappointed as a result.

In a nutshell, what it does is take you through the language and wider RTL as at the XE2 release, covering older and newer features alongside each other. Consequently, one chapter tackles string handling, another streams and so on. If you are an experienced Delphi user, the earlier chapters may not be so interesting while the later ones (which include coverage of OS X support at the RTL level and the newer multithreading primitives) hopefully will be; conversely, less experienced users may find the earlier chapters more relevant.

For the eBook edition, I have split the book into three parts. This simply means you get a third of the whole book per purchase. Pricing is £7.99/€8.99/US$9.99 per part (European prices include VAT). For samples, either use Amazon’s ‘Look Inside’ feature, or have a sample sent to a registered Kindle device or app – look out for the link on the right of the product page:

Since I have gone through Amazon’s Kindle eBook store, you need either a Kindle device or Amazon’s free Kindle app installed to read my book. In the case of the latter, the app is available for a variety of desktop and mobile platforms (click here) – the main exceptions are e-reader rivials to the Kindle, however iOS is supported.

Whether using a Kindle device or a Kindle app, support for Amazon’s newer ‘KF8’ format is preferred, however it isn’t a requirement – if the chapter headings of my book come out with a top and bottom border then KF8 is being used, otherwise it isn’t. All Kindle Fire tablets, together with Kindle and Kindle Touch e-readers bought in the past couple of months, support KF8 by default; others may need a system update from Amazon. In the case of the Kindle apps, these are supposed to auto-update, and therefore, have acquired KF8 support if they didn’t have it already. However, this didn’t work for me, so I had to re-download the apps manually.

As my recent blog posts have indicated, there will be a printed version of the book, just not quite yet. Unlike the eBook edition, the printed version won’t come in separate parts. It will also be a bit more expensive than the three eBooks combined, however the differential will be similar to what professionally published books tend to have between the two formats.

[Update: the printed version is now available too at Amazon.com, Amazon.co.uk, Amazon.de, Amazon.fr, Amazon.es, Amazon.it and CreateSpace.]