Marco Cantu

Syndicate content
Techie Italian Blogging on Delphi and More
Updated: 1 hour 26 min ago

RAD Studio 10.2.2 Tokyo February 2018 Patch Re-Released

4 hours 52 min ago

Last week, Embarcadero released a patch for Tokyo 10.2.2, focused on Android and RTL improvements. What happened is that Windows would not always ask for execution with admin account (on systems with active User Account Control) and could end up copying the replacement files in a wrong location. It did affect a few of the developers who tried it, so we pulled it, fixed the installer and now re-issued the patch.

If you are a registered user of Tokyo (or have a license for it), you can find it at

There is no change in the content on the patch, so if you already installed it successfully, there is no need to repeat the process. On the other hand, if your installation got broken, we have provided an alternative ZIP-based option (in the same download page). We have already sent it to developers who had got in trouble, but might not have reached everyone.

As for the content, the main fix is the Android animations and tab animation issue. These have been addressed. There are still cases in code where the combination of called to Application.ProcessMessages and timers might get you in trouble. I'll blog more information ASAP, but the general recommendation is to use threads rather than timers for background processing -- an all platforms, although in Windows that coding style can be used.


Updated Notice: Only for 10.2.2 Build 2004 

We had a notice in the download page, but better repeat it here. The patch is only for the second build of 10.2.2 we released, build 2004. If you have the previous build (which had compatibility problems with third party packages) don't install the patch. Either wait for a future update (if you don't specifically need the fixes the patch provides) or install build 2004 first. The link to 2004 installer is in the patch download page.

Categories: News, Blogs, and Tips

Delphi 23 and Delphi 10.2.3

Wed, 02/14/2018 - 13:05

Today is Delphi's 23rd birthday. The product was launched on Valentine day in 1995 in San Francisco (and I had the luck to be there, as I covered in the past). 23 years is a lot of time for people. It is a incredibly long time for technologies. It is hard to find a language, framework and IDE from 23 years ago you can use to build todays's and tomorrow's software. Of course, the IDE, language and frameworks have evolved and keep evolving -- developers using them can modernize their apps without a full rewrite.

In this 23 years, millions of developers and have used Delphi to build millions of applications, and applications used by millions of users. The most used Delphi application ever build is probably Skype for Windows. But it has been used to build applications worth millions in sales and moving millions in financial markets. And Delphi is still used to day to maintain those applications and create new ones in industrial, financial, health, travel, and sport fields (among others)... including mobile apps for its birthday. Or to run a miniature airport.

In these 23 years the product has changed a lot (Hey, I've changed a lot from the picture in the link above!), Below you can find a comparison of Delphi 1 running on a VM and Delphi 10.2.2 (with dark theme) running on the same machine. It is not a Photoshop, it is an actual screenshot!

Both versions of the IDE have a VCL application with a Button and the Caption property highlighted in the Object Inspector. I didnt' include the about bos of 10.2.2 (as I was trying to do) because it is a little too big. One of these days I'll make a parallel video of working on both. But you know what? Most applications you build in Delphi 1 can be recompiled with few changes in the 23 year later version. Well, as long as you don't use pointers, as Delphi 1 had 16 bit pointers (ugh!). Of course, most applications you write in todays product don't have a chance to run in the older sibling.

Speaking of today, Embarcadero (and the PM team I'm part of) just announced some more plans for this year, and the plan does include the coming release of an additional quality focused update for 10.2 Tokyo, 10.2.3. Now 10 x 2 + 3 is in fact 23. Or Delphi 10 version 2.3. We have a lot in the works for the next mayor release, but also want to keep improving on the quality of Tokyo and release it as soon as possible.

What else can I say? Just invite to you watch Jim Mckeeth great "23 years" Why I Love Delphi video.

Categories: News, Blogs, and Tips

My New RTTI in Delphi Class on Embarcadero Academy

Mon, 02/05/2018 - 01:43

As you might remember, I'm helping building the Delphi curricula on the Embarcadero Academy web site. My focus so far has been on the Delphi language, while other tackle VCL and other areas, or other languages and tools. Last week I completed my set of classes on the Modern Delphi language (Interfaces, Generics, Anonymous Methods) with a class on reflection and RTTI. You can buy each of these classes separately (price vary depending on the length) or buy the complete bundle with over 8 hours of content.

The class on reflection and RTTI has a lot of information on the modern RTTI (compared to the classic one), covers the RTTI unit, the TValue record, the use of attributes and much more. And for those who already purchased the Modern Delphi bundle in th past, the new class has been added to their account for free!

Categories: News, Blogs, and Tips

Try-Finally Blocks for Protecting Multiple Resources in Delphi

Fri, 01/26/2018 - 08:52

The Delphi language shares with many others a standard resource allocation pattern to make sure that in case of an exception the resources is properly released. Resources in this context are memory objects, files, operating system objects and handles, and the like. In Delphi, compared to other languages with a garbage collector, the relevance increased by memory management considerations.

Protecting a Single Object

In the most simple cases, you'd write code like:

allocate resource try use resource finally free resource end;

A more specific example would be like:

A1 := TTest.Create; try A1.DoSomething; finally A1.Free; end;

So far, so good. Notice that is an error happen during the constructor execution, Delphi will automatically execute the destructor for the partially initialized object (but this could be a topic for another blog post).

Protecting Two Objects: How NOT to Write the Code

The issue I want to focus on is how to write the same type of code if you need to allocate and dispose two resources. Here there are multiple options. What you shouldn't do (but is fairly common) is to write:

A1 := TTest.Create; A2 := TTest.Create; try A1.DoSomething; A2.DoSomething (A1); finally A2.Free; A1.Free; end;

The issue with this code is that in case the creation of A2 fails (and there could be many reasons), the A1 object would remain in memory. Simply pushing the second allocation within the try block is also not good:

A1 := TTest.Create; try A2 := TTest.Create; A1.DoSomething; A2.DoSomething (a); finally A2.Free; A1.Free; end;

With this code in case of a failure in object A2 constructor call, the finally block will try to Free an uninitialized object (the default value of a local object reference is undefined). This is why a possible solution is to set A2 to nil at the beginning -- as calling Free on a nil object has no effect. Or set all object reference to nil for simplicity and uniformity. Or write two nested try blocks to protect each of the resources.

Protecting Two Objects: A Tale of Three Solutions

This long introduction brings us to the point of this blog post. There are at least 3 different correct solution for the issue of protecting two resources in the same code block, as I just mentioned. Here are the three solutions in an image I "borrowed" from one of our RAD Studio R&D architects, Bruneau Babet.

Provided they are all correct in terms of proper resource management in all scenarios, which are the advantages and disadvantages of these 3 solutions? What is important to consider is that the 2 resources could be 3, or 4 or half a dozen. 

Which One to Pick?

The first solution with the nested try blocks fairly clean but more verbose (more lines of code) and has additional nesting that could become an annoyance with multiple resources. Also, there is a runtime cost associated with try blocks, clearly limited but not zero. 

The second solution has the least amount of lines of code code and the least amount of runtime cost. The only additional is setting A2 to nil. The code remains readable also with many resources. However, the code is "unbalanced" and it might be slightly confusing.

The third solution goes in the same direction, but it adds one extra technically useless assignment to nil (for A1), offering the advantage of being cleaner and more balanced, and likely more readable after all.

So what's the best solution? This is really hard to tell,. I personally mostly used #1 in my books, but at Embarcadero we tend to prefer the cleaner and faster ones (that is, #2 or #3) for library code. Interested in your opinions, of course.

Categories: News, Blogs, and Tips

HTTP Protocol Related Improvements in Delphi 10.2.2

Wed, 01/24/2018 - 07:11

The new features for the HTTP client library offer more flexibility and options in terms of protocol and standards support. 

Better Secure Protocols Support

The first change is the improved support for security protocols. In the past it wasn't possible to specify the required security protocols (TLS1.1, TLS1.2, etc.) for an HTTP request. We have added a new enumeration, THTTPSecureProtocol with the values (SSL2, SSL3, TLS1, TLS11, TLS12). THPPTClient and related classes have now a SecureProtocols property which is a set based on that enumeration.

The property (available only at run-time) controls which security protocols to use and it is currently implemented only for Windows. This was requested in our Quality Portal at

HTTP Redirect Improvements

Another set of improvements is in the way the HTTP client library handles redirects. There is a new RedirectsWithGET runtime property offering another set of options, this time based on the following enumeration:

THTTPRedirectWithGET = (Post301, Post302, Post303, Post307, Post308,   Put301, Put302, Put303, Put307, Put308, Delete301, Delete302,   Delete303, Delete307, Delete308);

The property controls which request method and response status must be redirected using GET method and it was reported in several entries in QP, including

New REST Client Events OnNeedClientCert and OnAuthEvent

These events corresponds to their HTTPClient counterparts and are now surfaces at a higher level:

TRESTClient.OnNeedClientCertificate: TNeedClientCertificateEvent TRESTClient.OnAuthEvent: TCredentialAuthEvent

This was requested in

MIME Name Helper

We added a function that to the TEncoding support, which returns the encoding MIME for a speficied encoding:

function GetEncodingMimeName(AEncoding: TEncoding): string; Changed TIniFile Behaviour

This one is totally unrelated, beside the fact it was also done in 10.2.2. The Ini File behavior was platform specific, not is it platform independent. On Windows, TIniFile ReadString ignores the case of Key parameter. On Linux, the ReadString call was case sensitive, leading to issues when migrating code and configuration files. Now by default TIniFile content structure (not the actual values) is treated in a case-insensitive way on all supported platforms.

Categories: News, Blogs, and Tips

My Year in Cities 2017

Sun, 12/31/2017 - 08:45

This is my end-of-the-year blog post listing places I've visited in 2017 for at least one night (plus some relevant daily trips, marked with an asterisk), in chronological order. At times, the reason for the trip is listed: 

Torino (Italy)*

Trento (Italy)*

Sydney (Australia)

Brisbane (Australia), ADUG conference

Melbourne (Australia), ADUG conference

Altdorf (Switzerland)

Sprendlingen (Germany)

Nieuwegein (Netherlands)

Amsterdam (Netherlands)

Texel Island (Netherlands)

Nieuw Vennep (Netherlands)

Rotterdam (Netherlands)

Bruxelles (Belgium)

Vincey (France)

Colmar (France)

Berlin (Germany)

Zegrze (Poland), Delphi conference

Pisa (Italy)*

Frascati (Italy), ITDevCon conference

Koln (Germany), EKON conference

Viareggio (Italy)

Lucca (Italy)*, Lucca Comics event

Katowice (Poland)*

Ravenna (Italy)*

While I've been traveling a bit, my trips this year have been limited to Europe, plus a long trip to Australia. Planning a trip to the US within a few weeks, and spend some time booking flights today. Good sign.  

Have a great 2018 full of health and happiness (and traveling!).

Categories: News, Blogs, and Tips

Moving DNS, Some Hiccups Expected

Mon, 12/18/2017 - 09:48

Not much to add. I'm (finally) changing my registrar and DNS provider. Hope everything goes smootly, but it might be that the site and blog are not working in the few coming days. The physical server is not moving, so there should be no big trouble.

Categories: News, Blogs, and Tips

DataSet Mapping to JSON for JavaScript client support in RAD Studio 10.2.2

Fri, 12/15/2017 - 02:45

RAD Studio has offered support for JSON in different ways and for a long time. From the JSON system unit (originally part of the DBX space) to the old DataSnap table mapping (also via DBX) and to FireDAC tables to JSON mapping, there are many ways to interact with JSON data structures. However, until the most recent release, we lacked a way to map a dataset to a custom JSON structure -- the FireDAC JSON support produces a FireDAC specific structure, with meta data and record status information.

While this is a gap we already wanted to fill, it become more important to address it now that we are pushing RAD Server (a free deployment license is included with 10.2.2 Enterprise and above) and use it as a backend for ExtJS applications. As you can read in my blog post Implementing AJAX and JSONP Support in RAD Server for ExtJS, while this works the dataset mapping to JSON required writing custom code. Our first step in simplifying the use of Delphi as a backend for JavaScript applications is offering a better way to produce the JSON data from a database table.

While we have build this support for the scenario of using RAD Server, FireDAC, and ExtJS, the same component and technology can be used for any web service architecture written in Delphi and C++Builder (even pure and simple WebBroker), any dataset other than FireDAC, and any JavaScript client. It is a completely open and a fairly flexible solution. But it certainly works great for our specific scenario!

A VCL Application

I'll describe the solution using two demos. The first is a plain VCL application. while the second will be a RAD Server package. This highlights the fact that the solution is fairly general. In the first demo, I have the following components on a form (I know, I should have used a data module...):

This is the configuration of the components:

object EmployeeConnection: TFDConnection Params.Strings = ( 'ConnectionDef=EMPLOYEE') end object EmployeeTable: TFDQuery Connection = EmployeeConnection SQL.Strings = ( 'SELECT * FROM EMPLOYEE') end object FDBatchMoveDataSetReader1: TFDBatchMoveDataSetReader DataSet = EmployeeTable end object FDBatchMoveJSONWriter1: TFDBatchMoveJSONWriter DataDef.Fields = <> end object FDBatchMove1: TFDBatchMove Reader = FDBatchMoveDataSetReader1 Writer = FDBatchMoveJSONWriter1 Mappings = <> LogFileName = 'Data.log' end

With this configuration in place, all you need to do to produce the JSON is connect the output to the JSON writer and execute the batch move operation. In this case I've used a stream:

procedure TForm5.Button1Click(Sender: TObject); var sstr: TStringStream; begin sstr := TStringStream.Create; try EmployeeTable.Active := True; FDBatchMoveJSONWriter1.Stream := sstr; FDBatchMove1.Execute; ShowMessage (sstr.DataString); finally sstr.Free; end; end;

Other options are assigning to the writer for the output a JSONWriter (as I'll show shortly) or a JSONArray.

A RAD Server Web Service

For the second demo, the RAD Server demo, I've used the same set of components with the same configuration. In this cases I've added to an EMS package an "employee" resource, and implemented its get operation with the following stream-based code:

procedure TEmployeeResource1.Get(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse); var mStream: TMemoryStream; begin mStream := TMemoryStream.Create; AResponse.Body.SetStream(mStream,'application/json', True); FDBatchMoveJSONWriter1.Stream := mStream; FDBatchMove1.Execute; end;

As a better and simpler alternative, I could have used the JSONWriter property. The difference is that rather tha building the entire JSON data structure in the memory stream and later copy it to the HTML response, the data is written directly to the HTML response, reducing the work and the memory consumption:

procedure TEmployeeResource1.Get(const AContext: TEndpointContext; const ARequest: TEndpointRequest; const AResponse: TEndpointResponse); begin FDBatchMoveJSONWriter1.JsonWriter := AResponse.Body.JSONWriter; FDBatchMove1.Execute; end;

In both cases, you'll see an output like the following:

This is only a first initial step of the support we are planning to simplify the use of Delphi and RAD Server as backend for JavaScript and ExtJS applications. More support will be made available soon. Stay tuned.

Categories: News, Blogs, and Tips

New VCL Panels in Delphi 10.2.2

Thu, 12/14/2017 - 13:47

With the need to support more screen resolutions, while creating nice looking user interfaces and pleasant user experiences, we think it is important to offer additional ways to build the UI of your VCL applications. This is why in 10.2.2 we introduced two new VCL panel controls. These are control containers with specific way to manage the layout and position of their child controls. You can see the controls at design time below:


The CardPanel control is a set of pages, like the old PageControl, with no tabs. You display one page at a time, and it has built in support for swiping pages using a gesture. It is a collection of panels of the same size, each hosting its own controls.

At design time, you can use the local menu to add a card or select one, as shown here (image courtesy of RAD Studio DocWiki):

Each page is a "TCard" object, which is just a regular panel in disguise, so no special properties of configuration. More information at


The stack panel is a panel with a special layout. All controls added to it are placed in a different "row" (or column if you set it horizontally). The controls can be aligned to the left, the right, the center or use the entire space (fill). You set the default alignment at the stack panel level, and you can override it for each individual control (or use the special default value to pick the parent control setting). Each of the controls hosted by the panel, gets three additional properties "injected" by the container -- at the bottom of the Object Inspector list -- as you can see below:

More information at

The VCL remains a central pillar of Delphi (and C++Builder), and Embarcadero is and will continue to enhance it matching the evolution of the Windows platform and user experience, while on the other hand ensuring a very high degree of compatibility with the existing VCL code.

Categories: News, Blogs, and Tips

Debugging Delphi Apps on Android 8.1 Works

Thu, 12/14/2017 - 03:52

When Google introduced Android 8 this summer, they increased the platform security but happened to block socket access to the debugger, basically preventing debugging applications on a device. You'd see the error message "Can't open socket: Permission denied." as reported also at The issue was not a change in out debugger support, but a problem at the operating system level. You can read some of the discussion here:

Now the good news is Google fixed the issue (as indicated in the thread above). We tested it on previews and it seemed fine. Now Google has shipped Android Oreo 8.1, I got it for my Nexus 5X device this morning, installed it, and I can now debug a Delphi application as usual. I captured an image of the program stopped at a breakpoint below. 

Now this is not related to 10.2.2 in any way, as the change was only on the Android side, not the RAD Studio side. What we have fixed at our end is the display of the device name as target, but that wasn't a really big issue anyway.

Categories: News, Blogs, and Tips

New VCL Date and Time Picker Controls in Delphi 10.2.2

Wed, 12/13/2017 - 08:34

We at Embarcadero continue to consider the VCL as the best library for Windows-specific GUI development and are continuing the effort of improving and modernizing it, particularly improving the overall support for Windows 10. One of the directions of this effort (along side with styling, WinRT API, Desktop Bridge and more) is the addition of new VCL controls with the look of feel of the latest Windows platform controls, part of the WinRT UI layer. We have already delivered similar controls in 10 Seattle and 10.1 Berlin, and now adding 2 more in this release.

The goal od this control is to offer a more modern UI for VCL applications, adopting the Windows 10 UI style and elements without forcing you to rewrite the entire application (as someone in Redmond suggests) and allowing you to build programs that will still work fine and look great on Windows 7 -- a version of Windows still largely used today.

This is the reason why this family of controls is a set of pure VCL controls, that mimic the WinRT controls with no WinRT dependency. You can see the current list in the image below. Of these 4 controls are new in 10.2.2 Tokyo, the two pickers I'm covering in this blog post and two additional container panels I'll cover in a separate post.

As the name implies, the Date Picker and Time Picker components offers a simple, intuitive, and modern way to select a date or a time. These components are highly configurable, and can be adapted to any locale and format -- as these are quite different depending on where people live. 


The date selection component both displays a date in a given format and offers the user a simple way to select a date value from a dropdown. Rather than displaying a calendar, the user can change the day, month, and year values separately, similarly to what happens in most mobile platforms and applications. The user can change the selection with the keyboard arrow keys, clicking with the mouse on the upper or lower elements of a list or on the top and bottom arrows, or using the mouse wheel.

The key property of the component is the DateFormat property. This allows you to establish the format in which you want to display the date, changing the sequence in which the control displays the elements (month/day/year vs. day/month/year, vs year/month/day, etc.). This affects both the initial display and the actual selection. Below you can see a couple of different configurations, one at design time above and one at runtime. You can also see in the drop down a list of sample configurations, including month names or numbers, one or two digit days, and so on. The image is from the DateTimePickers sample that ships with RAD Studio 10.2.2 in the VCL section of the demos.

More information about the component is available in the RAD Studio DocWiki at


The time selection component is very similar to the date selection. Again it has multiple sections for the hour, the minute, possibly the seconds, and possibly the AM/PM selector. In this case the fundamental property is the TimeFormat property. Again, it determines both the display and the pickers behavior. You can include seconds or exclude hours and add AMPM to the time format to use a 12 hours format and to include an AM / PM selector to the dropdown.

Again, here is an example with a couple of different settings (at design time and runtime) with an image taken from the same demo mentioned above.

Additional documentation is at

That's all for now. Stay tuned for info on the other two new VCL controls in 10.2.2, or join the intro webinar tomorrow.

Categories: News, Blogs, and Tips

Delphi 10.2.2 Has Been Released

Tue, 12/12/2017 - 12:56

As you can see at, the new version 10.2.2 of Delphi, C++Builder, and RAD Studio is now available. 

The new features are covered in the docWiki, at

There are hundreds of bugs fixed (including over 150 bugs reported by customers in Quality Portal), as you can read in List of new features and customer reported issues fixed in RAD Studio 10.2 Tokyo Release 2 (we'll close the matching QP report in the coming days).

In the coming days I and the other PM will write a few blog posts on specific features added to the product. Also, there is a webinar on Thursday you can sign up for (at 3 times in the day). It will be an introduction to 10.2.2. Follow one of the 3 links at:

Categories: News, Blogs, and Tips

Delphi Blogs of the Month #57

Tue, 12/12/2017 - 01:51

As usual, this is a collection of links to relevant blog post and other newws you might heve missed over the recent perios of time, and that relate with Delphi one way or another.

Embarcadero News

There is a new Sencha MVP program, similar to the RAD Studio one:

Healthcare App Prototype Built In Delphi Wins First Place In Startup Weekend Competition! Read more at

Blog Posts

Top 10 Most Popular Open Source Delphi Projects On GitHub By Star Rating by Eli at

RAD Studio Custom Editor Sub-views by David Hoyle at (this is an extremely detailed example of writing editor views, which is a fairly complex extension to the RAD Studio IDE)

Persisting enumeration and sets to JSON by Chee Wee Chua at (a small and handy tip)

Microsoft has a very interesting blog post by Matteo Pagani covering the Desktop Bridge, a technology we support in Delphi, and while not everything is directly applicable, it is a very interesting read:

Supporting iPhone X display with Delphi by Dave Nottage at (some related improvements will be made available in RAD Studio 10.2.2)

Delphi + Enterprise Connectors + RAD Server = SAP native client for iOS and Android by Fernando Rizzato at (given the Enterprise Connectors cannot be used directly on mobile, you need a middle tier architecture to leverage them on your phone -- which also opens us to using push notifications)

Experimenting with Neural Networks – Part 6 by Craig Chapman at (read the previous 5 parts as well, of course)

Massive Collection Of Design Patterns, Frameworks, Components, And Language Features For Delphi at

Older but Great Posts

I missed this, but worth highlighting: A Delphi Primer with RAD Studio 10.2 by T Theobald at (a nice, long, and detailed "first look" to Delphi)

Roll your own lightweight, scalable backend using ZeroMQ at

Projects and Libraries

Pyscripter is a feature-rich but lightweight Python IDE (written in Delphi): There is also a related Python Delphi integration package at and this classic page



Categories: News, Blogs, and Tips

Cross JIRA Analysis with FireDAC CDATA JIRA Connector

Fri, 11/24/2017 - 08:06

In Embarcadero, for the RAD Studio project, we have two JIRA systems. One is a public system better known as Quality Portal (, while the second is an internal JIRA system accessible only behind the firewall. The two systems are kept in sync, as I explained in the past, so that a bug opened in the public system is reflected in the internal one; as we close a bug in the internal system and ship the fix, the internal status is reflected in the public system.

Almost always. In fact, there are reasons (timing, specific configurations, unexpected workflows, timeouts during synch operations, scripts that get stuck...) that prevent the regular flow to happen, leaving bugs in an inconsistent state. Specifically, we often have bugs closed internally that remain open (indefinitely) in the public system. I've spent time in the past looking for these orphaned items, but it is a fairly tedous process. So I though of writing an application to automate this. I could have used JIRA own scripting, but the process needs manual overview, which makes it more complex. So why not use Delphi?

Using the CData JIRA Enteprise Connector to run a query against JIRA and storing the data in a dataset takes literally a few minutes. You can use FireDAC query editor to refine your query, and write fairly standard Delphi dataset processing code. This blog post is a description of what I did to achieve my goal -- and the application I build it going to save me a lot of time in the future.

First, I've added to a data module (of a good old VCL application) the components needed to access quality portal and query for all of the open issues:

object QualityportalConnection: TFDConnection Params.Strings = ( 'URL=' 'ConnectionDef=QualityPortal' 'IncludeCustomFields=true') LoginPrompt = False end object QPIssuesTable: TFDQuery Connection = QualityportalConnection SQL.Strings = ( 'SELECT Key, StatusName, IssueTypeName, Summary, InternalID FROM ' + 'CData.JIRA.Issues where ProjectKey = '#39'RSP'#39' AND StatusName = '#39'Open'#39) end

The connection uses the IncludeCustomFields flag to retrieve extra custom fields of our JIRA installation, namely the cross reference from one JIRA system to the other, stored in the InternalID field -- and something a regular user without admin permissions should not be able to see. In fact, you need to provide your user name and password, the regular ones you use on the site.

For query I've picked the fields I'm interested in, to reduce network traffic (I'm reading a lot of data!) and filtered on RSP (Data Studio Project) and Open status. You can see the query running in FireDAC query editor below:

I also created static field objects for all fields in the query. For the internal JIRA analysis I've defined a query to retrieve information about an individual item, using a parametric query (like in SQL):

SELECT Key, StatusName, FixVersionsAggregate, StatusName, ResolutionName FROM CData.JIRA.Issues where Key = :key

With this query I'm retrieving the status, the type of resolution and the fix version. The basic approach of the application is to iterate all of the items open in the public system, fetch the internal status and check for inconsistencies. This is the basic loop:

QPIssuesTable.Open; // for each, check internal status QPIssuesTable.First; while not QPIssuesTable.EOF do begin JiraIssuesTable.Close; JiraIssuesTable.Params[0].AsString := QPIssuesTableInternalID.AsString; JiraIssuesTable.Open; // consider only issues closed internally if (JiraIssuesTableStatusName.AsString = 'Closed') then begin   ...     end;     QPIssuesTable.Next; end;

There is another part of the code I'm omitting to examine the fixVersion, which is a string with same complex JSON structure (an array of records). I need to extract the version number to see if the issue was closed in the past or it has just been closed for a not-yet-released version (in which case, it is fine). For all of the matches (issues closed in released versions) I add them to an FDMemTable created with appropriate fields and connected to a DBGrid:

      begin         FDMemTable1.Insert;         FDMemTable1QPKey.AsString := QPIssuesTableKey.AsString;         FDMemTable1JiraKey.AsString := JiraIssuesTableKey.AsString;         FDMemTable1QPStatus.AsString := QPIssuesTableStatusName.AsString;         FDMemTable1JIRAStatus.AsString := JiraIssuesTableStatusName.AsString;         FDMemTable1IssueType.AsString := QPIssuesTableIssueTypeName.AsString;         FDMemTable1Resolution.AsString := JiraIssuesTableResolutionName.AsString;         FDMemTable1Summary.AsString := QPIssuesTableSummary.AsString;         FDMemTable1FixVersions.AsString := fixJSONString;         FDMemTable1.Post;       end;

With this code, I obtain a grid with all items most likely out of synch, as displayed below, which lists the two IDs, the status on both systems, the internal resolution, and the version is was fixed:

The version number are internal ones, but I imagine you can guess which public version they match to. With the help of the data in this grid, I can go over the issues, open them in the internal system (if in doubt), and decide what to do. If I want to synchronize them, I need to add them to a list in the format expected by a JIRA script we use to force the synchronization. By double clicking on the grid, I execute the trivial code below that creates the comma separated list of keys I need:

procedure TForm14.DBGrid1DblClick(Sender: TObject); begin Edit1.Text := Edit1.Text + ', ' + DataModule15.FDMemTable1JiraKey.AsString; end;

So much less copy and paste! And now I can use the next couple of days to cleanup the Quality Portal system a bit...

Categories: News, Blogs, and Tips

New on Embarcadero Academy: CodeRage Replays and my New Course and Bundle

Mon, 11/20/2017 - 08:10

Embarcadero Academy is an independent online training site available at The site has an overall agreement with Embarcadero as a key destination for online training for the company development tools products.

The academy site co-hosted the CodeRage XII conference the other week and it is not offering the complete set of replays. All you need to do is create an account on the platform and sign up for the free CodeRage course at

On my part, I added a new course on Anonymous Methods and a course bundle on Modern Delphi Language including the courses on interfaces, generics, and anonymous methods. This bundle includes 6 hours of content. Also, all of the courses have a 20% special CodeRage discount until the end of November.

There are many other great classes on Delphi by Alister and non-Delphi classes as well. It is also now possible to take the Delphi certification exams on the academy site. There are other ideas floating around to improve the academy, like live online classes and subscriptions: more than willing to get your feedback (that I can share with the academy site team) or suggestions to me for other topics to cover in future additional courses.

Categories: News, Blogs, and Tips

Explaining Tasks in Delphi Parallel Library... by Creating too Many Tasks

Thu, 11/16/2017 - 09:19

Recently, I wrote some new demo for Delphi PPL (Parallel Programming Library), while doing some research for an online class -- which is available since last week on the Embarcadero Academy site ("Anonymous Methods in Delphi"), along with a new overall bundle of my classes ("Master Modern Delphi Language Techniques").

In the past I've used different ways to explain tasks and compare them to threads. Tasks are lightweight and managed more efficiently, than threads. The PPL creates a thread pool and assigns pending tasks (and their code) to a pool of threads that depends on your CPU cores and current workload. But these descriptions might still explain tasks and threads as fairly similar in scope. Now let's look at this source code snippet:

procedure TForm12.btn100sClick(Sender: TObject); var tasks: array of ITask; Value: Integer; I: Integer; begin SetLength(tasks, 100000); Value := 0; for I := Low (tasks) to High (tasks) do begin tasks[I] := TTask.Create (procedure () begin TInterlocked.Increment (Value); end); tasks[I].Start; end; TTask.WaitForAll (tasks); Memo1.Lines.Add(Value.ToString); end;

As you can see this event handler creates not hundred, but hundred thousand tasks. Each of them has an extremely simple operation to complete -- fairly nonsensical, I know. But you can create 100,000 tasks and they'll all done done in less than a second, on my computer. Consider creating 100,000 threads! that would create a significant extra overhead. By running this code, the tasks are assigned to a few threads in a pool, as you can see in the debugger:

Small demo and pretty much useless code, but I think it does a good job in highlighting the lightweight and flexible nature of nature of tasks, when compared to threads.

Categories: News, Blogs, and Tips

CodeRage XII Starts Today (With European Schedule)

Tue, 11/07/2017 - 02:34

The online CodeRage conference by Embarcadero starts today: Registration is still oepn at

With dozens of session based on central US time zones, it is easy to get confised. So I've amended the official calendar for those based in Europe (warning, in case of last minute schedule changes, I won't probably be able to udpate it). Here are thre three PDFs for the 3 days with UTC+1 or Central Europe Time zone times:

Tuesday Nov 7th

Wednesday Nov 8th

Thursday Nov. 9th

Remember you can sign-up and follow the event also on the Embarcadero Academy site at

I'll be "live tweeting" any even vaguely Delphi-related CodeRage information Follow the account if you don't do already!

Categories: News, Blogs, and Tips

CodeRage XII is Next Week

Fri, 11/03/2017 - 02:05

Next week, from Tuesday November 7th to Thursday November 9th will see the 12th edition of Embarcadero's yearly online conference, called "CodeRage" since the CodeGear days. This event goes beyond all other webinars and sessions, in scope, breadth and focus, and is really an online multi-day event. While most sessions will be available afterwards, I really recommend you to plan attending live and get involved into the Q&A and discussion and social media conversations around the conference. Reserve your time and don't be shy asking your boss some free time to attend the conference -- it will be so much cheaper than going to a real one!

You can see the temporary program at:

I won't comment on all of the sessions, but I'm going to mention a few highlight and list mine:

  • Two guess industry luminaries will be giving sessions, Robert Martin (aka Uncle Bob) is speaking on "The Clean Coder - An Introduction to Software Professionalism" and Steven McConnell (of "Code Complete" fame) is speaking on "Managing Technical Debt".
  • RAD Studio product address by the PM team (Sarina, David, and myself) in which we will provide hints (and screenshots) of new features to come in RAD Studio 10.2.2 -- Tuesday 9AM Central US Time or 4PM in Central Europe.
  • Many sessions by well-known Delphi gurus including Ray Konopka (he'll also provide some interesting previews), Cary Jensen, Brian Long, Bob Swart, Danny Wind, Olaf Monien.... and many many others
  • Sessions by most Embarcadero SC at all latitudes, covering many ways to use RAD Studio
  • Detailed covered of many third party tools (including FMX Linux, Arduino integration, reporting, DB tools, UI controls and libraries, code migration, and much much more)
  • Technical sessions by the PM team (David, Sarina, myself, and Sandeep for Sencha). Specifically, I'm giving a session titled "Introduction to Ext JS for Delphi Developers" in which I'll provide some initial information on Ext JS and the use of the Sencha Architect IDE for building the front end of a RAD Server web service -- Tuesday 11AM Central US Time or 6PM in Central Europe.

Finally notice that this year the online conference will be hosted both on GoToWebinar and on Embarcadero Academy at, where you can already sign up and see the detailed schedule.

Categories: News, Blogs, and Tips