Thursday, July 19, 2018

Delphi Free for Some - Lazarus Free for Everyone!

Embarcadero has announced the Community Edition releases for Delphi and C++Builder. Sounds like a reason to celebrate. But reading the "fine print" is rather sobering, as the license agreement practically excludes anyone but some students and hobbyists, perhaps:
"The Community Edition license applies solely if Licensee cumulative annual revenue (of the for-profit organization, the government entity or the individual developer) or any donations (of the non-profit organization) does not exceed USD $5,000.00 (or the equivalent in other currencies) (the "Threshold"). If Licensee is an individual developer, the revenue of all contract work performed by developer in one calendar year may not exceed the Threshold (whether or not the Community Edition is used for all projects). For example, a developer who receives payment of $5,000.00 for a single project (or more than $5,000.00 for multiple projects) even if such engagements do not anticipate the use of the Community Edition, is not allowed to use the Community Edition. In addition, a developer building solely an app store application would not be allowed to use the Community Edition once the app store revenue reaches a revenue of $5,000.00 or more in a year. If Licensee is a company that has a cumulative annual revenue which exceeds the Threshold, then Licensee is not allowed to use the Community Edition, regardless if the Community Edition is used solely to write applications for the business' internal use or is seen by third parties outside the company or has a direct revenue associated with it."

I think there's no need to be so excited about it. Consider this: you mustn't have more than $5000 a year (or $416.67 a month), regardless of what tools you're using. Mind you, revenue, not profit, and even donations count. That makes the offer unusable even for most start-ups, students or hobbyists. So in case you make a bit more than that ;-) and still don't want to pay the full price for a Professional or Enterprise Edition, you're back to

Free Pascal and Lazarus


  • Truly free (both as in beer and as in speech) Object Pascal compilers and tools supporting multiple target platforms, including Windows, Mac OS X and Linux, Intel 32-bit, 64-bit, ARM and more. (I haven't tried the mobile platforms, Android or iOS, yet.)
  • A nice, stable and capable IDE, itself a great example of its own multi-platform support (screenshots).
  • LCL (Lazarus Component Library) - cross-platform, with many components, extensible with your own. (Just a few days ago, I realised there's an LCL port of Virtual TreeView which I can use in my projects on all the three major operating systems. I'm eager to try it out!)

All free and open, with full source code. Licensed under GPL/LGPL.

OK, Embarcadero still considers Delphi as the Swiss Army Knife of software development and Swiss Army Knives don't come cheap. Maybe not everybody shares that point of view and some may not feel like paying to find out (30 days trial is just not enough for such a complex tool.) For those, Free Pascal and Lazarus are still a working and probably the best solution.

Saturday, June 23, 2018

FastText follow-up

Just a quick follow-up for those of you who showed interest.

My proof-of-concept with FastText has been a success. The C# class library has been integrated with a product and staged for a future release.

The product provides a web-based conversational user interface, accepting natural language as user input and performing configurable actions, possibly interacting with other (external or internal) software products and services. For example, "How's the weather in Tokyo?" will send a request to a weather service and return the response, or "Show me the current sequence of application xyz" will query another product's database and display the results (prompting the user in case of uncertainty). Therefore the initial use case is supervised text classification, and FastText has proven to be fit for the purpose.

The FastText functionality I've exposed to .NET so far includes:
- all training methods (cbow, skipgram, supervised) and their parameters
- file persistence
- text classification
- partial word representation, "nearest neighbour" queries, "analogies"
- accessing dictionary and model data

The top two points open the possibility to re-train based on new user input, ie. continuous learning.

Additionally, I've implemented database persistence of the dictionaries and trained models so they can be queried directly in SQL code. For example, the classic "king - man + woman" (using cosine similarity):

Sunday, May 20, 2018

One of my favourite ways of multi-threading on Windows

Having blogged about a few bugs in multi-threading libraries recently, I want to show an easy and convenient alternative. It's minimalistic but it works.

On Windows, the I/O completion port offers a way to use a thread pool for your multi-threaded application. Designed primarily for efficient processing of asynchronous I/O, it supports files, named pipes, sockets and device control.

In addition to that, you can post your own packets to the port. Quoting from the documentation:
The PostQueuedCompletionStatus function allows an application to queue its own special-purpose completion packets to the I/O completion port without starting an asynchronous I/O operation.
An example of this is shown in the worker demo project (which uses no async I/O at all).