Tuesday, July 31, 2012

Async/Await in Delphi

Let’s assume you’ve inherited this pretty useless code.
procedure TForm125.Button1Click(Sender: TObject);
var
  button: TButton;
begin
  button := Sender as TButton;
  button.Caption := 'Working ...';
  button.Enabled := false;
  Sleep(5000);
  button.Enabled := true;
  button.Caption := 'Done!';
end;

Now, your boss says, you have to make it parallel so the user can start three copies of it. (You also have to add two new buttons to the form to start those instances but that’s easy to do.)

Tuesday, July 17, 2012

Параллельное программирование с OmniThreadLibrary

Alex did the impossible and translated all existing parts of Parallel Programming with OmniThreadLibrary in a record time! The Russian version of the book is now on sale at LeanPub.

Параллельное программирование с OmniThreadLibrary

Click here for additional information about the book…

Monday, July 16, 2012

Programming with Smart

Today I have published a new chapter in A Smart BookProgramming with Smart. Inside you’ll find:

  • My First Smart Program
  • File Management
  • Application Architecture
  • Forms and Navigation
  • Message Dialogs
  • Themes and Styles
  • Command-line Applications
  • Writing Games

Click here for more information about the book …

Tuesday, July 10, 2012

Параллельное программирование с OmniThreadLibrary *

bookpage[* Translation: Parallel Programming with OmniThreadLibrary]

Fellow programmer Егоров Александр (Alex Egorov) has offered to translate the OmniThreadLibrary book into Russian.

As the original book, it will be published on the LeanPub. Current plan is to make it available after the High-level multithreading chapter is translated. At the moment, you can download the first draft which contains translated Introduction.

You can express your interest in the book here.

Sunday, July 08, 2012

Introduction to OmniThreadLibrary

The Introduction to OmniThreadLibrary chapter is completed. New version of the book has already been published and all buyers have been notified by the email.

Wiki will be updated soon.

Please remember – the best way to support the OmniThreadLibrary project is to buy the book!

The next chapter will be either Synchronisation or How-to. I’ll give you few more days of voting time to decide the matter.

Friday, July 06, 2012

New Poll

There’s a new poll available – look to the right and you’ll see it.

If you have any preferences on what you want to read in the Parallel Programming with OmniThreadLibrary next, please vote.

Thursday, July 05, 2012

High-level Multithreading

Chapter five of my book Parallel Programming with OmniThreadLibrary is now completed. New version of the book has already been published and all buyers have been notified by the email.

Wiki will be updated soon.

Please remember – the best way to support the OmniThreadLibrary project is to buy the book!

The next chapter on the list is Introduction to OmniThreadLibrary which won the public poll by a very small margin (34 votes against the 31 votes for the Synchronisation chapter).

Smart Controls

Today I have published new version of the A Smart Book.

Newly added chapter Smart Control on 54 pages covers all built-in controls, from TW3Panel to TW3Header. Additional sections include tips on writing custom controls and description of the TW3ScrollControl control.

Sample book was also extended. In addition to Smart Pascal and Regular Expressions chapters it now contains selected parts from the Smart Controls chapter, including full text on TW3EditBox and TW3Toolbar.

Click this link for more information about the book …

Wednesday, July 04, 2012

OmniThreadLibrary Documentation: Blocking Collection

A chapter on blocking collection (IOmniBlockingCollection) is now available online.

Tuesday, July 03, 2012

OmniThreadLibrary Documentation: ForkJoin

A chapter on Parallel.ForkJoin is now available online.

Better OnStop

Pop quiz! What’s wrong with this code?

  FPipeline1 := Parallel.Pipeline
.Stage(
procedure (const input: TOmniValue; var output: TOmniValue)
begin
end)
.Stage(
procedure (const input: TOmniValue; var output: TOmniValue)
begin
end)
.OnStop(
procedure
begin
Caption := 'All done';
FPipeline1 := nil;
end)
.Run;
FPipeline1.Input.CompleteAdding;

Thursday, June 21, 2012

Parallel Programming Poll Extended

While setting up the poll on the right I did something wrong and it was prematurely closed.

This has now been corrected – you can again vote for your favourite.

Monday, June 18, 2012

Hacking FastMM for Debugging Purposes

Last week I started solving weird ‘out of memory’ crash in one of our services. First reports of problems came in from a client but with some experimenting I managed to repeat it on the test configuration. The program works nicely for few hours and then something weird happens and it starts using the memory, few megs per minute, until it crashes.

Repeating the problem on the test configuration usually means half the victory won but this time it wasn’t so :( I was fighting the most terrible of memory leaks – a live leak. Memory was allocated, stored away in some management structure and properly disposed off when the program terminated. FastMM have shown no problems at all. Such problems are always hard to find.

Saturday, June 16, 2012

Delphi Foundations

Chris Rolliston has published his monumental[*] work “Delphi XE2 Foundations” in Kindle format (paper version to follow). The book is split in three parts (TOC is provided in the book home page), each priced at £7.99/€8.99/US$9.99 (which of course translates to $13.79 for people not living in USA, UK, DE, FR, ES or IT – damn Amazon!). As the book is excellent, the price is more than fair – if you doubt my words, download the sample from the Amazon.

As the book site is called “delphifoundations.com” and not “delphixe2foundations.com” I can’t but assume that Chris will update the book to following Delphi releases, which would indeed be a great thing.

Recommended!


[*] It is hard to tell book size from the Amazon’s download size but I have read Chapter 15 (Multithreading) in advance and I can attest to the fact that it is a) very long and detailed, b) very exhaustive and c) very well written.

Tuesday, June 12, 2012

The Book is Here!

I have finally pushed the Publish button and “The Book” is now available on LeanPub.

To get the current book status, click here or on the book cover image right to this post.

If you want to affect the order in which the book is written, participate in poll on the right (below the book cover image). I will complete the “High-level Multithreading” chapter regardless of your votes but then I’ll follow the majority.

Monday, June 11, 2012

Thursday, June 07, 2012

Parallel Programming with OmniThreadLibrary – Current Status

Parallel Programming with OmniThreadLibrary is now complete. It will be updated as the OmniThreadLibrary itself is updated, but other than that it is done.

Go to LeanPub to learn more about the book, read the free sample or buy your own copy!

Tuesday, June 05, 2012

When a Hotfix Requires a Hotfix

Do you know that feeling when you can’t put together a simple piece of code? You turn it around and around and there’s always “one last” problem. Even after you’ll happy with it, the first user that tries it out will find a problem. And then you correct that and you’ll happy with it again and the first user that tries it now will find a new problem. :(

It looks like I’m playing this game with Parallel.Join. I can’t make the @#$%^ thing to work correctly. That’s why I have just issued another hotfix. If you are following the SVN head, just do the Update. Otherwise, please download the updated OtlParallel unit.

Thanks go to [meishier] for reporting the problem!

Sunday, June 03, 2012

A New Web, a New Book and a New Info Source

I have decided to start up a new blog, dedicated to programming with Smart – www.smartprogrammer.org. If you are using the Smart Mobile Studio or if you think that programming mobile applications with Pascal is an interesting idea, make sure to bookmark it.

I will however not move all my Smart-related posts there, most important stuff will also be published here.

My book about the Smart is now available – read more in my post on the new blog. [But feel free to comment here, if you want.]

And the last but not least – I have created a Twitter account. (Took me a long time, I know.). Follow me @thedelphigeek and you’ll get notifications about the OmniThreadLibrary, A Smart Book and more.

Parallel.Join hotfix

There was a nasty bug in Parallel.Join which (sometimes) raised its ugly head when number of tasks submitted to the Join abstraction was larger than the number of parallel execution units (threads). Big thanks go to [Passella] for reporting the problem together with a reproducible test case.

If you are following the SVN head, just do the Update. Otherwise, please download the updated OtlParallel unit.