Watch, Follow, &
Connect with Us

Embarcadero Blogs

Latest Posts


RAD Studio XE8, XCode 6.4 and iOS 8.4 - it’s safe to go in the water!

Shark Week 2015 starts on the Discovery Channel this Sunday. This week, Apple released updated Xcode (Xcode 6.4) and iOS (8.4) to support the Apple Music launch (along with other improvements and bug fixes). Within 2 minutes of the release, I got an email from several developers asking if it was safe to install these updates and use them with RAD Studio XE8. Our R&D teams have been using and testing the beta releases of iOS 8.4 and Xcode 6.4 for awhile, but we always wait to do final testing on the actual release (we’ve been surprised a couple of times with changes that appeared between beta and release).

We’ve tested the IDE, PAServer, Delphi and C++Builder compilers, runtime library, debugging, app distribution, device integration, using the simulator, and building/running mobile sample applications. Several of our field software consultants have also tested these latest Apple releases with their computers and devices.

After final testing by our teams, I can officially report that it is safe to use Xcode 6.4 and iOS 8.4 with RAD Studio XE8. It’s safe to go in the water, but keep a lookout for any shark reports in your area. Let us know if you find any issues. You can use the Embarcadero Quality Portal to report problems.

 

 

 

 

 


posted @ Thu, 02 Jul 2015 23:02:55 +0000 by David Intersimone


Deploying your EMS server applications for scalability and security

Yesterday I wrote about some of the RAD Studio XE8 secure computing capabilities that are supported in the product features and technologies. Robert posted a comment asking whether the EMS Console app was secure as it was using HTTP for development and debugging. This is true.  I asked our EMS R&D team members. I was reminded that when you deploy your EMS server applications they run under Microsoft IIS using an included ISAPI.DLL that works with your EMS application package files. The tools that come with the deployment including the console app and browser interface also work inside an HTTPS environment.  Security is assured as long as you configure your IIS Server correctly.

Information in our DocWiki for EMS application deployment says: "For a production environment, we recommend to set up the EMS Server and the EMS Console Server on a web server. We currently support Microsoft IIS Server." The tools you need are included as DLL versions in the RAD Studio XE8 (enterprise edition and above). You’ll find the DLL versions in the "C:\Program Files (x86)\Embarcadero\Studio\16.0\bin folder". Additional developer and packaging information is also included in the DocWiki - If you have created one or more packages of custom EMS resources, you must build them into package shared library files, which you need as well.

EMS Development gives you executables for the EMS server and console apps. These you can test and debug inside your own secure environment. For development we give you 5 user licenses. When you want to deploy your EMS based applications, contact our sales office or reselling partners to get your deployment licenses.

For the two main EMS deployment DLLs you’ll need to configure IIS to know where they located, This is documented in the "Configuring IIS for the ISAPI DLL topic". The EMS DLLs are: :

  • emsserver.dll, for example C:\inetpub\wwwroot\emsserver\emsserver.dll
  • emsconsole.dll, for example C:\inetpub\wwwroot\emsconsole\emsconsole.dll

Additional information about setting up a secure IIS installation is provided by Microsoft including the following links:

How To Set Up an HTTPS Service in IIS - https://support.microsoft.com/en-us/kb/324069

How to Set Up SSL on IIS 7 - http://www.iis.net/learn/manage/configuring-security/how-to-set-up-ssl-on-iis

How to implement SSL in IIS - https://support.microsoft.com/en-us/kb/299875

IIS7 : HOW TO configure a website for HTTPS? - http://blogs.msdn.com/b/rakkimk/archive/2007/05/25/iis-7-how-to-configure-a-website-for-https.aspx

Thanks, Robert, for the comment/question on my secure computing in RAD Studio XE8 Security blog post.

 

 

 


posted @ Thu, 02 Jul 2015 21:41:31 +0000 by David Intersimone


Потребность в мобильных приложениях

хорошо описывается в статье с данными от Gartner в контексте долгоиграющих трендов. На текущий момент только 26% ведут мобильную разработку собственными силами.

Конкретно российский рынок корпоративной мобильности (не раскрывая особых секретов) пока не демонстрирует той зрелости, которая уже во многом достигнута в лидирующих в плане IT странах. У нас "корпоративная мобильность" распадается на ряд пунктов:

  • можно пользоваться собственным смартфоном на работе;
  • компания оплачивает сотрудникам мобильную связь;
  • компания выдаёт номера в рамках корпоративного контракта;
  • можно пользоваться корпоративной почтой с мобильного устройства;
  • есть ряд мобильных приложений, которые сотрудники обязаны использовать для выполнения служебных обязанностей.

Более 100 мобильных устройств в компании уже обслуживаются при помощи какой-либо MDM-системы (как, например, Samsung KNOX Premium - всё на русском, есть trial-период, вопросы ко мне).

Возвращаясь к статье, рекомендуется создавать мобильные приложения для бизнеса быстро. Для "дефльфистов" это хорошо. Причём её мульти-платформенность есть большой плюс даже с позиции мобильных вендоров. Если посмотреть внимательно на KNOX Premium, он тоже является мульти-платформенным. Поддерживает Android на любых "железках". И даже - iOS. Конечно, есть свои преимущества от Samsung, например, криптоконтейнер Samsung KNOX Workspace. Но и он прекрасно работает с "неродными", но полномасштабными MDM-системами (MobileIron, XenMobile, SAP Afaria, AirWatch, Good etc), оставаясь жёстко привязанным к "своему" железу.

Сейчас время полностью снять барьеры (особенно технологические) перед тотальной мобилизацией, чему во многом следуют и разработчики инструментов, и производители платформ. Хотя я в последнее время интенсивно использую Delphi для создания учебных мобильных приложений под конкретных диапазон устройств. В конечном итоге победить BYOD нельзя, но можно противопоставить CYOD. В любом случае, глобальный тренд оптимистичен.


posted @ Thu, 02 Jul 2015 15:36:12 +0000 by Vsevolod Leonov


The RAD Studio XE8 Summer (Northern Hemisphere) and Winter (Southern Hemisphere) of Security!

The RAD Studio XE8 Summer (Northern Hemisphere) and Winter (Southern Hemisphere) of Security!The RAD Studio XE8 Summer/Winter of Security!

This blog post contains information and links covering secure development topics for Delphi, C++Builder and RAD Studio XE8 developers. You’ll find secure computing introductory topics and starting information for InterBase database, components, libraries, Backend as a Service (BaaS), Cloud, App Tethering and more. Throughout the Summer (or Winter if you live in the Southern Hemisphere), I’ll continue writing about secure topics and showing sample development projects. If you have specific secure development needs, send an email to davidi@embarcadero.com

Interbase – security at the database, column and over-the-wire levels.

InterBase® XE7 is a full-featured, high performance, encryptable, multiplatform and scalable relational database for developers who are looking to embed a low-cost, zero admin, lightweight secure database into their cross platform connected applications. With InterBase XE7 you get powerful access control, data change management, disaster recovery and journaling, as well as support for popular database drivers for increased deployment flexibility.

Data security is a hot topic! The loss of data via cyber attacks can lead to loss of customers and reputation, lead to regulatory action, and even expose you to large fines. InterBase is here to help with its flexible on-disk and over the wire encryption capabilities. InterBase also benefits from inbuilt user authentication and security in place wherever your data files reside. Choose to encrypt the entire database or just a critical table or column, and define who can decode that data with powerful role based authentication. InterBase supports both Advanced Encryption Standard (AES) and Data Encryption Standard (DES) encryption.

InterBase Encryption is supported starting with InterBase 2009. InterBase enables you to encrypt information at one or both of the following levels:

  • Database Level Encryption (InterBase encrypts all of the database pages that contain user information).
  • Column Level Encryption (Column-level encryption is more flexible and specific).

Using InterBase Database Encryption you can also encrypt Database Backup Files. For more information about encrypting your data with InterBase, see Data Definition Guide

Security is provided in the InterBase Server, InterBase Desktop and InterBase ToGo editons. To see additional features of each InterBase edition go to the InterBase product editions page at http://www.embarcadero.com/products/interbase/product-editions

Additional links and videos about InterBase database encryption can be found at:

Rise to the Data Security Challenge: Creating Secure Database Applications using InterBase – OnDemand Webinar -http://forms.embarcadero.com/InterBaseSecurityWebinar5-28

Why Database Encryption Matters: Is the NSA reading this? http://blogs.embarcadero.com/stephenball/2013/12/18/why-database-encryption-matters-is-the-nsa-reading-this/ 

 

EMS

EMS (Enterprise Mobility Services) offers a Mobile Enterprise Application Platform (MEAP) that you can host in the Cloud or on the premises, to expose custom REST APIs and enterprise database data. The enterprise data access is provided by the FireDAC data access library.

EMS offers a comprehensive solution including REST API, remote database access, users tracking, and analytics. Compared to a do-it-yourself model, in EMS you have a pre-build server with core capabilities in which you can plug custom packages.

You can create custom packages to expose datasets and plain REST resources, and easily embed the client code to access those resources in mobile and desktop applications.

http://docwiki.embarcadero.com/RADStudio/XE8/en/Enterprise_Mobility_Services

EMS Server Authorization allows you to authorize or deny access to a EMS Resource or a particular EMS Endpoint in an HTTP request. The authorization depends on the credentials used in the HTTP request to the EMS Server.

http://docwiki.embarcadero.com/RADStudio/XE8/en/EMS_Server_Authorization

EMS allows you to use external credentials in your custom plugins to execute login and signup operations in the EMS Server.

http://docwiki.embarcadero.com/RADStudio/XE8/en/EMS_External_Credentials_Support 

 

DataSnap

DataSnap is a RAD Studio XE8 technology for Delphi and C++Builder that allows the development of multi-tier applications, most notably multi-tier database applications. DataSnap offers the possibility to create Client-Server applications that communicate through the Internet, the local network, or the local host.

The main feature of DataSnap is the ability of the Client application to invoke methods that are implemented on a Server. DataSnap automatically generates the necessary interface for the Client to communicate with the Server, containing the prototypes of the Server methods.

DataSnap provides a way for the Client to safely communicate with the Server, using a secured transfer of JSON (JavaScript Object Notation) data content over TCP/IP, HTTP and HTTPS. The ability to define filters at both ends of the communication channel, for encryption and compression purposes, improves the security.

DataSnap provides Encyption filter support for data sent. You can choose PC1 or RSA - In case of using the PC1 encryption filter, the Properties property holds the Key value to use for the encryption. If using the RSA filter, the Properties property holds a list of three properties, UseGlobalKey, KeyLength, and KeyExponent.

Start with the DataSnap Server Wizard. DataSnap Server Wizard provides an easy way to implement a server application using the DataSnap technology. Regardless of the options you select, it creates a ServerContainerUnit that contains a TDSServer component. All the additional components are connected to the TDSServer, having the Server property set to the name of the TDSServer component. If the selected protocol is TCP/IP, the server unit also contains a TDSTCPServerTransport. If HTTP is selected as the communication protocol, the server unit contains a TDSHTTPService component. If HTTPS is selected, then the server unit will contain a TDSHTTPService component configured for HTTPS operations.

http://docwiki.embarcadero.com/RADStudio/XE8/en/DataSnap_Server_Wizard

Additional DataSnap documentation pages:

 

Cloud Application Development

Building cloud based applications also involves security, authentication, storage and more.  RAD Studio XE8 provides several interfaces to cloud systems using the Cloud API runtime libraries with support for Amazon AWS and Microsoft Azure.

http://docwiki.embarcadero.com/RADStudio/XE8/en/Developing_Cloud_Applications

We also provide component interface for Backend as a Service (BaaS) providers Parse, Kinvey, App42 (a separate free download). These BaaS services provide their own secure interfaces for developers for user and device authentication, storage and push notifications.  You can find additional information on their sites.

Sarina Dupont has a series of blog and tutorial posts showing you how to use BaaS providers. Use the following community blog post and tags to find the articles:

 

App Tethering

The RTL provides app tethering components, giving your applications the ability to interact with other applications running either on the same machine or on a remote machine.

Using app tethering, your applications can easily:

The app tethering feature does not depend on a specific transport or protocol, and new transports and protocols can be implemented using the app tethering API. The RTL provides built-in support for IP and Classic Bluetooth connections. IP support includes connecting applications running on the same device.

You’ll find a wide range of App Tethering documentation and tutorials on the Embarcadero DocWiki:

 

HTTP/HTTPS

 

RAD Studio XE8 supports using the Native HTTP libraries on multiple devices.

http://docwiki.embarcadero.com/RADStudio/XE8/en/Using_an_HTTP_Client, http://docwiki.embarcadero.com/Libraries/XE8/en/System.Net.HttpClientComponent

You can also use OpenSSL with your secure applications. http://docwiki.embarcadero.com/RADStudio/XE8/en/OpenSSL, https://www.openssl.org/

 

TurboPower LockBox

TurboPower LockBox 2 (Win32, Win64, Android, OSX) and LockBox 3.5.2 (Windows, Android, OSX) cryptography libraries/components. You can download and install the latest releases for RAD Studio XE8 using GetIt  (Tools | GetIt) menu item in the IDE:

  

Secure C Library

The foremost reason why Secure C Library came into existence was the need for bounds checking for string handling functions in the C Library. There are many functions in the C Library that expect the caller to supply string parameters long enough to hold the result of the operations. When a larger string is written "over" a smaller string, in fact data is written past the end, overwriting other program data. This can lead to "mysterious" failures, as the program has no means of knowing if or when something went wrong.

A typical solution was to try to use strings that were "big enough" but this could lead to two problems: either the result was a waste of space, or the user’s "big enough" was not big enough in practice. In addition, buffer overflows can be exploited in order to run harmful code, compromising the security of operating systems and networks.

For many C Run-time Library functions, the Secure C Library introduces extra parameters that are used for bounds checking of character arrays, and data is never written past the end of an array. Besides that, it introduces run-time constraints and the means for the user to set his own run-time violation handling functions. Doing so, the program can know when and where something goes wrong with a character array and can fix the error, or fail gracefully.

http://docwiki.embarcadero.com/RADStudio/XE8/en/Secure_C_Library

 

Windows CryptoAPI

You can always call Windows SDK functionality even if we have not wrapped the API in our RTL or components. Here is the Microsoft SDK URL for CryptoAPI –

Cryptography - https://msdn.microsoft.com/en-us/library/windows/desktop/aa380255(v=vs.85).aspx

Cryptography API - https://msdn.microsoft.com/en-us/library/ms867086.aspx

 

IP*Works! By /n software

Internet components that are provided as part of the RAD Studio XE8 Registered User Downloads.

The full version of /n software’s IP*Works components - A comprehensive suite of components for Internet communications including more than 40 individual components covering every major Internet Protocol. IP*Works! eliminates the complexity of Internet development, providing easy-to-use, programmable components that facilitate tasks such as sending email, transferring files, managing networks, browsing the web, and consuming web services.

You can then purchase their addon packs for SSL, SSH and more at

Registered user download links:

 

Project Indy Internet Components

Project Indy includes a range of components for RAD Studio XE8 supporting a wide range of Internet protocols, clients, servers and more. You can find additional information on our DocWiki about the components and how to secure Indy based network connections:

 

I will be covering additional RAD Studio XE8 secure development topics throughout the summer. Stay tuned for demos and articles on the above topics as well as secure development for REST, SOAP and other web based architectures.

Have a great Summer or Winter depending on which hemisphere you live it :D

 


posted @ Wed, 01 Jul 2015 20:18:42 +0000 by David Intersimone


Using the Community Toolbar in RAD Studio XE8

The Community Toolbar in RAD Studio XE8 provides quick access to key Embarcadero Community features and is available as part of the RAD Studio XE8 General Update 1 and RAD Studio XE8 Subscription Update 1.

The toolbar quickly notifies you of new Messages from other community members.

Logging in is easy since you can just use your existing EDN account.

Quickly view Upcoming Events, including webinars, skill sprints and live in-action sessions with the community calendar and view and respond to recent questions using the Questions & Answers pane.

 

The Embarcadero Community also provides access to technical articles, multiple forums and community blogs that you can access by going to community.embarcadero.com.


posted @ Tue, 30 Jun 2015 21:34:59 +0000 by sarinadupont


RAD Studio XE8 runs on the latest Windows 10 Insider Preview Build 10158

RAD Studio XE8 (Original Release and Subscription Update 1 versions) runs on the latest Windows 10 Insider Preview Build 10158. The Update/Install, on my MacBook Pro running Parallels for the Mac Desktop, took a while, at least 15 minutes time (but I did not run a clock as I was working on other computers at the same time).  There were several reboots in the process. So, you’ll want to “Sit back and relax” according to the Microsoft Upgrading Windows screen.

I tested the already installed RAD Studio XE8, the IDE launches without a problem. I built "One Button" apps for VCL and FMX, ran without a problem. I tried a few sample of the sample apps and used the Windows 10 style – all good too. InterBase XE7 64-bit developer server– runs as a service with no issues.

I used GetIt (Tools | GetIt) to download the Delphi Windows RT library. Grabbed Marco’s sample app from his dropbox link. Build the sample – Notification works.  Note: Microsoft has renamed the "Notification Center" as the “Action Center” even though when you hover over the toolbar icon – it still reports “New Notifications Available”. Read Marco’s blog post at http://community.embarcadero.com/index.php/blogs/entry/windows-10-notifications-from-a-vcl-app-with-the-winrt-api for additonal information and the link to the sample app (https://dl.dropboxusercontent.com/u/133855/WinRTCheck.zip).

A final note - in Windows 10 build 10158, Microsoft Edge now has a graphically stylized lower case “e” for its icon on the toolbar :D

 


posted @ Tue, 30 Jun 2015 19:05:57 +0000 by David Intersimone


Using Azure Translator Services with Delphi

Often when building IoT applications there is benefit in linking to 3rd party services. e.g. Heating control systems may link to weather services to help detect external influences that may effect their operation. Typically these services are exposed via JSON and REST providing multi-platform access.

Microsoft Azure data services offer access to a wide range of datasets and services and in this blog post I will take you over my journey connecting to the Azure translator data service and achieving translation of text on Windows, Mac OS X, iOS and Android thanks to the REST components and helper classes in RAD Studio XE8.

About Microsoft Azure Translator Data

Microsoft Translator is a WEB API that enables Automatic Translation (Machine Translation) of text between any of the 50 supported languages

The Azure Translator data is used by Microsoft Office, Visual Studio, Bing and many more Microsoft products. It works over REST using a mix of JSON and XML to provide a number of services including translation and text to audio.

To use the Azure Translator data service you must be registered to use the market place and have an app registered to get the required credentials.

Once registered it uses 2 step authentication to provide a token (valid for 10 minutes from issue) that is then used for API calls. It does this with separate URLS’s for the security and the data services.

A great link to steps and URL’s (incase any change) is the Getting Started using Translator API page

Step 1) – Signing up with Microsoft Translator

As with most services, you need to be registered to use them. Documentation of signing up for Translator is found in steps 1 and 2 of this blog post.
http://blogs.msdn.com/b/translation/p/gettingstarted1.aspx 

Once registered, Ensure you sign Up for the $0.00 per month option to get your free translation credits.

Step 2) Registering an App

Now you are signed up, you need to register your application. (ok we don’t have one yet, so we will just make one up for testing). To register your application for use with the Translation service visit https://datamarket.azure.com/developer/applications and choose Register.

On the registration screen you need to enter in a Client ID (no longer than 20 characters or it will not work from my experience) and also enter a name for your application and a description (anything will do as you can change it later) Finally a redirect URL (your website home page will do, its not used with the REST component setup, but is required)

Azure_Translator_Register_Delphi

 

At this point you will need to copy down the two parts of data I have highlighted on the reg form. The Red part is what you have typed in (Client ID) and the blue part (Client Secret) which is  generated for you by Azure. These two are used to get your session token later on that allows you to talk to the API’s. – Don’t worry if you hit create before you make a note of them as you can open it back up from the applications page at a later point.

Step 3) Building the app using Azure Translation Service in Delphi

Click here for the API documentation for Azure Translator that I’ll be referencing to.

To use a REST service you first need to know what API’s the service exposes, the parameters it requires and then the response to expect. So lets start there…

With REST the API comes in the form of a URL base that then has methods (resources) appended. Each resource has parameters to define the data exchanged, but there are a few ways of passing parameters. The most typical is a URL Segment, but there are also Body and Header parameters. You achieve this easily in Delphi use the parameter property of the TRESTRequest component. (I will get to this shortly).

3.1 – Getting the access token

It is common practice with REST that there is an authorisation step that provides you a session token for subsequent calls. The first stop to using Translator is obtaining an Access Token to use with your API calls.  From reading the documentation and scanning the C# example I was able to locate the Base URL,

 https://datamarket.accesscontrol.windows.net/v2

and the resource for authentication

OAuth2-13

For the resource there are a number of parameters, all of them URL segment parameters and as described in the document this is a HTTP post method.

Parameter Description
client_id Required. The client ID that you specified when you registered your application with Azure DataMarket.
client_secret Required. The client secret value that you obtained when you registered your application with Azure DataMarket.
scope Required. Use the URL http://api.microsofttranslator.com as the scope value for the Microsoft Translator API.
grant_type Required. Use “client_credentials” as the grant_type value for the Microsoft Translator API.

The first two are linked to the data that we generated when registering the application in Step 2 above while the other two always have the same, but required, values.

So now we know what to call, how do we setup the components to call this?

We are going to use 3 components.

TRESTClient – To define where the Base URL is.
TRESTRequest – To define the resource we want to use and the parameters we are passing
TRESTResponse – To collect and store the reply

Compoents for REST call

Adding the three components to your data module or application form should link them all together.

On the REST Client I set the base URL (see above for value) and on the REST Request I set the resource to OAuth2-13 and checked to make sure that the method was a rmPOST. Opening the Params property on the TRESTRequest I also added in the 4 parameters.

RESTAuthParams

You can either set the Client ID and Client Secret in the parameter at design time, or you can define that in code using the TRESTRequest.Params.ParamByName(‘name’).value property e.g.

RequestAuthToken.Params.ParameterByName(’client_secret’).Value := ‘MyClientSecret’;

RequestAuthToken.Params.ParameterByName(’client_id’).Value := ‘MyAppID’;

If you set the values at design time you should be able to right click on the Request and Execute to populate the Response.content. Alternatively, call the Request.Execute at runtime.

3.2 – Finding and extracting the Token

So now we know how to ask for the token, how do we extract it and work with it? What comes back?

The documentation defines the response properties that are returned. These can be queried or using the TRESTResponse instance GetSimpleValue method.

Property Description
access_token The access token that you can use to authenticate you access to the Microsoft Translator API.
token_type The format of the access token. Currently, Azure DataMarket returns http://schemas.xmlsoap.org/ws/2009/11/swt-token-profile-1.0 , which indicates that a Simple Web Token (SWT) token will be returned.
expires_in The number of seconds for which the access token is valid.
scope The domain for which this token is valid. For the Microsoft Translator API, the domain is http://api.microsofttranslator.com.

AuthCode

In the code example above (click to make bigger), you can see the

Client secret and Client ID get set at run time.
The request is executed by calling .Execute;
The response is checked for the access_token return parameter.
The request components that I will use to call the API’s (RESTRequestTranslate and RESTRequestPlay) now I am authorised have the returned access token set as the value for use.  – I’ll cover the setup of these shortly)

New – System.TNetEncoding

The final two lines use TNetEncoding (a really useful class with class functions) to show a decoded Token. No value other than curiosity, but it does show how to decode a URL value (there is also HTML and Base64 decoding helper methods) .

I wouldn’t recommend that for a live application.

3.3 – Calling the Translate API with the Token

To recap. I have used the TRESTClient to point to the BaseURL of the service. Used the TRESTRequest to define the resource and parameters that need to be passed, set the parameters and fetched and retrieved the token, which has been set into the Authorization parameter of another TRESTRequest that I have called RESTRequestTranslate.

So there are a few things to cover here still.

The setup of RESTRequestTranslate and its associated components, especially the parameters
And what comes back from the Translate API

3.3.1 Component Setup to call the API with the Access token.

In a very similar way to getting the Access token, we use the same components to call the live API. Using the same process as before its possible to identify the Base URL and parameters – full list of methods here https://msdn.microsoft.com/en-us/library/ff512419.aspx

Base URL

http://api.microsofttranslator.com/v2/Http.svc

and resources I have used

Translate

to convert text from one language to another and

Speak

to create an audio file based on text passed in.

Both have separate parameter lists so I’m just going to concentrate on translate for this post, however the sample has both in there.

Because all the resources share the same base URL, the TRESTRequests can share the same TRESTClient instance.  (see the green section in the diagram below.

In the documentation for the Translate API method, it defines the parameters that are required, but also the type of parameter required.

Most are segment URL values, but the authorization token must be a HTMLHeader defined as ‘bearer ‘+token.

To create the parameters for URL Segments its easy to define them as part of the resource.  – see image below.

TranslateAPI_Delphi_Component_Setup

Translate?text={text}&from={from}&to={to}

The {brackets} define a parameter name when part of the resource. They automatically get added as URL segment. (or you can add them manually yourself)

Finally. Add in the Authorization token by clicking on the Add icon on the Parameters editor. Making sure to select Kind pkHTTPHEADER.

Typically Parameters are encoded automatically for us so we don’t need to mess around with encoding values, however because the token returned is already encoded, we need to set the option to DoNotEncode on the Authorization token.

Authorization Delphi REST Param HTTPHeader

So we are now all set up with the components.

In code now, we just need to set the language from and to (these are specified in the documentation or can be collected from another API call) and the text to translate. (see below – The Text is set using LiveBindings however – see further down for that setup or just do it in code)

SettingParams_Delphi_Rest_in_code

3.3.2 – What comes out?

So here is that application at run time. I’ve selected Auth already and now choose Translate

LiveBindings_Setting_Params_Delphi_Rest

You will see that the Response Content is actually an XML data packet. For that you can use the XML Document interfaces to extract the value, (I’ll cover that in another post) but there we have it! Translated text :-)

Now as this is a FMX (FireMonkey) application, I can now go and use this on iOS, Android or Mac OS X as well as my local windows machine.

Translator Code Example – Download

The code I cover in this blog is available for download. however I have made it even easier to use…

Must have – BONUS DOWNLOAD

Included in the download is a set of classes I have created to

Encapsulate fetching and managing the token (inc lifespan)
Manage setting the parameters
Conversion of return data from XML to text.

see Project TranslateCompsExample in the project group – enabling code like…

procedure TForm15.btnTranslateClick(Sender: TObject);
var
Translator : TAzureTranslator;
Str : string;
begin
Translator := TAzureTranslator.Create(Self);
try
Translator.SourceLanguage := ‘en’;
Translator.TargetLanguage := ‘da’;
Translator.AccessToken := TokenManager;
Str := Translator.Translate(‘Delphi Rocks!’);
memo1.Lines.Text := Str;
finally
Translator.Free;
end;
end;

Get the code now, and start adding translation and playback of audio into your applications! http://bit.ly/ccAzureTranslatorDelphi

Happy Coding!

The post Using Azure Translator Services with Delphi appeared first on Stephen Ball's Technical Blog.


posted @ Tue, 30 Jun 2015 10:48:37 +0000 by Stephen Ball


Google’s Project Brillo, Weave, and Delphi

If you followed Google I/O then you no doubt heard about Google’s announcements in the Internet of Things space: Project Brillo and Weave. Brillo is Google’s new operating system for Internet of Things devices, and Weave is the language for … Continue reading

posted @ Mon, 29 Jun 2015 21:10:08 +0000 by Jim McKeeth


RAD Studio and Delphi XE8 BOGO and Discount End Tuesday June 30, 2015

Last chance for some of these offers on RAD Studio XE8, Delphi XE8 and C++Builder XE8.


posted @ Mon, 29 Jun 2015 09:55:00 +0000 by Tim Del Chiaro


The question is: Will the latest Xcode (6.3.2) work with Delphi XE8 Update 1?

I received an email just now from another David, saying "I haven’t found this information on your website…The question is: Will the latest Xcode (6.3.2) work with Delphi XE8 Update 1?". I have installed RAD Studio XE8 Subscription Update 1, installed the updated PAServer on my Mac to match the IDE, and I have Xcode version 6.3.2 running on my Mac. I am running iOS 8.3 on my iPhone 6 and iPad Air 2. To answer David (I also replied to his email): All is good with my development, testing and deployment of iOS and OSX apps.

Here are the screen grabs of my about boxes for both tools:

RAD Studio XE8 Subscription Update 1 about box

Xcode 6.3.2 about box

My guidance to developers is always, when you learn that there is a platform update, stay tuned to our blogs and wait until you hear from us that it is safe to go in the water before installing updates to the underlying platforms and devices we are using and targeting.  We give general platform version guidance at "Supported Target Platforms" pages (and links to specific target platforms) at http://docwiki.embarcadero.com/RADStudio/XE8/en/Supported_Target_Platforms.

I will work with our team to create a single spot where we can always update the version number dependencies and support we have, especially given that the platform vendors are making impactful changes these days even in what would normally be considered minor updates.  Stay tuned for a permanent URL.

 


posted @ Fri, 26 Jun 2015 19:14:53 +0000 by David Intersimone


Server Response from: BLOGS1