Over Danny

Delphi trainer en ontwikkelaar.

2020 space space 2021 space !

To me 20 20 was space space, but 20 21 will be space !

Some space ! events coming up:

The inaugural launch of NASA’s Space Launch System, then back to the Moon in 2024 and to Mars?
https://www.nasa.gov/exploration/systems/sls/index.html

SpaceX Serial number 9 (SN9) is up next – going up in orbit, Mars, here we come!
https://www.spacex.com/vehicles/starship/

Perseverance will be doing some extra scouting for us, countdown to landing on Mars…
https://mars.nasa.gov/mars2020/

Happy space ! everyone

Delphi 10.4.1 Apple Platforms Patch (December update)

De update patch voor de nieuwe Apple Platforms is ververst en opnieuw beschikbaar. Eerder was in november al de patch met support voor XCode 12, iOS 14 en macOS Big Sur uitgekomen. Deze december patch vervangt deze en fixt enkele bugs in de DataSnap ClientDataSet en in DBX en lost tevens enkele linker errors op als je build naar iOS14.

Beschikbaar via GetIt en als losse download. Let wel dat je de download hebt vanaf 18 december. Mocht je eerder op 16 december een download hebben gedaan, update deze dan met de versie van 18 december, anders heb je een oude versie van PAServer. Dit is in de zip eenvoudig te herkennen door de file datums van na 16 december.

Downloaden van deze patch via het registered users portal:
https://my.embarcadero.com/

Spice up your Delphi application with online image content – 8 december 09:15

Move beyond the confines of your application and add online content in
just 50 lines of code.

Join us with Alister Christie from New Zealand for this live Q&A and webinar on scraping the web for live and always up-to-date art work in your Delphi application.

In this session Alister shows you how to spice up your application with image content scraped from the WikiMedia website. Technologies used in this session are NetHTTP, JSON, Regular Expressions and XML storage with the ClientDataSet. At the end Alister goes down the rabbithole to add additional compatibility with a missing JPEG format in the VCL. Just for fun!

After this workshop you can easily use the code to create your own web crawler or scraper to add online content to your application. Please make sure the media you scrape can be used freely.

Register here:
https://www.barnsten.com/spice-up-your-delphi-application/

The Q&A at 09:45 will be handled by Alister (for him its 21:45), so this is a chance to meet him live online. I’ll be there as well.

DelphiCon 2020 Watch Now

Its almost time!

If you for some reason missed the email with the personal link for your session, just visit the schedule on the same computer where you registered and select that session and then click on the Watch Now button. This will open GotoWebinar for your session.

Or open a new webbrowser with the general link you received by email that has the attendee code in a parameter (looks like https://delphicon.embarcadero.com/?ah=00XX0x) and then use the View button to goto the current session from your personal schedule,
https://delphicon.embarcadero.com/attendee/schedule/, and go from there.

The opening keynote link is:
https://delphicon.embarcadero.com/talks/opening-keynote-the-state-of-delphi/

DelphiCon 2020 Watch Now

DelphiCon 2020 – 17 – 19 november

DelphiCon 2020Volgende week start de DelphiCon 2020 van 17 tot en met 19 november. Een online conference alleen over Delphi en niets anders dan Delphi.

Met ondermeer een sessie van Alister Christie met code en demos uit zijn boek Code Faster in Delphi. Ook een mooie sessie van Andrea Magni over zijn boek Delphi GUI Programming with FireMonkey. Ik kijk ook uit naar de sessie van Primož Gabrijelcic over zijn boek High Performance Delphi. Het is heerlijk om goed en mooi leesvoer te hebben over Delphi.

Heb jij of je klant net een 4K scherm gekocht? Neem dan ook even een kijkje bij de sessie van Ray Konopka over Leveraging High DPI in VCL Applications.

En mocht je ooit een keer een bug introduceren in je code dan kun je zeker de sessie van Bob Swart waarderen over Real-world CodeSite Logging Techniques.

Het volledige programma vindt je hier:
https://delphicon.embarcadero.com/schedule/

Vergeet ook niet de Delphi 10.4.1. compiler en LSP patch te installeren die vandaag is uitgekomen. Hierin wordt een bug gefixt in record alignment die je lastig kan vallen.

Code Faster in Delphi by Alister Christie

Code Faster in Delphi by Alister ChristieHave you ever wondered what an experienced Delphi developer knows about how to code in Delphi? Particularly how to code FASTER in Delphi? This book has you covered!

Alister kindly invited me to read pre-press versions of this book and having seen it evolve into what it is now, I can only say it’s absolutely worth your time. In fact, you’ll probably regain the time spent reading this book in the first week after, when you apply its knowledge. It’s probably a Timey-Wimey kind of thing where you gain more time by using some time.

Alister Christie is a writer, but also an experienced Delphi developer and trainer and overall good guy. When we visited his family home in New Zealand his enthusiasm and vibrant energy combined with his kindness made it a very special experience for us.

For me this book is now a staple, a standard book every Delphi developer should have. Read it, I’m sure you’ll agree.

Delphi 10 VCL Essentials training – 28-30 oktober 2020

Eind volgende maand staat opnieuw een driedaagse Delphi 10 VCL Essentials training in de planning, op woensdag 28 oktober tot en met vriidag 30 oktober in de mooie locatie van het Jachthuis Beukenrode in Doorn.

De training is bedoeld voor coders en developers met enige ervaring in programmeren in  Delphi of een andere programmeeromgeving die graag snel en goed Delphi willen leren of beter leren kennen. We beginnen met een overview van alles wat je met Delphi en de VCL kunt, maar gaan ook in op details als de event-loop en de interne werking van de VCL (visual component library) en RTL (run-time library). In de driedaagse training leer je je Windows applicaties maken met Delphi, gebruik maken van een database via FireDAC. Verder in-memory en local datasets, debugging, de RTL, Windows-10 styling en zelfs wat generics.

Inschrijven en details van de agenda van de trainingen vindt je hier:
https://www.barnsten.com/nl/product-categorie/rad-studio-tools-nl/trainingen/

5 quick tips for removing ARC in Delphi Sydney

With the release of version 10.4 Sydney, Delphi has officially moved away from the ARC memory model in the mobile compilers. This was announced in 2018, there is some nice background info in this blog post by Marco Cantu.

So how do you do a quick check if your Delphi mobile code has ARC dependencies you should fix?

Tip #1 – Run on Windows with ReportMemoryLeaksOnShutDown := True

This instructs the FastMM memory manager to report memory leaks. Simply run your iOS or Android App on Windows (with the Windows Platform active), perform the usual actions an end-user would perform and close the application. Any memory leaks will be reported and should be fixed.

In your application source code add this line:

 
begin
  ReportMemoryLeaksOnShutdown := True;
  Application.Initialize;
  Application.CreateForm(TFormMain, FormMain);
  Application.Run;
end.

If you have a memory leak a message like this will popup after closing the application.

Unexpected Memory Leak

Tip #2 –  Search | Find In Files (Shift-Ctrl-F) for any “.Create” code

Most ARC (Automatic reference Counting) code should be changed to CTFF (Create Try Finally Free). Just check if there is a try-finally and a free directly after the .Create. Not all Create code needs a try-finally-free, as some instances are owned by their container, for instance in a TObjectList<T> that may take ownership of the instantiated object.

Change this ARC code

 
procedure DoSpellCheck;
var 
  Harry: TWizard;
begin
  Harry := TWizard.Create; 
  Harry.SpellCheck;
end; 

To this CTFF code

 
procedure DoSpellCheck; 
var 
  Harry: TWizard; 
begin
  Harry := TWizard.Create;
  try
    Harry.SpellCheck;
  finally
    Harry.Free;
  end;
end;

Some code can not be easily changed from ARC to CTFF, mostly due to the Free needing to be called at some unspecified time in the future, which for instance is common in multi-threaded code. If this applies to you then you could take a look at smart pointers in Spring4D using Shared.Make(TObject.Create), or take a look at the new custom managed records which where introduced in Delphi 10.4. Both options enable you to use ARC style freeing of resources, within the now default unified memory model.

Tip #3 – Use a tool to check for memory leaks

The code in tip #1 uses the built-in FastMM4 and is free. There is also a dual-license newer version FastMM5, both are however limited to Windows. Luckily there is a nice and simple free library called leakcheck that does this for all Delphi platforms. Alternatively, if detecting leaks in Windows only is preferred, the commercial DeLeaker has a lot of options and easy overview of memory leaks. A nice summary of these tools and more can be found in the blog post of Wagner Landgraf.

Tip #4 – Check for platform specific code

The short check for memory leaks under the Windows platform will skip platform specific code for Android and iOS, so you should check for compiler directive based platform dependencies {$IFDEF ANDROID}, {$IFDEF IOS}, but also for run-time dependencies like with TOSVersion.TPlatform.pfiOS and TOSVersion.TPlatform.pfAndroid. Note that the compiler directive AUTOREFCOUNT has been removed in Delphi 10.4, but its entirely possible you used this in your own code to check for ARC availablity.

Tip 5 – Check for weak references

These are mostly introduced to enable multiple references to instances without affecting reference count in combination with ARC. Do not just remove them, they can also be used for other reference counted data structures which may not have anything to do with ARC perse.

Even without ARC, reference counting still exists in Delphi. The compiler will still automagically reference count interfaces and strings. The same mechanism is also used for the new custom managed records.

RAD Studio 10.4 Sydney Webinar 16 juni 2020

View of Sydney Harbour

Barnsten organiseert een RAD Studio 10.4 webinar op 16 juni om 14:00 waarbij ik de mogelijkheid krijg om enkele van de nieuwe features van Delphi 10.4 wat uitgebreider te laten zien. Nu ben ik best blij met de nieuwe versie dus die kans laat ik niet voorbij gaan.

Onderwerpen zijn  de werking en voordelen van per control VCL Styling, het hoe en wat van de nieuwe Delphi Language Server Protocol server voor Code Insight en de ins en outs van Managed Records en het uitfaseren van ARC (Automatic Reference Counting) op de mobile platforms. Er zit nog wel meer in qua onderwerpen, maar die kom je vanzelf tegen als je het webinar volgt.

Meer info en inschrijven kan met deze link::

Ontdek RAD Studio 10.4 Sydney – Webinar 16 juni – 14.00 uur

Tot volgende week dinsdag bij de Q&A !

Delphi 10.4 Sydney

Delphi 10.4 Sydney has all the right ingredients. From support for Android OpenJDK up to the soon to be required iOS Storyboard; it’s all there. The all new LSP adds syntactic sugar and the per control Windows VCL styling is the finishing touch.

For me the timely support for iOS storyboard is the winner, as Apple requires us to start using this on June 30th.

Support for Android OpenJDK is very cool, as this opens up the Android environment even more. Although you could already customize and modify just about anything in Delphi on Android (adding APIs and even CPU code), this makes it easier still.

And what about this LSP, the Language Server Protocol? We now have all kinds of syntax, code, class completion and what not in multiple LSP processes! This is also very open, allowing you to add your own. Most important for you as a developer, it’s asynchronous, so you’ll never lose keystrokes again, when code completion kicks in.

Starting from this release we now have the same classic unified memory model for all platforms. This means that you no longer have to write specific code for ARC (Automatic reference Counting) anymore, because its gone (except for strings and interfaces). If you’ve adhered to the CTFF (Create Try Finally Free) pattern on mobile platforms there is no need to change any code, if not, you may want to add a Free at some places in your source code.

Last, but not least, per control Windows VCL styling. It’s now possible to use multiple VCL styles in one application at the same time, even on the same form. This will allow you to mix and match your main VCL style with form specific styling to better match specific styling of certain third-party controls you can not VCL style themselves. Finishing touch indeed.

All features can be found right here: http://docwiki.embarcadero.com/RADStudio/Sydney/en/What%27s_New

You can download Delphi 10.4 Sydney from the new customer portal here: https://my.embarcadero.com/#downloadsPage The online web installer and the offline ISO installer are now compatible with one another. The ISO file contains the files the web installer would otherwise download, so you can choose the method you prefer.