Watch, Follow, &
Connect with Us

Idle Musings of a Delphi Junkie

Delphi for Android app spotted in the wild

I have spotted what I think may be the first Delphi for Android app to make it into the Google Play store. It’s an app developed by Brian Hamilton, which displays data from weather stations, and is a port of his existing iOS version (if you can call a single source, multi-platform app a port :-))

Nice work, Brian!

Posted by David Clegg on September 12th, 2013 under Android, Delphi, iOS | 8 Comments »


QC Plus has a new home

As many of you may be aware, Jeremy North of JED Software has created an excellent Windows client to interact with the QualityCentral issue and feature tracking system used by Embarcadero. While he no longer hosts QC Plus on his site, he has kindly given me permission to host it on CodeCentral, and you can now download it from there.

It is important to note that QC Plus is being offered on an "as is" basis, with no warranties whatsoever. If you have any issues with the software, please do not contact Jeremy about it, as he is no longer supporting it. Of course, if you have any technical issues with QualityCentral, feel free to contact me.

Posted by David Clegg on September 2nd, 2013 under EDN, General | 8 Comments »


EDN Mobile users, this is your upgrade reminder notice

You may recall a few weeks ago that I blogged about upcoming changes to the DataSnap REST service used by EDN Mobile. Well, today I deployed these changes to production. So if you are an EDN Mobile user on version 1.1.4 or prior, I strongly suggest that you upgrade to the latest version.

And if you’re not an EDN Mobile user, what are you waiting for? Download it today! :-)

Posted by David Clegg on July 29th, 2013 under EDN | 2 Comments »


Tweeting from Delphi for iOS apps

Victory Fernandes (Twitter user @victoryjorge) has a great blog post demonstrating how easy it is to use the TMSCloudPack set of components to add Twitter integration into your Delphi for iOS applications. Nice work, Victory (and TMS, for providing such a simple to use API)!

As a Twitter junkie myself (feel free to follow me; my handle is @delphijunkie), this is something I may need to explore a bit more. Likewise, some of the other components in the TMS Cloud Pack look very useful, as I find myself embracing more and more cloud services.

Posted by David Clegg on July 11th, 2013 under Delphi, iOS | 2 Comments »


If you are an EDN Mobile user, you should upgrade

I have been porting many of my DataSnap REST services from using dbExpress for its database access, to take advantage of the FireDAC data access framework. As a side-effect of this, I’ve had to make a change to the EDN Mobile application to handle a slight difference in datatype in some of the datasets it remotes to clients. In particular, the My Member Services and My duplicate accounts functionality may no longer work as intended with EDN Mobile versions 1.1.4 and prior once I upgrade the REST server.

I intend to upgrade the REST service that EDN Mobile consumes one month from today, so you should have plenty of time to upgrade to the latest version of EDN Mobile (currently 1.1.5). The new version should consume the existing  REST service with no issues.

This upgrade also fixes a bug with the way auto login authentication details were stored, so if you are encountering issues in this area, this upgrade will be beneficial to you.

Posted by David Clegg on June 13th, 2013 under EDN, General | 3 Comments »


Cross platform anonymous threads and progress notification

Reading Anders Ohlsson’s latest blog post about using iOS APIs we don’t wrap reminded me of another couple of helper classes that I created, and which ship with the RAD Studio XE4 samples.

The first of these is the TAnonymousThread<T> generic class (in <samples installation directory>Delphi\RTL\CrossPlatform Utils\AnonThread.pas), and is designed to make it easy to create and consume anonymous threads for any activities that will return some kind of result (e.g. fetching data from a remote service). The public API for it is as follows :-

TAnonymousThread<T> = class(TThread)
public
  constructor Create(AThreadFunc: TFunc<T>; AOnFinishedProc: TProc<T>;
    AOnErrorProc: TProc<Exception>; AStartSuspended: Boolean = False;
    AFreeOnTerminate: Boolean = True);
end;

As you can see, the interface is pretty straightforward. It takes a series of procedure and function pointers to allow you to specify a function to be run in the thread, a callback procedure which will be run in the main thread so you can process the result, and a callback procedure which will run in the main thread if an exception occurs during thread processing. By default it will not start the thread suspended, and will free the thread on termination (for platforms that don’t have ARC implementations).

Here is an example of using this class:-

var
  lThread: TAnonymousThread<TDataSet>;
begin
  lThread := TAnonymousThread<TDataSet>.Create(
    function: Boolean
    begin
      //Runs in separate thread
      Result := SomeLongRunningMethodReturningADataSet;
    end,
    procedure(AResult: TDataSet)
    begin
      //Runs in main thread
      SomeMethodToProcessDataInMainThread(AResult);
    end,
    procedure(AException: Exception)
    begin
      //Runs in main thread
      ShowMessage(AException.Message);
    end);
end;

The second class is the TAsyncProgress<T> generic class (in <samples installation directory>Delphi\RTL\CrossPlatform Utils\Xplat.Utils.pas). Like the TAnonymousThread<T> class, it is designed to run a method returning a result in a separate thread, but has the added functionality of showing notification of a long running process. The public API for this class is as follows:-

TAsyncProgress<T> = class
  public
    class procedure Execute(AFunc: TFunc<T>; AOnFinished: TProc<T>;
      AOnError: TProc<Exception>);
  end;

As you can see, it has a similar interface to TAnonymousThread<T>, and accepts callback methods to handle a threaded function, and methods running in the main thread to process the result, or any exception that may occur during thread processing.

Here is an example of using this class:-

TAsyncProgress<Boolean>.Execute(
  function: TDataSet;
  begin
    //Runs in separate thread
    Result := SomeMethodReturningADataSet;
  end,
  procedure(AResult: TDataSet)
  begin
    //Runs in main thread
    SomeMethodToProcessData(AResult);
  end,
  procedure(AException: Exception)
  begin
    //Runs in main thread
    ShowMessage(AException.Message);
  end);

If you look at the implementation of TAsyncProgress<T> in Xplat.Utils.pas, you’ll see that it leverages the FMX.Platform.TPlatformServices class to register and consume an IPleaseWaitService interface. This interface has the following signature:-

IPleaseWaitService = interface
  procedure StartWait;
  procedure StopWait;
end;

I have created an implementation of this interface for iOS in iOS.Services.pas, and for OSX in Mac.Services.pas. The iOS implementation uses the technique that Anders blogged about to show the network activity indicator in the iOS status bar, but it also uses the UIActivityIndicatorView class to show a spinning progress indicator in the centre of your application view. Similarly the OSX implementation uses the NSProgressIndicator class to show a spinning progress indicator in the center of your main OSX application view.

To register an implementation for a given platform, simply add the relevant *.Services.pas file to your project.

In addition to leveraging the IPleaseWaitService interface via the TAsyncProgress<T> class, you can also interact with this service directly using helper methods in XPlat.Utils.pas, by utilizing the following:-

//Returns an instance of the IPleaseWaitService registered for the current platform
function PleaseWaitService: IPleaseWaitService;

//Runs the specified procedure (unthreaded), using the IPleaseWaitService interface to
//indicate execution progress.
procedure ProgressProc(AProc: TProc);

//Wraps a call to IPleaseWaitService.StartWait, if the service has been registered
procedure StartWait;

//Wraps a call to IPleaseWaitService.StopWait, if the service has been registered
procedure StopWait;

There are sample applications for iOS showing how to consume the TAnonymousThread<T> and TAsyncProgress<T> classes located in <samples base>Delphi\RTL\CrossPlatform Utils\AsyncProgress/AnonymousThread.dproj and <samples base>Delphi\RTL\CrossPlatform Utils\AsyncProgress/AsyncProgress.dproj respectively.

Posted by David Clegg on April 30th, 2013 under Delphi, OSX, Windows, iOS | 3 Comments »


Persisting settings in Delphi iOS applications

I thought I’d celebrate the release of RAD Studio XE4 by climbing back on the article writing horse. My first article is about persisting settings in iOS applications written in Delphi, and can be found on EDN.

As always, all feedback is greatfully received. And I’ll see if I can conjure up a few more over the coming weeks (no promises though :-)).

Posted by David Clegg on April 23rd, 2013 under Delphi, iOS | 3 Comments »


Are you eligible?

A couple of weeks ago, I implemented a new EDN feature which may have gone unnoticed by many of you. When you log into Member Services, you will now see a new ‘My eligible field tests’ option in the navigation bar to the left.

My eligible field tests navigation element

My eligible field tests navigation element

When you click on this, it will show you a list of any field tests you may be eligible to participate in, due to having a registration for a qualifying Embarcadero product.

Eligible field tests

Eligible field tests

As of today, this means that all current Delphi XE3, C++ Builder XE3, and RAD Studio XE3 users have access to the Quintessence field test, which will allow you to test and provide feedback on the latest iteration of iOS support in Delphi.

When you find an eligible field test that you think you may want to participate in, click the ‘Sign up’ link to the right of the table, and you will be taken through the field test sign up process. Once you’ve signed up for a field test, clicking this link again should (in a roundabout way) take you to the overview page for that field test. I intend to enhance this further so that any eligible field tests you’ve already registered for will handle this in a more seamless method (think of it as replacing the roundabout with a freeway :-)).

Posted by David Clegg on December 4th, 2012 under EDN, General | 19 Comments »


Introducing EDN Mobile v1.1

EDN Mobile

EDN Mobile

A new version of EDN Mobile has been launched, and along with it comes a few new features that moves it from being simply a clone of the http://members.embarcadero.com website, to instead starting to harness some of the features found in Android smartphones.

I used this opportunity to write an EDN article about it, for the benefit of the one or two community members who don’t follow my blog :-). Feel free to take a read to find out more about the newest features of EDN Mobile, and please take it for a test run and let me know what you think.

Posted by David Clegg on July 2nd, 2012 under EDN, General | 2 Comments »


EDN Mobile: Maintenant avec la localisation française!

Thanks to a totally unsolicited email from EDN community member Whiler, I am pleased to announce that EDN Mobile now supports the French locale.

I now invite other community members to provide localizations in any of the supported languages. As of Android 4.0.3, this list is available here. The localization process is pretty simple, and involves downloading these XML files, and replacing the English text values with the localized version (leaving the name attribute untouched). Once you’re done, you can email me the updated file, and I’ll incorporate it into a subsequent release of EDN Mobile.

Also, if you email me your intent to perform a localization, or add a comment here, I can keep everyone updated in the comments so we don’t have multiple people working on the same localization.

Posted by David Clegg on May 2nd, 2012 under EDN, General | 1 Comment »




Server Response from: BLOGS2