Sunday, June 25, 2017

Simple retry mechanism in Delphi

Hi all,
I want to share with you a nice unit that provide a retry pattern. How many times you want to execute some code and, if that method throws an exception, you want to retry executing it several times? For example when you try to connect to a service or network resource or a database. The operation was something that failed frequently enough that it was necessary sometimes to retry until it succeeded. With this unit you enable an application to handle transient failures by transparently retrying a failed operation.
Here is the RetryHelperU:
The snippet is very simple to understand: you have to specify the number of retries, the milliseconds between each retry and a TProc that represents the operation to do.
I also added this project to my Delphi Demos repository.
I hope it will be useful!

Tuesday, April 11, 2017

Delphi and Firebase: Remote configuration

Hi all,
as you know Firebase is a backend service that include a data storage service. One of common example of this kind of service is Remote Configuration, that allows you to change the behavior or appearance of your app (ex. change the welcome message of your app) without changing the app source code.
I've just updated the Firebase4Delphi repository with a new demo : RemoteConfigDemo.
In this demo I implemented a mechanism to allow to change the behavior and appearance of your app without publishing an app update.
The process is very simple, you have to:
  1. create a JSON Object in your console project that represents the app configuration
  2. Wraps that configuration in your app
  3. Check when configuration change and communicate it to your app
In this demo you have the possibilities to change the style of your application, according to OS, at run time.

Firebase Console configured at run-time configured at run-time

ASAP I'll post a short video to show the power of this feature.

Friday, March 24, 2017

One codebase to rule them all - RAD Studio 10.2 Tokyo is here!

Finally, it's arrived!! The penguin invasion has started! RAD Studio 10.2 Tokyo is here bringing with it support for Linux!
Delphi for Linux is now available delivering support for Linux 64bit server-side and standalone applications for Ubuntu and RedHat Enterprise. Guys, I'm very enthusiastic about this new support! This is a very greats news for Delphi developers and not, everywhere!

By now Delphi can support and generate native code for several platforms (7 to be exact!!!): Linux (64bit), Windows (x86 and x64), OS X (32-bit ), iOS (32 and 64-bit) and Android.
I think that no citation may be more appropriate of this:
one codebase to rule them all
Below a list of the most interesting features available in this release (IMHO):

Delphi Linux Compiler

  • 64-bit Linux platform support
  • Delphi language support
  • ARC-enabled
  • 1-based strings
  • LLVM engine based

Supported Linux Distributions

  • Ubuntu Server (Ubuntu 16.04 LTS)
  • RedHat Enterprise Linux (version 7)

RTL features supported

  • Linux file system access
  • Threading and Parallel Programming Libraries support
  • Memory management
  • HTTP and REST libraries support for HTTP calls

64-bit Linux for Server Applications

  • FireDAC provides Linux support for all Linux-capable DBMS, with the only exception of Informix. See Database Connectivity.
  • WebBroker, RAD Server (EMS), and DataSnap support for Multi-tier servers (standalone and Apache modules).
  • DUnitX support.
  • PAServer support.
  • Indy-based client and server support.


  • New System Status Bar Options on iOS
    • Two new properties have been added to TForm for changing the behavior of the system status bar on iOS: SystemStatusBar.BackgroundColor and SystemStatusBar.Visibility.

  • Multi-Threading Support for TBitmap, TCanvas and TContext3D
  • Unification of Delphi and Java threads on Android: CallInUIThread has been deprecated. All code is now running in the Java UI Thread, removing the need for thread synchronization

Improvements for Firebird

  • New Direct property to add support for the Direct I/O backup feature.

Improvements for MySQL

  • Support for MySQL v 5.7.
  • Support for MariaDB v 5.5 or later. Use FireDAC's MySQL node to connect to MariaDB.
  • Compatibilty with the recent MySQL versions 5.6.x and 5.7.x.

Database improvements

  • VCL TDBImage direct support for JPEG and PNG graphic formats.
  • Support for display options for BlobFields.
  • Direct GUID access for TField classes.


  • HTTP Client
  • HTTP Client Library provides support for 64-bit Linux.
  • Improved async support in HTTP client
  • RTL support for 64-bit Linux
  • RAD Studio 10.2 Tokyo provides Linux file system support using standard system functions, streams, and the IOUtils unit. It also provides Standard RTL Path Functions support for 64-bit Linux.

Improved C++ packages for mobile

RAD Studio 10.2 Tokyo links C++ packages for iOS and Android statically. Previous versions of RAD Studio generated a file with the .so extension for C++ packages, but were not actually dynamic libraries. RAD Studio 10.2 Tokyo generates C++ packages with the correct file extension (.a). If you statically link against a .so package, you may need to change to link against the new filename.

RAD Server Multi-Tenancy Support

With Multi-Tenancy support, a single RAD Server instance with a single RAD Server database connection can support multiple isolated tenants. Each tenant has a unique set of RAD Server resources including Users, Groups, Installations, Edge Modules, and other data. All tenants have custom resources that are installed in the EMS Server. Also, as an administrator you can create new tenants, edit existing ones, add, edit, or delete details of your tenants, specify if the tenant is active, and delete the tenants that you do not need.

iOS 10 Simulator, device, and macOS

Full support for iOS 10, including iOS 10 32-bit and 64-bit debugging on device, Simulator support (Delphi only) and macOS Sierra support.

The news are not only these, for the complete list of all news of this release go here.