Ian’s Oct 2024 Meeting Summary

  • Microsoft Power Automate – Martin Hamilton
  • Web Assembly from pascal – Ian Hamilton
  • The Sex Life of Functions – Paul McGee

Ian’s Summary

Welcome and News

This was back to just a virtual meeting, with all attendees on-line. The meeting began with the usual housekeeping. Issues with the previous meeting were discussed and the venue is supposed to be improving the wifi.

The agenda for the day had 2 sessions listed at different times compared to the provisional agenda published previously and Jason pointed out the contributors can ask for particular slots, if they want to. As usual, there are not enough offers in talks and planning for the next couple of meetings. He is hoping to arrange a talk from a security expert. On the subject of permissions for screen recordings of sessions, while they were previously just for group members, permission can now be granted for public viewing.

Access to the summer series of Delphi webinars is through the CodeGear website, instead of, or perhaps as well as, the Embarcadero site. There was a question about new books on Delphi, to which a response can be found in the Slack channel.

Microsoft Power Automate – Martin Hamilton

The first scheduled talk of the day was given by Martin Hamilton on the subject of Microsoft Power Automate.

Power Automate is a part of Microsoft’s Power Apps suite and provides a mainly graphical way to build automated processes in Windows. It comes in 2 versions, Desktop and Business, although Martin was concentrating on the Desktop version in this presentation. Power Automate for Desktop comes pre-installed on Windows 11 and can be installed on Windows 10. The business version runs in the cloud and has more facilities than the desktop version, providing more ways to trigger a Flow and access to more external entities.

A program or process is called a Flow and is made up of Blocks. Flows are made by dragging and dropping Blocks to build a sequence of activities. Blocks can be as simple as adding 2 variables together, or as complex as loading a web page. Types of Block were listed and described.

Martin then moved on to a demonstration of the desktop version, which looks like it is running in a browser. The initial view shows Home, MyFlows and Examples, showing your existing Flows by default. From this form, it is possible to either edit or run an existing Flow, or create a new one. The Flow management form has 3 elements, a list available Blocks on the left, The details of the Flow on the main panel in the centre and variables on the right. In the centre, Blocks can be added, removed and edited. Actions to create Blocks can be recorded for automated processes.

Working through a Flow to send an email, The first Block, or Action, opened Excel, the second extracted data from a worksheet and the third pasted the data into an email and sent it. The second example involved extracting text from a pdf and pasting it into Excel. This Flow was built from scratch, to show the whole process.

The first Block would open a pdf file and extract text from it, so, in the list of available Blocks on the left panel, the PDF item was expanded to show the available Actions for PDFs, which included an option to extract text. Dragging this onto the Flow panel pops up a properties form for the Block. Text found in the file is displayed in a selection window, so that the required bits can be identified. The extracted text will be placed in a Flow variable. Breakpoints can be set in the process, so that it can be followed.

From the Excel options on the left, 3 Blocks were dragged onto the Flow panel, one to open Excel, one to paste the data and one to save and close Excel. The data could be previewed and processed. A finished version of the Flow was then shown, which had some data manipulation processes performed on the data before it was pasted into the worksheet. Martin went through the various processes performed.

The final example was on browser automation, launching a browser, loading a web page and scraping some information from it. This was again done by building a new Flow from scratch. In the preview window, areas of the page could be selected as targets for extraction. Martin worked through this process, which appeared to be a bit tricky at times.

It can connect to databases, but requires ODBC drivers, and can execute SQL statements. Documentation seems to be high-level and aimed at the business version, but there are tutorials on YouTube.

Web Assembly from pascal – Ian Hamilton

The second scheduled session was by Ian Hamilton on WebAssembly in Pascal. It was originally offered as a summary of an article in Blaise Pascal magazine on controlling the browser from WebAssembly written in Pascal, but the talk was expanded to start as an introduction to WebAssembly in general.

The session was divided into 3 sections, a general introduction, a look at running WebAssembly in a Pascal program and the original idea of looking at controlling the browser from a WebAssembly module. The talk was mainly based around a slide presentation.

Starting with the introduction, WebAssembly, or wasm for short, was described as an open byte format designed to run in the browser in a sandboxed environment. The location of the specifications for the W3C and github elements were shown and links were provided in the Slack channel. There was also a 4 page cheat sheet in pdf format uploaded to Slack.

Moving on to running WebAssembly in a Pascal program, it was explained that, as WebAssemly is byte code, it requires a runtime engine or VM to be hosted in the app. Four wasm runtimes were identified, although more exist, and the home page of each was briefly shown. WebAssembly has well and truly escaped fro its original home in the browser and is now being run in containers, amongst other uses. FPC now has import units for 2 of the runtimes shown and there was a brief look at the code for an example app hosting one of them.

Wasm is a compiler output in FPC and not available in Delphi yet. A standard Lazarus installation on a Win64 machine will comprise a 64 bit IDE with a 64 bit compiler to build 64 bit Windows exes, and it will all work out of the box. Compiling to wasm, however, requires FPC cross-compilers to be installed, which usually works out of the box as well, but at the time of the presentation, the wasm compiler installation was failing, so could not be shown.

The last part covered the concept of controlling the browser from the wasm module. The point of WebAssembly originally, had been to run in a protected way in a sandboxed way in the browser; the sandbox protecting the wasm from the outside and protecting the host from the wasm. WebAssembly does, however, offer the possibility of putting code into the browser in a way that the user cannot just view it.

In the last year, the Pas2js process has been extended to provide a way of enabling the code in the WebAssembly module to reach out and interact with the browser, by creating proxy objects in the Javascript to handle the interactions. This process is known as the Javascript Object Bridge, or JOB for short, and had been a paid for by a commercial organisation. The concept was explained and some code examples were shown, followed by a brief comparison of 3 simple apps all doing the same thing, one in plain Javascript, one in Pascal as a Pas2js app and the last as WebAssembly from Pascal. The last also requires a simple Pas2js app as a launcher, to initialise the JOB elements, although, as the wasm module name is passed as a parameter, this app only needs to be written and compiled once.

The Sex Life of Functions – Paul McGee

The third scheduled session was done by Paul McGee on the Sex Life of Functions. It began with a humorous view of Sir David Attenborough apparently talking about programming. Paul then outlined his motivation for his quest to understand how things work. Is it better to store the number 12 or to have a function whose sole purpose is to return the number12? Is it better to have a list of all possible squares or to have function to calculate square values? The questions were asked, but not answered.

Coroutines and asynchrony, with examples in Haskell, which, to a Pascal programmer, is a confusing language. Asynchrony is another way of complicating things; a sentiment many could support. A little bit of Set Theory and then partial functions, where only some of the set domains are mapped and the unmapped values actually map to null? What does this mean?

Language as a category, within the context of Category Theory; functions are composed and arrows are composable. On to a discussion of Types, where the goal might be algebraic data types, and then Sum Types, with  a couple of examples of Haskell code, which was explained. A version of the code was then shown in Delphi.

Moving on to Functors and example code in another language. A bunch of headings flashed up, but was not discussed and then on to an example of combinators in yet another language. Combining functions to get an output, is this different? It finished with a list of references to texts related to functional programming and other things covered in the talk.