ADUG Perth – June 16th

Scott Hollows very kindly invited me to do a presentation for the western Australia Delphi User Group. The meeting will held next Tuesday, June 16th, in The Perth Artifectory. Details can be found here: http://www.adug.org.au/meetings/june-meeting-perth/
The subject of the presentation is the Delphi Parallel Library; Task, Future, Parallel.For, but also ThreadPool, ThreadedQueue and TInterlocked operations.

I’ll zip over to the other end of the globe using bits and bytes, so I won’t be there in person. Too bad, I could have visited a friend of mine that lives just around the corner in Brisbane.

Build an auctioning software suite… in one day

On March 12th in Brussels and on March 5th in Hoofddorp Barnsten is hosting a free event in which you will see how to use the power of Delphi to create a fully functional auctioning software suite in just one day.

During this day Pawel Glowacki and I will make all software live, combining the power of VCL with that of FireMonkey. For the backoffice, AWS S3 Cloud storage, REST, FireDac JSON Reflection, Interbase and EC2. We will also make the frontend, an Android app for Auction Masters to add items for bidding (REST + Cloud) and an Android app that attendees can use to actually bid on the items (REST + EC2). Bluetooth LE is used as well, to do over-the-air authorization. There is even some parallel programming involved, don’t worry we’ll keep it light. The day will be concluded with a live auction, allowing you to do virtual bids using the Android app just created.

For Brussel, more info here:
http://www.barnsten.com/default/events/details?events_id=136
For Hoofddorp, more info here:
http://www.barnsten.com/nl/events/details?events_id=135

JPG and PNG inside a database (VCL)

In VCL applications we can easily add images to a database using the TDBImage component. But TDBImage only supports Bitmaps (BMP), and these uncompressed images take a lot of space and network bandwidth to store them. Fortunately it is quite easy to store compressed JPG and PNG images inside a database using TWICImage.

The TWICImage component has been available since Delphi 2010, and it uses Windows DirectX to determine and handle multiple image formats. It is actually an encapsulation of the Windows Imaging Component (WIC). We can use TWICImage to determine the type of an image and have it create a correct image format header. We can then save this header + image into a blob field.


procedure SavePictureFileToField(PictureFile: TFileName; Field: TBlobField);
var
  lWICImage: TWICImage;

begin
  lWICImage := TWICImage.Create;
  lWICImage.LoadFromFile(PictureFile);
  Field.Assign(lWICImage);
  lWICImage.Free;
end;

When we later read this image from the blob field, we use TWICImage to interpret the header and then assign it into a TImage.Picture for display.


procedure LoadPictureFromField(Field: TBlobField; Picture: TPicture);
var
  lWICImage: TWICImage;

begin
  if (Field.BlobSize > 0) then
  begin {Assume image}
    lWICImage := TWICImage.Create;
    lWICImage.Assign(Field);
    Picture.Assign(lWICImage);
    lWICImage.Free;
  end
  else {Empty}
  begin
    Picture.Assign(nil);
  end;
end;

And that’s all.

This code will work for any Delphi version starting from Delphi 2010.

Please note that if you are creating a multi-device / FireMonkey application you should not use TWICImage, the FireMonkey TImage and TImageControl both already handle all types of images just fine themselves and going through TWICImage would not be of benefit, in fact it would lock you into Windows.

Completed source code as a simple VCL SQLLite XE7 database application can be downloaded here: DBImage_JPG_PNG

SDC 1 en 2 december 2014

Binnenkort staat de SDC van 2014 alweer voor de deur. Dit keer komt Marco Cantu opnieuw naar Nederland, dus als je Delphi vragen hebt, mis dan vooral zijn Delphi Present and Future keynote niet om 19:00 op maandag.

Verder leuke sessies van Bob Swart, over Intraweb, REST vs SOAP en Datasnap session management. Zelf heb ik samen met Cary Jensen twee presentaties over threading en parallel programming. Cary Jensen gaat verder nog in op RESTful Datasnap en mis ook vooral zijn sessie niet over ClientDataset vs FDMemTable. Zelf geef ik nog een leuke sessie over FireMonkey styles, waarin we componenten een ander likje verf geven.

Kijk hier voor meer info:
http://www.sdn.nl/SDN/SDNEvent/EventDecember2014/tabid/227/Default.aspx

CodeRage 9 – Parallel Programming Library: Create Responsive Apps with Tasks, Futures and Parallel Loops

Parallel Programming Library: Create Responsive Apps with Tasks, Futures and Parallel Loops must be the longest title I ever used for a session. I hope you found this introduction into parallel programming with the new TTask, TTask.Future en TParallel.For loop useful.

The replays of this and other sessions of Coderage 9 are now available on YouTube here:
https://youtu.be/rZfux4by0po?list=PLwUPJvR9mZHhgQYWWgF6BCkgDwIpP78ZV

Source code for this session is available here:
DelphiParallelLibrary_CreateResponsiveApps_DannyWind

As a last minute note: when using Synchronize inside a TTask.Run AND using TTask.WaitForAll from the main thread there is potential for deadlock as they will then wait for each other. Although it is safe to use Synchronize inside a Task if you only use WaitForAll from inside Task.Run, as demonstrated in the example TaskChaining, it is often better to use TThread.Queue, which doesn’t halt the thread it’s called from and is therefore generally safer.

CodeRage 9 – 28, 29 en 30 oktober 2014

Nog maar een week en dan begint CodeRage 9!

In dit online event vele bekende sprekers met enkele erg interessante sessies van Ray Konopka (Generics, RTTI), Allen Bauer (Parallel Library), Jim McKeeth (Brain Computer Interface, Voice Control) en vele anderen zoals Marco Cantu, Cary Jensen en Robert Love.

Zelf heb ik ook een korte sessie, waarin ik de nieuwe Parallel Library introduceer en gebruik om applicaties te maken die altijd responsive zijn en de gebruiker nooit blokkeren. Weg met de zandloper!

Meer info over CodeRage 9 vindt je hier:
http://www.embarcadero.com/kr/coderage/coderage-9-op-sessions

Webinars, Webinars

Morgen zie je in dit AppMethod webinar hoe je Android gadgets kan pairen en met mobile devices info uit cloud web services kunt halen. Uiteraard ook een demo van Tethering in dit Internet Of Things webinar. AppMethod gebruikt de core technologie uit Delphi dus ook voor Delphi developers interessant. http://embt.co/1qLknR2

Heb je de XE7 Launch event gemist, dan is dit webinar met DavidI misschien wat voor je. Ook deze vind plaats op woensdag 24 september. http://embt.co/Zjvt4g Zie ook het blog van DavidI http://blogs.embarcadero.com/davidi/2014/09/22/43821

Delphi XE7

Delphi XE7 is er! Mijn favoriete nieuwe feature is de FireUI Multi-Device Designer, waarbij je nu slechts één project maakt voor alle platformen (Windows, Mac, iOS, Android) en je elk scherm / form voor elk formaat device van mini tot tablet een iets anders uitziende user interface kan geven.

Op de tweede plek, of misschien toch eerste? De aanzet tot fraaier en eenvoudiger toegankelijke multi-threading, met parallelle for loops, futures, tasks en een threadpool. Met al die multi-core devices een echte must-have.

Verder vele andere grote en kleine verbeteringen en toevoegingen, kijk bijvoorbeeld ook eens naar de property ControlType van TEdit.

 

Developer Skill Sprints – 12 september 2014

Direct na de Delphi XE7 Launch event zijn de Developer Skill Sprints. Hiermee leer je in één dag bijvoorbeeld de basis en nog een beetje meer van het maken van een Delphi Android app, of van FastReport of over de snelle kbmMW componenten.

Meer informatie via:
http://www.barnsten.com/nl/development-tools/live-developer-skills-sprint-sessions-1

In de Android sessies van Bob Swart en mij leer je hoe je een Delphi Android app maakt die met DataSnap data robuust weergeeft over mobile of WiFi netwerken, maar die ook een responsive design GUI heeft en die snel en vloeiend reageert en ook nog eens Java kan gebruiken.

Meer informatie over de Android Skill Sprint:
http://www.barnsten.com/nl/development-tools/live-developer-skills-sprint-sessions-1/develop-and-deploy-delphi-android-apps