Saturday, July 12, 2014

Smart Mobile Studio 2.1 (beta 1) is out!

If you need to write software for phones/browsers/node.js/microcontrollers, you should check out the new Smart Mobile Studio 2.1 (beta 1). The list of new and fixed features is much too long to list here so I’ll just focus on the most important additions.

  • Integrated debugger!

  • Dockable IDE with support for multiple layouts.

  • Configurable keyboard shortcuts.

  • Split view mode shows code and design side-by-side.

  • Support for with statement in a clean, non-Delphi way.
    with p := something do begin
      // do anything with p
  • Optimizations and bug fixes in the compiler.
  • Built-in browser uses Chromium CEF3.

Thursday, July 10, 2014

Incrementing Progress Bar from a ForEach Loop

A deceptively simple question – how do you update a progress bar from a ForEach loop – popped up on the Google+ OmniThreadLibrary community. The implementation turned out to be quite tricky so I created an example (55_ForEachProgress) which is now part of the OmniThreadLibrary SVN repository.

The starting point was a simple Parallel.ForEach loop which I further simplified in the demo.

procedure (const task: IOmniTask; const i:
// do some work

// update the progress bar - how?

We cannot simply update the progress bar from the ForEach executor as that code executes in a background thread and one must never ever access VCL GUI from a background thread! It is also no good to send “please update” Windows messages to main thread as Parallel.ForEach is by default blocking – it waits for all workers to stop working – and messages won’t be processed during ForEach execution.