Delphi XE8 Launch 19 en 21 mei

Het leuke van Internet of Things is dat IoT leuk is. Het maakt ineens dingen mogelijk die je niet voor mogelijk had gehouden.

Je loopt een wachtruimte in en je telefoon ziet dit en meldt je automatisch aan. De app die zichzelf heeft geactiveert laat je ook zien wie je gaat spreken en wanneer. Zodra je aan de beurt bent geeft hij je een seintje.

Bij een veiling zie je van elk item op je smartphone wat de geschiedenis is door hem dichtbij het te veilen item te houden. Zodra je de veilinghal inloopt verandert de app en kun je bieden op de door jou uitgekozen items.

Wil je zien hoe je wat Delphi XE8 voor mogelijkheden biedt voor IoT, kom dan naar de XE8 launch event, georganiseerd door Barnsten op 19 mei in Utrecht of 21 mei nabij Antwerpen.

Meer info vindt je hier:
http://www.barnsten.com/nl/events/details?events_id=147

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

Happy Birthday Delphi

Today Delphi turns 19. Last year has been pretty exciting for her, with XE4 iOS and XE5 with Android support. This year she’ll make some nice visits home in Windows VCL, with many good things to come.
Talking about VCL, don’t miss the Delphi Boot Camp which is all about VCL, here in the Netherlands:
http://www.barnsten.com/nl/events/details?events_id=90
Happy Birthday Delphi!

we made Tarte Tatin

we made Tarte Tatin