Delphi

Welcome to the future of software development, again

I have some good news for you, the future of software development has arrived! Well, to be precise, the next possible big thing in the future of software development is here… again. Works anywhere, just add RAM I have this mental block about the name Electron. I’m not entirely sure why it is but whenever I try to remember the name of this ubiquitous web framework my little gray cells shout “Eclipse” and, try as I might, I can’t conjure up the correct name in the appropriate moment during the chatty to and fro of a webinar. I think I have a theory though on why this is happening; my unconscious mind is trying to prevent me from crossing over to the dark side to use Electron to create cross-platform applications. What is wrong with using Electron? Look, there’s nothing wrong with using Electron as such. I’ve actually used Electron and produced an app which was, in effect a website encapsulated by the Electron framework and runtime. But, that said, it is a voracious eater. It will consume every part of your machine’s RAM and CPU resources if left to its own devices. If you don’t believe me just run a quick web search for “electron problems”. The pros of Electron are that it can be a quick route to market. If you have a web app it’s not a massive task to wrap that website or web app with the Electron framework. Also, it implements an auto-update system which means you can push out new versions and improvements with fairly low friction. A web developer is not necessarily an application developer A couple of problems crop up. Behind the scenes of almost every Electron app is the beast which is Node.js – bringer of NPM, the Node Package Manager. The NPM is a superb repository of add-ons, components, modules and time-saving Nodestuffs. Electron / Node developers can get a package for almost everything. If you’re a web developer who has some JavaScript knowledge the NPM can allow you to pull in components to save you a ton of work. Isn’t using NPM a bit like installing Delphi Components? Well, yes it is. Except with one very specific difference: Delphi is compiled down to native code with an optimizing compiler. If you include 1000 Node packages – either deliberately due to some form of overzealous optimism, or inadvertently due to one package having a dependency on another which depends on another five which all depend on another six packages – then you will have 1000 Node packages in your app even if all it does is display a page saying “hello world” in flashing magenta. If you do the same in a Delphi app you will get a lot of unnecessary junk included – but Delphi’s compiler and linking mechanism will exclude a massive amount of things you pulled in but don’t actually get used. It can’t totally protect you from yourself and your component-hoarding kitchen-sink ways but it will definitely save you from creating a Gigagbyte app when it only needed a few MB at most. Low code is the Next Big Thing Right. Low Code apps. You’ve seen some of them and, yes, they can be great for creating apps usually either by answering questions in a wizard […]

Read More

How To Capture Highly Customizable Website Snapshots

Screenshotlayer is a lightweight REST API built to deliver high-quality PNG, JPEG & GIF visual website snapshots through a simple and easy to use interface. We’re going to make use of that API to create a really powerful website snapshot app. Website snapshots, in Delphi, using the Screenshotlayer API The Screenshotlayer API is easy to integrate and works without requiring a queue. With the Screenshotlayer API, you can create a reliable web snapshot automation service. You can capture daily, weekly or monthly, and create an archive if you need. In this post, we will integrate Screenshotlayer API into a cross-platform desktop and mobile application using the Delphi FireMonkey Low-Code Wizard. What is the Screenshotlayer API? The Screenshotlayer API is a world-class RESTful web service to capture highly customizable snapshots of any website in seconds. Just give the website URL, and the web service returns you a screenshot of the website. It offers advanced options, for instance: Set preferred thumbnail dimensions and viewport Inject your CSS Specify a capturing delay Export to AWS S3, FTP  and more How to use Screenshotlayer API? Capturing a snapshot using the Screenshotlayer API is simple. Each API request is based on the following URL and can be configured with different parameters. To make a simple request, you should pass the API access key and URL of the website that you want to take a screenshot of. Moreover, based on how you wish to configure your screenshot, you can choose from several optional parameters: fullpage – take a full height of the target website width – specify your preferred thumbnail width in pixels viewport – specify your preferred viewport dimensions in pixels format – screenshot output format secret_key – your secret key, an MD5 hash of the target & secret word (optional) delay – specify a delay before a screenshot is captured (in seconds) export – export snapshot via custom FTP path or using your AWS S3 user details Let’s see an example of a request Depending on your subscription plan, you can have more secure data streams and features or limits. For instance, higher-level subscription plan users can establish a secure connection. You can have maximum API performance, and the request limit is higher. URL Encryption – If you need a more secure connection, you can utilize the secret key for every API request. First, you need to specify the secret key on the dashboard. My secret key, of course, is the word “delphi”. Then we need to combine the URL and secret keyword into one string and create an MD5 hash out of the string. After that, you can give that value in the query. The Screenshotlayer API Features By default, screenshots are rendered based on the height of the selected viewport. You can alternatively request the full height of the target website with the parameters that we talked about above. CSS Injection – The Screenshotlayer API enables you to inject a custom CSS stylesheet into the target website by appending an existing CSS file URL to the API’s css_url parameter. TTL (Caching Time) – By default, website snapshots are cached for 30 days. Using the ttl parameter, you can specify a custom caching time lower than the default setting. Furthermore, you can have a fresh screenshot of the target website by using the force parameter, which refreshes the target website. How to export website snapshots to AWS S3 or […]

Read More

How To Add IP Address Intelligence Services To Your Apps

Have you ever wanted your apps to have the power to examine an IP address and then find out everything you possibly could about it such as what time zone is local to the IP, what currency they use or what internet service provider is used? This capability is called IP address intelligence and it can add a powerfully rich package of knowledge to your applications allowing you to customize how you present information to your users. In this post you will be learn how to quickly and easily integrate IP address Intelligence into your Delphi desktop and mobile applications. We are going to use a service called IPApi, which is one of the market-leading solutions for all your IP Intelligence requirements in one place. Why would we want to find out information about an IP Address? The IP address is often tied to an individual user. If you know information about that IP address you can customize some of the information, services or even the user interface to better meet the needs of your users. For example, if you find out that the current time for the IP address is night time then you might want to offer different services to those you offer during their daytime hours. Knowing the local currency in use where the IP address is hosted allows you can offer that as a default for purchases. Lastly, you may want or need to restrict some of app’s features if an IP address is located in a different country, possibly for security reasons or to comply with local laws or copyright compliance. With proper IP address intelligence information all of this should be possible. What is the IPApi service? The IPApi service is a powerful IP lookup RESTful web service that helps to find a different set of information using only the IP address. You can do more fascinating things with IP addresses. For instance: Content Personalization based on location Time Zone Lookup Language Redirection based on geolocation Currency and Fraud detection and more The IPApi platform is platform agnostic and offers accurate information. IPApi say their RESTful web service is “trusted by 30,000+ businesses worldwide”. How do I start getting information about an IP address in my application? Head over to the IPApi official website to sign up. There is a Free plan to test it out. IPApi Example Plan Details How do I use IPApi to get information about an IP address? After you sign up, you will have an API access key. And you can utilize that API access key to send requests to the endpoint.  Here is an example of calling to the endpoint: And depending on your subscription plan, you get different sets of data in your response: { “ip”: “161.185.160.93”, “type”: “ipv4”, “continent_code”: “NA”, “continent_name”: “North America”, “country_code”: “US”, “country_name”: “United States”, “region_code”: “NY”, “region_name”: “New York”, “city”: “Brooklyn”, “zip”: “11238”, “latitude”: 40.676, “longitude”: -73.9629, “location”: { “geoname_id”: 5110302, “capital”: “Washington D.C.”, “languages”: [ { “code”: “en”, “name”: “English”, “native”: “English” } ], “country_flag”: “http://assets.ipapi.com/flags/us.svg”, “country_flag_emoji”: “🇺🇸”, “country_flag_emoji_unicode”: “U+1F1FA U+1F1F8”, “calling_code”: “1”, “is_eu”: false }, “time_zone”: { “id”: “America/New_York”, “current_time”: “2018-09-24T05:07:10-04:00”, “gmt_offset”: -14400, “code”: “EDT”, “is_daylight_saving”: true }, “currency”: { “code”: “USD”, “name”: “US Dollar”, “plural”: “US dollars”, “symbol”: “$”, “symbol_native”: “$” }, “connection”: { “asn”: 22252, “isp”: “The City of New York” […]

Read More

How to use Azure Cognitive Services?

It’s been around 6 years since I last wrote about the Azure Translator Services. Since 2015, the API has been updated from XML to JSON and re-organised under the Cognitive Services branding. Additionally, functionality has been broken down into different resources to help control access and provide increased flexibility around service delivery and billing. This week, I’ve updated the original blog content and shared new classes that work with the latest API’s. The security configuration has been updated to reflect the latest regions and the code released onto Github Download the code The readme.md provides details about the prerequisites for using the Azure Services, including the steps to follow to find the access keys when you set up your subscriptions and resources on the Azure portal. You can see the updated blog entry covering the services in more detail at https://delphiaball.co.uk/2021/07/30/how-to-use-azure-cloud-cognitive-services/ Azure Cloud – Translator Services Azure Cloud – Text to Voice Azure Cloud – Voice to Text

Read More

This Is How To Make A Geocoding App in 5 Minutes

In our super-connected world, looking up physical addresses and getting accurate geographic locations is becoming an almost must-have skill for our apps. Would you like to enhance your application with accurate forward and reverse batch geocoding? Wouldn’t it be nice to have a free, lightweight and easy-to-use geocoding REST API to geocode any global address or set of coordinates in real-time? Well you’re in luck, we’re going to show you how to do that and, furthermore, we’re going to do it with a really tiny amount of code. What exactly do we mean by “geocoding”? Before we dive into how we’re going to do things, we should perhaps spend a minute or two going over some of the technical terms we’re going to cover. Forward geocoding is the process of looking up a plain-text address or place name (e.g. Eiffel Tower), whereas reverse geocoding is performed by passing latitude and longitude values of a desired location to the API. If successful, both types of geocoding return an extensive array of location-related data as well as multiple potential results along with confidence scores. In this article we will see how fast and easy it is to use RAD Studio and Delphi to create a FireMonkey multidevice application using the LowCode Wizard in addition to a REST client library to take advantage of PositionStack API and retrieve a JSON format response for worldwide news, headlines and blog articles in real-time. What is the PositionStack API? PositionStack API offers instant access to live geocoding for global places and coordinates around the world. This is possible to be done for free (up to first 25,000 calls/month; no credit card required) and much more is available at very affordable prices and scalable to the use you make with no upfront commitments. The PositionStack API covers 2+ billion addresses sourced from multiple, highly reliable sources, such as Nominatim, GeoNames, Pelias and OpenStreetMap. Updates to our dataset are made multiple times per day and smart filters and algorithms ensure the highest possible level of consistency across API requests and accuracy in geo data responses. Our RAD Studio and Delphi applications will be able to call the API and request information based on the name of parameters you provide. How do I set up the PositionStack API? Make sure you refer to PositionStack API website (https://PositionStack.com/) and and SignUp for the free Plan providing only your email and some basic information (no credit card required). Once you are in the website will redirect you to a Quickstart guide dashboard and your API Access Key will be provided. The Access Key unique, personal and is required to authenticate with the API. Keep it safe! How do I call PositionStack API endpoints? Now all we need to do is to call the API base URL (http://api.positionStack.com/) via a HTTP POST method with no JSON request body needed and some few requested parameters added to the URL address depending on the ednpoint we choose to call. One can do that using REST Client libraries available on several programming languages. PositionStack offers two API endpoints to choose from Forward Geocoding: Geocoding by free-text place name or address. Reverse Geocoding: Geocoding by coordinates or IP address. Our demo will focus on the Forward Geocoding Endpoint but all the others follow similar logic but […]

Read More

Day 4 – Learn to Code Summer Camp 2021 – All About Python

In keeping with our  theme, today we are focusing on Python, PyScripter, and the Python4Delphi bridge. The 11 AM CDT session covers Python and PyScripter basics The 1 PM CDT Session covers Python 4 Delphi and Delphi 4 Python Be sure to register if you haven’t already. For more articles about Python and Python GUII development visit PythonGUI.org

Read More

How To Make An Immensely Powerful Search Engine Results App

A search engine results page, or SERP, is the page you see after entering a query into Google, Yahoo, or any other search engine. In addition to organic search results, search engine results pages usually include paid search and pay-per-click (PPC) ads plus additional generated information not directly related to the search. Wouldn’t it be nice to have a free, lightweight, easy-to-use SERP API built into your own app to give your users the ability to harness the immense power of the search engines? How to add superb power to your apps with the absolute minimum of coding effort Low code is where RAD Studio Delphi really shines compared to nearly all other programming languages. In many ways it was one of the very first ground-breaking systems to embrace low code as a philosophy right from the very first day it was released. In this article we will see how fast and easy it is to use RAD Studio and Delphi to create a Firemonkey multidevice application using the LowCode Wizard in addition to a REST client library to take advantage of SerpStack API and retrieve a JSON format response for Google SERP in real-time. Using SerpStack API with RAD Studio’s low code capabilities is a smart way to produce applications in the modern world SerpStack API offers instant access to live geocoding for global places and coordinates around the world. This is possible to be done for free (up to first 100 calls/month; no credit card required) and much more is available at very affordable prices and scalable to the use you make with no upfront commitments. Our RAD Studio and Delphi applications will be able to call the API and request information based on the name of parameters you provide How do I set up the SerpStack API? Make sure you refer to SerpStack API website (https://SerpStack.com/) and and SignUp for the free Plan providing only your email and some basic information (no credit card required). Once you are in the website will redirect you to a Quickstart guide dashboard and your API Access Key will be provided. The Access Key unique, personal and is required to authenticate with the API. Keep it safe! How do I call SerpStack API endpoints? Now all we need to do is to call the API base URL (http://api.serpStack.com/) via a HTTP POST method with no JSON request body needed and some few requested parameters added to the URL address depending on the endpoint we choose to call. One can do that using REST Client libraries available on several programming languages. SerpStack offers two API endpoints to choose from Search: Get SERP data for your search query Locations: Search locations supported by the API Our demo will focus on the Search Endpoint but all the others follow similar logic but with different parameters passed. For a complete and detailed list of endpoints and its parameters make sure you refer to SerpStack Quickstart guide (https://serpStack.com/quickstart) // Search API Endpoint http://api.serpstack.com/search ? access_key = YOUR_ACCESS_KEY & query = mcdonalds // optional parameters: & engine = google & type = web & device = desktop & location = new york & google_domain = google.com & gl = us & hl = en & page = 1 & num = 10 & output = json // […]

Read More

How To Validate And Lookup Global Phone Numbers In Your Apps

NumVerify is a full-fledged and powerful RESTful web service that allows global number validation and lookup service in more than 230 countries around the globe. It offers a simple RESTful JSON API endpoint that you can send and receive correct information about a phone number. NumVerify API sends handy JSON formatted data about the carrier, geographical location, line type, and more in seconds. NumVerify API is easy to integrate. NumVerify API is platform agnostic and offers a simple connection in any platform. Moreover, with the power of Delphi, you can send and receive phone number validation information without coding because of low-code app development features. How to integrate NumVerify API into Delphi FireMonkey application? In this post, we will create a fully functional cross-platform application using FireMonkey App Low Code Wizard. the FireMonkey Low Code Wizard fully integrates with NumVerify API. What exactly is the NumVerify API? NumVerify API is a product built and maintained by apilayer and helping millions of developers to automate complex processes using solid RESTful web services.  Number Validation – Keep your user database clean and fight fraud by validating. Swift & Secure API – Easy to integrate URL structure Advanced Tools – Configure lookup options with a set of parameters Cost-effective API How do I set up the NumVerify API? Just head over to the NumVerify API website (https://numverify.com/) and sign up for the free subscription by providing basic information. After signing up, you can open Dashboard, and there will be your API Access Key with documentation. How to send a request to the NumVerify API endpoint? Well, now you can send requests to the endpoint using your API access key. Just need to give the required parameters to the URL.  Here is a sample API request with a sample JSON response. After the request is successfully sent, you receive a clear JSON response. Each API response consists of 10 different response objects. You learn more about the response structure here (https://numverify.com/documentation) How do I connect my applications to the NumVerify API? In this demonstration, I utilize Delphi and FireMonkey to create a client app. REST Client components can work with any RESTful web service easily.  The lightning-fast way of connecting to APIs is the RAD Studio Delphi REST Debugger REST Debugger is a specialized tool for Delphi and C++ Builder developers. You can play with any kind of REST-based web service. Besides, after connecting and receiving the JSON response, you can quickly copy and paste components from the REST Debugger to your Delphi or C++ Builder project. And you are good to go! How to build an app which runs on Windows, macOS, Android, and iOS and works with the NumVerify API I pointed out to the FireMonkey App Low Code Wizard. Low Code Wizard helps us to initialize a fully functional cross-platform FireMonkey application. The wizard gives you different options and database functionalities. And then, you select the required features which, then generate a complete app. How do I start using Low-Code development in RAD Studio? Run your copy of RAD Studio. Open the GetIt Package Manager from the Tools menu. There you can search for a “low code” keyword. Now install the FireMonkey App Low Code Wizard. Now you can utilize Low Code App Wizard and generate a fully functional app within seconds. For this, you should go on the menu: File->New->Other and select Multi-Device […]

Read More

6 Simple Ways to Generate Dummy Data for Your Windows Apps

What is the purpose of dummy data generation? As a Developer or Tester, sometimes we need a large volume of data in the database to test the applications. Manually creating this data and inserting it into the database is not an affordable option if we consider the price and effort involved too. This is where you need the tools for automatically generating as much dummy data as you need, to test or populate your apps at the lowest cost. Load, performance, and stress testing are just impossible without the help of these data generation tools. These tools are easy to use, and in turn, save a lot of time. It not only saves time for creating lengthy scripts but has also made data generation easy. With just a few lines of Python code, you will be able to create a large volume of data. To get the data using web scraping, instead of dummy data generation, read this article for tutorials and best options: Delphi adds powerful GUI features and functionalities to Python In this tutorial, we’ll build Windows Apps with extensive Test Data Generation capabilities by integrating Python’s Test Data Generation libraries with Embarcadero’s Delphi, using Python4Delphi (P4D). P4D empowers Python users with Delphi’s award-winning VCL functionalities for Windows which enables us to build native Windows apps 5x faster. This integration enables us to create a modern GUI with Windows 10 looks and responsive controls for our Python Test Data Generation applications. Python4Delphi also comes with an extensive range of demos, use cases, and tutorials. We’re going to cover the following… How to use Faker, FauxFactory, lipsum, Mimesis, pandas, and radar Python libraries to Generate Dummy Data for Your Windows Apps All of them would be integrated with Python4Delphi to create Windows Apps with Test Data Generation capabilities. Prerequisites Before we begin to work, download and install the latest Python for your platform. Follow the Python4Delphi installation instructions mentioned here. Alternatively, you can check out the easy instructions found in the Getting Started With Python4Delphi video by Jim McKeeth. Getting started with Python4Delphi and RAD Studio First, open and run our Python GUI using project Demo1 from Python4Delphi with RAD Studio. Then insert the script into the lower Memo, click the Execute button, and get the result in the upper Memo. You can find the Demo1 source on GitHub. The behind the scene details of how Delphi manages to run your Python code in this amazing Python GUI can be found at this link. Open Demo01.dproj. 1. How can I use Faker to generate dummy data? Faker is a Python package that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill in your persistence to stress test it, or anonymize data taken from a production service, Faker is for you. After installing Python4Delphi properly, you can get Faker using pip or easy install to your command prompt: Don’t forget to put the path where your Faker library installed, to the System Environment Variables: System Environment Variable Examples C:/Users/YOUR_USERNAME/AppData/Local/Programs/Python/Python38/Lib/site-packages C:/Users/YOUR_USERNAME/AppData/Local/Programs/Python/Python38/Scripts C:/Users/YOUR_USERNAME/AppData/Local/Programs/Python/Python38 C:/Users/YOUR_USERNAME/AppData/Local/Programs/Python/Python38/Lib/site–packages C:/Users/YOUR_USERNAME/AppData/Local/Programs/Python/Python38/Scripts C:/Users/YOUR_USERNAME/AppData/Local/Programs/Python/Python38 The following is the code example of Faker and Python4Delphi to generate real-world example: Complex data with nine variables and 1000 rows (Run this inside the lower Memo of Python4Delphi Demo01 GUI): import pandas from faker import Factory import random […]

Read More

Everything You Need To Build A Real-time Flight Status App

Would you like to create an application with real-time flight status & global Aviation data updated as often as every single minute? Whether it’s building booking platforms, visualizing and monitoring global flights or creating popular flight tracking applications, wouldn’t it be nice to have a free, simple REST API for live flight tracking & airport timetable data? You’ve probably used one already and, if you’re like me you’ve found a few of them a little lacking and thought “I could do that” – well, now you can! How to build a flight status app with as little code as possible In this article we will see how fast and easy it is to use RAD Studio and Delphi to create a FireMonkey multidevice application using the LowCode Wizard in addition to a REST client library to take advantage of AviationStack API and retrieve a JSON format response for worldwide Live Flight tracker & airport timetable data. What is the AviationStack API? The AviationStack API offers instant access to live extensive set of aviation data, including real-time flight status, historical flights, schedules, airline routes, airports, aircrafts from 250+ countries and 13.000+ airlines from all around the world. This is possible to be done for free (up to first 500 calls/month; no credit card required) and much more is available at very affordable prices and scalable to the use you make with no upfront commitments. Our RAD Studio and Delphi applications will be able to call the API and request information based on the name of parameters you provide. How do I set up the AviationStack API? Make sure you refer to AviationStack API website (https://aviationStack.com/) and and SignUp for the free Plan providing only your email and some basic information (no credit card required). Once you are in the website will redirect you to a Quickstart guide dashboard and your API Access Key will be provided. The Access Key unique, personal and is required to authenticate with the API. Keep it safe! How do I call AviationStack API endpoints? Now all we need to do is to call the API base URL (http://api.aviationStack.com/) via a HTTP POST method with no JSON request body needed and some few requested parameters added to the URL address depending on the ednpoint we choose to call. One can do that using REST Client libraries available on several programming languages. AviationStack offers several API endpoints to choose from: Real-Time Flights: Look up flights in real-time Historical Flights: Look up historical flights Airline Routes: Look up airline routes Airports: Look up global airports Airlines: Look up global airlines Airplanes: Look up airplanes/aircrafts Aircraft Types: Look up aircraft types Aviation Taxes: Look up aviation taxes Cities: Look up global cities Countries: Look up countries Our demo will focus on the Real Time Flights Endpoint but all the others follow similar logic but with different parameters passed. For a complete and detailed list of endpoints and its parameters make sure you refer to AviationStack Quickstart guide (https://aviationStack.com/quickstart) // Real-Time Flights (For the free subscription the request should be done using http and not https in the link below) https://api.aviationstack.com/v1/flights ? access_key = YOUR_ACCESS_KEY // optional parameters: & limit = 100 & offset = 0 // more parameters available please refer to the API Documentation (https://aviationstack.com/documentation) // Real-Time Flights (For […]

Read More