All posts by Stephen Ball

Stephen is a Charted IT Professional and the Associate Product Manager for InterBase at Embarcadero. He is also a Product Evangelist for RAD Studio, regularly speaking across EMEA. @DelphiABall

How to use Azure Cloud Cognitive Services?

What is Azure Cognitive Services?

According to Microsoft, the Cognitive Services in the Microsoft Azure Cloud bring AI within reach of every developer, without requiring machine learning expertise.

Using the Azure Cognitive Services API you can use API’s to embed the ability to hear, speak, translate and understand directly into your applications.

How are Azure Services configured?

Inside the Azure Cloud Services, different functionality is grouped together and made available to developers as online “Resources” that link to a subscription. Cognitive Services is a grouping of a number of AI-based services, with each service offered as a Resource (that you create to make active against your subscription).

The Azure Resource and Subscription model allow each resource to be billed individually and provided from any one of the specific data centers around the world. This makes it possible to develop functionality that fulfills local legal restrictions around the movement of data. It also makes it possible to provide customer-specific configurations when deploying inside an app.

For many of the Azure services, a free tier is available which is ideal for small deployments and testing.

Code Example for using Azure Cognitive Services

I originally looked at Using Azure Translator Services with Delphi in 2015. Since then, the original XML-based API has been deprecated in favour of a JSON-centric API, as part of the re-branding and re-organisation of the Azure cloud with the launch of Cognitive Services. The following code has been re-built from the ground up to take advantage of the latest language features in Delphi.

UPDATED CODE: Download from Github https://github.com/DelphiABall/Azure-Cognitive-Services

The classes in the GitHub repo make it simple to use the following Microsoft Azure Cloud services:

Authentication

Each service uses the same authentication class (TAzureToken) to convert the access key for the resource into a session token. Note: Translator and Speech Services are different resources and as such use different instances of the authentication class.

unit Azure.API3.Constants provide a list of Regions based on the current Azure Regions, however, if these change, each class has overridden constructors that allow you to pass in the region as a string.

When you create a TAzureToken, use the constructor with the region for the resource, and then set the SubscriptionKey. This will automatically set the correct endpoints for the security to work. At the point the token is requested from the object, the API will be called, and the result cached. When the token times out, a new token will automatically be collected for you.

The following service and features are available to use: Each feature is in the corresponding unit following the naming conversion of Azure.API3.<Service>.<Feature>

Translator

  • Text Translation (converting text from one to multiple languages)
  • Dictionary Look up (looking up a words between languages and reporting on its usage)

Speech

  • Text To Speech (converting text using one, or multiple voices into audio file)
  • Speech to Text (converting .wav or .ogg files to text)

To see how to use these services, watch the videos below.

Azure Cloud – Translator Services

Azure Cloud – Text to Speech

Azure Cloud – Speech to Text

Getting Started with Delphi

The code sample is written to work in Delphi 10.4 and above. This provides the advantage of being able to work on Windows, macOS, iOS, Android and Linux.

You can download the latest Trial of Delphi from Embarcadero www.embarcadero.com/products/delphi/start-for-free.

For students or open-source projects, check out the latest Delphi community edition

How to migrate from old versions of InterBase?

I got a question this week about how to migrate from an old version of InterBase to the latest version, so I thought I would share a few tips and hints on how to move data forward from old versions.

InterBase On Disk Structure

Before we start, it is important to know that each major release of InterBase has an associated On-Disk Structure (ODS).

When database files are restored on created with the latest ODS it enables InterBase to make features available for use with that database file. If you don’t use the latest ODS format, then features in the InterBase engine may not be available to that database file.

InterBase versionPrimary ODS version
202018
201717
XE716
XE315
XE15
200913
200712
7.011
6.010
5.5/5.69.1
5.0/5.19

One benefit of InterBase today is that the ODS is cross-platform, meaning the same database file can be moved between Windows, macOS, iOS, Android, and Linux without modification, drastically simplifying the development and maintenance of data in cross-platform/multi-platform applications.

What is the InterBase migration process?

For most cases, the InterBase migration progress follows 4 simple steps:

  1. Backup all the databases to be migrated.
  2. Install the latest InterBase server.
  3. Restore the databases being migrated on the most recent version
  4. Validate migrated databases.

When migrating from a version using ODS 13 or newer, this should be enough to get updated. If you are using an older ODS, then there are a couple of more steps to get updated.

The only other checks to make when updating are for are new keywords in InterBase. These are occasionally added to support new features, such as table truncation, or ChangeViews. A full list of keywords is available on docwiki

How to migrate from very old versions of InterBase?

If you are using a version prior to InterBase 2009, then there are two options available to you.

  1. Migrate to an intermediary version first (that supports ODS 13 or above)
  2. Move the data to a new database created in the latest version.

Migrating to an intermediary version

As an example, a backed-up version of an InterBase 5 database could be restored using InterBase 2007 (to create an InterBase database file that uses ODS 12). The new database file can then be backed up in InterBase 2007 to a backup that supports ODS 12. InterBase 2020 can actually read ODS 11 and 12 for backup purposes only, so from here you can restore to the latest version.

Prior to the release of InterBase 2007, a number of new keywords were added to InterBase. By targeting InterBase 2007 first, you can also locate any issues around keywords prior to the bigger jump to ODS 18 (InterBase 2020)

Moving data from an old to a new database

The other option is to use a data pump tool to move the database from an old database to a newer version. This can be more complicated due to foreign key constraints, however, there are specialist tools such as InterBase DataPump that can be used for this process.

https://clevercomponents.com/products/datapump/index.asp

If you choose to go this path, then the basic steps are to

  1. Create a blank new database in the latest version
  2. Save the metadata from the existing database, and use it as a script to add the structure to the new database file
  3. Pump in the data: Making allowance for
    • the order data is moved based on Foreign key constraints
    • table triggers (best to disable these first)
  4. Reset database generators to the required value

External Dependencies

Another things to check when migrating to newer InterBase versions are any external dependancies. (e.g. User Defined Libraries (UDF) that you use). Older versions of InterBase could have been 32bit only.

As 32bit and 64bit libraries are incompatible with each other, an initial upgrade route would be to get to the latest version of InterBase on 32bit, and then look to get a 64bit version of the UDFs for use with a 64bit version of InterBase. As the ODS is the same for all InterBase platforms, this is then a seamless migration.

Where to download the latest InterBase version?

The Latest version of InterBase is available from Embarcadero.com with a Developer Edition (which offers light database encryption only) or Trial Edition (includes strong encryption at rest on disk). For older editions of InterBase to help with migration, please contact Embarcadero sales

Native v Hybrid v WebApp

I recently posted on my Embarcadero Blog about the 3 main types of mobile applications that developers write. Native apps, web-based mobile apps, and hybrid apps, and highlighted that you can achieve the benefits of both Hybrid development with a single code base to manage, test, and develop, with the SPEED AND SECURITY of TRUE native compilation. (Note, Not all development toolchains that claim to be native, compile everything!- Delphi does!)

Definitely worth sharing with those you know looking to choose which platform they want for their next development project.

Each approach has its Pro’s and Con’s, and with a view of how operating systems have developed over time, its easy to see how web-based technologies (web-native, and hybrid) have had a positive role to play in the adoption of multiple platforms by targeting the one thing each platform provides, a browser-based on HTML and open standard.

With OS vendors only interested in offering the best speed, performance, and usability via their own tools to aid adoption, and as OS’s evolve in different ways, (especially early in their development cycle) is understandable that choosing web can seem a good option to gain market entry with a broad access.

That said, we are now at a point where the market has matured. We have Apple and Google as the two key players covering over 99% of the market, pushing developers towards needing to maintain two codebases for the best user experience on mobile. On the other side, a number of web-based frameworks offering semi-native apps with a single code base.

What I love about Delphi, is that there is a unique offering enabling developers to benefit from a single code base that address both mobile platforms, with the speed, security and usability of Vender tools, PLUS the lower development cost, and low code options promoted by web/scripted frameworks.

FireMonkey is now 9 years old, and benefits from the best available compilers on the market, targeting the latest technologies (like Metal on iOS for blazing-fast rendering) and offers a choice of true native controls or platform styles controls at runtime.

Read more on my Embarcadero blog – What are the best options for mobile app development?

How ISV’s Drive Innovation with InterBase

I recently ran a webinar, alongside Mary Kelly, discussing how InterBase ISV’s are innovating faster while improving profitability and return on investment through using InterBase. Following up on that webinar, I wanted to summarise some of the points discussed.

Why ISV’s Choose InterBase?

To put it simply – Trust – ISV’s trust InterBase to lower their business risks, and cut out large costs that exist around data management and support, while kick starting their development with a stack of required core capabilities around data storage, data protection and user security.

Real Value of Ownership

Let me share what I mean with a quick story from my own first-hand experience. A number of years ago, I worked as a Director for an ISV when it purchased a .NET software house. The .NET product used MSSQL as the backend and supported a quarter of the businesses that the existing supported Delphi & InterBase application did. Even though it was hosted, the .NET product support overhead was over 5x the cost to run compared to InterBase after purchase, year on year.

The largest part of the cost came from having 2 full-time DBA’s, compared to minimal training that was required for those supporting InterBase. Additionally, InterBase was suitable for remote deployment and support on whatever type of computer the customer had. This helped improve the value proposition to the customer and lower the risks to landing business.

InterBase features and benefits that bring business value

A full list of the top reasons ISV’s / OEM partners choose InterBase discussed in the webinar include

  • Highly Scalable
    • From one machine to 100’s of connections on a dedicated server, it grows with you easily!
  • Small memory & on-disk footprint
    • Regardless of the device InterBase just runs! – from a mobile to a laptop to a top-end Server, InterBase is lean!
  • Affordable
    • OEM / VAR program offers great options for ISV’s with bespoke pricing based on your usage.
  • Simple Deployment
    • Next > Next > Finished! You don’t need a training course to get InterBase server running, making it ideal for remote, low-cost deployment
  • Fast & Simple
    • Out the box, InterBase has an element of self-tuning included. But is also highly configurable.
  • Reliable
    • Near zero admin and automatic crash recovery make it ideal for embedding into remote deployments. Even if the plug gets pulled out the server, InterBase pops back up and goes!
  • Embedded User Security
    • It’s easy to overlook the value you get (especially when combined with Encryption) to control access around the database. The full roll based user security makes it simple to implement.
  • Change Views
    • Data change tracking with the IoT Award-winning database.
    • The patented change tracking method is designed to enable 1000’s of connected devices to track changes, even when disconnected without any overhead on the central database! – No change-logs, table triggers or anything else that bloat the database and become hard to manage over time!
  • Rich Disaster Recovery
    • A great mix of database features for backup, restore, dumping etc, and enhanced even further with a unique use of Table Spaces.
  • Cross Platform Support
    • Server, Desktop AND mobile spanning Windows, Linux, macOS, iOS, and Android.
  • Strong “Enterprise Grade” Encryption
    • 256bit AES strength on-disk encryption at rest that is transparent to the client, with column level encryption options with multiple encryption keys – InterBase is used by everything from Financial and POS systems to Medical software globally to deal with financial, personal, and medical data, enabling customers to reach a wide range of industry data management and security standards.
  • Tight RAD Integration
    • It’s easy to develop with InterBase, with it used widely by RAD Studio customers,
    • Its open API also supports direct backup from software, making regular admin tasks very simple.
    • It’s also widely used by considerable .Net applications and offers .Net, ODBC, and JDBC drivers.

The ISV Business Model

Further to the above, the webinar also spends time looking into the key business of a typical ISV, and the other value InterBase makes possible for them.

InterBase ISV Business Model Canvas

A big part of the InterBase customer stories shared on the Embarcadero website, include time and again, customers talking about the evolution of InterBase, and even when they have been slower to upgrade their development environment, how InterBase has enabled them to release new features. This open innovation approach enables ISV’s to gain a real innovation boost to their product with major releases of InterBase, complementing their own R&D.

A good example of this was the addition of transparent on-disk encryption a number of years ago. This server-side feature, enabled with a simple parameter update in the client-side, provided rich functionality and data storage compliance with nearly zero R&D spend! More recently, Table Spaces has enabled customers to speed up their server for larger deployments by targeting which part of the database goes on which drive.

Anyway, I hope you find the webinar an interesting watch, and it would be great to hear about your InterBase stories!

If you are interested in becoming an InterBase ISV. Then please contact the Embarcadero sales team, or me directly.

Migration Links from DelphiCon 2020

Firstly, thank you to the hundreds of you who joined us for the panel discussion at DelphiCon2020. As promised during that session, here is a summary of the links we shared during the panel discussion..

Migration and Upgrade Center

A lot of useful content and papers are on the Migration and Upgrade Center on the Embarcadero website http://embt.co/MigrationCenter

This includes

  1. Unicode
  2. 64bit Migration
  3. Database and Middleware
  4. 3rd Party Components
  5. Monetization 

Tip & Tricks, White Papers, Videos, Articles

YouTube

There are so many useful channels. But the official one for Embarcadero, including links to language specific content is https://www.youtube.com/c/EmbarcaderoTechnologies

A special call out t o the Modernizing Your Apps (Upgrade and Migrate) section that has 15+ helpful videos, including the move to Windows 10

Migration Automation links

reFind – The_Search_and_Replace_Utility_Using_Perl_RegEx_Expressions.
http://docwiki.embarcadero.com/RADStudio/Sydney/en/ReFind.exe

Delphi Parser – Great 3rd party tool for helping migrate Delphi and C++ code.
https://delphiparser.com/

Unicode Analysis Tool – Great for working out the scope of what you need to do.
https://cc.embarcadero.com/item/27398

String to AnsiString Convertor tool (Falling back to AnsiString) – If you don’t need Unicode, this might be the way to go.
http://www.innovasolutions.com.au/delphistuf/ADUGStringToAnsiStringConv.htm

InterBase DataPump – Great for migrating from BDE to InterBase
https://clevercomponents.com/products/datapump/index.asp

Mida – VCL to FireMonkey Converter Toolhttp://www.midaconverter.com/

Other Links

Migrating Midas to DataSnap (Middle-Tier migration)https://blogs.embarcadero.com/migrating-legacy-dcom-based-datasnap-servers-from-delphi-2007-and-earlier-to-delphi-2009-2010-and-later/

3rd party components/libraries (GeitIt Partner Center)
https://getitnow.embarcadero.com/?q=partnercentral.exe

Migrating BDE Applications to FireDAC (the_Search_and_Replace_Utility_Using_Perl_RegEx_Expressions)
http://docwiki.embarcadero.com/RADStudio/Sydney/en/Migrating_BDE_Applications_to_FireDAC

Converting 32-bit Delphi Applications to 64-bit Windows
http://docwiki.embarcadero.com/RADStudio/Sydney/en/Converting_32-bit_Delphi_Applications_to_64-bit_Windows

DelphiCon 2020 : T-5 Days!

We are now only 5 days away from the start of DELPHICON 2020, and the line up is looking pretty cool! I also hear registration is pretty high too.

If you have not already registered, it’s free to do so and to pick the sessions you want to attend. Sign up now for DelphiCon2020

Below is a snapshot of what I’m looking forward to, and sessions to look out for!

Sessions to watch out for on Day 1! (17th Nov)

1) Opening Key note by Marco – The State of Delphi

I will definitely be attending Marco’s Opening keynote: The State of Delphi. I hear there could well be exciting product roadmap updates included in that session.

November 17, 2020, 3:00 pm GMT

Continue reading DelphiCon 2020 : T-5 Days!

Key Target Platforms Update

I wanted to share some interesting data following a recent presentation looking into Modern Windows development.

75% of Windows Desktops use Windows 10!

Source: https://gs.statcounter.com/windows-version-market-share/desktop/worldwide/#monthly-201709-202009

Windows 10 is now used by 3 out of every 4 Windows desktop machines! This market share is up around 10% in 2020, having originally passed Windows 7 back in late 2017.

Windows 7 is down to around 18%, and falling. In part as Enterprises continue to shift to Windows 10 following Windows 7 going End of life in January. Windows 8.1 is stable at around 4%

What does it mean for me as a developer?

You need to make sure you applications are Windows 10 ready more than ever. Windows 10 has made fundamental adjustments to the UI layer in reaction to a number of hardware innovations, and patterns of use. This includes adjustments for PerMonitor support for different resolutions and DPI’s, and the enhancements around HighDPI support.

HighDPI support is no longer an optional item, without it your application could be rendered unusable on certain screens and the end user experience will suffer.

That said, there is still a reason to have backward compatibility to older versions of Windows. (Something the VCL helps support with its implementation of the new Windows 10 controls – YES – you can run then on Windows 7 and Windows 8 if you use the VCL)

If you are looking to add HighDPI support to your Windows applications, then I suggest starting with images, and check out the new TImageCollection and TVirtualImageList and also watch this webinar replay

For more about Windows 10, and some of the new controls and Windows 10 features in RAD Studio for Delphi and C++Builder, this 5 Unique Features for Windows 10 blog post is a good summary.

Windows and Android rule the roost!

Source: https://gs.statcounter.com/os-market-share#monthly-201809-202009

The numbers are pretty clear.

  • 38.51% – Android
  • 36.27% – Windows
  • 14.12% – iOS
  • 08.25% – macOS
  • 00.83% – Linux

When it comes to the type of devices on the mobile side – its mobile (50.33%) and desktop (47.04%) all the way, with Tablets accounting for just 2.63% of the market share.

Source: https://gs.statcounter.com/platform-market-share/desktop-mobile-tablet#monthly-201709-202009

What does it mean for me as a developer?

It means Android (and also iOS) are a key platform and technical asset to target to expand the technical capabilities of your desktop applications. This barrier to entry is low as the adoption is high. This makes it an ideal target to enhance your product offering and maximize development return.

With more mobile devices in use that desktops, mobiles can not be ignored when it comes to product innovation. Mobile devices offer a developer a key different set of technical capabilities. e.g. Camera, Accelerometer, Compass etc, and when paired alongside Desktop solutions, enable innovative ways to do data capture.

With the core System libraries in Delphi being cross platform, it means you can fast track your mobile development through the use of a single code base as well. Large parts of the business logic can move from Windows, over to iOS and Android rapidly.

It’s also worth looking at the Enterprise version of Delphi to get access to InterBase ToGo for mobile as a run-time royalty-free database. The full on-disk encryption of the database provides the highest level of data security, typically reserved for enterprise servers, yet still within a small footprint, highly distributable database.

If you are looking to use a mobile alongside a local application, (and don’t need the data to go centrally first for processing) then the unique approach of AppTethering is certainly worth a look. AppTethering avoids the need for pushing data to a central server, making it faster (as data is local). If this sounds of interest, then definitely check out this webinar replay.

Alternatively, RAD Server is a great way to take existing business logic and make it accessible as a remote API. Click for more blogs on RAD Server

Regional Specific Trends

If you want to delve deeper into regional-specific trends, then I would suggest visiting https://gs.statcounter.com/ and using the Interactive chats, powered by Fusion Charts (which also recently became a member of the Idera Group)

3 Libraries for improving Existing Applications built with Delphi

One topic I get increasingly asked about Delphi Programming when developers are migrating to the latest version of RAD Studio is “quick ways to improve their applications”. So in this post, I am going to summarise 3 favorites by focusing on the libraries in RAD Studio. If you are new to RAD Studio, then I would also recommend reading these, as they are very easy to implement and provide quick wins to new code too.

As with any actively developing and improving language and IDE, RAD Studio / Delphi is improving all the time. This summary is based on the questions I receive weekly focusing on what is in the box so to speak. While I barely scratch the surface here, I also want to point out that there is a great 3rd party community of developer tools offering even more options that you can explore.

Continue reading 3 Libraries for improving Existing Applications built with Delphi