Technology News Worth Reading

Here are a few technology news stories that I’ve read in the past week or so.

News Headlines

How to Convert a PDF to PNG or JPG in Java

This article reviews three Conversion APIs that will allow you to convert any PDF document into an image. This includes conversion to a PNG or JPG array with one image created per page in your document. The article also discusses how you can merge and stack your PDF pages for conversion into a single PNG, or “tall” image. The goal for this tutorial is to simplify and improve your versatility for document display and sharing. Furthermore, as most documents can be converted to PDF, you can apply these APIs to any file, post-PDF-conversion. Read the DZone article.

Popular JavaScript Frameworks to Build API and Microservices

This Dzone post discusses the most popular JavaScript frameworks used to build APIs and Microservices. Microservices and APIs are often being confused for each other. In reality, they are 2 separate concepts altogether, where API is a communication pattern and microservices are an architectural pattern. Read the DZone article.

How to Build Real-Time Notification Service Using Server-Sent Events (SSE)

Most of the communication on the Internet comes directly from the clients to the servers. The client usually sends a request, and the server responds to that request. There are some scenarios in which the server needs to send a message to the client without the preceding request. In such cases, developers have a couple of options: use short and long polling, webhooks, websockets, or event streaming platforms like Kafka. However, there is another technology, not popularized enough, which in many cases, is just perfect for the job. This technology is the Server-Sent Events (SSE) standard. Read the DZone article.

Facebook Announces Beta Messenger API Support for Instagram

Facebook announces updates to the Messenger API to support Instagram messaging, giving businesses new tools to manage their customer communications on Instagram at scale. The new API features enable businesses to integrate Instagram messaging with their preferred business applications and workflows; helping drive more meaningful conversations, increase customer satisfaction and grow sales. The updated API is currently in beta with a limited number of developer partners and businesses. Read the Facebook announcement.

IBM Unveils New Capabilities for Preserving Aging Infrastructure Using AI, 3D Modeling and Data Capture

IBM announces new capabilities in IBM Maximo for Civil Infrastructure to help prolong the lifespan of aging bridges, tunnels, highways, and railways. New enhancements include the ability to deploy on Red Hat OpenShift for hybrid cloud environments, as well as new AI and 3D model annotation tools that can provide deep industry and task-specific insights to support engineers. “Tools like AI, predictive maintenance, drones and hybrid cloud will play an important role in meeting the challenge of rising infrastructure costs, and helping these vital structures endure for future generations,” said Bjarne Jørgensen, Executive Director, Asset Management at Sund and Baelt. “These solutions can help determine the exact need for maintenance in near real-time to assist organizations in extending the lifetime of structures.” Read the press release.

13 Tools to Monitor Remote Teams (Plus Tips)

How do employers ensure that their remote teams remain productive? This is where remote monitoring tools come into the picture. Remote monitoring tools are an excellent way for companies to continue moving with the tide without compromising the productivity of their remote employees or micromanaging them. This DZone article discusses 13 of the most popular remote monitoring tools.

Building a C++ VCL Customer/Sales Master/Detail/Charting Application with 1 Line of Code

These days low-code development is en vogue. Various research groups, such as Gartner, put the low-code application development platform market at ~$10M billion in 2019 and project CAGR to be greater than 20% from 2020 to 2027. This post shows how you can build a Windows C++ Customer/Sales, Master/Detail/Charting application that only needs 1 line of code.

Things to consider when running visual tests in CI/CD pipelines

This blog post contains a summary of the author’s recent webinar and focuses on demos that show how to handle visual testing in CI/CD. The demos focused on 3 different CI/CD scenarios: Azure DevOps, GitHub Actions and Container Based Pipelines.

An Open Source Sorting Algorithms Visualizer

This GitHub project is a tool, made with python and pygame, for visualizing sorting algorithms in an educational way. The project’s purpose is to portray several sorting algorithms so the user can understand how a computer “move some pieces” to achieve the goal of having sorted data at the end!

A faster way to prototype your APIs using OpenAPI 3 and Swagger UI

The goal of this GitHub project is to create a generator that conveniently creates API definitions in the OpenAPI 3 format using marshmallow classes and saves them into a YAML file. You can think this project as programmable API definitions/documentation for your API (your API can be written in any language, not only in Python). Python is used here just for convenience of describing classes and has less code yet strong typing. Then you can inject the generated YAML file with Swagger UI to any project (just a page that renders Swagger UI HTML code which requests the generated YAML file).

Fun With SQL Using Postgres and Azure Data Studio

Azure Data Studio is a cross-platform database tool for data professionals using the Microsoft family of on-premises and cloud data platforms on Windows, macOS, and Linux. It is very easy to install and offers a modern editor experience with IntelliSense, code snippets, source control integration, and an integrated terminal. It’s engineered with the data platform user in mind, with the built-in charting of query result sets and customizable dashboards. You can learn more about it from the official website on this link. ADS also has notebooks that are similar to Jupiter notebooks for python and other languages and are great for combining formatted text with code. You can execute queries via a query window or via a notebook window. This post discusses some of the basics and at the same time shares the author’s experience using Azure Data Studio.

AppSec vs. DevSecOps, and what that means for developers

Traditional application security is different in two key ways from what has come to be known as DevSecOps. First, modern software companies are integrating application security into their DevOps pipelines, so security becomes part of the flow. Second, it’s also about DevOps being built into application security. In this SD Times article, Patrick Carey, who leads product strategy in the Software Integrity Group at security solutions provider Synopsys, explains these differences. By building application security into your automated development environment, he said, security “is initiated through events, rather than necessarily a phase where somebody at the end of the line, whose job it is to make sure that you didn’t screw up and code a vulnerability,” does the testing. On the other side of that coin, building DevOps into AppSec, eliminates the gates created by traditional DAST or pen-testing tools, creating instead guardrails that allow the team to move forward with relatively low friction but to stay on track. In the traditional gated pass-fail system, “if you fail you got your vulnerability report that just said you know there were a bunch of vulnerabilities, but oh, by the way we can’t tell you exactly where those are in your code; your developer’s going to have to go figure that out.”

5 edge computing predictions for 2021

The new business models that will push edge computing “from science project to real value” in 2021 are largely based around two factors, Forrester said: Cloud platforms having to compete with artificial intelligence, and the widespread proliferation of 5G will make edge use cases more practical. With those two drivers in mind, Forrester made five predictions about how the tech world will evolve in 2021 that will directly impact edge computing. Read the article that lists Forrester’s predictions.

Technology News Worth Reading

Here are a few technology news stories that I’ve read in the past week or so.

News Headlines

Cloud Native Computing Foundation Announces Rook Graduation

Rook is an open source cloud native storage orchestrator for Kubernetes, providing the platform, framework, and support for a diverse set of storage solutions to natively integrate with cloud native environments. Rook delivers its services via a Kubernetes Operator for each storage provider. It was originally accepted as a CNCF project in 2018. It is the thirteenth CNCF project, and the first project based on block, file, or object storage, to graduate. Read the announcement article

How is Robotics Changing the Healthcare Industry?

Robotics is changing the healthcare industry in a lot of fundamental ways. Robots can manage the monotonous and repetitive tasks while leaving the doctors and nurses free to do the critical tasks they were trained for. This article discusses the wide variety of applications that robotics has in healthcare to make the lives of both doctors and patients much easier. Read the article.

Looking for the Next Step in Cloud Performance? Look to Data Center Design

In the near future, data centers will need specialized storage and compute areas that are segregated from each other. For example, when designing a floor plan, it’s likely we’ll see data center operators walling off Compute-as-a-Service from Storage-as-a-Service. This can help solve issues around cooling, which is paramount to eliminating waste and improving performance. However, it doesn’t fully solve the issue of accessibility and latency speeds. Read the post.

Object Detection from 9 FPS to 650 FPS

This article is a practical deep dive into making a specific deep learning model (Nvidia’s SSD300) run fast on a powerful GPU server, but the general principles apply to all GPU programming. The SSD300 is an object-detection model trained on COCO, so output will be bounding boxes with probabilities for 81 classes of object.

Product Demo Sucks Because It’s Focused on Your Product

In this exclusive interview, Falcone shares the structure of a winning product demo and the tactics he’s discovered to convince people that they need your product in just one conversation. one of the easiest and biggest mistakes he sees is that companies don’t effectively craft their demo to fit their specific audience — i.e. they don’t distill their dozens of features and selling points into the few that will really resonate with this particular investor, prospect, or even prospective employee.

Computer Scientists Break Traveling Salesperson Record

In a paper posted online, Klein and his advisers at the University of Washington, Anna Karlin and Shayan Oveis Gharan, have finally achieved a goal computer scientists have pursued for nearly half a century: a better way to find approximate solutions to the traveling salesperson problem. Read the article. Read the paper.

The Gap: Where Machine Learning Education Falls Short

As the field of machine learning has become ever more popular, a litany of online courses has emerged claiming to teach the skills necessary to “build a career in AI”. But before signing up for such a course, you should know whether the skills acquired will directly allow you to apply machine learning better. These questions are not limited to online courses but rather encompass machine learning classes that have begun to fill lecture halls at many universities. Are these classes that students flock towards actually helping them achieve their practical goals? Read the article.

10 Popular Backend APIs

A Backend API is an Application Programming Interface that developers can use to integrate with backend services. A great place to find these APIs is in the Backend or Backend as a Service categories in the ProgrammableWeb API directory. This article gives details to the ten most popular Backend APIs on ProgrammableWeb, based on website traffic.

The unreasonable effectiveness of the Julia programming language

Six years ago, the author wrote about the enduring prominence of Fortran for scientific computing and compared it with several other languages. That article with a prediction that, in 10 years, a new language called Julia stood a good chance of becoming the one that scientists would turn to when tackling large-scale numerical problems. The author’s prediction was not very accurate, though. It actually only took Julia about half that time. Read the article.

Big Tech, Out-of-Control Capitalism and the End of Civilization

“Our digital era is a blend of “utopia and dystopia,” says Tristan Harris, who left Google to cofound The Center for Humane Technology (a phrase that sounds increasingly oxymoronic). “I can hit a button on my phone and a car shows up in 30 seconds and I can go exactly where I need to go. That is magic.” But Harris fears tech’s ill effects are outweighing its benefits. “If we don’t agree on truth,” he says, “or even that there is such a thing as truth, we’re toast.” Read the complete Scientific American article.

10 Best Text Annotation Tools and Services for Machine Learning

In the AI research and development industries, annotated data is gold. Large quantities of high-quality annotated data is a goldmine. On the other hand, sometimes finding or creating this data can be an expensive and arduous task for your team. Fortunately, there are a variety of text annotation tools and services available that can provide you with the data you need. Some of these services include entity extraction, part-of-speech tagging, sentiment analysis, and more. Read the DZone article.

30+ Tools List for GitOps

Speaking of the right tools for the job, there are countless tools to help you integrate the GitOps approach with your existing workflows. Some of the tools supporting GitOps are so popular that you may even be using it in your existing pipeline. To help you get started, here are the tools that we recommend if you want to incorporate GitOps. Read the post.

Using Python4Delphi with C++Builder VCL applications

Some C++ developers also use Python for their application development. There are several ways to integrate the two languages together. One way is to create Python extension modules containing C++ functions that implement new object types and functions. Another way is to use the Boost Python C++ library that enables interoperability between the Python and C++ languages. A third way is to use the productivity, resusability, and encapsulation of components to to integrate C++Builder and Python. In this chapter you’ll learn how to use the Python4Delphi open source components in your VCL applications.

Introduction to Python4Delphi (and C++Builder)

Python for Delphi (P4D) is a set of free components (MIT Open Source License), created by Kiriakos Vlahos author of the popular PyScripter Python IDE, that wrap up the Python DLL into Delphi. The components allow you to create or extend your Delphi and C++Builder applications to execute Python scripts, create new Python modules and new Python types. You can also create Python extensions as DLLs and much more.

You’ll find Python4Delphi on GitHub at https://github.com/pyscripter/python4delphi. The GitHub project includes a readme file, installation notes, supported platforms, how Python4Delphi finds your Python distributions, tutorials and demos.

Jim McKeeth recently hosted a webinar with Kiriakos, “Python for Delphi Developers Part 1 – Introduction” (replay is available on YouTube). A Part 2 Python for Delphi Developers will take place on Wednesday, October 14, 2020 at 7am Pacific Time. While this webinar series focuses on Delphi programming, it also provides information about the Python4Delphi components and Python programming that can help C++Builder developers.

While the webinar and Python4Delphi speaks to Delphi developers, C++Builder developers can compile and install the components for use in their Win32 and Win64 C++ VCL applications. To build and install the Python4Delphi components you can use all editions of C++Builder (community, professional, enterprise and architect) and RAD Studio (professional, enterprise and architect) for versions 10.3.3, 10.4 and 10.4.1. If you only have C++Builder, you’ll learn how to use the included Delphi DCC32 and DCC64 command line compilers to build the Delphi component package project and install the components.

Installing Python for Windows (32 and 64 bit)

Before you start using the Python4Delphi components in your C++Builder VCL applications you’ll need to make sure you have Python for Win32 and Win64 installed on your computer.

You can download and install releases of Python from the Python.org web site. For Win32 and Win64 you will find installers at https://www.python.org/downloads/windows/

To find Python distributions installed on your computer, use the “where python.exe” Windows command.

By default, Python for Win32 installs into the C:\Users\david\AppData\Local\Programs\Python\Python39-32\ folder (or wherever you tell the install to put the distribution).

By default, Python for Win64 installs into the C:\Users\david\AppData\Local\Programs\Python\Python39\ folder (or wherever you tell the install to put the distribution).

Installing Python4Delphi and Using the Components

The following are the steps I followed to download and build the Python4Delphi components for use with C++Builder 10.3.3, 10.4 and 10.4.1. While I used RAD Studio (which includes C++Builder and Delphi), you can also use C++Builder along with the Delphi command line compilers to compile and install the components.

Step 1 – Download the latest release of the Python4Delphi

Grab the python4delphi-master.zip file (https://github.com/pyscripter/python4delphi) and unzip it to your hard drive (I put it in my C:\Users\david\Documents\Embarcadero\Studio\Projects/ folder).

Step 2 – In the IDE open the Python_D package project file (RAD Studio editions)

In the C++Builder 10.4.1 RAD Studio IDE, open the Python_D.dproj package project file (you’ll find it in the “python4delphi-master\Packages\Delphi\Delphi 10.4+” folder).

Step 3 – Add an $IFDEF around the requires DesignIDE unit

Look at the Python_D.dpk source file, if you don’t see an $IFDEF around the DesignIDE unit, add it to avoid a compiler error when using the Win64 C++ compiler – DesignIDE is only required for Win32 since the IDE is a 32-bit Windows app.

Notice (in the source code above) that the LibSuffix Delphi compiler directive is set to “AUTO”. This can be done in source code or in the Project | Options | Description page (in the image below) to match the package file suffix with other compiled package files. The suffix is applied before the file extension. In drop down list, you can select the $(Auto) option for the suffix to represent the compiler version suffix for binary package files.

There is a separate Python_D.dpk package source file for versions 10.3 and earlier in the “python4delphi-master\Packages\Delphi\Delphi 10.3-” folder. In this package source file there are $IFDEFs to set the LIBSUFFIX for several recent Delphi compiler releases.

If you are going to use this earlier Python_D.dpk project you may need to comment out (or remove) the “{$R *.res}” statement at the front of the package source file (it may have already been removed in the latest commit of Python4Delphi).

Step 4a – Build and Install the Python4Delphi components with RAD Studio

There are two ways to build and install the components depending on whether you have RAD Studio or one of the C++Builder editions. If you only have C++Builder skip to “Step 4b” to learn how to use the Delphi command line compilers for Win32 and Win64.

Set the Python4Delphi Project Options for the Delphi Compiler | C/C++ Output file generation for Win32 and Win64 platform (all configurations – debug and release). Build and Install the Python4Delphi components for Win32 and Win64 targets.

Building and installing the components will make sure you have the generated C++ header files, package import library files and package static library files for your C++ VCL Win32 and Win64 projects.

From the help file: the “Generate all C++Builder files (including package libs)” option generates the package and all Delphi pieces, along with all necessary header files (.hpp), package import library file (.bpi), and package static library file (.lib and .a) for C++ projects. This is the default in desktop platforms.

Set the Delphi Compiler Search Path to include the Python4Delphi source directory so that the compiler will find any required include files and other files.

Step 4b – Use the Delphi command line compilers to Build and Installing the components

You can use batch files (or other script files) that run the Delphi command line compilers for Win32 (DCC32.exe) and Win64 (DCC64.exe). These Delphi compilers (included in the bin folder) will build the Python4Delphi package file and create the C++ header files, compiled package file, static library and other files required for use in your C++ applications.

CompilePython4DelphiPackage4Win32.bat

@ECHO OFF
ECHO Compiling Python4Delphi Component Package for Win32
dcc32 Python_D.dpk ^
-I"C:\Users\david\Documents\Embarcadero\Studio\Projects\Python4Delphi\python4delphi-master\Source" ^
-LE"C:\Users\Public\Documents\Embarcadero\Studio\20.0\Bpl" ^
-LN"C:\Users\Public\Documents\Embarcadero\Studio\20.0\Dcp" ^
-NH"C:\Users\Public\Documents\Embarcadero\Studio\20.0\hpp\Win32" ^
-NB"C:\Users\Public\Documents\Embarcadero\Studio\20.0\Dcp" ^
-E"C:\Users\Public\Documents\Embarcadero\Studio\20.0\Dcp" ^
-JL ^
--lib-suffix:260 ^
-NSsystem;vcl;winapi;system.win ^
-u"c:\program files (x86)\embarcadero\studio\20.0\lib\win32\release"

move /y "C:\Users\david\Documents\Embarcadero\Studio\Projects\Python4Delphi\python4delphi-master\Packages\Delphi\Delphi 10.3-\Python_D.lib" "C:\Users\Public\Documents\Embarcadero\Studio\20.0\Dcp\Python_D.lib"

ECHO Completed Python4Delphi Component Package Win32
pause

CompilePython4DelphiPackage4Win64.bat

@ECHO OFF
ECHO Compiling Python4Delphi Component Package for Win64
dcc64 Python_D.dpk ^
-I"C:\Users\david\Documents\Embarcadero\Studio\Projects\Python4Delphi\python4delphi-master\Source" ^
-LE"C:\Users\Public\Documents\Embarcadero\Studio\20.0\Bpl\Win64" ^
-LN"C:\Users\Public\Documents\Embarcadero\Studio\20.0\Dcp\Win64" ^
-NH"C:\Users\Public\Documents\Embarcadero\Studio\20.0\hpp\Win64" ^
-NB"C:\Users\Public\Documents\Embarcadero\Studio\20.0\Dcp\Win64" ^
-E"C:\Users\Public\Documents\Embarcadero\Studio\20.0\Dcp\Win64" ^
-JL ^
--lib-suffix:260 ^
-NSsystem;vcl;winapi;system.win ^
-u"c:\program files (x86)\embarcadero\studio\20.0\lib\win64\release"

move /y "C:\Users\david\Documents\Embarcadero\Studio\Projects\Python4Delphi\python4delphi-master\Packages\Delphi\Delphi 10.3-\Python_D.a" "C:\Users\Public\Documents\Embarcadero\Studio\20.0\Dcp\Win64\Python_D.a"

ECHO Completed Python4Delphi Component Package Win64
pause

Install he Python4Delphi Package

In the C++Builder IDE, use the Components | Install Packages menu item and click the “Add…” button.

Navigate to the C:\Users\Public\Documents\Embarcadero\Studio\21.0\Bpl folder (the number will depend on which version of C++Builder you have) and select the Design time package (BPL) file and click the Open button. This will add the package and components to the IDE. You’ll now see “Components for Python” in the list of Design time packages. Highlight the entry and click the Components button to display the list of components in the package.

Step 4c – Verify that the generated Python4Delphi files for C++ use are generated

After you compile the Python4Delphi package project for Win32 and Win64 target platforms the following files will be generated:

C:\Users\Public\Documents\Embarcadero\Studio\21.0\hpp\Win32
Python_D.hpp
PythonEngine.hpp
PythonGUIInputOutput.hpp
MethodCallBack.hpp
WrapDelphi.hpp
C:\Users\Public\Documents\Embarcadero\Studio\21.0\hpp\Win64
Python_D.hpp
PythonEngine.hpp
PythonGUIInputOutput.hpp
MethodCallBack.hpp
WrapDelphi.hpp
C:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp
Python_D.bpi
Python_D.dcp
Python_D.lib
C:\Users\Public\Documents\Embarcadero\Studio\21.0\Dcp\Win64
Python_D.a
Python_D.bpi
Python_D.dcp
C:\Users\Public\Documents\Embarcadero\Studio\21.0\Bpl
Python_D270.bpl
C:\Users\Public\Documents\Embarcadero\Studio\21.0\Bpl\Win64
Python_D270.bpl
Python_D270.rsm

In the IDE you’ll now see the components in the Component Palette window.

Building Your First C++Builder Python4Delphi VCL Application

Using RAD Studio, I opened the Python4Delphi Demo1 Delphi project and tested it to make sure that I had the components and Python working. C:\Users\david\Documents\Embarcadero\Studio\Projects\Python4Delphi\python4delphi-master\Demos\Demo01

Use File | New | C++Builder VCL application to create a starting C++Builder project (note: the source code for the project is in a zip file listed in the References section). I copied all of the components from the Delphi version of the Demo01 form file.

Demo01Unit.dfm file

object Form2: TForm2
  Left = 0
  Top = 0
  Caption = 'Demo 01 Python (C++, VCL)'
  ClientHeight = 344
  ClientWidth = 534
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Splitter1: TSplitter
    Left = 0
    Top = 153
    Width = 534
    Height = 3
    Cursor = crVSplit
    Align = alTop
    Color = clBtnFace
    ParentColor = False
    ExplicitWidth = 536
  end
  object Memo1: TMemo
    Left = 0
    Top = 156
    Width = 534
    Height = 144
    Align = alClient
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Consolas'
    Font.Pitch = fpVariable
    Font.Style = []
    Lines.Strings = (
      'print(2+2)')
    ParentFont = False
    ScrollBars = ssBoth
    TabOrder = 0
  end
  object Panel1: TPanel
    Left = 0
    Top = 300
    Width = 534
    Height = 44
    Align = alBottom
    BevelOuter = bvNone
    TabOrder = 1
    object Button1: TButton
      Left = 0
      Top = 6
      Width = 115
      Height = 25
      Caption = 'Execute script'
      TabOrder = 0
      OnClick = Button1Click
    end
    object Button2: TButton
      Left = 167
      Top = 6
      Width = 91
      Height = 25
      Caption = 'Load script...'
      TabOrder = 1
      OnClick = Button2Click
    end
    object Button3: TButton
      Left = 264
      Top = 8
      Width = 89
      Height = 25
      Caption = 'Save script...'
      TabOrder = 2
      OnClick = Button3Click
    end
  end
  object Memo2: TMemo
    Left = 0
    Top = 0
    Width = 534
    Height = 153
    Align = alTop
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Consolas'
    Font.Pitch = fpVariable
    Font.Style = []
    ParentFont = False
    ScrollBars = ssBoth
    TabOrder = 2
  end
  object PythonEngine1: TPythonEngine
    IO = PythonGUIInputOutput1
    Left = 32
    Top = 32
  end
  object OpenDialog1: TOpenDialog
    DefaultExt = '*.py'
    Filter = 'Python files|*.py|Text files|*.txt|All files|*.*'
    Title = 'Open'
    Left = 240
    Top = 32
  end
  object SaveDialog1: TSaveDialog
    DefaultExt = '*.py'
    Filter = 'Python files|*.py|Text files|*.txt|All files|*.*'
    Title = 'Save As'
    Left = 328
    Top = 32
  end
  object PythonGUIInputOutput1: TPythonGUIInputOutput
    UnicodeIO = True
    RawOutput = False
    Output = Memo2
    Left = 128
    Top = 32
  end
end

Demo01Unit.h file

//---------------------------------------------------------------------------

#ifndef Demo01UnitH
#define Demo01UnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include "PythonEngine.hpp"
#include <Vcl.Dialogs.hpp>
#include <Vcl.ExtCtrls.hpp>
#include "PythonGUIInputOutput.hpp"
//---------------------------------------------------------------------------
class TForm2 : public TForm
{
__published:	// IDE-managed Components
	TSplitter *Splitter1;
	TMemo *Memo1;
	TPanel *Panel1;
	TButton *Button1;
	TButton *Button2;
	TButton *Button3;
	TMemo *Memo2;
	TPythonEngine *PythonEngine1;
	TOpenDialog *OpenDialog1;
	TSaveDialog *SaveDialog1;
	TPythonGUIInputOutput *PythonGUIInputOutput1;
	void __fastcall Button1Click(TObject *Sender);
	void __fastcall Button2Click(TObject *Sender);
	void __fastcall Button3Click(TObject *Sender);
private:	// User declarations
public:		// User declarations
	__fastcall TForm2(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm2 *Form2;
//---------------------------------------------------------------------------
#endif

Next, add OnClick event handlers for the 3 buttons.

Demo01Unit.cpp file

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Demo01Unit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "PythonEngine"
#pragma link "PythonGUIInputOutput"
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
	PythonEngine1->ExecStrings( Memo1->Lines );
}
//---------------------------------------------------------------------------

void __fastcall TForm2::Button2Click(TObject *Sender)
{
	if (OpenDialog1->Execute()) {
		Memo1->Lines->LoadFromFile( OpenDialog1->FileName );
	}
}
//---------------------------------------------------------------------------

void __fastcall TForm2::Button3Click(TObject *Sender)
{
	if (SaveDialog1->Execute()) {
		Memo1->Lines->SaveToFile( SaveDialog1->FileName );
	}
}
//---------------------------------------------------------------------------

Save the project to a folder.

Compile and Run the C++ VCL Demo program and try some Python code

In the TMemo at the bottom of the form, type in some Python code. In my example I print the sum of two numbers, print the value of Pi from the Python math library and print the Python version # from the Python platform library. You can also use the Load and Save script buttons to bring up dialog boxes to load and save Python script files. Click the Execute script button to see the results show up in the upper TMemo.

References

Python4Delphi and PyScripter

Python4Delphi on GitHub by Kiriakos Vlahos – https://github.com/pyscripter/python4delphi

Webinar Replay – Python for Delphi Developers – Part 1 – Introduction – https://blogs.embarcadero.com/webinar-replay-python-for-delphi-developers-part-1-introduction/

PyScripter on GitHub by Kiriakos Vlahos – https://github.com/pyscripter/pyscripter

Python for Windows

Python Releases for Windows (python.org) – https://www.python.org/downloads/windows/

Embarcadero DocWiki

Creating Packages and DLLs – http://docwiki.embarcadero.com/RADStudio/en/Creating_Packages_and_DLLs

Project | Options | Output – C/C++ – http://docwiki.embarcadero.com/RADStudio/en/Output_-_C/C%2B%2B

Project | Options | Description – http://docwiki.embarcadero.com/RADStudio/en/Descripti

Package Files Created by Compiling – http://docwiki.embarcadero.com/RADStudio/en/Package_Files_Created_by_Compiling

DCC32.EXE, the Delphi Command Line Compiler – http://docwiki.embarcadero.com/RADStudio/en/DCC32.EXE,_the_Delphi_Command_Line_Compiler

DCC64.EXE, the Delphi 64-bit Command Line Compiler – http://docwiki.embarcadero.com/RADStudio/en/DCC64.EXE,_the_Delphi_64-bit_Command_Line_Compiler

Delphi 32-bit compiler (DCC32.exe) cmd line help (from C++Builder Community Edition 10.3.3)

Embarcadero Delphi for Win32 compiler version 33.0
Copyright (c) 1983,2018 Embarcadero Technologies, Inc.

Syntax: dcc32 [options] filename [options]

  -A<unit>=<alias> = Set unit alias
  -B = Build all units             
  -CC = Console target             
  -CG = GUI target                 
  -D<syms> = Define conditionals   
  -E<path> = EXE/DLL output directory
  -F<offset> = Find error          
  -GD = Detailed map file          
  -GP = Map file with publics      
  -GS = Map file with segments     
  -H = Output hint messages        
  -I<paths> = Include directories  
  -J = Generate .obj file          
  -JPHNE = Generate C++ .obj file, .hpp file, in namespace, export all
  -JL = Generate package .lib, .bpi, and all .hpp files for C++
  -K<addr> = Set image base addr   
  -LE<path> = package .bpl output directory
  -LN<path> = package .dcp output directory
  -LU<package> = Use package       
  -M = Make modified units         
  -NU<path> = unit .dcu output directory
  -NH<path> = unit .hpp output directory
  -NO<path> = unit .obj output directory
  -NB<path> = unit .bpi output directory
  -NX<path> = unit .xml output directory
  -NS<namespaces> = Namespace search path
  -O<paths> = Object directories   
  -P = look for 8.3 file names also
  -Q = Quiet compile               
  -R<paths> = Resource directories 
  -TX<ext> = Output name extension 
  -U<paths> = Unit directories     
  -V = Debug information in EXE    
  -VR = Generate remote debug (RSM)
  -VT = Debug information in TDS   
  -VN = TDS symbols in namespace   
  -W[+|-|^][warn_id] = Output warning messages
  -Z = Output 'never build' DCPs   
  -$<dir> = Compiler directive     
  --help = Show this help screen   
  --version = Show name and version
  --codepage:<cp> = specify source file encoding
  --default-namespace:<namespace> = set namespace
  --depends = output unit dependency information
  --doc = output XML documentation 
  --drc = output resource string .drc file
  --no-config = do not load default dcc32.cfg file
  --description:<string> = set executable description
  --inline:{on|off|auto} = function inlining control
  --legacy-ifend = allow legacy $IFEND directive
  --zero-based-strings[+|-] = strings are indexed starting at 0
  --peflags:<flags> = set extra PE Header flags field
  --peoptflags:<flags> = set extra PE Header optional flags field
  --peosversion:<major>.<minor> = set OS Version fields in PE Header (default: 5.0)
  --pesubsysversion:<major>.<minor> = set Subsystem Version fields in PE Header (default: 5.0)
  --peuserversion:<major>.<minor> = set User Version fields in PE Header (default: 0.0)
  --lib-version:<version> = Output package name version
  --lib-suffix:<suffix> = Output package name suffix
Compiler switches: -$<letter><state> (defaults are shown below)
  A8  Aligned record fields         
  B-  Full boolean Evaluation       
  C+  Evaluate assertions at runtime
  D+  Debug information             
  G+  Use imported data references  
  H+  Use long strings by default   
  I+  I/O checking                  
  J-  Writeable structured consts   
  L+  Local debug symbols           
  M-  Runtime type info             
  O+  Optimization                  
  P+  Open string params            
  Q-  Integer overflow checking     
  R-  Range checking                
  T-  Typed @ operator              
  U-  Pentium(tm)-safe divide       
  V+  Strict var-strings            
  W-  Generate stack frames         
  X+  Extended syntax               
  Y+  Symbol reference info         
  Z1  Minimum size of enum types    
Stack size: -$M<minStackSize[,maxStackSize]> (default 16384,1048576)

Delphi 64-bit compiler (DCC64.exe) cmd line help (C++Builder Community Edition 10.3.3)

Embarcadero Delphi for Win64 compiler version 33.0
Copyright (c) 1983,2018 Embarcadero Technologies, Inc.

Syntax: dcc64 [options] filename [options]

  -A<unit>=<alias> = Set unit alias
  -B = Build all units             
  -CC = Console target             
  -CG = GUI target                 
  -D<syms> = Define conditionals   
  -E<path> = EXE/DLL output directory
  -F<offset> = Find error          
  -GD = Detailed map file          
  -GP = Map file with publics      
  -GS = Map file with segments     
  -H = Output hint messages        
  -I<paths> = Include directories  
  -J = Generate .obj file          
  -JPHNE = Generate C++ .obj file, .hpp file, in namespace, export all
  -JL = Generate package .lib, .bpi, and all .hpp files for C++
  -K<addr> = Set image base addr   
  -LE<path> = package .bpl output directory
  -LN<path> = package .dcp output directory
  -LU<package> = Use package       
  -M = Make modified units         
  -NU<path> = unit .dcu output directory
  -NH<path> = unit .hpp output directory
  -NO<path> = unit .obj output directory
  -NB<path> = unit .bpi output directory
  -NX<path> = unit .xml output directory
  -NS<namespaces> = Namespace search path
  -O<paths> = Object directories   
  -P = look for 8.3 file names also
  -Q = Quiet compile               
  -R<paths> = Resource directories 
  -TX<ext> = Output name extension 
  -U<paths> = Unit directories     
  -V = Debug information in EXE    
  -VR = Generate remote debug (RSM)
  -VT = Debug information in TDS   
  -VN = TDS symbols in namespace   
  -W[+|-|^][warn_id] = Output warning messages
  -Z = Output 'never build' DCPs   
  -$<dir> = Compiler directive     
  --help = Show this help screen   
  --version = Show name and version
  --codepage:<cp> = specify source file encoding
  --default-namespace:<namespace> = set namespace
  --depends = output unit dependency information
  --doc = output XML documentation 
  --drc = output resource string .drc file
  --no-config = do not load default dcc64.cfg file
  --description:<string> = set executable description
  --inline:{on|off|auto} = function inlining control
  --legacy-ifend = allow legacy $IFEND directive
  --zero-based-strings[+|-] = strings are indexed starting at 0
  --peflags:<flags> = set extra PE Header flags field
  --peoptflags:<flags> = set extra PE Header optional flags field
  --peosversion:<major>.<minor> = set OS Version fields in PE Header (default: 5.0)
  --pesubsysversion:<major>.<minor> = set Subsystem Version fields in PE Header (default: 5.0)
  --peuserversion:<major>.<minor> = set User Version fields in PE Header (default: 0.0)
  --lib-version:<version> = Output package name version
  --lib-suffix:<suffix> = Output package name suffix
Compiler switches: -$<letter><state> (defaults are shown below)
  A8  Aligned record fields         
  B-  Full boolean Evaluation       
  C+  Evaluate assertions at runtime
  D+  Debug information             
  G+  Use imported data references  
  H+  Use long strings by default   
  I+  I/O checking                  
  J-  Writeable structured consts   
  L+  Local debug symbols           
  M-  Runtime type info             
  O+  Optimization                  
  P+  Open string params            
  Q-  Integer overflow checking     
  R-  Range checking                
  T-  Typed @ operator              
  V+  Strict var-strings            
  W-  Generate stack frames         
  X+  Extended syntax               
  Y+  Symbol reference info         
  Z1  Minimum size of enum types    
Stack size: -$M<minStackSize[,maxStackSize]> (default 16384,1048576)

C++ Demo project and Delphi command line package build batch files (zip file)

A zip file is available for download at http://davidi.com/code/Python4DelphiDemo01.zip

Technology News Worth Reading

Here are a few technology news stories that I’ve read in the past week or so.

News Headlines

Microsoft’s 10 app store principles to promote choice, fairness and innovation

For software developers, app stores have become a critical gateway to some of the world’s most popular digital platforms. We and others have raised questions and, at times, expressed concerns about app stores on other digital platforms. However, we recognize that we should practice what we preach. So, today, we are adopting 10 principles – building on the ideas and work of the Coalition for App Fairness (CAF) – to promote choice, ensure fairness and promote innovation on Windows 10, our most popular platform, and our own Microsoft Store on Windows 10. Read Microsoft’s blog post.

PostMan’s 2020 State of the API Report

Every year, Postman surveys industry members to get a picture of the API industry—to understand who is working with APIs, how they are getting their work done, and where they see the industry going. More than 13,500 developers, testers, executives, and others took our 2020 survey and provided insights on everything from how they spend their time to what they see as the biggest issues and opportunities for APIs. Three key findings: API investments stay strong, The pandemic has changed the world, but it didn’t stop APIs, and APIs are the nucleus of digital transformation. Read and download the report on the Postman website.

Hybrid cloud is where the action is

Multicloud is definitely a thing. However, it’s not exactly clear what that “thing” is. According to new survey data from database vendor MariaDB, 71% of survey respondents report running databases on at least two different cloud providers today. Yet when asked what would keep them from going all in on a cloud database, a vendor’s “lack of a multicloud offering” ranked dead last. In other words, everyone is doing multicloud, but no one knows why. Read Matt Assay’s InfoWorld article.

Nvidia claims Cambridge-1 is the U.K.’s fastest supercomputer

Cambridge-1, which Nvidia expects to come online by year-end 2020, is a joint project between GSK, AstraZeneca, Guy’s and St Thomas’ NHS Foundation Trust, King’s College London, and Oxford Nanopore. Built on Nvidia’s DGX SuperPOD architecture, it’s anticipated to deliver over 400 petaflops of AI performance and 8 petaflops of Linpack performance. That would rank it 29th on the TOP500 list of the world’s most powerful supercomputers and among the top three most-energy-efficient machines in the Green500. Read Kyle Wiggers’ VentureBeat article.

Survey finds cloud complexity increases challenges

Aptum’s Global Cloud Impact Study reveals this with 62 percent of respondents citing complexity and abundance of choice as a hindrance when planning a cloud transformation. One of the biggest sources of complexity that crops up in more advanced cloud projects are legacy systems. The “abundance of choice” or the need to select the best of breed is a prime culprit. This usually results in a technological smorgasbord, where hundreds of decoupled cloud dev and migration teams make their own calls around what technology to use. Complexity naturally arises when it’s time to join and coordinate those apples and oranges. Read David Linthicum’s InfoWorld article.

The art of code reviews

According to Phil Hughes, front-end engineer at GitLab, it’s about how you provide and convey that feedback — and that’s an art form and a skill that is learned over time. “Reviewing code efficiently is a skill that gets learned the more you do it. Spending time coming up with a workflow that works for yourself is just as important”. Read the SD Times article by Christina Cardoza.

An AI can simulate an economy millions of times to create fairer tax policy

Scientists at the US business technology company Salesforce think AI can help. Led by Richard Socher, the team has developed a system called the AI Economist that uses reinforcement learning—the same sort of technique behind DeepMind’s AlphaGo and AlpahZero—to identify optimal tax policies for a simulated economy. The tool is still relatively simple (there’s no way it could include all the complexities of the real world or human behavior), but it is a promising first step toward evaluating policies in an entirely new way. “It would be amazing to make tax policy less political and more data driven,” says team member Alex Trott. Read the MIT Technology Review article by Will Douglas Heaven.

The most valuable software developer skills in 2020

Which developer skills are the most valuable in today’s market? We’ve pored through the data to find the most bankable developer skills for the coming years—and how best to set yourself up for success in a fraught job market: Don’t put all your eggs in one basket, Some skills are hotter than others, Going cloud native, Ordering the full stack, Data is still the new oil, and Formal education isn’t everything. Read the InfoWorld article by By Scott Carey.

Justices wary of upending tech industry in Google v. Oracle Supreme Court fight

The dispute concerns about 11,500 lines of code that Google used to build its popular Android mobile operating system, which were replicated from the Java application programming interface developed by Sun Microsystems. At the end of an hour and a half of arguments, Justice Stephen Breyer, who at one point read aloud some code, seemed to be the only sure vote. Several of the other justices, including Chief Justice John Roberts, suggested they were sympathetic to Oracle’s copyright claims. Several of the court’s conservatives, including Justices Brett Kavanaugh and Samuel Alito, noted that Google’s allies had warned that the “sky will fall” if Oracle won. But those comments were also peppered with skepticism. “I’m not aware that the sky has fallen in the last five or six years,” Kavanaugh said, noting that Google had lost its first appeals court battle in the case in 2014. Read the CNBC article by Tucker Higgins.

Section 230 will be on the Chopping Block at the Next Big US Congressional Hearing

Will Section 230 be on the chopping block at the next US congressional tech hearing. Hearing will focus on Section 230 of the Communications Decency Act, the key law that shields online platforms from legal liability for the content their users create. What is clear: Tinkering with such a foundational law could have a huge cascade of effects for the internet as we know it and isn’t something to be undertaken lightly — if at all. Read the TechCrunch article by Taylor Hatmaker.

To the moon and beyond: How HoloLens 2 is helping build NASA’s Orion spacecraft

When workers for Lockheed Martin began assembling the crew seats for a spacecraft designed to return astronauts to the moon and pave the way for human exploration to Mars, they had no need for paper instructions or tablet screens to work from. Everything they needed to see, including animations of how pieces fit together, engineering drawings and torque values for tightening bolts, was visible in HoloLens 2 devices that they wore. Read the TechXplore article by Jennifer Langston, Microsoft.

Affordable AI: Nvidia Launches $59, 2GB Jetson Nano Computer

While Raspberry Pi boards are great for doing all kinds of tasks and they’re capable of doing object recognition, they can be a little slow when it comes to real-time image recognition. In 2019, Nvidia came out with an A.I.-focused Pi competitor in the $99 Jetson Nano. Fast forward to 2020 and Nvidia is back with a 2GB version of the Jetson Nano that sells for a more reasonable $59 and, for consumers in some markets (including America), comes with a compatible USB Wi-Fi dongle in the box. Due out later this month, the new Nvidia Jetson Nano 2GB is designed to make A.I. more accessible to hobbyists, kids and aspiring developers. Read the Toms Harware article by Avram Piltch.

Microsoft’s VS Code comes to Raspberry Pi and Chromebook – new v1.50 update is out

An official Microsoft build of the Visual Studio Code editor is now available for Linux Armv7 and Arm64 architecture devices, extending Microsoft’s popular cross-platform code editor to Chromebooks, the Raspberry Pi and rival Arm-based single-board Linux computers such as Odroid. Read the ZDNet article by Liam Tung.

Why Apple needed the FDA to sign off on its EKG but not its blood oxygen monitor

The features on the Apple Watch that track heart rate and heart rhythm, though, have a key difference from the blood oxygen monitor: the heart-tracking features are cleared by the Food and Drug Administration (FDA), and the oxygen monitor is not. Apple went through a long, extensive process to develop and validate an EKG feature so that the watch could detect a condition called atrial fibrillation. It didn’t need to do the same thing for the pulse oximeter. Blood oxygen monitors, or pulse oximeters, are considered Class II medical devices by the FDA. Read TheVerge article by Nicole Wetsman.

JDK 16: What’s coming in Java 16 (due March 2021)

Java Development Kit (JDK) 16 has begun to take shape, with proposed features including concurrent thread-stack processing for garbage collection, support for C++ 14 language features, and an “elastic metaspace” capability to more quickly return unused class metadata memory to the OS. Read the InfoWorld article by Paul Krill.

Microsoft launches Playwright for Python for automating testing

Microsoft is trying to make it easier for developers to automate their end-to-end tests. The company has announced a preview of Playwright for Python, which allows developers and testers to write such tests in Python. According to Microsoft, automated end-to-end tests have become more important than ever as teams build apps that run on a number of different kinds of devices. The increase in the number of targets coupled with increased delivery speed has put more pressure on the testing process, and automation is crucial to enable testing at the speed it needs to be done. Playwright for Python provides timeout-free automation, which makes it more reliable. Read the SD Times article by Jenna Sargent.

Definitely not Windows 95: What operating systems keep things running in space?

To deal with unforgiving deadlines, spacecraft like Solar Orbiter are almost always run by real-time operating systems that work in an entirely different way than the ones you and I know from the average laptop. Operating systems used in space add at least one more central criterion: a computation needs to be done correctly within a strictly specified deadline. When a deadline is not met, the task is considered failed and terminated. And in spaceflight, a missed deadline quite often means your spacecraft has already turned into a fireball or strayed into an incorrect orbit. There’s no point in processing such tasks any further; things must adhere to a very precise clock. Read the ArsTechnica article by Jacek Krywko.

GitHub Code scanning is now available!

One year ago, GitHub welcomed Semmle. We’ve since worked to bring the revolutionary code analysis capabilities of its CodeQL technology to GitHub users as a native capability. At GitHub Satellite in May, we released the first beta of our native integration: code scanning. Now, thanks to the thousands of developers in the community who tested and gave feedback, we’re proud to announce that code scanning is generally available. Read the GitHub blog post by Justin Hutchings.

4 common C programming mistakes — and 5 tips to avoid them

Common C mistake: Not freeing malloc-ed memory (or freeing it more than once). Common C mistake: Reading an array out of bounds. Common C mistake: Not checking the results of malloc. Common C mistake: Using void* for generic pointers to memory. Read the InfoWorld article by Serdar Yegulalp.