Delphi

Quickly Convert Speech To Text With Powerful Google Artificial Intelligence APIs

What can the Google Audio Transcription API do for our applications? Google’s Audio Transcription API allows your program to use all the power of Google’s huge computing resources to accurately transcribe speech found in audio files into text. As Google’s documentation says: Transcribe your content in real time or from stored files Deliver a better user experience in products through voice commands Gain insights from customer interactions to improve your service How can we use the Audio Transcription API with Delphi? Google cloud services have been positioned as a must have computing service solution today. They allow us to easily use their perfectly-designed AI solutions to use in our applications. Not only that, prices are also reasonable and you can start with zero payment by just adding your credit card. But how about getting those amazing functions to our Delphi application? Some people would think that Delphi is not the ideal language to work with those popular cloud computing APIs. It’s not true. With the help of the huge community for Delphi, it’s simpler than you think. Google Speech to Text and Text to speech are two of those cloud computing functions that could vital for some business applications. With the help of few repositories by grijjy in GitHub, we can easily get those functionalities to our Delphi application. Actually the repository is dated from 2017 but surprisingly it works perfectly with the newer versions of Delphi without many changes to the code. How to setup Google cloud services to work with Delphi? To use Google cloud services in our Delphi project, we need credentials to allow our project to use our google cloud API account. To do that, please visit this link and create an account. https://cloud.google.com Then create a new project. Then go to API and services dashboard and create new credentials. Make sure it’s service account. Then go to the new service account and create new key in Keys tab. Please make sure the key type is P12. Now you need to convert this P12 key to PEM to use with our Delphi components. To do that, please run this command in a folder with OpenSSL binaries. Make sure to edit file names: openssl pkcs12 -in path.p12 -out newfile.key.pem -nocerts -nodes em>openssl pkcs12 –in path.p12 –out newfile.key.pem –nocerts –nodes/em> Keep that generated pem file to use with our Speech to Text Delphi project. What are the prerequisites for creating a Delphi Audio Transcription project? Download the GrijjyFoundation repository. https://github.com/grijjy/GrijjyFoundation Download the “Nghttp2.pas” from this link and copy it to the GrijjyFoundation folder. https://github.com/grijjy/DelphiRemotePushSender/blob/master/Nghttp2.pas Download the “Google.API.pas” form this link and include it in your project folder. https://github.com/grijjy/DelphiGoogleAPI/blob/master/Google.API.pas How to setup new Delphi project to demonstrate Audio Transcription? Create a new Delphi project and add components like this. Alternatively, you can download the demo project form this link. Demo Project GrijjyFoundation has many units to support many Google Cloud services. But in this project we only need few of them. Please include only these units to your Delphi project. How to code the Delphi Audio Transcription project? Now let’s move to the coding part. We use an instance of “TgoGoogle” class to post data and get the response form the Speech to Text API. We need to set some parameters of “TgoGoogle”. TgoGoogle.OAuthScope – OAuth Scope of the […]

Read More

Easily Automate The DigitalOcean API From Windows And Mobile

DigitalOcean offers a set of APIs that we can access to manage their products from our application.  You can create applications that act like DigitalOcean’s Droplets Control Panel. You can access DigitalOcean’s API documentation here https://developers.digitalocean.com/documentation/v2/. One reason to utilize the DigitalOcean API is to automate your cloud server management and deployment process. If you are building out separate machines for customers (using RAD Server for example) this would be a great way to automate that process. Or maybe you have a CI pipeline you’re setting up that involves automated deployment and testing of an installation process this would be a great way to automate the process through Delphi and the DigitalOcean API. How do I set up a Windows app with DigitalOcean’s API? This article is only an example of the initial steps in creating an automation application, so I only show how to set up the DigitalOcean’s Droplet. In order to create a droplet (virtual private server) the /v2/droplets endpoint exists. It can be called to create a new server for you to use. Here are the two request headers needed which include authorization. Content-Type: application/json Authorization: Bearer b7d03a6947b217efb6f3ec3bd3504582 Content–Type: application/json Authorization: Bearer b7d03a6947b217efb6f3ec3bd3504582 Here are the list of request parameters that can be set when creating a droplet. The parameters are sent via JSON in the request body. You will see these parameters used in the Object Pascal code below. Name Type name String region String size String image integer (if using an image ID), or String (if using a public image slug) ssh_keys Array backups Boolean ipv6 Boolean private_networking Boolean vpc_uuid string user_data String monitoring Boolean volumes Array tags Array And here is some example JSON of a request body: { “name”: “example.com”, “region”: “nyc3”, “size”: “s-1vcpu-1gb”, “image”: “ubuntu-16-04-x64”, “ssh_keys”: [ 107149 ], “backups”: false, “ipv6”: true, “user_data”: null, “private_networking”: null, “volumes”: null, “tags”: [ “web” ] } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 {   “name”: “example.com”,   “region”: “nyc3”,   “size”: “s-1vcpu-1gb”,   “image”: “ubuntu-16-04-x64”,   “ssh_keys”: [     107149   ],   “backups”: false,   “ipv6”: true,   “user_data”: null,   “private_networking”: null,   “volumes”: null,   “tags”: [     “web”   ] } What Does the Delphi API code look like to access DigitalOcean? We are going to use the TRESTClient TRESTRequest TRESTResponse pipeline that is built into the Delphi RTL to make it easy to handle the REST request. The library is available for all platforms that are supported by Object Pascal. The REST Library framework focuses on JSON as the representation format. REST.Client.TRESTClient is the component that actually executes a request to a service. TRESTClient manages the HTTP connection to the service, deals with HTTP headers and proxy servers, and receives the response data. Authenticators (described later) can be attached to the client for a convenient way of adding authentication to a request. The request (REST.Client.TRESTRequest) holds all parameters and settings that form the actual HTTP request to the service. When connected to a client-component, it can be executed (even at design time). One of the most important properties of the request is the ‘Resource’. This value forms the previously mentioned ‘second half’ of the full request-url and defines the actual action that is executed on the service. The request also defines the HTTP methods (‘get’, ‘post’, ‘put’, ‘delete’) that are used for its execution. The response […]

Read More

Developer Stories: Giuliano D’Oronzo Talks Through His Board Game Prime

Giuliano D’Oronzo has been programming with Delphi since 2017. His (Prime) application was one of the showcase entries of the Delphi 26th Showcase Challenge and we have also asked him further about his Delphi skills. Get more information about his board game at Prime. When did you start using RAD Studio/Delphi and have long have you been using it? I have been using Delphi since 2017, but have been programming in Pascal for over 30 years. I almost always used Embarcadero development tools (first Borland then Inprise). What was it like building software before you had RAD Studio/Delphi? Previously I developed only for the Windows platform, now thanks to Delphi I can create applications for all the major existing platforms. How did RAD Studio/Delphi help you create your showcase application? Delphi allowed me to speed up the porting process to the Android platform with minimal effort. What made RAD Studio/Delphi stand out from other options? For me the “Object Pascal” language is extremely easy to use as well as very powerful. As a result, the development speed is significantly faster than with other development tools. What made you happiest about working with RAD Studio/Delphi? Working with Delphi is a lot of fun, and it gives me a lot of satisfaction. What have you been able to achieve through using RAD Studio/Delphi to create your showcase application? I managed to get a good chess engine (adapted for my game), and a good GUI on both platforms (android and windows). What are some future plans for your showcase application? I am developing another video game soon. Thank you for your insights, Giuliano! You will find the showcase entry for his application below Showcase

Read More

Developer Stories: Oripov Murod Converses Regarding His DovtaLab2020 Application

Oripov Murod has been programming with Delphi since 2006. His application (DovtaLab2020) was submitted as an entry for the Delphi 26th Showcase Challenge and we interviewed him to know more about his application and experiences with Delphi. You can download his application over at DovtaLab2020. When did you start using RAD Studio/Delphi and have long have you been using it? I started studying from 2003 (Delphi6)  as beginner. I use Delphi seriosly from 2012 (Delphi2010). What was it like building software before you had RAD Studio/Delphi? I used FoxPro, Basic,C, Access. How did RAD Studio/Delphi help you create your showcase application? Delphi is more simple and Delphi has a lot of tools for creating any application. What made RAD Studio/Delphi stand out from other options? It seems to me that I understand delphi better than others. What made you happiest about working with RAD Studio/Delphi? I love delphi very much What have you been able to achieve through using RAD Studio/Delphi to create your showcase application? I liked this system and now i have more abilities to create a lot of apps in future. What are some future plans for your showcase application? I want to teach children to delphi to learn more myself.   Thank you, Oripov! You can find the link of his showcase entry below. Showcase

Read More

Websockets Harness Real-Time Power In Your Delphi Apps

Are you using websockets in your applications yet? Do you need to know what websockets can do for your apps? Read on to get up to speed on everything you need to know about using websockets with Delphi along with a run-down on some of the available component sets which take all the hard work out of making the magic happen. What are websockets? There are two sides to a websocket implementation – the client side and the server side. At the most basic level a websocket server is an application which listens for TCP traffic. The websockets clients are one or more applications or even web pages which connect to the websocket server via a “handshake” request and, if successful, a continuous connection is established between the server and the client. Are websockets just a special type of HTML? The short answer to that question is no, websockets use the TCP communication protocol – not the much more heavyweight HTTP. The websockets server is not a web server, although it can be implemented on one. The websockets TCP traffic, the data sent back and forth between the client and server, is not the familiar “200 OK” and “HTTP/2.0 a bunch of HTML” type text data. The websockets protocol is very lightweight and as a result, very fast. Websockets are also designed to be used in situations where there are prolonged and ‘constantly-on’ connections to the server by multiple clients. Compare that to HTML where the interaction is typically client makes a page request, the web server sends back its response and that’s end of interaction until the next web resource request. Websockets are more like a ‘push’ technology where the server can send updates without being asked. This push ability is more similar to the notifications on your mobile phone. Are websockets secure? The websocket protocol provides for both non-secure and secure connections. The secure protocol uses TLS/SSL. Why would I want to use websockets in my app? Websockets are really useful for applications which need to update small amounts of data frequently and on a schedule which is not predictable. You can use websockets to provide a highly efficient way of communicating that data without the overhead of things like REST which relies on HTML and therefore has all the added baggage of HTML request/response codes, headers and MIME types. Your applications cut out all that extra noise using websockets while providing a near real-time response without needing to implement things like the server or client polling for any requests or updates. This makes your app super-responsive and lightweight. What sort of applications can I write? The most common example you see given for websockets is in real-time “chat” programs which emulate popular apps like Slack, Discourse and Messenger. There are a whole host of other uses too: “Feed” type usage – like a Twitter tweet feed or an “as it happens” time and status update print-out from something like a temperature monitoring hardware control. Two-way updates between two client applications. For example, two users are both updating a shared resource like a set of notes or different parts of a patient record. Using websockets you could implement an update mechanism where both users could see the other’s changes in near-real time rather than having to hit a […]

Read More

Plunge Into A Museum Adventure With This Delphi Integration

This really wonderful Delphi app makes truly creative use of the integration of museum visitors with exhibits. Written by Oz Software of Spain, vCoolture makes a trip to the museum into an adventure where visitors using the app not only hear the descriptions offered by traditional audio guides but a plethora of additional information such as a biography of the painter or sculptor of an art exhibit, links to relevant web pages such as a contemporary artist’s own website or other publicly available information like a Wikipedia article. How does vCoolture achieve this integration magic? Oz Software makes use of Delphi’s ability to integrate with iBeacons – discrete little Bluetooth Low Energy devices – which are carefully placed at strategic points around the museum or art exhibition. When a visitor using the mobile device app comes within range of an iBeacon the app looks up the iBeacon’s hardware ID and retrieves the facts, photos and links associated with it. As well as visual information at the same time the device begins playing any audio linked to the exhibit’s iBeacon. To the visitor it all seems to work by some kind of invisible magic, but that magic is pretty easy to achieve with RAD Studio Delphi and a little imagination. What other types of integration does the app enable? Along with the images and audio the app also provides a map of each room as the user enters it. This map/iBeacon integration means the user not only sees a smaller, more concise map but can have relevant exhibits highlighted on the map in greater detail than could be done on a simple full-build floor plan. vCoolture is an example of software for mobile devices that substantially improves the user experience in visiting museums or any kind of exposition, offering many more services than those offered by traditional audio guides. vCoolture also uses the ready-to-go components in Delphi to provide in-app billing using Google Ad integration as well as the ability for the museums to display virtual reality ‘billboard’ advertising which seem to be projected on the floor of the halls or even the exhibits themselves! Gift merchandising information can also be integrated into the information associated with the iBeacons so things like relevant books, mementoes and T-shirts sold in the museum gift store can be displayed next to an exhibit. But there’s more than just hardware integration! As if all of this wasn’t enough, vCoolture has one more trick: to make a great visit even more interesting, vCoolture includes a ‘Enigma’ game built in. Visitors have to find the answers to questions posed by the app which allows them to ‘find’ 10 objects hidden ‘behind’ of some works of art. There is an interactive or group play element to because the game allows you to compete with friends or colleagues. What does the Oz Software say about vCoolture? “The vast majority of applications using iBeacons are specific to a particular museum and only serve for that particular use, so often the visitor is very reluctant to install a heavy application for a single use. vCoolture is a single App for any museum or exposition, there is no limitation, since all the information is loaded on demand from a local or remote web service. But also, every museum/exposition can personalize vCoolture for […]

Read More

Automate Access To Current And Historical Currency Exchange Rates Via API

{     “success”: true,     “timestamp”: 1618443847,     “base”: “EUR”,     “date”: “2021-04-14”,     “rates”: {         “AED”: 4.401602,         “AFN”: 92.987438,         “ALL”: 123.189782,         “AMD”: 622.325441,         “ANG”: 2.150997,         “AOA”: 771.454377,         “ARS”: 111.049893,         “AUD”: 1.550998,         “AWG”: 2.156941,         “AZN”: 2.046165,         “BAM”: 1.960773,         “BBD”: 2.419639,         “BDT”: 101.557685,         “BGN”: 1.956108,         “BHD”: 0.4518,         “BIF”: 2355.859391,         “BMD”: 1.198301,         “BND”: 1.602747,         “BOB”: 8.262446,         “BRL”: 6.775187,         “BSD”: 1.198391,         “BTC”: 1.9067596e–5,         “BTN”: 90.06308,         “BWP”: 13.096988,         “BYN”: 3.135003,         “BYR”: 23486.695865,         “BZD”: 2.415529,         “CAD”: 1.499979,         “CDF”: 2391.808752,         “CHF”: 1.105916,         “CLF”: 0.030816,         “CLP”: 850.318038,         “CNY”: 7.824422,         “COP”: 4381.9464,         “CRC”: 734.603479,         “CUC”: 1.198301,         “CUP”: 31.754971,         “CVE”: 110.932648,         “CZK”: 25.94405,         “DJF”: 212.962255,         “DKK”: 7.437344,         “DOP”: 68.255016,         “DZD”: 158.571629,         “EGP”: 18.777483,         “ERN”: 17.976802,         “ETB”: 49.55004,         “EUR”: 1,         “FJD”: 2.452563,         “FKP”: 0.870416,         “GBP”: 0.869667,         “GEL”: 4.140164,         “GGP”: 0.870416,         “GHS”: 6.926206,         “GIP”: 0.870416,         “GMD”: 61.113259,         “GNF”: 11983.008607,         “GTQ”: 9.248383,         “GYD”: 250.707366,         “HKD”: 9.305333,         “HNL”: 28.903569,         “HRK”: 7.57158,         “HTG”: 97.906362,         “HUF”: 358.507893,         “IDR”: 17515.083611,         “ILS”: 3.931206,         “IMP”: 0.870416,         “INR”: 89.904135,         “IQD”: 1751.316633,         “IRR”: 50454.456016,         “ISK”: 151.714206,         “JEP”: 0.870416,         “JMD”: 179.460912,         “JOD”: 0.849552,         “JPY”: 130.510579,         “KES”: 127.98481,         “KGS”: 101.611855,         “KHR”: 4847.126741,         “KMF”: 492.801162,         “KPW”: 1078.470959,         “KRW”: 1338.046775,         “KWD”: 0.361276,         “KYD”: 0.998693,         “KZT”: 516.331626,         “LAK”: 11287.993862,         “LBP”: 1825.846885,         “LKR”: 241.461698,         “LRD”: 206.832071,         “LSL”: 17.555151,         “LTL”: 3.538271,         “LVL”: 0.72484,         “LYD”: 5.410369,         “MAD”: 10.702619,         “MDL”: 21.535088,         “MGA”: 4535.568261,         “MKD”: 61.636388,         “MMK”: 1689.632611,         “MNT”: 3415.939059,         “MOP”: 9.586206,         “MRO”: 427.793183,         “MUR”: 49.357594,         “MVR”: 18.514034,         “MWK”: 943.661381,         “MXN”: 24.066602,         “MYR”: 4.947184,         “MZN”: 73.899259,         “NAD”: 17.5549,         “NGN”: 455.949342,         “NIO”: 42.036495,         “NOK”: 10.054341,         “NPR”: 144.100848,         “NZD”: 1.677843,         “OMR”: 0.461273,         “PAB”: 1.198391,         “PEN”: 4.348335,         “PGK”: 4.229665,         “PHP”: 58.092767,         “PKR”: 183.160095,         “PLN”: 4.554208,         “PYG”: 7547.686137,         “QAR”: 4.363013,         “RON”: 4.926575,         “RSD”: 117.877158,         “RUB”: 91.127306,         “RWF”: 1171.339041,         “SAR”: 4.494591,         “SBD”: 9.559982,         “SCR”: 18.14974,         “SDG”: 455.955933,         “SEK”: 10.143077,         “SGD”: 1.600804,         “SHP”: 0.870416,         “SLL”: 12252.625895,         “SOS”: 699.807988,         “SRD”: 16.960723,         “STD”: 24839.742882,         “SVC”: 10.486172,         “SYP”: 1506.944044,         “SZL”: 17.554312,         “THB”: 37.538567,         “TJS”: 13.664046,         “TMT”: 4.206036,         “TND”: 3.287535,         “TOP”: 2.735603,         “TRY”: 9.677839,         “TTD”: 8.146733,         “TWD”: 33.952055,         “TZS”: 2778.859514,         “UAH”: 33.497945,         “UGX”: 4315.378685,         “USD”: 1.198301,         “UYU”: 52.971442,         “UZS”: 12589.347994,         “VEF”: 256232928513.0559,         “VND”: 27655.584381,         “VUV”: 131.260508,         “WST”: 3.033771,         “XAF”: 657.576278,         “XAG”: 0.047174,         “XAU”: 0.00069,         “XCD”: 3.238468,         “XDR”: 0.841171,         “XOF”: 660.854586,         “XPF”: 120.009287,         “YER”: 299.994695,         “ZAR”: 17.244269,         “ZMK”: 10786.147736,         “ZMW”: 26.585877,         “ZWL”: 385.853094     } }

Read More

Creating custom File Dialogs: ShellBrowser Delphi Components

No doubt, the VCL FileDialogs offer a multitude of configuration options that cover most standard use cases. But sometimes this might not be enough and you want to create a specialized custom dialog with a different layout, additional controls (e.g. for import/export dialogs) or different looks. Rebuilding the dialog from scratch, including all the file system related components, will however in most cases not be a feasible alternative. At this point, the ShellBrowser Components can fill the gap quite comfortably: All the Win32 shell related functionality is wrapped into easy-to-use components so you can concentrate on your special use case. You can obtain a trial version of the ShellBrowser Components via Embarcadero’s GetIt Package Manager or using the link at the end of this article. After installation, you will find the ShellBrowser components in the “JAM Software” section of the component palette. The Windows Explorer style The quickest way is using a “TJamExplorerBrowser” component as the main building block of the dialog. Similar to the FileDialog components of VCL, ExplorerBrowser is built around a Windows COM object, representing a configurable file system browser which shares most parts with the Windows File Explorer. Using the “VisiblePanes” property, you can configure what parts of the control you want to show (the folder view on the right side cannot be hidden). Other design time options for the control include setting the path or “Special Folder” – a collection of named locations, including file system folders (e.g. SF_DOWNLOADS) and virtual folders (SF_DRIVES), as well as different filtering and view settings. To make the dialog complete, we’ll add two more typical file dialog components, the “TJamOpenSaveComboBox” for the file name to be opened or saved, and the “TJamFilterCombo” for specifying file extension filters which can be applied. Keeping controls in sync There is no need to write code to synchronize the components! This can be done using a “TJamShellLink”. You can simply drop an instance from the component palette and assign it as the “ShellLink” property of the ShellBrowser controls that should be synchronized. Let me show you in this small example: All ShellBrowser controls on the form use the same ShellLink. TJamShellLink synchronizes selected paths, files and filters among attached controls. The ShellLink can be used to restrict navigational access to an allowed range of folders, too. In the example below, it will apply the filter that is set in the TJamFilterCombo to ExplorerBrowser, set the text of the “TJamOpenSaveComboBox” to the file name that is selected in ExplorerBrowser and navigate to the path that the user types in the TJamOpenSaveComboBox in ExplorerBrowser. Using the ExplorerBrowser as the main file system component in this example has the benefit that – being a Windows control – it looks and behaves exactly like Windows Explorer. The drawback is that not all details of appearance or behavior can be accessed or modified. E.g. there is no way to filter the visible root nodes of the navigation tree; ExplorerBrowser also does not support VCL Styles or any other form of dark theme. Even more control: TJamShellTree and TJamShellList As an alternative approach, the ExplorerBrowser component can be replaced by various other ShellBrowser controls, such as the TJamShellList, TJamShellTree and TJamShellBreadCrumbBar. These are not based on a Windows COM object, but replicate its look and behavior as closely as […]

Read More

Incredible Real-Time Mobile App Is Built With Delphi

The OCEASet™ real-time mobile application is the companion tool for configuring the OCEABridge™ Bluetooth®/Cloud gateway. OCEABridge™ is a gateway device that provides a transparent link between customer’s local Emerald™ or Atlas™ dataloggers and the OCEASOFT Cloud service via the Internet. Readings are taken in real-time by dataloggers and are captured wirelessly and automatically by OCEABridge™.  The readings are forwarded to the Cloud for monitoring and reporting. What kind of real-time data can be captured? According to OCEASoft’s website the apps provide: Wireless data logger communication with Bluetooth Configurable data logging start time Definable high and low limits, with delays Fast access to readings, events, and alarms Automatic data transfer to OCEASOFT’s secure OCEACloud platform Values displayed in °C or °F, in GMT or local time Generates e-mail with mission report and attached CSV file with all information Download complete reports in PDF, XLS, and CSV format The apps are written using RAD Studio’s Delphi with the Firemonkey cross-platform capabilities and this means they’re available on both iOS and Android. Website OCEASet iOS App Store ‎OCEASet on the App Store (apple.com) Google Play OCEASet Screenshot Gallery Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder. Design. Code. Compile. Deploy.Start Free Trial   Upgrade Today    Free Delphi Community Edition   Free C++Builder Community Edition

Read More

Developer Stories: Themba Sivate Talks About The ST Auto Player Lite Software

Themba Sivate has been a Delphi programmer since 2012. He introduced his application (ST Audio Player Lite) at the Delphi 26th Showcase Challenge and we got to converse with him to have an insight on his Delphi expertise. Find out more about his software at ST Software When did you start using RAD Studio/Delphi and have long have you been using it? I started using RAD Studio on 2012 at University. A year later, I started to learning building applications from scratch using C++ builder installed on institution’s machines, until today. What was it like building software before you had RAD Studio/Delphi? I tried both QT Creator and visual studio before, and it was a pain and limitations too. Rad Studio will let you call Delphi code within C++. Meaning you can reuse Delphi libraries on c++, How did RAD Studio/Delphi help you create your showcase application? RAD Studio is easy to use, simplified drag and drop, simplified packaging. It help me to complete my audio player in less time. What made RAD Studio/Delphi stand out from other options? Easy to use, backwards compatibility, tons of libraries/components, simplified drag and drop, cross-platform outputs. What made you happiest about working with RAD Studio/Delphi? Less development time. Good database handling and development. Its sad that the I cant afford the license at this stage, but I’d be happy to build the list of applications I had on my mind which requires a paid version of RAD Studio. What have you been able to achieve through using RAD Studio/Delphi to create your showcase application? Debugging was pretty easy and straight forward. Most can be achieved by modifying values of the properties, without writing a line code. What are some future plans for your showcase application? I’m planning to upload it on windows store. Future releases are planned and bug fixes. Also planned to support multiple languages. Thank you, Themba! You can check out his software’s showcase entry below. Showcase

Read More