Adam’s Feb 2022 Meeting Summary
- React framework – an introduction – Will Watts
- Nugget: Automating Google lookups – Mark Jacobs
- Interbase and Interbase with IBX – Jason Chapman
Adam’s Summary
The meeting started with discussion of the 27th birthday celebrations for Delphi, and some positive noises about SKIA4Delphi.
React framework – an introduction – Will Watts
React is a JS Framework for front-end presentation in Browser or “Electron-type” Apps. It can compile to native OS Applications, but it is not as widely used in this way.
It’s competitors are Angular and VU.js, but VU.js is a very distant third. React is newer than Angular, and has developed out of initiatives in Facebook and is now Open Source. Angular developed out of Google, and is also Open Source.
As Javascript has developed so profoundly over the years Angular was somewhat trapped by having coded for legacy elements of JS, whereas React has been more free to develop their framework in a context where JS is more complete, both are extremely widely used by major corporates.
JS Frameworks in general allow a programmer to write more elegantly structured code, have the framework output workable Javascript, and manage the Document Object Model (DOM). These are huge advantages, as HTML was not originally designed to cope with the very high demands of modern web Applications.
React allows the programmer to write Components and then couple these together into elements which actually appear on a page. It stores a “Shadow DOM” (ie it’s own version of how the page is structured) so all program-interactions can be mapped onto this object, and then only changes actually need to be passed to the browser. This results in massive efficiency improvements.
A typical development stack for React seems to be VS Code, perhaps writing Typescript, possibly using Babel and Next.js libraries. The developer can set up this stack, run a program from VS Code and see the resulting Webpage. If “React Developer Tools” are added to Chrome or Firefox quite detailed debugging is also possible.
React uses a variation on the MVC application model, which they call Flux: This works from ideas of a program having: State – View – Action, with a unidirectional flow of data “around” these elements.
Recently React has drunk the Functional Programming cool-aid, and now features “Functional Components”, that is Components (visual elements which can be viewed on a page) but which exist as Functions. For those of us used to OO Programming, this is a big leap. Will said he as “startled” by how well these Functional Components worked, but also felt that certain aspects of Functional Programming were a drawback in a Component-oriented context. React has had to add the concept of “Hooks” to the framework in order to allow programmers to interact with Functional Components, and this has both good and bad sides.
Some screen grabs from Will’s talk are attached to this post.
Interbase and Interbase with IBX – Jason Chapman
Jason Chapman spoke about InterBase, IBX and FireDAC components (https://www.embarcadero.com/products/interbase)
InterBase (IB) is Borland/Codegear/Embarcadero’s “in-house” database engine, with a long and colourful history, the most of important part of which is probably the point where it was declared Open Source and a fork to Firebird (FB) was created. Both IB and FB are heavy-weight databases, with very full, complex component-sets in Delphi. Programmers now access either using FireDAC data-access components, but IBX and FibPlus components are also available.
Jason showed the components: IBDatabase, IBTransaction, IBTable, IBSQL (fast read-only unidirectional dataset), UpdateSQL (component for holding SQL statements), plus a whole page of useful service components. My main take-aways were the fact that IBTransaction is a critical part of the component structure, and manages / determines how data is actually retrieved / posted to the database, so “posting” data in a table-component does not actually persist it back to the database (unless the user sets up some properties for it to do so). The Transaction seems to be a key part of the richness and power of the IB environment, for example it is possible to create a Transaction with TransactionType = “SnapShot”, which holds an image of the database at the moment it was opened. The transaction-based architecture makes IB extremely robust.
Deployment is easy: Just put gds32.dll in the Exe’s folder.
Gotchas: It is painfully easy to have multiple instances of gds32.dll running, and note that they can all run on different Ports. As it can run as an Application or Service, it is also possible to “see” 2 instances running, but for there to be a third (or even forth) lurking. Jason has regularly had to “spring clean” client’s IB set up to clear up issues of multiple instances of gds32.dll, but if you know about it this is easy to fix.
Jason showed a simple minimal data Application, with a grid-view and edit-window, and showed how to connect and post data. There was a lot of discussion about FireDAC v. other options for data-access.
Nugget: Automating Google lookups – Mark Jacobs
Mark Jacobs showed his “Random Word” web-page – https://jacobsm.com/randword.htm
This picks a random word from a list of several hundreds of thousands of words, and allows the user to jump to a randomly chosen web-page based on the word.
It is a fun, silly and interesting web-page.
The talk showed how Mark packages up a URL sending a request for web-pages to Google, and how he then parses Google’s result. This was very eye-opening, as it showed just how much work Google put into sending back not just simple web-links but much more complex search-URLs which help them with tracking, advertising and managing user’s web-experience. Mark has done a lot of work “converting” the result from Google into much plainer HTML to get around this. In a number of cases this involved search and replace of the Google response, so that HTML keywords were replaced with meaningless text.
A valuable Nugget was the fact that adding: “&tbm=isch&tbn=large” to the end of his Google-search circumvented it from making a Cookies Request with every search.
Mark also showed how when his site was PHP generated he had become a target for hackers, who were able to pass dodgy URLs to his site and trigger security warnings. This has lead him to remove PHP from his server.