Marco Cantu

Syndicate content
Techie Italian Blogging on Delphi and More
Updated: 28 weeks 5 days ago

[OffTopic] Oculus, Glass, and ViewMaster

Wed, 03/26/2014 - 21:52

I got these two posts in sequence in Twitter, and it is a coincidence as they came from two different sources. Too funny, so I had to share this.

Notice: the one BELOW is the first to read, as it is an inverted temporal sequence. And this is a real snapshop, I'm not making this up. Retweeted by completely different people at the same time. 

(PS. For those unaware, Facebook bought Oculus -- big virtual reality devices -- for a ton of money).




Categories: News, Blogs, and Tips

Delphi Blogs of the Week #9

Sun, 03/23/2014 - 04:21

I skipped last week (as there wasn't much content), while this was a week with quite some interesting material.

Embarcadero Press Coverage

R eviews of Appmethods (like this one on sdtimes, this one on thenextweb, and this one on pcworld

On CA-ERWin, and tworldcanada, among many others.

Delphi and Mobile

New Frech iOS app (for hiring Delphi developers!) discussed at

Music search (with a new REST service) by Sarina at

Delphi Online

New online community by Embarcadero, for now for Appmethod users, explained by David I: The community itself is at

Impressive collections of all videos of CodeRage conferences, webinars, online events, online training and other events all grouped at The page is called RAD Studio Webinar On-Demand Library and lists (directly and indirectly) hundreds of technical videos on Delphi and C++Builder. Kudos to the team for putting this together.


One truly technical blog post, mason asking for live leaks detection. Interesting idea. See

That's all for the week. During the next I'll be in the office, so likley little time for blogging.


Categories: News, Blogs, and Tips

Hotfix Coming for iOS 7.1 Simulator Problems with RAD Studio XE5

Tue, 03/18/2014 - 15:39

RAD Studio XE5 has problems running apps on the recently released iOS 7.1 simulator, while targeting an updated iOS 7.1 device seems to work fine (I haven't done it myself). The RAD Studio team had tested beta versions of 7.1 and everything was working smoothly, but in the final release of Xcode 5.1 Apple broke our integration, based on PAServer. A fix has been developed and is currently being tested internally.

We expect to make this fix available soon (meaning within a few days, likely next week), depending on the current testing. It will be a PAServer update, a hotfix freely available to XE5 Update 2 users.


Categories: News, Blogs, and Tips

Mobile Apps Update Rate

Sun, 03/16/2014 - 01:57

Compared to the slow uptake of desktop applications, mobile users update very fast, due to store management and notifications. This is what I noticed looking to the migration rate data of my mobile app. True, this is a single data point, and not a statistical analysis, but I'd expect this to be rather standard.

The graph below (for My Mini Figures Android app) shows the current users for each of the versions of the application. The green area is the update to the new release. As you can see, out of the almost 30,000 active users (users with the app installed) after a week of the release of an update, about 25,000 moved to the new version. That is an impressive rate to me, clearly showing how different this world is form the classic desktop one.


Categories: News, Blogs, and Tips

Migrate Legacy Windows XP Applications Now

Fri, 03/14/2014 - 09:52

One of the drivers of my webinar next week on "Modernize Your Windows Applications" is the end of support for Windows XP, now less than a month away. What is that, and how is it relevant to Delphi developers?

Windows XP End-Of-Support on April 8th

As you certainly know, there is less than a month of support for Windows XP. After that date, the company is not going to release any new fix, even in case of a critical bug malware could exploit. So keeping those Windows XP boxes running is far from ideal, particularly in a business environment. You can read more (from Microsoft) on A really nice resource is the dedicated site called Not sure you have to ask a web site which operating system you have, but that's another story. Nicely enough, if I go there, it tells me I'm not running XP. In fact, I'm running a Mac.

Delphi and C++Builder Offers Smooth Migration

Delphi and C++ Builder offer a very smooth migration off Windows XP. If you take an old application (like those written with a single digit versions like Delphi 6 or C++Builder 7), make sure strings management is Unicode complaint, double check your file system usage (so that the application is UAC compliant), you can recompile with a newer version of RAD Studio, like XE5. Truly, there might be third party components or some low-level code to deal with, but the migration is relatively smooth...and infinitive smoother than having to rewrite in a different programming language and with a different component library.

By rebuilding in newer versions of RAD Studio you gain themes support (and a more integrated UI), some system dialogs redirected to the latest version in Windows 7 or 8, migration to some newer APIs, and a large set of fixes and enhancements. And you can often rebuild your applications as native 64bit Windows applications.

The advantage of this move is also that it will let you leverage new features for your VCL applications (without having to migrate to FireMonkey, which is nice for multi-device but certainly not required for Windows). You can easily take advantage of VCL styles, adopt the Modern UI (Windows 8) look and feel, gain full Unicode support, embrace new database access and web service access libraries.

Speaking of data access libraries, if you have existing old applications written in Delphi or C++Builder it is likely they'd be build using the BDE. Now if that engine is still technically in the product (but not for long) we fully recommend migrating away from the BDE to FireDAC as a very significant part of your migration effort.

A Great Opportunity for Developers

Now how is this different from migrating from Windows XP and to newer versions of RAD Studio 6 months ago or a year ago? The difference is that today if your users are running on XP they will be pushed to migrate, and might be more open to invest a little extra money to clean up and move to Windows 8 some of those old legacy business applications they have. In other words, Windows XP migration might become a very good excuse for you as a developer to sell the full migration and modernization story, and be able to sell this work to your customers (rather than having to do it as part of normal support work).

Like the mythical millennium bug, or the Euro switch (for us in Europe), the XP end-of-life is getting a lot of media attention, with the extra push (this time) of a large Microsoft advertising campaign. This gives the opportunity to all Windows developers to get back to their customers and offer them something new. Which is what we are also doing with those Delphi and C++Builder developers still stuck on older versions.

Webinar Next Week, Amnesty Offer This Month

Not only we are doing this effort in terms of marketing and with next week webinar (sign up on ), but we are also offering an upgrade amnesty offering all RAD Studio old timers a great chance to upgrade to XE5: . Don't miss the opportunity: attend the webinar and buy XE5 before the offer expires at the end of March.


Categories: News, Blogs, and Tips

Delphi Blogs of the (Last) Week #8

Mon, 03/10/2014 - 08:43

Another week gone by, and what a week of Delphi and Embarcadero announcements, beside blogs.

Announcements: Roadmap, Recharge, Appmethod

Let me start with the announcements:

And Blogs as Usual

Here is a round of notable blog posts:

Also, CodeRage 8 C++ sessions are now available, as explained by Tim at That's all for the (past) week. 

Categories: News, Blogs, and Tips

My Webinar about Modernizing Windows Applications (or Move Away from Windows XP)

Thu, 03/06/2014 - 04:07

In two weeks I'll host an online webinar about modernizing Windows applications written with the VCL. Live events on a similar topic are ongoing in Europe, and I'm presenting one in Milan next week.

The Online Webinar, March 19

The webinar is on Wednesday March 19th (the first day of spring), repeated 3 times during the day. You can sign up at . Topics include:

  • Pure migration form XP and from old versions of Delphi (moving to Unicode, User Account Control, recompiling old Delphi applications)
  • Modernizing applications with new styles, graphic support, following Windows 8 Modern UI, using new dialogs, and so on
  • Upgrading data access to today's world, moving away from the BDE, using FireDAC, using cloud and REST servers, looking into Live Bindings
  • Peering into what's new in the language
  • Mentioning why, how, and when move to FMX.
The Webinar Focus: VCL and XP Migration

As you can see from the list above, the webinar should take about 100 hours, but due to time constrains we will ZIP it into a single hour. Needless to say, it will be more of an overview, but with enough technical information to get you started. The goal is primarily developers who are still targeting Windows XP with old versions of Delphi, but the content is rich and wide enough that most Delphi developers will have a change to learn some new tricks.

If you know other Delphi developers stuck in the past, let them know about this webinar, as this is a way for them to understand how the product is evolving. And if you know developers still focused on Windows XP as a target platform, notice they have a month left to migrate their applications according to Microsoft.

Seriously, moving away from Windows XP is a very significant business requirement these days, worth your effort and worth your customers attention. But given this is a significant topic, I'll blog about it separately.

Live Event in Milan Next Week

Finally, let me point out to an Italian event with a similar focus, a Delphi Live meeting in Milan, next Tuesday (March 11th), in the morning. Sign up at  (I'll be giving the session in Milan, but not the one in Rome, where Daniele Teti will be speaking). There are other similar sessions happening around Europe, like in Germany and Russia.


Categories: News, Blogs, and Tips

Delphi and C++Builder Roadmap

Wed, 03/05/2014 - 03:39

A RAD Studio roadmap for 2014 and beyond is available on the Embarcadero web site, in case you missed the announcement. Not that I want to add much, if not that we expect updating it more frequently and that not everything is set in stone. Also, the roadmap highlights the key features: There is much more we are working on right now that is not listed.

The official document is at

 There are already discussions in the forum, on Google+, and elsewhere.

Categories: News, Blogs, and Tips

RAD Studio Recharge Program

Tue, 03/04/2014 - 04:45

Last week, Embarcadero has announced a new plan for selling updates of Delphi and C++Builder. The idea is to make it easier (and cheaper) for early adopters and loyal users. In summary, the idea is that the new RAD License Recharge Plan allows you to continuall y recharge your RAD Studio, Delphi or C++Builder license with every major release at an affordable License Recharge fee for each release. 

The plan is called "Recharge Plan" and the concept is quite simple. Given we are currently working on a schedule of 2 releases a year for RAD Studio, we are going to start offering a special update price only from the previous version of the same product. This will cost half of the regular update price. Actually, it will be just a little less than half of the regular update price, as we want this to be the less expensive upgrade model.

You can read the details and a FAQ at .

These are some scenarios:

  • If Delphi XE5 (Professional with or without the various packs, Enterprise, or above), when we will release XE6, you'll be able to upgrade your license to XE6 at a special price (less than half of the regular update price from, say, XE4). Later, as we release another version, you'll be able to keep upgrading at a similar low price.
  • By upgrading twice in a year, you'll pay less than if you skip a version and buy a regular update. And you'll benefit form having always the latest release available. In other words, early adopters and loyal users now have a good deal.
  • If you are still not on XE5, you can go ahead and buy it now. When the next version comes out, you'll be able to recharge your license. If you stay on an older version, you'll have to pay for a full upgrade.

One important element is this is not just a one time offer, but a long term plan for the future, that will depend on the number of releases of RAD Studio in a single year. With a more predictable plan, you'll be able better plan your investments, even without moving to the pre-paid maintenance program (which remains available, if you prefer that model).

With the fast moving landscape in mobile platforms, we need to keep release cycles shorter, and we are trying to adapt the sales model to better serve this new approach. Hope you like the idea and get ready to recharge your licenses.


Categories: News, Blogs, and Tips

Delphi Blogs of the (Last) Week #7

Mon, 03/03/2014 - 07:58

While I was looking to the mobile world, Delphi and C++Builder events kept happening and blog posts kept flowing:

Not as rich as other weeks, but I was very distracted (while traveling around Spain) and have likely missed a few.


Categories: News, Blogs, and Tips

My Views on Mobile World Congress 2014 (or Nokia is doing Android)

Thu, 02/27/2014 - 05:42

I've spent the last few days in Barcelona for the Mobile World Congress, the world largest gathering of vendors mobile devices and services. My focus, of course, is that of a development tool product manager... so don't expect a review of the devices announced.

A Huge Conference

The conference is huge. Number of attendees is really impressive. Some large companies had booths of hundred of square meters. Traffic and taxi lines where out of control. And, quite surprisingly, Internet connectivity was extremely poor... but, again these are not my main points. Event venue pictures are below.

Devices, Devices, Devices

Although my focus was not really on devices, I have to say I was impressed by a few:

  • The coming Samsung 12" tablet has a great screen, quad-core CPU, and can have up to 4 apps on screen at the same time, each the size of a large phone app. I was really impressed by this, more than the new Galaxy phone (which seems nice but more expected).
  • Samsung had also the new Gear watch (not not on display), with a twin light version for outdoor activity which looks interesting. Lots of "wearables", but most of them ugly, with limited battery, odd form factors. I guess only a few will survive.
  • The Nokia X new phone to me is the best low-cost Android phone out there. It is so much better in terms of quality, speed, screen than Samsung and other vendors low-cost phones. Nokia knows how to build a phone, for sure. But given the importance of this phone, more about it later.
  • HP is full speed into medium to high range phones and phablets. Don't ask them about Windows... they really want to differentiate themselves from being a "Microsoft hardware vendor"
  • Intel primary focus seemed pushing the full Windows 8 (not RT) platform, showcasing many interesting and high quality tablets, with some very creative ways to fold the keyboard. Light enough, but extremely powerful compared to a regular tablet.
  • Pens are back, aside using fingers. The fact you have more control on the actual position you click is a key reason. Not sure, though.

Here is an image and the specs of the new large screen Samsung device.

Talking Platforms

Which platforms are up and which are down? With Apple and iOS not at the center of the stage, it was Android all over, of course. And Android with ARM CPUs to a very large extent. The new Samsung 12" tablet is ARM only (unlike their current 10" device, which in some cases has an Intel CPU). Asus has an Intel tablet, that ships with an ARM emulator.

What about Windows phone? While it is true a few new vendors announced support for it (but we'll have to see if this turns into actual sales) the big news was about Nokia (soon-to-be-acquired by Microsoft) releasing 3 Android phones and announcing 2 more in the pipeline. As I mentioned above, for their price these seem to be the best Android phones out there. Nokia is not using Google Android, but its own customized versions, more or less like Amazon did with its Kindle Fire. So there will be a Nokia App Store for Android, it own maps, its own advertising and in-app payment and some more. On those phones there is no Google Play, and the search engine (not surprisingly) in Bing. Now the number of applications that can run on those phones is large... basically almost all Android apps that don't make use of Google Services.

This is the file system of the Nokia X phone:

Nokia, Android, and Microsoft

Officially, Nokia move has been "downplayed" as for emerging markets, only low cost devices, and so on. To me these are just excuses. A 5" device? The best value on the low-cost Android market can make wonders also in the first world. Which is were Samsung is selling in large volumes also those entry devices. Also, out of the Windows phones Nokia is selling mostly at the low end of the spectrum, so this is exactly a replacement offer. My personal idea is a top level Nokia Android phone with a great Nokia camera could have a huge impact.

It you don't trust my words read this piece on ZD Net, which I mostly agree with:

And if you think, this is just Nokia, nothing to do with Microsoft thing twice. Could have Nokia done this without Microsoft approval? How comes Skype (also owned by Microsoft) is pre-installed on the phone? How comes most of the services (search, remote storage) are from Microsoft, if the company things this project is a mistake? To me, if Microosft wants to have a foot in the devices and services world, they cannot to it form the "our operating system only) perspective. Not in todays, world.

At the development side, Nokia had a full day event to convince Android developers to support their app store, to the point they were giving out free phones in exchange for porting one single application. They claim Android developers will have a many new users for their apps, users previously confined on Windows. So this is how the Nokia Android (above) and Nokia Windows (below) developers areas looked like, in terms of interest:

I know, this is mainly an Android event --- but it is only because Android is so ubiquitous. Nokia also had a large green bus (Android green) focused on developers:

And, Finally, Embarcadero

So what does this mean for us at Embarcadero, and the developers who use our product. You can join the "same code base, new user base" slogan, given the majority of Delphi Android applications will run on the Nokia X phones. This is the 5 minutes experiments I did at the show, plan doing some more testing in the coming days. This is my (son) Google Play Minifigures app on a Nokia phone:

This is certainly great news. While we will see the implications for Windows Phone platform, to me if this was a small one, it looks like it will have an even more difficult times ahead. By the way, we had our own booth (for the first time), made some great contacts, and introduced RAD Studio to app developers who had never seen it, receiving a lot of positive feedback.

That's all form Barcelona. I'm still in Spain, but currently in Alicante.


Categories: News, Blogs, and Tips

Delphi Blogs of the Week #6

Sun, 02/23/2014 - 15:29

An other weeks of blogs about Delphi and RAD Studio, while I'm in Barcelona (Spain) for the Mobile World Congress that kicks off tomorrow, and were Embarcadero has a booth to showcase its mobile development solution.

Some blogs posts during the past week:

There has been a lot of discussion around Delphi content that was pulled off stackoverflow, including some on the Delphi IDE and language. Jim saved some at Some of these are indeed interesting... I guess I'll have to double check all of them for the book I'm writing. (Oh, did I just mention I'm writing a book? Yes, I did.)

The last link I wanted to refer you to is the "Delphi Migration Center" collection os resources at If you have old Delphi code you plan moving to newer versions (and there are many reasons to do so, including moving off Windows XP before April) that is a good collection. In any case, I'm going to cover some of this in a March webinar. Stay tuned.

PS. Next week I'm in Barcelona, and later Alicante. If you do any C++ remember checking the C++ edition of CodeRage 8, starting Wednesday. And if you have friends who are C++ programmers, invite them to the free online conference. More C++Builder for iOS and all other platforms (beside Android, which is coming soon). The link is I have a session on DataSnap, similar to th one I did the for Delphi side of the event.



Categories: News, Blogs, and Tips

Webinar on Developing for iOS in C++ (with JT)

Tue, 02/18/2014 - 10:59

Tomorrow (Wednesday, 19 February 2014) Embarcadero is hosting an online webinar on the use of C++ (rather than the classic ObjectiveC) for iOS development. The webinar will be given by JT (Development Tools Product Manager at Embarcadero) at three different times during the day (for the different time zones around the world, 3pm Europe, 11am Pacific, 10 am Tokio next day). The title is:"iOS Application Development with C++Builder XE5".

You can register (for free) at If you are a Delphi developer, but have friends who prefer C++, forward them this invite!

The main focus, as the title implies, is th new C++Builder for iOS, with ARC for C++ and other special features... but mostly now the primary iOS development tool based on the C++ language!

As an aside, I was reading this blog post recently, Replacing ObjectiveC, and I guess we really need to dispel this myth that the only modern alternative to Object C for native iOS development (that is, non JavaScript) is C#. Well, given the blog post was written by a Xamarin user, no surprise this is his conclusion. However, given C# language implementations seem to change a bit depending on the target platform, and there is little common libraries, why not use either C++ (in C++Builder) or Object Pascal (in Delphi) for your iOS development? You gain also the big advantage of being able to recompile your code for Android and for desktop platforms as well!

See you online tomorrow...

Categories: News, Blogs, and Tips

Delphi (and C++) Blogs of the Week #5

Mon, 02/17/2014 - 01:21

Another late post, summarizing last week blogs, given I was flying back home from California over the week end.

Mobile Development General Delphi and C++ General Programming

That's all for this week.



Categories: News, Blogs, and Tips

It's Delphi Birthday

Fri, 02/14/2014 - 09:27

It's Delphi Birthday today, given it was introduced on February 14th 1995. See some pictures from that day on

The Invite to The Launch

Back to the Future

And the product is alive and kicking. Since the last birthday, Delphi was made available for two growing platforms, iOS and Android, so you can now write Delphi applications for well over 95% of the computers and mobile devices out there. 

Not only Delphi now supports new platforms, but the Object Pascal language has tremendous features added over the recent years that you are badly missing if it you are still developing with an old version of the product. Now is a great time to migrate your VCL applications, taking advantage of all the new features, and bring your expertise to the mobile world with our single source, multi-device solution leveraging native compilers for all of the platforms we support, including the mobile ones.

As Delphi was a unique product when it was launched, it is a unique product today in the multi-device world we live in. For more information, jump to

How the World Looked Back Then

How the Delphi World Looks Today


Categories: News, Blogs, and Tips

Delphi (and C++) Blogs of the Week #4

Fri, 02/07/2014 - 10:44

Another round, this time before the end of the week. Given I'm including also C++ content, it might make sense to change the title of the series to "RAD Studio". I'll figure out.

Blog Posts Mobile Apps

And, finally, a case study on Digifront solution at


Categories: News, Blogs, and Tips

Nick Hodges Webinar on Unit Testing and a C++ CodeRage

Thu, 02/06/2014 - 08:11

Two online events coming from Embarcadero.

1. RAD in Action: Unit Testing in Delphi, by Nick Hodges

Next week Nick will host a webinar on unit testing in Delphi, covering also some advanced languages features and many related topics. Make sure you don't miss it. 

It is on February 12, next Wednesday, on the 3 usual times of the day for different time zones. Signup (if you still haven't done so) at Seems we'll have a packed virtual room!

2. CodeRage 8 for C++

The second event will be at the end of the month, and it is a 2 days online conference focused on C++, and in particular the new C++ iOS support offered in RAD Studio since Update 2 of XE5. If you have used C++Builder in the past, this is the event for you. If you are a C++ developer, looking for a mobile solution, this is also an event for you. For information refer to . The event is on Feb 25th and 26th. I should be giving a DataSnap session. 



Categories: News, Blogs, and Tips

Giving Data a Good Spin (Android, Windows, Azure)

Wed, 02/05/2014 - 11:09

Over the last week I bumped into data that was presented with a real twist. And more than once. Hence this rather unusual blog post for my blog.

Mobile Phones: Android Wins, but Windows Grows Faster

I guess you've seen similar headlines, one of them is in this press release from Canalys, Look at this numbers of phones sold in the year

  • Android: added 350 Millions, reaching almost 800 Million (and growing to 79%)
  • iOS: added a few more millions, reaching 150 Millions phones sold (but decreasing percentage wise)
  • Windows phones: added a few more millions, and sold 32 Millions phones

And (at least to some commenter) the winner is Microsoft for increasing their number of over 60% compared to the last year. But Android, that was already the best selling platform, increased its sales by 20 times more than Windows did, if you consider the number of devices. And in a note you read the Microsoft phones sales actually dropped in Q4.

Microsoft Numbers

Microsoft recent financial number were discussed by the press world wide with a similar spin that is hard to believe. You probably read it. It is the online services like Azure and Office 365 that saved the quarter and are making big inroads. They are growing more than any other division. Yes, growing more, but only in percentage... in absolute value they are a fraction. Look at these numbers (taken from a rare balanced article,

  • Revenues for commercial licensing (like Windows and Office for companies): almost 11 billions, earnings 10 billions (gained 751 millions)
  • Revenues for the enterprise services 1.7 billions, earnings half a billion (gained 199 millions)

Not only Windows and Office traditional licensing is a huge business, but it is growing more in value than the online services are.

First Conclusion

Trends and percentages matter, but in some cases the raw numbers are relevant. If I create my own device and next year sell 10 phones, out of 1 this year, I made a 1000% increase, but no one will care. Unless my marketing machine can put a good spin on it, of course.

Second Conclusion

Android is growing in a crazy way, great we have a Delphi product for it. Windows phone is doing OK, but it is still very very small.

The Windows Enterprise business shows no slow down. Windows remains the main business platform, and we have a Delphi product for it. But all versions of Delphi also talk with Azure, just in case.

Categories: News, Blogs, and Tips

Delphi Blogs of the (Last) Week #3

Mon, 02/03/2014 - 08:05

Got a little late this week with my weekly blog post summarizing blogs and news in the Delphi community (and given it is not great to blog on weekends... I'm here on Monday). Here it goes. And there is quite a lot.

Delphi Mobile and FireMonkey

FM and VCL Styles and More

I actually do have a few more posts noted, but they are worth some more room, so I'll blog about them separately.


Categories: News, Blogs, and Tips

Delphi XE5 Update 2 has FireDACJSONReflect for DataSnap

Wed, 01/29/2014 - 09:21

Only few developers know that there was another hidden gem in the Update 2 of Delphi XE5 (and RAD Studio and C++Builder), namely a new unit to help you working with DataSnap REST servers and FireDAC datasets, both on the client and on the server side. This is a short description of the key elements of this feature (which is rather complex, so I won't be able to cover it in full). Let me start by explaining the issue.

Suppose you want to create a DataSnap server in Delphi, exposing database tables. You basically have two approaches. The first is to rely on the good old IAppServer interface, exposing datasets using provider components and using ClientDataSet components on the client side. That's easy and powerful, but it cannot be used by REST servers, simply because it is a statefull interface (with calls like "give me the next data packet") and required a "heavy" session on the server for each connected user. Also, this is not FDMemTable friendly.

The second approach is to use a RESTfull approach, exposing datasets in your methods. Too bad this is not very efficient and offers no easy way to use an FDMemTable rather than a ClientDataSet on the client side. Plus all updates management has to be done by the developer. So what happens is that we are pushing customers towards two core technologies like DataSnap and FireDAC and we want to make it easier to use them together.

That's why in the Update 2 of XE5 we introduced a new unit, called Data.FireDACJSONReflect . This unit has many capabilities for:

  • Returning one of more datasets in a single call, using an efficient format; multiple datasets in a single call are supported as this is more transactions friendly than doing multiple calls (particularly with databases with a strong implementation of read transactions, like InterBase)
  • Easily caching those datasets in an FDMemTable object on the client, either creating a new structure or adding the result of multiple calls to the same in-memory table
  • Sending back the cached updates (or deltas) for a memory dataset... or more than one in the same call, again for transaction support
  • Easily resolving the update requests on the server
  • Reading and writing data from the datasets and the deltas into custom formats

In this first, simple demo I'm going to show you the code required to send the data from the server to the client and read it on the client. In a future post I'll show an example of the updates management. On the server, rather than returning a TDataSet from a REST function, you have to return a new data type, TFDJSONDataSets. Here is the full code of such a function (using a local temporary table as database, to simplify the demo):

function TServerMethods1.GetJSONData: TFDJSONDataSets; begin Result := TFDJSONDataSets.Create; if not FDMemTable1.Active then FDMemTable1.LoadFromFile('../../customer.fds') else FDMemTable1.Active := False; TFDJSONDataSetsWriter.ListAdd(Result, FDMemTable1); end;

As you the see the code creates an instance of the dataset list class, and adds a table to the list using a custom writer. In the same call, you can also give the dataset a name, to make it easier to refer to it in the client code (where you can access the list elements by position of by name).

The client code has the opposite appraoch, using a reader to populate back a memory table:

var DSList: TFDJSONDataSets; begin FDMemTable1.Close; DSList := ClientModule1.ServerMethods1Client.GetJSONData; FDMemTable1.AppendData( TFDJSONDataSetsReader.GetListValue(DSList, 0)); FDMemTable1.Open; end;

In this case the code empties the memory table of any existing data before adding the new content (calling Close) and uses the first and only dataset, number 0. That's all it takes to transfer any FireDAC dataset on the server side to a FDMemTable on the client side (either desktop or mobile).

I hope this blog post serves as a starting point for your personal exploration if this new and rich unit. The only think I want to underline is that unlike when you return a plain dataset, the REST server return JSON data with mime encoded binary content, so this technique is meaningful only if RAD Studio is used on both ends. For any other client, just use the plain TDataSet JSON mapping. 

Categories: News, Blogs, and Tips