Wednesday, May 22, 2013

XE4 for iOS in Slovenia

I just came home from the XE4/iOS presentation in Ljubljana and if I had to summarize the participant response it would be: “A very nice product, we’ll probably buy it when the Android is supported too.”

This (and a relatively small attendance) clearly shows that iOS is just not that popular in Slovenia. Even more, most of big Delphi-using companies in Slovenia have no interest in creating fresh, modern software and are still living in the “interesting, but we don’t need it” world :(

2013-05-22 09.07.20

Thanks to everybody for coming to the presentation!

Wednesday, May 15, 2013

XE4 in Ljubljana

If you live in Slovenia and if you are programming in Delphi or C++Builder, make sure to reserve some time for the next Wednesday (22nd) for the RAD Studio XE4 presentation in Ljubljana.

Most of the presentation will focus on the iOS development with RAD Studio XE4. More details here: Marand.

Tuesday, May 07, 2013

Results of the “Webinars” Survey

For Mason (and everybody else who might be interested), here are condensed results of the OmniThreadLibrary Webinars Survey.

Sunday, May 05, 2013

OmniThreadLibrary Webinars

Results of the OmniThreadLibrary Webinars Survey are now in. 77 people cared enough to answer (thanks!) and from them the Random.org site selected the winner who will get a free copy of the Parallel Programming with OmniThreadLibrary book – Mr. Nigel Hughes. Congratulations to the winner!

Considering the results of the survey we have decided that the webinars will be free and that a copy of each webinar will be available for download for $10. First 20 downloads will also get a free copy of the OTL book, courtesy of De Novo software.

Exact dates/times for webinars will be announced later this month. Stay tuned!

Monday, April 22, 2013

Programación Paralela con OmniThreadLibrary

image

After a long wait, Programación Paralela con OmniThreadLibrary has been synchronized with the english version of the book. The book has now 209 pages and is considered to be 60% complete.

Tuesday, April 16, 2013

OmniThreadLibrary Webinars

In association with De Novo Software (www.denovosoftware.com) I am preparing a series of webinars about the multithreading and OmniThreadLibrary. Currently proposed topics are:

1. High-level multithreaded programming with the OmniThreadLibrary

This two part webinar will focus on high-level abstractions (Await, Future, ParallelTask, ForEach, Pipeline etc). In addition to the in-depth presentation of all eight high-level abstractions, the webinar will explore the blocking collection, a queue class extensively used in many high-level abstractions.

2. Low-level multithreaded programming with the OmniThreadLibrary

This webinar will focus on differences between the TThread (Delphi) and CreateTask (OmniThreadLibrary) model and will be intended for programmers that have no problems writing TThread-based code. If will firstly show what the OTL equivalents for the TThread operations are and then continue by exploring the parts of the OTL that have no TThread equivalent (such as writing background tasks without the main thread loop, communicating between the main thread and the task and so on.)

3. Using OmniThreadLibrary frameworks effectively

This webinar will focus on "backend" classes in the OTL - queues, locking primitives, TOmniValue record etc. All of these can be use in any application, single-threaded or multithreaded, TThread- or OTL-based to simplify programming and improve your productivity.

4. “Do's” and “Dont's” of multithreaded programming

This webinar will present best practices for the multithreaded programming. In addition to the abstract talk, it will contain numerous code examples to prove the point.

All of the webinars will be split into 45 minute presentation followed by the 15 minute Q&A part.

Interested?

To help me determine the best time for webinars and to assess the interest, I have put together a small survey. If you are interested in participating in a webinar or downloading it for your personal use, please fill out the survey. There are only seven questions, none of them mandatory.

All participants of the survey that will leave an email address will be entered into a draw to win a prize – a free copy of the OmniThreadLibrary book!

Thursday, April 11, 2013

ThreadSafe Lock Manager: [3] Test

After you have designed and written some code, you should always test it. This is especially important for the multithreaded code which rarely works on the first (or the second, or third) try.

Friday, April 05, 2013

ThreadSafe Lock Manager: [2] Code

After explaining the design, I’ll continue my trip into the depths of the lock manager by exploring the actual code. Let’s take a look at the public parts first.

[This code is implemented in the OtlSync unit, which is part of the OmniThreadLibrary distribution. You’ll have to fetch the OTL from the SVN to use it.]

Tuesday, April 02, 2013

ThreadSafe Lock Manager: [1] Design

Few weeks ago I ran into a problem. I needed a thread-synchronizing code that would work similarly to a critical section, but would allow me to lock “anything”. If I could limit myself to objects, I could live with TMonitor.Enter/Exit, but I specifically wanted to limit access to some string keys. [In a way, my problem was similar to a problem of locking access to specific items in a string-keyed dictionary. Details differed, though.]

I was thinking about the problem and it turned out not to be a simple one. Yes, I could solve it by introducing a string-keyed dictionary of critical sections but that would be a little bit too limiting for my taste. I had some other requirements in mind which further complicated the implementation.

TL;DR – This lock manager is implemented in the OmniThreadLibrary as IOmniLockManager<K>/TOmniLockManager<K> in the OtlSync unit since revision 1268.

Tuesday, March 26, 2013

Using Generics to Manipulate Enumerated Types

I’d like to present a short class written by my colleague at work. Why? Because I just love how it uses the generics syntax to simplify some operations on enumerated types.

Like me, he hated the hoops one must jump through to convert an instance of an enumerated type to a string, to check if an integer value that was read from some storage contains a valid integer representation of some enumerated value and to enumerate (no pun intended) over such a type. Unlike me, he did something about that and wrote a Spring-inspired Range<T>.

Monday, March 11, 2013

Numbers I Should Keep In Mind

Name Nanoseconds
L1 cache reference 0.5
Branch mispredict 5.0
L2 cache reference 7.0
Mutex lock/unlock 100.0
Main memory reference 100.0
Compress 1K bytes with Zippy 10,000.0
Send 2K bytes over 1 Gbps network 20,000.0
Read 1 MB sequentially from memory 250,000.0
Round trip within same datacenter 500,000.0
Rusty disk seek 10,000,000.0
Read 1 MB sequentially from network 10,000,000.0
Read 1 MB sequentially from disk 30,000,000.0
Send packet from CA->Netherlands->CA 150,000,000.0

From always excellent kellabyte.

Friday, March 08, 2013

Embarcadero Academy: The Power of XE3

Next Wednesday (March 13th) we have organized a presentation for all users that are afraid to upgrade and are staying (for example) with Delphi 7. In “The Power of XE3” session I’ll go through all* new features added to the Delphi and C++ Builder since Delphi 7 days. We’ll discuss language changes, platform changes, framework changes, additions to the VCL, RTL, database layer …

Register here.


* As much as humanly possible. There are simply too many to cover them all.

Wednesday, March 06, 2013

Developer Wanted

The following text is a job offer for a Slovenian developer and is therefore written in Slovenian language.

Iščemo Delphi razvijalca za izpeljavo večmesečnega projekta. Zahteve: zna (ali se je pripravljen naučiti) osnovega dela z zbirnikom. Delovno mesto je v Ljubljani. Delo na domu ni možno.

Projekt je dvodelen, prva faza vsebuje predelavo aplikacij na MS Ribbon, druga pa predelavo taistih aplikacij, da se bodo prevedle za Win64.

Ob uspešni izvedbi projekta obstaja tudi možnost zaposlitve za nedoločen čas.

Prijave (s CV) in dodatna vprašanja pošljite na sandra.support@fab-online.com, v subject pa vpišite "razpis Delphi".

Če vas zanima, s čim se ukvarjamo, si oglejte www.fab-online.com.

Thursday, February 28, 2013

When Does “Execute on Destroy” Fail

Yesterday I wrote a post about executing some code automatically when a method ends. Today I’ll show you why this approach must be used with care.

OmniThreadLibrary on Google+

OmniThreadLibrary now has its own Google+ community so you are welcome to visit it and ask questions, report bugs, discuss possible OmniThreadLibrary improvements and so on …

Wednesday, February 27, 2013

Running “Any” Code When a Method Ends

Just like (some) other programmers, I like to abuse the fact that the Delphi compiler only destroys local interfaces when a method ends. If you don’t know what I’m talking about, check out the latest Nick’s post in the Fun Code of the Week series.

As an example, Nick put together a function which changes application cursor and at the end of the method reverts it back to the previous state.

procedure test;
begin
  AutoCursor(crHourGlass);
  // some long operation
  // cursor is automatically reverted when ‘test’ exits
end;

My approach to this pattern is usually slightly different. I like to mark the scope of the local interface with a with statement.

Thursday, February 21, 2013

Accessing Input Queue of a Pipeline Stage

On the today’s “Multithreading” workshop, a request popped up – a potential OmniThreadLibrary user asked how to access an input queue of a specific pipeline stage. As this was the second time this request was presented, I decided to implement this feature. It turned out that all available information was already present and I just had to expose it.

Sunday, February 17, 2013

Embarcadero Academy: Multithreaded Programming 1.1

The “Embarcadero Academy 2012” series of Delphi-related workshops was very well accepted in Slovenia so we (Embarcadero, Slovenian distributer Marand and me) have extended it into year 2013. The first workshop will be – due to a popular demand – revisited extended workshop on multithreaded programming. I’ll be extending the topics covered in the first workshop with many practical examples.

The date is slightly awkward – February 21st, the same date when Embarcadero will present the “Delphi for iOS” programming tool. Luckily, we’ll finish around 01:00PM which will give everyone enough time to return to the office and watch the webinar which starts at 03:00PM. (We apologize for this – we selected the date when Embarcadero’s webinar was still announced for the 14th but then Emb. moved the date a week ahead.)

As always, workshop will be lead in Slovenian language. Register here!

Monday, January 28, 2013

The OTL Book–Russian Edition

Just a quick notice to my readers – the Russian translation of Parallel Programming with OmniThreadLibrary has been updated and now contains all the material from the English edition.

Big thanks go to Alex Egorov for his hard work!

image

Saturday, January 26, 2013

Monday, January 21, 2013

Sending Event Handlers Across Thread Boundary

Recently, I ran into an interesting problem. I was doing some high-bandwidth, low-latency data processing where a background task received the data, dispatched it to a central hub which then forwarded data to the appropriate data processing & transmitting thread. Data absolutely had to travel through the main thread (the reasons for that are quite convoluted and not important for the story) which bothered me from a performance viewpoint. This could introduce some unwanted overhead as I can only send data to the main thread via Windows messages.

The simplest (given the current codebase) way to solve the problem was to introduce an asynchronous event handler. The main thread implements an event handler called for each received data block and passes this event handler to the receiver thread, which calls the event handler from its own context. As a result, the code that logically belongs to the main thread is executed from the worker thread and there is (almost) no delayed introduced. (The ‘almost’ part coming from the fact that I had to use some locking to synchronize operations inside the main thread.)

During the implementation phase, I found out that it’s quite difficult to send an event handler over the OmniThreadLibrary communication channel. The solution was non-trivial and required quite some ugly hacks so I’m posting it here for future reference.

Friday, January 18, 2013

DataSnap Speed & Stability, Part 2

As the Roberto’s blog is still not listed on the DelphiFeeds, I’d like to bring your attention to his second article about DataSnap: DataSnap analysis based on Speed & Stability tests – Part 2.

Saturday, December 22, 2012

Parallel Programming with OmniThreadLibrary: Synchronization

The “OTL book” has just been extended with a chapter on synchronization (22 pages). Basic understanding of synchronization issues and critical section usage is required as this chapter only deals with OmniThreadLibrary-specific support for locking.

Tuesday, December 18, 2012

OmniThreadLibrary ile Paralel Programlama*

image

Due to a strong language barrier we don’t hear from Turkish programmers much even though the programming (and Delphi) community in this big country is quite strong. That’s why I was pleasantly surprised when I received a proposal from that country to translate the OmniThreadLibrary book. We quickly set up a workflow (as the OTL book is still being written this is not a trivial task) and the book is now being translated.

Although I didn’t see more than a few translated paragraphs yet, I have great hopes that the initial Turkish release will join the ever growing family of the OTL books (English, Russian, Spanish) early next year. Until then, you can express the interest in the book here.

Great thanks go to Tugrul Helvaci for initiating the project and to Ramazan Gülbahar for translating the book!

* Parallel Programming with OmniThreadLibrary

Friday, November 23, 2012

DataSnap Speed & Stability

As the Roberto’s blog is not yet included in the DelphiFeeds concetrator, I’d like to bring to your attention his very interesting post: DataSnap analysis based on Speed & Stability tests.

Embarcadero Academy: Live Bindings

On Thursday, 29th I’ll be leading a workshop about LiveBindings and Visual LiveBindings in Ljubljana. The workshop will cover both XE2 and XE3 and will also cover differences between the VCL and FireMonkey implementation.

Predavanje bo v slovenskem jeziku. Prijavite se tu.

image

Sunday, November 11, 2012

FireMonkey2 in Ljubljana

Last week I spoke at FireMonkey2 workshop in Ljubljana. Attendance was low (compared to other “Embarcadero Academy” sessions) but very attentive and interested in the FireMonkey development.

FireMonkey2

Next session will be dedicated to LiveBinding (visual and nonvisual – both XE2 and XE3 will be covered) and is planned for 29. November. I’ll put a notice on my blog when a registration page is up.

Wednesday, November 07, 2012

OTL Repo Stable Again

Christian has finished the housekeeping tasks (days ago but I was busy and forgot to put a notice on the blog, sorry), so the repository is stable again.

Changes, with his own words:

  • introduced lib path (now all lowercase) to receive all DCU files separated by compiler, platform and configuration. The tests compile really quick now, without "polluting" the source directory with .dcu files
  • changed fastmm4 to fastmm, which is now an svn:external
  • added main icon for all tests (linked via MainIcon.rc resource script)
    • this still might cause linking issues on Delphi 2007, if compiled for the first time, but I will investigate this in the next days.
  • removed unused files and directories from the svn repository

Tuesday, October 30, 2012

Embarcadero Academy 2012: FireMonkey 2

Next week we (Embarcadero + Marand + me) are starting the next cycle of Delphi workshops. This time I’ll be talking about FireMonkey2 – about everything that is new & great in the latest release of this framework.
Predavanje bo – tako kot doslej – v slovenskem jeziku. Več podatkov dobite tu.
image

Monday, October 29, 2012

Welcome New OTL Committer!

Christian W. Budde has kindly offered to do a long-neglected housekeeping on the OmniThreadLibrary SVN tree. He now has committing rights and is already busy fixing .dproj files, SVN external references and other small things that I never have time to work upon.

The current state of the SVN tree may be as of this moment described as a ‘slightly unstable’ so checkout/update at your own risk. I’ll let you know when the rearrangements will have finished.

Sunday, October 28, 2012

Automagically Creating Object Fields with RTTI

While working on an internal project I came into a situation where a user (that is, a fellow programmer) would have to create a hierarchy of classes. As it turned out, this hierarchy would contain almost no implementation, just the class declarations, with one exceptions – every class would still have to be responsible for creating its children objects. Then I had a thought. Maybe I could use attributes and RTTI to do that in one central place instead of in every object.

Saturday, October 27, 2012

ITDevCon–Recap

The ITDevCon 2012 is over and I’m back at home, resting and gathering impressions.

The conference was even better organized than previous years and everything was running as smooth as possible (with the small exception of the projector in the main hall, which somehow was not capable of giving out a completely sharp picture). In addition to the multinational group of speakers, the visitors also came from variety of countries – I noticed four Germans, two Russians and a Lituanian – which plays well with the intentions of making the ITDevCon the biggest European conference.

As usual, the conference took two full days, with five session timeslots on the first and six on the second day. At every time there were three parallel talks going on, some in Italian and some in English.

I’ve given three presentations – general tutorial on regular expressions and two “hands-on” sessions in problem/solution format – one on Windows + OS X development and another on OmniThreadLibrary. Slides and sample code are available on my blog.

I also listened to few sessions – both talks by Jeroen Pluimers were full of information and very useful; Ray Konopka’s session on user interfaces was incredible as always, Paweł Głowacki showed us what can be done with FireMonkey 3D components and Jørn E. Angeltveit gave interesting (WAT!) talk about the Smart Mobile Studio. I’m just too sory that I couldn’t follow Ray’s talk on creating custom controls for FireMonkey … Still, every session was recorded and participants will be able to get recordings of sessions they have missed. (By the way, recordings of last year conference are available on line.) I was also happy to finally meet Detlef Overbeek, the main guy behind the Blaise Pascal Magazine.

A quick shout to people that I haven’t yet mentioned – it was great to talk to you!

I would like to thank the organizer for inviting me again to the beautiful Verona and for all the great food we were able to taste in the two conference days (and at the pre-conference dinner). See you next year, guys!