PASCON 19 maart 2016

De volgende PASCON is alweer heel dichtbij, op zaterdag 19 maart. Het wordt een  uitdagende dag met begrijpelijke uitleg van complexe onderwerpen zoals Generics, Kunstmatige Intelligentie (David Dirkse) en Threading met de PPL (Danny Wind).

Over het stukje PPL (Parallel Programming Library)  kan ik wat meer vertellen; hier laat ik enkele eenvoudig toepasbare usage patterns zien die je direct kunt gebruiken in je eigen Delphi code om je code vlot en responsive te laten reageren. Onder andere een pattern voor Task Resource Handling, en Task Monitoring, maar ook netjes afhandelen van Task Canceling.

Meer info hier, en toegang is gratis:
http://www.delphigg.nl/DutchPascon/Pascon_PASCAL_MAART_2016.html

CodeRage X – Delphi Parallel Programming Deep Dive: Task Monitoring, Resource Locking, Thread Pool, Design Patterns and more!

Made by kantanna.nl

Made by kantanna.nl

Delphi Parallel Programming Library Deep Dive: Task Monitoring, Resource Locking, Thread Pool, Design Patterns and more! That is the full title of this session at CodeRage X. I hope you found this deeper look into some of the relevant parallel programming features such as TInterlocked, TMonitor and TThreadPool useful.

The replay of this session of CodeRage X has been made available by Embarcadero on YouTube here:
CodeRage X Delphi Parallel Programming Deep Dive

 

Source code for this session is available here:
CodeRageX_DelphiParallelProgrammingDeepDive_DannyWind

Remember: when you run into shared resources with multi-threaded programming; consider just making a copy of the data for each thread.

The entire CodeRage X Object Pascal playlist of videos is available here:
CodeRage X Object Pascal Track

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.

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

RAD Studio in Action LIVE! – 7 september 2013

De grootste Delphi en Pascal conventie in de Benelux sinds jaren. In een reeks van energieke en enthousiaste sessies laten bekende sprekers zien wat de laatste nieuwe mogelijkheden zijn, maar ook wat je nu al allemaal kunt doen met Delphi en Lazarus.

Pawel Glowacki laat de laatste nieuwtjes van Delphi zien, Bob Swart duikt diep in iOS, Mario Vermeulen gaat op in 3D Office, Jeroen Pluimers zorgt voor zekerheid met versie beheer, Mattias Gärtner sluit alles op in Closed Source packages met Lazarus en zelf zet ik nog wat puntjes op de i van Android.

Inschrijven kun je via:
http://www.barnsten.com/nl/events/details?events_id=71

Delphi toetscombinaties

In deze online video laat ik de toetscombinaties zien die ik zelf vaak gebruik bij het ontwikkelen in Delphi. Met deze handige toetscombinaties kun je niet alleen sneller ontwikkelen in Delphi, maar hoef je ook minder te onthouden. De video is bedoeld voor de beginnende Delphi ontwikkelaar.

Delphi toetscombinaties video

In de demo applicatie gebruik ik visual livebindings om de properties van een class aan een control in de user interface te verbinden. Als je alleen het stukje over de visual livebinding tussen class en control wilt zien, begin dan op 4:40 in de video.

Delphi keystrokes

In this online video I demonstrate the keystrokes that I often use when developing Delphi applications. Using these keystrokes allows you to develop faster and with less effort. This video is meant for the beginning Delphi developer.

Delphi keystrokes video

In the demo application I use visual livebindings to connect properties of a class to a control in the user interface. If you’re only interested in that specific part, skip ahead to 4:40.

Delphi applicaties

Zo af en toe wordt mij gevraagd welke software er wordt geschreven met Delphi. De meest bekende is natuurlijk Skype, alhoewel Skype inmiddels opgekocht is door Microsoft. Wel een leuke gedachte eigenlijk, dat zij nu een Delphi applicatie in de markt zetten.

Wist je dat er op de Embarcadero site een aardig overzicht van applicaties geschreven in Delphi staat? Wie weet zitten er applicaties bij die je zelf ook vaak gebruikt, zoals WinRAR?

https://www.embarcadero.com/br/rad-in-action/application-showcase

Delphi XE4 iOS Quickstart

Nu Delphi XE4 uit is wil je natuurlijk zo snel mogelijk aan de slag. Dit heb je nodig:

  1. Delphi XE4
  2. Mac met XCode 4.6
  3. iPhone of iPad
  4. iOS Developer Program

Delphi XE4 draait onder Windows, een Virtual Machine op een Mac kan ook. Voor het code signing, zodat je naar een fysieke iPhone/iPad toe mag, heb je toch een Mac nodig. Mocht je al een Mac hebben, voor iOS 6.x ontwikkeling moet je OSX Lion (10.7) of Mountain Lion (10.8) draaien. Deze versies werken alleen op 64-bit Intel Macs. Hierop installeer je dan XCode 4.6 met de command-line utilities. Wil je naar een iPhone/iPad deployen, dan heb je behalve het apparaat zelf ook een iOS Developer licentie nodig. Met die licentie mag je trouwens dan ook je App in de shop verkopen.

Wil je alleen even proberen hoe het werkt? Dan heb je genoeg aan een x86-64 Intel Mac met de gratis XCode. Delphi kan namelijk ook compileren naar de XCode simulator. Download hier de Delphi trial en je kunt direct aan de slag.
Update: ook zonder echte Mac kun je testen en wel via Mac In Cloud. Voor nieuwe en bestaande XE4 users is er een voordelige trial op http://edn.embarcadero.com/article/43181 beschikbaar tot 15 juli 2013.